* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f0;
  color: #1a1a1a;
}

/* ── Layout ── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  /* Center everything: nav + content aligned together */
  justify-content: center;
}

/* ── Sidebar ── */
#sidebar {
  width: 11.25rem;
  flex-shrink: 0;
  border-right: 1px solid #e0ddd6;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 0 0;
  background: #eeecea;
  display: flex;
  flex-direction: column;
}

#nav-tree {
  flex: 1;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 700;
  color: #D4621A;
  padding: 0 0.75rem 0.5rem;
  letter-spacing: -0.01em;
}

.nav-year {
  margin-bottom: 0.25rem;
}

.nav-year-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1a1a1a;
  padding: 0.25rem 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.nav-year-label:hover {
  background: #fff;
}

.nav-month {
  margin-left: 0.5rem;
}

.nav-month-label {
  font-size: 0.8125rem;
  color: #555;
  padding: 0.1875rem 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.nav-month-label:hover {
  background: #fff;
  color: #1a1a1a;
}

.nav-day {
  font-size: 0.75rem;
  color: #999;
  padding: 0.125rem 0.75rem 0.125rem 1.75rem;
  cursor: pointer;
}

.nav-day:hover {
  color: #555;
}

.nav-toggle {
  font-size: 0.6875rem;
  transition: transform 0.2s;
  display: inline-block;
}

.nav-toggle.open {
  transform: rotate(90deg);
}

.nav-children {
  display: none;
}

.nav-children.open {
  display: block;
}

/* ── Main ── */
#main {
  width: 47.5rem;
  max-width: 47.5rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f5f5f0;
  margin-left: 0.75rem;
}

/* ── Compose ── */
#compose {
  padding: 1rem;
  border-bottom: 1px solid #e0ddd6;
  background: #fff;
  flex-shrink: 0;
}

.compose-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Row 1: expression | description */
/* Row 2: source (wide) | file (narrow) */
.compose-grid .src-input {
  grid-column: 1;
}

.compose-grid .img-input {
  grid-column: 2;
}

.full-row {
  grid-column: 1 / -1;
}

input[type="text"] {
  padding: 0.4375rem 0.625rem;
  font-size: 0.875rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #f9f9f7;
  color: #1a1a1a;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus {
  border-color: #D4621A;
  background: #fff;
}

input[type="file"] {
  font-size: 0.8125rem;
  color: #888;
  padding: 0.375rem 0.625rem;
  border: 1px dashed #ccc;
  border-radius: 8px;
  background: #f9f9f7;
  cursor: pointer;
}

.compose-bottom {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.btn-post {
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4375rem 1.25rem;
  border-radius: 20px;
  border: none;
  background: #D4621A;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-post:hover {
  background: #A84D14;
}

/* ── Content wrap ── */
.content-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;  /* Allow flex child to overflow */
  height: 100%;
}

/* ── Timeline header ── */
#timeline-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid #e0ddd6;
  background: #fff;
  flex-shrink: 0;
  position: relative;
}

.filter-tabs {
  display: flex;
  gap: 0.25rem;
}

.filter-tab {
  font-size: 0.8125rem;
  padding: 0.3125rem 0.75rem;
  border-radius: 20px;
  border: 1px solid #ddd;
  background: transparent;
  color: #888;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-tab:hover {
  border-color: #aaa;
  color: #555;
}

.filter-mob-select {
  display: none;
  font-size: 0.8125rem;
  padding: 0.3125rem 0.625rem;
  border-radius: 20px;
  border: 1px solid #ddd;
  background: #FDE8D8;
  color: #D4621A;
  font-weight: 500;
  cursor: pointer;
  appearance: auto;
}

.filter-tab.active {
  background: #FDE8D8;
  color: #D4621A;
  border-color: transparent;
  font-weight: 500;
}

/* ── Timeline ── */
#timeline {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0 2.5rem;
}

.date-anchor {
  font-size: 0.75rem;
  font-weight: 600;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1rem 0 0.5rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid #e0ddd6;
}

.date-anchor:first-child {
  margin-top: 0;
}

/* ── Card ── */
.card {
  background: #fff;
  border: 1px solid #e8e5de;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.card.known {
  border-left: 3px solid #1D9E75;
}

.card.unknown {
  border-left: 3px solid #D85A30;
}

.card-img-wrap {
  width: 100%;
  height: 15rem;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-img {
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

.card-body {
  padding: 1.25rem 1rem 0.875rem;
  text-align: center;
}

.card-en {
  font-size: 1.5rem;
  font-weight: 500;
  color: #1a1a1a;
  margin-bottom: 0.375rem;
  line-height: 1.3;
}

.card-ko {
  font-size: 1.0625rem;
  color: #555;
  margin-bottom: 0.5rem;
}

.card-source {
  font-size: 0.8125rem;
  color: #aaa;
}

.card-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #f0ede6;
  background: #faf9f7;
  gap: 0.5rem;
}

.card-time {
  font-size: 0.75rem;
  color: #bbb;
  text-align: center;
  grid-column: 2;
}

.card-actions-left {
  display: flex;
  gap: 0.375rem;
  align-items: center;
  justify-content: flex-start;
  grid-column: 1;
  grid-row: 1;
}

.card-actions-right {
  display: flex;
  gap: 0.375rem;
  align-items: center;
  justify-content: flex-end;
  grid-column: 3;
  grid-row: 1;
}

.card-actions {
  display: flex;
  gap: 0.375rem;
  align-items: center;
}

.toggle-btn {
  font-size: 0.8125rem;
  height: 1.875rem;
  padding: 0 0.75rem;
  border-radius: 12px;
  border: 1px solid #ddd;
  background: transparent;
  color: #888;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
}

.toggle-btn:hover {
  border-color: #aaa;
}

.toggle-btn.known-active {
  background: #E1F5EE;
  color: #0F6E56;
  border-color: #5DCAA5;
}

.toggle-btn.unknown-active {
  background: #FAECE7;
  color: #993C1D;
  border-color: #F0997B;
}

.del-btn {
  font-size: 0.8125rem;
  height: 1.875rem;
  padding: 0 0.625rem;
  border: 1px solid #ddd;
  background: transparent;
  color: #888;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
}

.del-btn:hover {
  color: #E24B4A;
  background: #FCEBEB;
  border-color: #f0997b;
}

/* ── Empty state ── */
.empty {
  text-align: center;
  color: #bbb;
  font-size: 0.9375rem;
  padding: 3rem 0;
  line-height: 1.8;
}

/* ── Sidebar header ── */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.75rem 0.5rem;
}

#sidebar-close {
  display: none;
  background: none;
  border: none;
  font-size: 1.0625rem;
  color: #888;
  cursor: pointer;
  padding: 0.125rem 0.375rem;
}

/* Nav toggle button - hidden on desktop */
#nav-toggle-btn {
  display: none;
  font-size: 0.875rem;
  padding: 0.3125rem 0.75rem;
  border-radius: 20px;
  border: 1px solid #ddd;
  background: transparent;
  color: #555;
  cursor: pointer;
}

/* Overlay - hidden by default */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
}

/* ── Mobile (48rem and below) ── */
@media (max-width: 768px) {

  /* Mobile: app uses full flex width */
  #app {
    justify-content: flex-start;
  }

  #main {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
  }

  /* Sidebar: hidden by default, slides in */
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 75%;
    max-width: 17.5rem;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    border-right: 1px solid #e0ddd6;
    box-shadow: 2px 0 12px rgba(0,0,0,0.12);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #sidebar-overlay.open {
    display: block;
  }

  #sidebar-close {
    display: block;
  }

  /* Show menu toggle button */
  #nav-toggle-btn {
    display: block;
  }

  /* Timeline header: button and filter on each side */
  #timeline-header {
    justify-content: space-between;
  }

  /* Smaller filter tab text */
  .filter-tab {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }

  /* Mobile: hide all button text, show icons only */
  .btn-text {
    display: none;
  }

  .toggle-btn {
    font-size: 1rem;
    padding: 0.3125rem 0.625rem;
  }

  .edit-btn {
    font-size: 0.9375rem;
    padding: 0.3125rem 0.625rem;
  }

  .del-btn {
    font-size: 0.9375rem;
    padding: 0.3125rem 0.625rem;
  }

  /* Narrow card-footer spacing */
  .card-footer {
    padding: 0.5rem 0.625rem;
    gap: 0.25rem;
  }

  /* Compose grid: single column */
  .compose-grid {
    grid-template-columns: 1fr;
  }

  .compose-grid .src-input,
  .compose-grid .img-input {
    grid-column: 1 / -1;
  }
}

/* ══════════════════════════════
   수정 버튼
══════════════════════════════ */
.edit-btn {
  font-size: 0.8125rem;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  border: 1px solid #ddd;
  background: transparent;
  color: #888;
  cursor: pointer;
  transition: all 0.15s;
}

.edit-btn:hover {
  background: #FEF3EB;
  color: #D4621A;
  border-color: #F5B98A;
}

/* ══════════════════════════════
   수정 팝업 (모달)
══════════════════════════════ */
#edit-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

#edit-modal.open {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: 14px;
  width: 90%;
  max-width: 30rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f0ede6;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.0625rem;
  color: #aaa;
  cursor: pointer;
  padding: 0.125rem 0.375rem;
  border-radius: 6px;
}

.modal-close:hover {
  background: #f5f5f5;
  color: #555;
}

.modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.modal-full-row {
  grid-column: 1 / -1;
}

.edit-img-preview {
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.edit-img-preview img {
  height: 5rem;
  width: auto;
  border-radius: 8px;
  border: 1px solid #eee;
  object-fit: contain;
}

.edit-img-preview button {
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border: 1px solid #f0997b;
  background: #faece7;
  color: #993c1d;
  border-radius: 8px;
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid #f0ede6;
  background: #faf9f7;
}

.btn-cancel {
  font-size: 0.875rem;
  padding: 0.4375rem 1.125rem;
  border-radius: 20px;
  border: 1px solid #ddd;
  background: transparent;
  color: #888;
  cursor: pointer;
}

.btn-cancel:hover {
  background: #f5f5f5;
}

/* ══════════════════════════════
   코멘트
══════════════════════════════ */
.comments-section {
  border-top: 1px solid #f0ede6;
  padding: 0.75rem 1rem;
  background: #faf9f7;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.comment-item {
  background: #fff;
  border: 1px solid #e8e5de;
  border-radius: 10px;
  padding: 0.625rem 0.75rem;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.comment-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1a1a1a;
}

.comment-time {
  font-size: 0.75rem;
  color: #bbb;
  flex: 1;
}

.comment-del {
  font-size: 0.75rem;
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  padding: 0.125rem 0.25rem;
  border-radius: 4px;
}

.comment-del:hover {
  color: #E24B4A;
  background: #FCEBEB;
}

.comment-text {
  font-size: 0.875rem;
  color: #444;
  line-height: 1.5;
  white-space: pre-wrap;
}

.comment-form {
  display: grid;
  grid-template-columns: 6.25rem 1fr auto;
  gap: 0.5rem;
  align-items: start;
}

.cmt-name-input {
  padding: 0.4375rem 0.625rem;
  font-size: 0.875rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: #1a1a1a;
  outline: none;
}

.cmt-name-input:focus {
  border-color: #D4621A;
}

.cmt-text-input {
  padding: 0.4375rem 0.625rem;
  font-size: 0.875rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: #1a1a1a;
  outline: none;
  resize: vertical;
  min-height: 2.375rem;
  font-family: inherit;
}

.cmt-text-input:focus {
  border-color: #D4621A;
}

.cmt-submit-btn {
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.4375rem 0.875rem;
  border-radius: 8px;
  border: none;
  background: #D4621A;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.cmt-submit-btn:hover {
  background: #A84D14;
}

/* Mobile comment form */
@media (max-width: 768px) {
  .comment-form {
    grid-template-columns: 1fr;
  }

  .cmt-submit-btn {
    justify-self: flex-end;
  }
}

/* ══════════════════════════════
   타임라인 헤더 - 고정 (스크롤 안됨)
══════════════════════════════ */
#timeline-header {
  flex-shrink: 0;
}

/* ══════════════════════════════
   타임라인 자체 스크롤
   (#main이 overflow-y: auto이므로
    timeline은 자연스럽게 흐름)
══════════════════════════════ */

/* ══════════════════════════════
   nav 날짜 글씨 크게
══════════════════════════════ */
.nav-year-label {
  font-size: 1rem;
}

.nav-month-label {
  font-size: 0.9375rem;
}

.nav-day {
  font-size: 0.875rem;
  padding: 0.1875rem 0.75rem 0.1875rem 1.75rem;
}

/* ══════════════════════════════
   nav 전체보기 + 선택 활성화
══════════════════════════════ */
.nav-all {
  font-size: 0.875rem;
  color: #888;
  padding: 0.375rem 0.75rem 0.625rem;
  cursor: pointer;
  border-bottom: 1px solid #e0ddd6;
  margin-bottom: 0.375rem;
}

.nav-all:hover { color: #D4621A; }

.nav-active {
  color: #D4621A !important;
  font-weight: 600;
}

.nav-day.nav-active {
  background: #FDE8D8;
  border-radius: 6px;
}

/* ══════════════════════════════
   FAB (모바일 글쓰기 버튼)
══════════════════════════════ */
#fab {
  display: none;
  position: fixed;
  bottom: 1.75rem;
  right: 1.5rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: #D4621A;
  color: #fff;
  font-size: 1.875rem;
  line-height: 1;
  border: none;
  box-shadow: 0 4px 16px rgba(212,98,26,0.35);
  cursor: pointer;
  z-index: 90;
  transition: background 0.15s, transform 0.15s;
}

#fab:hover {
  background: #A84D14;
  transform: scale(1.07);
}

/* Mobile compose modal */
#mob-compose-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

#mob-compose-modal.open {
  display: flex;
}

/* ══════════════════════════════
   모바일
══════════════════════════════ */
@media (max-width: 768px) {
  /* Hide compose, show FAB */
  #compose {
    display: none;
  }

  #fab {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Timeline header sticky top: 0 (no compose above) */
  #timeline-header {
    top: 0;
  }
}

/* ── Timeline scrollbar style (optional, webkit) ── */
#timeline::-webkit-scrollbar {
  width: 0.375rem;
}
#timeline::-webkit-scrollbar-track {
  background: transparent;
}
#timeline::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 3px;
}
#timeline::-webkit-scrollbar-thumb:hover {
  background: #bbb;
}

/* ── Mobile: release main overflow hidden, timeline flows naturally ── */
@media (max-width: 768px) {
  #main {
    overflow-y: auto;
    overflow-x: hidden;
  }

  #timeline {
    overflow-y: visible;
    flex: none;
  }

  .content-wrap {
    height: auto;
  }
}

/* ══════════════════════════════
   Language switcher
══════════════════════════════ */
.lang-switcher {
  margin-top: auto;
  padding: 0.625rem 0.75rem;
  border-top: 1px solid #e0ddd6;
  background: #eeecea;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.lang-switcher a {
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4375rem 0.625rem;
  border-radius: 8px;
  color: #888;
  text-decoration: none;
  transition: all 0.15s;
}

.lang-switcher a:hover {
  background: #fff;
  color: #555;
}

.lang-switcher a.lang-active {
  background: #FDE8D8;
  color: #D4621A;
  font-weight: 600;
}

.quiz-nav-btn {
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4375rem 0.625rem;
  border-radius: 8px;
  color: #D4621A;
  background: transparent;
  border: 1px solid #F5B98A;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  margin-bottom: 0.5rem;
}

.quiz-nav-btn:hover {
  background: #FDE8D8;
}

.lang-switcher-divider {
  height: 0.0625rem;
  background: #e0ddd6;
  margin: 0.25rem 0 0.5rem;
}

/* ══════════════════════════════
   Mobile popup single-column grid
══════════════════════════════ */
.modal-grid-single {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.modal-grid-single input[type="text"],
.modal-grid-single input[type="file"] {
  width: 100%;
}

/* ══════════════════════════════
   Comment hearts + reply button
══════════════════════════════ */
.comment-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.375rem;
}

.heart-btn {
  background: none;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 0.1875rem 0.625rem;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.15s;
  color: #888;
}

.heart-btn:hover {
  background: #fff0f0;
  border-color: #ffb3b3;
}

.heart-count {
  font-size: 0.8125rem;
  color: #888;
}

.reply-toggle-btn {
  background: none;
  border: none;
  font-size: 0.8125rem;
  color: #aaa;
  cursor: pointer;
  padding: 0.1875rem 0.375rem;
  border-radius: 6px;
  transition: all 0.15s;
}

.reply-toggle-btn:hover {
  color: #D4621A;
  background: #FDE8D8;
}

/* ══════════════════════════════
   Replies
══════════════════════════════ */
.replies-wrap {
  margin-top: 0.5rem;
  margin-left: 1rem;
  border-left: 2px solid #f0ede6;
  padding-left: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.reply-item {
  background: #faf9f7;
  border-radius: 8px;
  padding: 0.5rem 0.625rem;
}

.reply-form {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-top: 0.25rem;
}

/* ══════════════════════════════
   Comment edit button
══════════════════════════════ */
.comment-edit-btn {
  background: none;
  border: none;
  font-size: 0.8125rem;
  color: #ccc;
  cursor: pointer;
  padding: 0.125rem 0.25rem;
  border-radius: 4px;
  transition: all 0.15s;
}

.comment-edit-btn:hover {
  color: #D4621A;
  background: #FDE8D8;
}

/* ── Inline edit form ── */
.inline-edit-form {
  flex-direction: column;
  gap: 0.375rem;
  margin-top: 0.375rem;
}

.inline-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.375rem;
}

.btn-cancel-sm {
  font-size: 0.8125rem;
  padding: 0.25rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: transparent;
  color: #888;
  cursor: pointer;
}

.btn-cancel-sm:hover {
  background: #f5f5f5;
}

/* ── Edited badge ── */
.edited-badge {
  font-size: 0.6875rem;
  color: #bbb;
  font-style: italic;
  margin-left: 0.25rem;
}

/* ══════════════════════════════
   코멘트 헤더 - 수정버튼 시간 옆으로
══════════════════════════════ */
.comment-header {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
}

.comment-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-right: 0.25rem;
}

.comment-time {
  font-size: 0.75rem;
  color: #bbb;
  /* Remove flex:1 so edit button sits right next to time */
  flex: none;
}

/* Push edit and delete buttons to the right end */
.comment-header .comment-edit-btn:first-of-type {
  margin-left: 0.125rem;
}

.comment-header .comment-del {
  margin-left: auto;
}

/* ══════════════════════════════
   코멘트 액션 - 답글 왼쪽 / 하트 오른쪽
══════════════════════════════ */
.comment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.375rem;
}

/* ══════════════════════════════
   포스트 번호 뱃지
══════════════════════════════ */
.card-media-wrap {
  width: 100%;
}

/* Number row: centered above image */
.card-number-row {
  display: flex;
  justify-content: center;
  padding: 0.625rem 0 0.375rem;
}

.card-number {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid #aaa;
  color: #aaa;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  flex-shrink: 0;
}

/* ══════════════════════════════
   compose textarea (영어표현/설명)
══════════════════════════════ */
.compose-textarea {
  padding: 0.4375rem 0.625rem;
  font-size: 0.875rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #f9f9f7;
  color: #1a1a1a;
  outline: none;
  resize: none;
  font-family: inherit;
  line-height: 1.5;
  min-height: 2.25rem;
  max-height: 7.5rem;
  overflow-y: auto;
  width: 100%;
  transition: border-color 0.15s;
  field-sizing: content; /* Auto height based on content (where supported) */
}

.compose-textarea:focus {
  border-color: #D4621A;
  background: #fff;
}

/* ══════════════════════════════
   nav 날짜별 포스팅 수 뱃지
══════════════════════════════ */
.nav-day {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-count {
  font-size: 0.6875rem;
  color: #bbb;
  background: #e8e5de;
  border-radius: 8px;
  padding: 0.0625rem 0.375rem;
  margin-right: 0.5rem;
  min-width: 1rem;
  text-align: center;
}

.nav-day.nav-active .nav-count {
  background: #FDE8D8;
  color: #D4621A;
}

.nav-day-cnt {
  font-size: 0.6875rem;
  color: #bbb;
  font-weight: 400;
}

.nav-day.nav-active .nav-day-cnt {
  color: #D4621A;
}

/* ══════════════════════════════
   Source autocomplete dropdown
══════════════════════════════ */

.compose-grid .img-input {
  grid-column: 2;  /* Right column */
}

.src-dropdown {
  position: fixed;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  z-index: 500;
  overflow: hidden;
  max-height: 12.5rem;
  overflow-y: auto;
}

.src-dropdown-item {
  padding: 0.5625rem 0.75rem;
  font-size: 0.875rem;
  color: #333;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
}

.src-dropdown-item:last-child {
  border-bottom: none;
}

.src-dropdown-item:hover {
  background: #FEF3EB;
  color: #D4621A;
}

.src-dropdown-item.src-dropdown-active {
  background: #FDE8D8;
  color: #D4621A;
}

.src-dropdown-item strong {
  color: #D4621A;
  font-weight: 600;
}

/* ══════════════════════════════
   Mini calendar popup
══════════════════════════════ */
.mini-cal-popup {
  position: fixed;
  background: #fff;
  border: 1px solid #e0ddd6;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  z-index: 300;
  padding: 0.625rem;
  width: 13.75rem;
}

.mini-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 0.5rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid #f0ede6;
}

.mini-cal-header button {
  background: none;
  border: none;
  color: #aaa;
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0.125rem 0.25rem;
  border-radius: 4px;
}

.mini-cal-header button:hover {
  color: #555;
  background: #f5f5f5;
}

.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.125rem;
}

.mini-cal-dow {
  font-size: 0.6875rem;
  color: #bbb;
  text-align: center;
  padding: 0.125rem 0 0.25rem;
  font-weight: 500;
}

.mini-cal-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.1875rem 0.0625rem;
  border-radius: 6px;
  cursor: default;
  min-height: 1.875rem;
  justify-content: center;
}

.mini-cal-day.has-post {
  cursor: pointer;
  background: #FEF3EB;
}

.mini-cal-day.has-post:hover {
  background: #FDE8D8;
}

.mini-cal-d {
  font-size: 0.75rem;
  color: #555;
  line-height: 1;
}

.mini-cal-day.has-post .mini-cal-d {
  color: #D4621A;
  font-weight: 600;
}

.mini-cal-cnt {
  font-size: 0.625rem;
  color: #5a8fc2;
  background: #e8f0f9;
  border-radius: 6px;
  padding: 0 0.1875rem;
  margin-top: 0.125rem;
  font-weight: 600;
  line-height: 1.4;
}

/* nav-count removed (replaced by (n) text) */
.nav-count { display: none; }

/* ══════════════════════════════
   ↑ Scroll to top button
══════════════════════════════ */
#scroll-top-btn {
  display: none;
  position: fixed;
  bottom: 1.75rem;
  right: 5.5rem; /* Position left of FAB */
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: #fff;
  color: #D4621A;
  font-size: 1.125rem;
  font-weight: 700;
  border: 1.5px solid #F5B98A;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  cursor: pointer;
  z-index: 89;
  transition: all 0.15s;
  align-items: center;
  justify-content: center;
}

#scroll-top-btn:hover {
  background: #FDE8D8;
  transform: translateY(-2px);
}

#scroll-top-btn.visible {
  display: flex;
}

/* Desktop: no FAB, position bottom right */
@media (min-width: 769px) {
  #scroll-top-btn {
    right: 1.75rem;
    bottom: 1.75rem;
  }
}

/* ══════════════════════════════
   모바일 헤더 MomoNote 로고
══════════════════════════════ */
#header-logo {
  display: none; /* Hidden on desktop */
}

@media (max-width: 768px) {
  #timeline-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
  }

  #header-logo {
    display: block;
    text-align: center;
    font-size: 1.0625rem;
    font-weight: 700;
    color: #D4621A;
    cursor: pointer;
    letter-spacing: -0.01em;
    padding: 0 0.5rem;
  }

  #header-logo:active {
    opacity: 0.7;
  }

  .filter-tabs {
    justify-content: flex-end;
  }
}
/* ══════════════════════════════
   Unknown word highlight
══════════════════════════════ */
mark.word-highlight {
  background: transparent;
  color: #D4621A;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.125rem;
  cursor: pointer;
  transition: background 0.12s;
  border-radius: 0.25rem;
  padding: 0 0.0625rem;
}

mark.word-highlight:hover {
  background: #FDE8D8;
}

/* ══════════════════════════════
   Unknown words section
══════════════════════════════ */
.unknown-words-section {
  border-top: 1px solid #f0ede6;
  background: #faf9f7;
}

.unknown-words-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4375rem 1rem;
  font-size: 0.8125rem;
  color: #bbb;
  cursor: pointer;
  user-select: none;
}

.unknown-words-header:hover { color: #888; }

.unknown-words-body {
  padding: 0.5rem 1rem 0.75rem;
}

.word-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.5rem;
}

.word-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #FDE8D8;
  color: #D4621A;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.1875rem 0.5rem 0.1875rem 0.625rem;
  border-radius: 12px;
  border: 1px solid #F5B98A;
}

.word-tag-del {
  background: none;
  border: none;
  color: #F5B98A;
  font-size: 0.6875rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.word-tag-del:hover { color: #D4621A; }

.word-input-row {
  display: flex;
  gap: 0.375rem;
  align-items: center;
}

.word-input {
  flex: 1;
  padding: 0.3125rem 0.625rem;
  font-size: 0.8125rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  outline: none;
  color: #1a1a1a;
}

.word-input:focus { border-color: #D4621A; }

.word-add-btn {
  font-size: 0.8125rem;
  padding: 0.3125rem 0.75rem;
  border-radius: 8px;
  border: none;
  background: #D4621A;
  color: #fff;
  cursor: pointer;
}

.word-add-btn:hover { background: #A84D14; }

/* ══════════════════════════════
   Nav search bar
══════════════════════════════ */
.nav-search {
  padding: 0.5rem 0.75rem 0.625rem;
  border-bottom: 1px solid #e0ddd6;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  background: #eeecea;
  box-sizing: border-box;
  width: 100%;
}

#nav-search-input {
  flex: 1;
  min-width: 0;
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  border: 1px solid #ddd;
  border-radius: 20px;
  background: #fff;
  color: #1a1a1a;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

#nav-search-input:focus { border-color: #D4621A; }

#nav-search-clear {
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  border: none;
  background: #ccc;
  color: #fff;
  font-size: 0.75rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#nav-search-clear:hover { background: #D4621A; }

/* Unknown words input in compose area */
.compose-grid .full-row {
  grid-column: 1 / -1;
  padding: 0.4375rem 0.625rem;
  font-size: 0.875rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #f9f9f7;
  color: #1a1a1a;
  outline: none;
  transition: border-color 0.15s;
}

.compose-grid .full-row:focus {
  border-color: #D4621A;
  background: #fff;
}
/* ══════════════════════════════
   Quiz Modal
══════════════════════════════ */
#quiz-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#quiz-modal.open {
  display: flex;
}

.quiz-modal-box {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 30rem;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.quiz-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid #f0ece6;
}

.quiz-modal-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #1a1a1a;
}

.quiz-modal-close {
  background: none;
  border: none;
  font-size: 1.0625rem;
  color: #bbb;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.quiz-modal-close:hover { color: #D4621A; }

.quiz-modal-body {
  padding: 1.25rem;
  flex: 1;
}

.quiz-start-screen {
  text-align: center;
  padding: 1.25rem 0;
}

.quiz-start-info {
  font-size: 0.9375rem;
  color: #888;
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.quiz-start-btn {
  padding: 0.6875rem 2rem;
  background: #D4621A;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.quiz-start-btn:hover { background: #b85316; }

.quiz-prog-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.quiz-prog-wrap {
  flex: 1;
  height: 0.25rem;
  background: #f0ece6;
  border-radius: 2px;
  overflow: hidden;
}

.quiz-prog-fill {
  height: 100%;
  background: #D4621A;
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

.quiz-prog-text {
  font-size: 0.8125rem;
  color: #bbb;
  white-space: nowrap;
}

.quiz-card {
  background: #fffdf9;
  border: 1px solid #F5B98A;
  border-radius: 14px;
  padding: 1.75rem 1.25rem;
  text-align: center;
  cursor: pointer;
  min-height: 11.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  margin-bottom: 1rem;
  transition: border-color 0.15s;
}

.quiz-card:hover { border-color: #D4621A; }

.quiz-card-hint {
  font-size: 0.8125rem;
  color: #ccc;
}

.quiz-card-word {
  font-size: 1.625rem;
  font-weight: 600;
  color: #D4621A;
}

.quiz-card-src {
  font-size: 0.75rem;
  color: #ccc;
}

.quiz-card-expr {
  font-size: 0.75rem;
  color: #ccc;
  font-style: italic;
  margin-top: 2px;
}

.quiz-card-def {
  font-size: 0.9375rem;
  color: #333;
  line-height: 1.6;
  max-width: 21.25rem;
}

.quiz-card-ex {
  font-size: 0.8125rem;
  color: #aaa;
  font-style: italic;
}

.quiz-actions {
  display: flex;
  gap: 0.625rem;
  justify-content: center;
}

.quiz-btn-reveal {
  padding: 0.625rem 1.75rem;
  border: 1px solid #ddd;
  background: transparent;
  border-radius: 10px;
  font-size: 0.9375rem;
  cursor: pointer;
  color: #555;
  transition: background 0.15s;
}

.quiz-btn-reveal:hover { background: #f5f5f5; }

.quiz-btn-knew {
  flex: 1;
  padding: 0.625rem;
  border: 1px solid #5DCAA5;
  background: transparent;
  border-radius: 10px;
  font-size: 0.9375rem;
  color: #0F6E56;
  cursor: pointer;
  transition: background 0.15s;
}

.quiz-btn-knew:hover { background: #E1F5EE; }

.quiz-btn-nope {
  flex: 1;
  padding: 0.625rem;
  border: 1px solid #F0997B;
  background: transparent;
  border-radius: 10px;
  font-size: 0.9375rem;
  color: #993C1D;
  cursor: pointer;
  transition: background 0.15s;
}

.quiz-btn-nope:hover { background: #FAECE7; }

#quiz-result {
  text-align: center;
  padding: 0.75rem 0;
}

.quiz-result-score {
  font-size: 3rem;
  font-weight: 600;
  color: #D4621A;
  margin-bottom: 0.375rem;
}

.quiz-result-label {
  font-size: 0.9375rem;
  color: #888;
  margin-bottom: 1rem;
}

.quiz-result-stats {
  display: flex;
  gap: 0.625rem;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.quiz-stat-knew {
  font-size: 0.875rem;
  padding: 0.3125rem 0.875rem;
  background: #E1F5EE;
  color: #0F6E56;
  border-radius: 20px;
}

.quiz-stat-nope {
  font-size: 0.875rem;
  padding: 0.3125rem 0.875rem;
  background: #FAECE7;
  color: #993C1D;
  border-radius: 20px;
}

/* ══════════════════════════════
   Word tag — click to lookup
══════════════════════════════ */
.word-tag-label {
  cursor: pointer;
  border-radius: 0.375rem;
  padding: 0 0.125rem;
  transition: background 0.12s, color 0.12s;
}

.word-tag-label:hover {
  background: #F5B98A;
  color: #7a2d00;
}

.word-tag-label.word-tag-active {
  background: #D4621A;
  color: #fff;
  padding: 0 0.25rem;
  border-radius: 0.375rem;
}

/* ══════════════════════════════
   Definition panel
══════════════════════════════ */
.def-panel {
  background: #fffdf9;
  border: 1px solid #F5B98A;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0 0.5rem;
  font-size: 0.875rem;
  line-height: 1.65;
  animation: defFadeIn 0.15s ease;
}

@keyframes defFadeIn {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

.def-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.def-word {
  font-weight: 600;
  color: #D4621A;
  font-size: 0.9375rem;
}

.def-phonetic {
  font-size: 0.75rem;
  color: #bbb;
  font-style: italic;
}

.def-badge {
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
  border-radius: 20px;
  background: #FDE8D8;
  color: #993C1D;
  font-weight: 500;
}

.def-audio-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9375rem;
  padding: 0;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.12s, transform 0.1s;
}

.def-audio-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

.def-google-link {
  margin-left: auto;
  font-size: 0.6875rem;
  color: #999;
  text-decoration: none;
  border: 0.5px solid #e0d8cf;
  border-radius: 0.375rem;
  padding: 0.125rem 0.5rem;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.def-google-link:hover {
  background: #f0ece6;
  color: #D4621A;
}

.def-close {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 0.8125rem;
  padding: 0;
  line-height: 1;
  transition: color 0.12s;
  flex-shrink: 0;
}

.def-close:hover { color: #D4621A; }

.def-pos {
  font-size: 0.6875rem;
  font-style: italic;
  color: #bbb;
  margin: 0.375rem 0 0.125rem;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.def-item {
  margin-bottom: 0.375rem;
  padding-left: 0.125rem;
  color: #2a2a2a;
}

.def-num {
  color: #F5B98A;
  font-size: 0.6875rem;
  margin-right: 0.25rem;
  font-weight: 600;
}

.def-text {
  color: #2a2a2a;
  font-size: 0.875rem;
}

.def-example {
  font-size: 0.75rem;
  color: #aaa;
  font-style: italic;
  margin-top: 0.125rem;
  padding-left: 0.875rem;
}

.def-loading {
  color: #bbb;
  font-size: 0.75rem;
}

/* src-dropdown arrow key active state */
.src-dropdown-item.src-dropdown-active {
  background: #FDE8D8;
  color: #D4621A;
}

/* ══════════════════════════════
   Quiz — new multi-mode styles
══════════════════════════════ */
.quiz-loading-msg {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  text-align: center;
  margin-bottom: 0.75rem;
}

.quiz-loading-bar-wrap {
  height: 4px;
  background: #f0ece6;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.quiz-loading-bar {
  height: 100%;
  background: #D4621A;
  border-radius: 2px;
  width: 0%;
  transition: width 0.2s ease;
}

.quiz-q-label {
  font-size: 0.6875rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.quiz-sentence {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text-primary);
  line-height: 1.7;
  margin-bottom: 0.5rem;
}

.quiz-blank {
  display: inline-block;
  min-width: 5rem;
  border-bottom: 2px solid #D4621A;
  color: #D4621A;
  text-align: center;
  font-weight: 500;
}

.quiz-big-word {
  font-size: 1.625rem;
  font-weight: 500;
  color: #D4621A;
  margin-bottom: 0.25rem;
}

.quiz-def-question {
  font-size: 0.9375rem;
  color: var(--color-text-primary);
  line-height: 1.65;
  margin-bottom: 0.5rem;
}

.quiz-q-src {
  font-size: 0.6875rem;
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
}

.quiz-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quiz-choice {
  padding: 0.625rem 0.875rem;
  border-radius: var(--border-radius-md);
  border: 1.5px solid #E8C9B5;
  background: var(--color-background-primary);
  color: var(--color-text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  text-align: left;
  line-height: 1.5;
  transition: all 0.15s;
}

.quiz-choice:hover:not(:disabled) {
  border-color: #D4621A;
  background: #FDE8D8;
  color: #993C1D;
}

.quiz-choice-correct {
  border-color: #5DCAA5 !important;
  background: #E1F5EE !important;
  color: #0F6E56 !important;
}

.quiz-choice-wrong {
  border-color: #F0997B !important;
  background: #FAECE7 !important;
  color: #993C1D !important;
}

.quiz-fb {
  font-size: 0.8125rem;
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--border-radius-md);
}

.quiz-fb-correct {
  background: #E1F5EE;
  color: #0F6E56;
}

.quiz-fb-wrong {
  background: #FAECE7;
  color: #993C1D;
}

.quiz-result-section-label {
  font-size: 0.75rem;
  font-weight: 500;
  margin: 1rem 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 0.5px solid var(--color-border-tertiary);
}

.quiz-label-correct { color: #0F6E56; }
.quiz-label-wrong   { color: #993C1D; }

.quiz-result-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.5rem 0.625rem;
  border-radius: var(--border-radius-md);
  margin-bottom: 6px;
}

.quiz-result-item-correct { background: #E1F5EE; }
.quiz-result-item-wrong   { background: #FAECE7; }

.quiz-result-word {
  font-size: 0.875rem;
  font-weight: 500;
}

.quiz-result-item-correct .quiz-result-word { color: #0F6E56; }
.quiz-result-item-wrong   .quiz-result-word { color: #993C1D; }

.quiz-result-def {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ══════════════════════════════
   Page switcher tabs (Words / Scrapbook)
══════════════════════════════ */
.page-switcher {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #e0ddd6;
  background: #f5f2ed;
}

.page-tab {
  flex: 1;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.375rem 0.5rem;
  border-radius: 7px;
  border: 0.5px solid transparent;
  color: #aaa;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.page-tab:hover {
  background: #fff;
  color: #555;
}

.page-tab-active {
  background: #FDE8D8;
  color: #D4621A;
  border-color: #F5C4A3;
}

/* ══ Words dropdown ══ */
.page-switcher {
  position: relative;
}

.page-tab-wrap {
  position: relative;
  flex: 1;
}

.page-tab-words {
  width: 100%;
  background: transparent;
  border: 0.5px solid transparent;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.page-tab-wrap.page-tab-active .page-tab-words {
  background: #FDE8D8;
  color: #D4621A;
  border-color: #F5C4A3;
}

.page-tab-arrow {
  font-size: 0.625rem;
  opacity: 0.7;
}

.words-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 140px;
  background: #fff;
  border: 0.5px solid #e0ddd6;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 200;
  overflow: hidden;
}

.words-dropdown-item {
  display: block;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  color: #555;
  text-decoration: none;
  transition: background 0.12s;
}

.words-dropdown-item:hover {
  background: #f5f2ed;
  color: #333;
}

.words-dropdown-active {
  background: #FDE8D8;
  color: #D4621A;
  font-weight: 500;
}

.words-dropdown-active:hover {
  background: #f5c4a3;
}

/* ══════════════════════════════
   Pagination — load more
══════════════════════════════ */
.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 1rem 0 1.5rem;
}

.load-more-btn {
  font-size: 0.875rem;
  padding: 0.625rem 1.5rem;
  border-radius: var(--border-radius-md);
  border: 0.5px solid var(--color-border-secondary);
  background: var(--color-background-primary);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.15s;
}

.load-more-btn:hover {
  border-color: #D4621A;
  color: #D4621A;
  background: #FDE8D8;
}

.load-more-count {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  opacity: 0.7;
}

/* ══════════════════════════════
   Responsive — 950px (Words page)
══════════════════════════════ */
@media (max-width: 950px) {
  #sidebar {
    position: fixed;
    left: -260px;
    top: 0; bottom: 0;
    z-index: 300;
    width: 220px;
    transition: left 0.25s ease;
  }
  #sidebar.open { left: 0; box-shadow: 4px 0 20px rgba(0,0,0,0.12); }
  #sidebar-overlay { display: none; }
  #sidebar-overlay.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 299;
  }
  #main { width: 100% !important; margin-left: 0 !important; }
  #nav-toggle-btn { display: flex !important; }

  #compose .compose-grid { grid-template-columns: 1fr; }
  #compose .src-input,
  #compose .img-input,
  #compose .full-row { grid-column: 1; }

  .card-footer    { flex-wrap: wrap; gap: 6px; }
  .card-time      { order: -1; width: 100%; }
  .card-actions-right { margin-left: auto; }

  #timeline-header { flex-wrap: nowrap; gap: 6px; padding: 8px 12px; }
  .filter-tabs     { margin-left: auto; }
}

/* ══ Words — mobile (≤768px) ══ */
@media (max-width: 768px) {
  .filter-tabs          { display: none; }
  .filter-mob-select    { display: block; margin-left: auto; }

  .card-footer    { flex-wrap: wrap; gap: 6px; }
  .card-time      { order: -1; width: 100%; }
  .card-actions-right { margin-left: auto; }
}

@media (max-width: 600px) {
  .card-en { font-size: 1.125rem; }
  .toggle-btn .btn-text,
  .edit-btn .btn-text,
  .del-btn .btn-text { display: none; }
  .toggle-btn, .edit-btn, .del-btn { padding: 0 8px; }
}
/* ══════════════════════════════
   Words page — bottom mini player
══════════════════════════════ */
@keyframes mpScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.words-player {
  position: fixed;
  bottom: 0;
  left: 220px;
  right: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.words-player > * { pointer-events: all; }

/* small toggle tab — always visible */
.wp-tab {
  width: 44px;
  height: 18px;
  background: #fff;
  border: 1px solid #E8C9B5;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.06);
}
.wp-tab svg { color: #D4621A; transition: transform 0.25s ease; }
/* default (content visible): ∨ */
.wp-tab svg { transform: rotate(180deg); }
/* collapsed: ∧ */
.words-player.collapsed .wp-tab svg { transform: rotate(0deg); }

/* player content — hidden when collapsed */
.wp-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  transition: all 0.25s ease;
  overflow: hidden;
}
.words-player.collapsed .wp-content { max-height: 0; overflow: hidden; }

/* tracklist */
.wp-tracklist {
  display: none;
  flex-direction: column;
  background: #fff;
  border: 1px solid #E8C9B5;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 680px;
  max-height: 240px;
  overflow: hidden;
}
.wp-tracklist.open { display: flex; }
.wp-tl-header {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-bottom: 0.5px solid #f0ede6; flex-shrink: 0;
}
.wp-tl-title { font-size: 13px; font-weight: 500; color: #1a1a1a; }
.wp-tl-cat   { font-size: 11px; background: #FDE8D8; color: #993C1D; padding: 1px 8px; border-radius: 20px; }
.wp-tl-close { background: none; border: none; font-size: 13px; color: #bbb; cursor: pointer; margin-left: auto; padding: 0; }
.wp-tl-close:hover { color: #D4621A; }
.wp-tl-tracks { overflow-y: auto; flex: 1; }
.wp-tl-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 0.5px solid #f5f2ed; cursor: pointer; transition: background 0.1s; }
.wp-tl-row:last-child { border-bottom: none; }
.wp-tl-row:hover { background: #faf9f7; }
.wp-tl-row.wp-playing { background: #FDE8D8; }
.wp-tl-num { font-size: 11px; color: #bbb; width: 16px; text-align: right; flex-shrink: 0; }
.wp-playing .wp-tl-num { color: #D4621A; }
.wp-tl-info { flex: 1; min-width: 0; }
.wp-tl-song { font-size: 13px; font-weight: 500; color: #1a1a1a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wp-playing .wp-tl-song { color: #D4621A; }
.wp-tl-artist { font-size: 11px; color: #aaa; margin-top: 1px; }
.wp-tl-rating { font-size: 10px; padding: 2px 7px; border-radius: 20px; flex-shrink: 0; }
.wp-tl-r-love { background: #FAECE7; color: #993C1D; }
.wp-tl-r-like { background: #E6F1FB; color: #185FA5; }
.wp-tl-r-rec  { background: #EAF3DE; color: #3B6D11; }
.wp-tl-r-hmm  { background: #FAEEDA; color: #854F0B; }
.wp-tl-r-bad  { background: #F1EFE8; color: #5F5E5A; }
.wp-tl-empty  { padding: 20px 14px; font-size: 13px; color: #bbb; text-align: center; }

/* player bar */
.wp-bar {
  display: flex; align-items: center; gap: 5px;
  background: #fff; border: 1px solid #E8C9B5;
  padding: 0 10px; height: 36px;
  width: 100%; max-width: 680px; box-sizing: border-box;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}
.wp-note { font-size: 13px; flex-shrink: 0; color: #D4621A; }
.wp-marquee-outer {
  flex: 1; min-width: 0; overflow: hidden;
  position: relative; display: flex; align-items: center;
}
.wp-marquee-outer::before,
.wp-marquee-outer::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 12px; z-index: 1; pointer-events: none;
}
.wp-marquee-outer::before { left:  0; background: linear-gradient(to right, #fff, transparent); }
.wp-marquee-outer::after  { right: 0; background: linear-gradient(to left,  #fff, transparent); }
.wp-marquee-track { display: flex; white-space: nowrap; font-size: 12px; color: #333; animation: mpScroll 12s linear infinite; }
.wp-marquee-track span { padding-right: 48px; }
.wp-controls-row { display: flex; align-items: center; gap: 2px; flex-shrink: 0; border-left: 1px solid #e8e5de; padding-left: 5px; margin-left: 2px; }
.wp-icon-btn { background: none; border: none; cursor: pointer; color: #999; border-radius: 4px; line-height: 1; flex-shrink: 0; transition: color 0.12s, background 0.12s; display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; }
.wp-icon-btn:hover { color: #D4621A; background: #FDE8D8; }
.wp-icon-btn.wp-play { color: #D4621A; }
.wp-vol { width: 50px; flex-shrink: 0; accent-color: #D4621A; cursor: pointer; border-left: 1px solid #e8e5de; padding-left: 5px; margin-left: 2px; }
.wp-cat { font-size: 11px; border: 0.5px solid #e0ddd6; border-radius: 5px; background: transparent; color: #888; padding: 2px 3px; cursor: pointer; flex-shrink: 0; max-width: 76px; }
.wp-list-btn { background: none; border: 0.5px solid transparent; cursor: pointer; color: #aaa; padding: 3px 4px; border-radius: 5px; display: flex; align-items: center; flex-shrink: 0; transition: all 0.12s; }
.wp-list-btn:hover, .wp-list-btn.active { color: #D4621A; background: #FDE8D8; border-color: #F5B98A; }

/* push content above player */
#timeline { padding-bottom: 60px; }

/* ── Responsive ── */
@media (max-width: 950px) {
  .words-player { left: 0; }
  .wp-bar, .wp-tracklist { max-width: 100%; }
}
@media (max-width: 768px) {
  .words-player { display: none; }
}

/* Mobile: filter row with music btn */
.filter-mob-row {
  display: none;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
@media (max-width: 768px) {
  .filter-tabs       { display: none; }
  .filter-mob-row    { display: flex; }
}
.filter-mob-select {
  font-size: 0.8125rem; padding: 0.3125rem 0.625rem;
  border-radius: 20px; border: 1px solid #ddd;
  background: #FDE8D8; color: #D4621A; font-weight: 500;
  cursor: pointer;
}
.wp-nav-music-btn {
  background: none; border: 1px solid #E8C9B5; border-radius: 8px;
  padding: 4px 8px; font-size: 15px; cursor: pointer; color: #D4621A;
  flex-shrink: 0; transition: background 0.12s; line-height: 1;
}
.wp-nav-music-btn:hover { background: #FDE8D8; }

/* Mobile music popup — center screen */
#wp-mob-popup {
  display: none; position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 260px; background: #fff;
  border: 1px solid #E8C9B5; border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.18); padding: 16px; z-index: 501;
}
#wp-mob-popup.open { display: block; }
.wp-mob-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 500; }
.wp-mob-overlay.open { display: block; }

#fab { z-index: 202 !important; }