@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=Pretendard:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Pretendard:wght@300;400;500;600;700&display=swap');

/* ═══════════════════════════════════════════════
   DESIGN TOKENS — DARK (기본)
═══════════════════════════════════════════════ */
:root {
  --bg:          #0c0c12;
  --bg2:         #111118;
  --surface:     #16161f;
  --surface2:    #1e1e2a;
  --surface3:    #272736;
  --border:      #2c2c3e;
  --border2:     #3a3a50;

  --text:        #f2f2ff;
  --text-sub:    #9090b8;
  --text-dim:    #52526e;

  --accent:      #6c63ff;
  --accent-h:    #8b84ff;
  --accent-glow: rgba(108,99,255,.25);
  --pink:        #ff6b9d;
  --teal:        #00d4a8;
  --amber:       #ffb347;

  --card-shadow: 0 4px 24px rgba(0,0,0,.45);
  --nav-bg:      rgba(12,12,18,.88);
  --radius:      14px;
  --radius-sm:   8px;
  --radius-xs:   5px;
  --trans:       .22s cubic-bezier(.4,0,.2,1);
}

/* ── LIGHT THEME ──────────────────────────────── */
[data-theme="light"] {
  --bg:          #f4f4f8;
  --bg2:         #ebebf2;
  --surface:     #ffffff;
  --surface2:    #f0f0f6;
  --surface3:    #e4e4ed;
  --border:      #d8d8e8;
  --border2:     #c4c4d8;

  --text:        #1a1a2e;
  --text-sub:    #5a5a7a;
  --text-dim:    #9090a8;

  --accent:      #5a52e8;
  --accent-h:    #7068f0;
  --accent-glow: rgba(90,82,232,.18);
  --pink:        #e05580;
  --teal:        #00a888;
  --amber:       #e09020;

  --card-shadow: 0 2px 16px rgba(0,0,0,.10);
  --nav-bg:      rgba(244,244,248,.92);
}

/* ── BASE ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Pretendard', 'Apple SD Gothic Neo', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background var(--trans), color var(--trans);
}
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% 5%, var(--accent-glow) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 95%, rgba(0,212,168,.07) 0%, transparent 60%);
  transition: background var(--trans);
}
[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 60% 40% at 10% 0%, rgba(90,82,232,.07) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 90% 100%, rgba(0,168,136,.05) 0%, transparent 60%);
}
h1,h2,h3,h4,h5 { font-family: 'Syne', sans-serif; font-weight: 700; line-height: 1.2; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; color: inherit; font-family: inherit; font-size: 14px; transition: var(--trans); }
input, textarea, select {
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 13px; outline: none;
  width: 100%; transition: border-color var(--trans), box-shadow var(--trans), background var(--trans);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
select option { background: var(--surface); }
textarea { resize: vertical; min-height: 72px; }
img { display: block; max-width: 100%; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ═══════════════════════════════════════════════
   LAYOUT
═══════════════════════════════════════════════ */
.app-root { position: relative; z-index: 1; display: flex; flex-direction: column; min-height: 100vh; }

.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; width: 100%; }

/* ═══════════════════════════════════════════════
   NAVBAR
═══════════════════════════════════════════════ */
.navbar {
  position: sticky; top: 0; z-index: 200;
  height: 62px; display: flex; align-items: center;
  background: var(--nav-bg);
  backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border);
  transition: background var(--trans), border-color var(--trans);
}
.navbar .container { display: flex; align-items: center; gap: 16px; }

.logo {
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 21px; letter-spacing: -.5px;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  flex-shrink: 0;
}

.nav-tabs { display: flex; gap: 2px; margin-left: 8px; }
.nav-tab {
  padding: 6px 14px; border-radius: var(--radius-xs);
  font-size: 13px; font-weight: 500; color: var(--text-sub);
}
.nav-tab:hover { color: var(--text); background: var(--surface2); }
.nav-tab.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* Theme toggle */
.theme-toggle {
  width: 38px; height: 22px; position: relative; flex-shrink: 0;
}
.theme-toggle input { opacity: 0; width: 0; height: 0; }
.theme-track {
  position: absolute; inset: 0; border-radius: 11px;
  background: var(--surface3); border: 1px solid var(--border2);
  cursor: pointer; transition: background var(--trans);
  display: flex; align-items: center; padding: 2px 3px;
}
.theme-track::after {
  content: ''; width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-sub); flex-shrink: 0;
  transition: transform var(--trans), background var(--trans);
}
.theme-toggle input:checked + .theme-track { background: color-mix(in srgb, var(--accent) 20%, var(--surface3)); border-color: var(--accent); }
.theme-toggle input:checked + .theme-track::after { transform: translateX(16px); background: var(--accent); }

.theme-icons { display: flex; gap: 6px; align-items: center; font-size: 13px; }

.avatar-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 13px; color: #fff;
  flex-shrink: 0; border: 2px solid transparent;
  transition: transform var(--trans), box-shadow var(--trans);
}
.avatar-btn:hover { transform: scale(1.08); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ═══════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: all var(--trans);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-glow); }
.btn-share { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-share:hover { background: var(--surface2); color: var(--text); transform: translateY(-1px); }
.btn-secondary { background: var(--surface2); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--accent); background: var(--surface3); }
.btn-ghost { color: var(--text-sub); padding: 7px 12px; border-radius: var(--radius-xs); }
.btn-ghost:hover { color: var(--text); background: var(--surface2); }
.btn-danger { background: rgba(255,80,80,.12); color: #ff5a5a; border: 1px solid rgba(255,80,80,.25); }
.btn-danger:hover { background: rgba(255,80,80,.22); }
.btn-teal { background: color-mix(in srgb, var(--teal) 15%, transparent); color: var(--teal); border: 1px solid color-mix(in srgb, var(--teal) 30%, transparent); }
.btn-teal:hover { background: color-mix(in srgb, var(--teal) 25%, transparent); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 9px; font-size: 11px; }
.btn-icon {
  width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); background: var(--surface2); border: 1px solid var(--border);
  flex-shrink: 0;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon.liked { color: var(--pink); border-color: var(--pink); background: color-mix(in srgb, var(--pink) 12%, transparent); }
.btn-icon.bookmarked { color: var(--teal); border-color: var(--teal); background: color-mix(in srgb, var(--teal) 12%, transparent); }

/* ═══════════════════════════════════════════════
   PAGE SYSTEM
═══════════════════════════════════════════════ */
.main { flex: 1; padding: 32px 0 60px; }
.page { display: none; }
.page.active { display: block; animation: pagein .28s ease; }
@keyframes pagein { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform: none; } }

.page-header { margin-bottom: 28px; }
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 4px; }
.page-sub { font-size: 13px; color: var(--text-sub); }
.page-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════
   CATEGORY BAR
═══════════════════════════════════════════════ */
.cat-bar-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 24px;
  gap: 0;
}
.cat-bar-wrap .cat-arrow {
  flex-shrink: 0;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-sub);
  transition: all var(--trans);
  z-index: 2;
  user-select: none;
}
.cat-bar-wrap .cat-arrow:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.cat-bar-wrap .cat-arrow:disabled { opacity: .25; cursor: default; }
.cat-bar-wrap .cat-arrow.prev { margin-right: 6px; }
.cat-bar-wrap .cat-arrow.next { margin-left: 6px; }

/* 좌우 페이드 마스크 */
.cat-bar-mask {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.cat-bar-mask::before,
.cat-bar-mask::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 24px;
  z-index: 1;
  pointer-events: none;
  transition: opacity .2s;
}
.cat-bar-mask::before {
  left: 0;
  background: linear-gradient(to right, var(--bg), transparent);
}
.cat-bar-mask::after {
  right: 0;
  background: linear-gradient(to left, var(--bg), transparent);
}
.cat-bar-mask.at-start::before  { opacity: 0; }
.cat-bar-mask.at-end::after     { opacity: 0; }

.cat-bar {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 4px 2px;
  scrollbar-width: none;
  scroll-behavior: smooth;
}
.cat-bar::-webkit-scrollbar { display: none; }

.cat-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 100px; font-size: 13px; font-weight: 500;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-sub);
  white-space: nowrap; flex-shrink: 0; transition: all var(--trans); cursor: pointer;
}
.cat-chip:hover { border-color: var(--accent); color: var(--text); }
.cat-chip.active { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: var(--accent); color: var(--accent); }
.cat-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 100px; font-size: 10px; font-weight: 700; line-height: 1;
  background: var(--surface3); color: var(--text-dim);
  transition: background var(--trans), color var(--trans);
}
.cat-chip:hover .cat-count { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.cat-chip.active .cat-count { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }

/* Sort bar */
.sort-row { display: flex; align-items: center; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.sort-label { font-size: 12px; color: var(--text-dim); }
.sort-btn {
  padding: 4px 11px; border-radius: 100px; font-size: 12px; font-weight: 500;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-sub);
}
.sort-btn:hover { border-color: var(--accent); color: var(--text); }
.sort-btn.active { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: var(--accent); color: var(--accent); }

/* ═══════════════════════════════════════════════
   CARD GRID
═══════════════════════════════════════════════ */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px,1fr)); gap: 18px; }

.fc-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; position: relative;
  overflow: hidden; transition: all var(--trans); cursor: pointer;
}
.fc-item::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--pink)); opacity: 0; transition: opacity var(--trans);
}
.fc-item:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); transform: translateY(-2px); box-shadow: var(--card-shadow); }
.fc-item:hover::before { opacity: 1; }

.fc-item-tags { display: flex; align-items: center; gap: 6px; margin-bottom: 11px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; gap: 3px; padding: 2px 9px; border-radius: 100px; font-size: 11px; font-weight: 600; }
.tag-cat { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.tag-public { background: color-mix(in srgb, var(--teal) 12%, transparent); color: var(--teal); border: 1px solid color-mix(in srgb, var(--teal) 25%, transparent); }
.tag-private { background: var(--surface3); color: var(--text-dim); border: 1px solid var(--border); }
/* 소유자 공개/비공개 전환 버튼 */
.tag-status-btn {
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s, box-shadow 0.15s;
  position: relative;
}
.tag-status-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px color-mix(in srgb, currentColor 20%, transparent);
}
.tag-status-btn:active { transform: translateY(0); filter: brightness(0.95); }
.tag-status-hint {
  font-size: 10px;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition: opacity 0.2s, max-width 0.2s;
  white-space: nowrap;
  margin-left: 0;
}
.tag-status-btn:hover .tag-status-hint {
  opacity: 0.75;
  max-width: 40px;
  margin-left: 2px;
}

.fc-title { font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 700; margin-bottom: 6px; line-height: 1.3; }
.fc-meta { font-size: 12px; color: var(--text-dim); display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.fc-meta span { display: flex; align-items: center; gap: 3px; }
.fc-author-link {
  cursor: pointer; display: flex; align-items: center; gap: 3px;
  color: var(--text-dim); border-radius: 4px; padding: 1px 4px; margin: -1px -4px;
  transition: color .15s, background .15s;
}
.fc-author-link:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.author-cards-modal { max-width: 720px; width: 95vw; }

.fc-actions {
  display: flex; align-items: center; gap: 6px;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.fc-actions .spacer { flex: 1; }
.cnt { font-size: 11px; color: var(--text-dim); }

/* ═══════════════════════════════════════════════
   VIEWER
═══════════════════════════════════════════════ */
.viewer-wrap { max-width: 660px; margin: 0 auto; }

.viewer-head { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; }
.viewer-head-info { flex: 1; }
.viewer-head-info h2 { font-size: 20px; font-weight: 800; }
.viewer-head-meta { font-size: 12px; color: var(--text-sub); margin-top: 3px; display: flex; gap: 10px; }

/* Progress dots */
.prog-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 18px; }
.prog-dots { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; max-width: 380px; }
.prog-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border2); transition: all var(--trans); cursor: pointer; }
.prog-dot.active { background: var(--accent); transform: scale(1.4); }
.prog-dot.done { background: var(--accent); opacity: .38; }
.prog-txt { font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* Card face */
.card-face {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 22px; min-height: 300px; padding: 44px 40px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; cursor: pointer; position: relative; overflow: hidden;
  transition: all var(--trans); user-select: none;
}
.card-face::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% -10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 65%);
  pointer-events: none;
}
.card-face:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); transform: translateY(-2px); box-shadow: 0 16px 48px rgba(0,0,0,.3), 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent); }
.card-face.revealed { border-color: var(--teal); }
.card-face.revealed::after { background: radial-gradient(ellipse at 50% -10%, color-mix(in srgb, var(--teal) 8%, transparent), transparent 60%); }

.face-label { font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 18px; }
.card-face.revealed .face-label { color: var(--teal); }

.face-content { font-family: 'Syne', sans-serif; font-size: 26px; font-weight: 700; line-height: 1.4; }
/* Rich text content */
.face-content p, .face-hint p { margin-bottom: .5em; }
.face-content strong, .face-hint strong { font-weight: 700; }
.face-content em, .face-hint em { font-style: italic; }
.face-hint { font-size: 16px; line-height: 1.7; color: var(--text-sub); animation: fadein .3s ease; max-width: 100%; overflow: auto; }

.face-tip { position: absolute; bottom: 14px; font-size: 11px; color: var(--text-dim); display: flex; align-items: center; gap: 4px; }

@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Nav row */
.card-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 24px; }
.cnav-btn {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  font-size: 18px; display: flex; align-items: center; justify-content: center;
}
.cnav-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); transform: scale(1.1); }
.cnav-btn:disabled { opacity: .3; cursor: default; }

.autoplay-btn {
  display: flex; align-items: center; gap: 7px; padding: 9px 20px;
  border-radius: 100px; background: var(--surface2); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600;
}
.autoplay-btn:hover { border-color: var(--teal); color: var(--teal); }
.autoplay-btn.playing { background: color-mix(in srgb, var(--teal) 12%, transparent); border-color: var(--teal); color: var(--teal); }

.ap-progress { height: 3px; background: var(--border); border-radius: 2px; margin-top: 14px; overflow: hidden; }
.ap-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--teal)); width: 0%; border-radius: 2px; }

.speed-row { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--text-dim); }
.speed-row select { width: auto; padding: 4px 8px; font-size: 12px; }

/* ── TTS Bar ──────────────────────────────────────────── */
.tts-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-xs); padding: 8px 14px;
  margin-bottom: 16px; font-size: 13px;
}
.tts-toggle-wrap { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tts-label { font-weight: 600; color: var(--text-sub); white-space: nowrap; }
.tts-lang-wrap { display: flex; align-items: center; gap: 7px; flex: 1; flex-wrap: wrap; }
.tts-lang-sel {
  flex: 1; min-width: 160px; max-width: 320px;
  padding: 4px 8px; font-size: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xs); color: var(--text);
}
.tts-test-btn { padding: 4px 10px !important; font-size: 12px !important; white-space: nowrap; flex-shrink: 0; }

/* ═══════════════════════════════════════════════
   COMMENTS
═══════════════════════════════════════════════ */
.comments-wrap { margin-top: 40px; }
.comments-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 7px; }

.cmt-form { display: flex; gap: 8px; margin-bottom: 18px; }
.cmt-form textarea { flex: 1; min-height: 48px; max-height: 120px; }
.cmt-form .btn { align-self: flex-start; flex-shrink: 0; }

.cmt-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 13px 15px; margin-bottom: 8px;
  transition: border-color var(--trans);
}
.cmt-item:hover { border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.cmt-header { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.cmt-author { font-size: 13px; font-weight: 700; color: var(--accent); }
.cmt-date { font-size: 11px; color: var(--text-dim); }
.cmt-body { font-size: 14px; color: var(--text-sub); line-height: 1.55; }
.cmt-actions { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; }

.reply-list { margin-top: 6px; padding-left: 18px; }
.reply-form { margin-top: 7px; display: flex; gap: 7px; }
.reply-form input { flex: 1; }

/* ═══════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════ */
.overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.65); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; width: 100%; max-width: 640px;
  max-height: 90vh;
  display: flex; flex-direction: column;   /* flex column으로 변경 */
  overflow: hidden;                         /* 바깥 overflow 차단 */
  transform: scale(.96) translateY(8px); transition: transform .25s ease;
}
.overlay.open .modal { transform: none; }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 26px 18px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;   /* 줄어들지 않음 */
}
.modal-title { font-size: 19px; }
.modal-close { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 6px; font-size: 18px; color: var(--text-dim); }
.modal-close:hover { background: var(--surface2); color: var(--text); }

.modal-body {
  padding: 22px 26px;
  overflow-y: auto;   /* 본문만 스크롤 */
  flex: 1;
}
.modal-foot {
  padding: 14px 26px 22px; display: flex; justify-content: flex-end; gap: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;   /* 줄어들지 않음 */
  background: var(--surface);
}
/* 카드 에디터 전용: 왼쪽에 카드 추가 버튼, 오른쪽에 닫기+저장 */
#overlay-editor .modal-foot { justify-content: space-between; }
.modal-foot-right { display: flex; gap: 8px; }

/* ── Mobile modal → bottom sheet ── */
@media (max-width: 600px) {
  .overlay { align-items: flex-end; padding: 0; }
  .modal { border-radius: 20px 20px 0 0; max-height: 92vh; }
  .modal-body { max-height: none; }   /* flex가 높이 제어 */
}

/* ═══════════════════════════════════════════════
   FORM ELEMENTS
═══════════════════════════════════════════════ */
.fg { margin-bottom: 16px; }
.fg-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-sub); margin-bottom: 6px; letter-spacing: .3px; }
.fg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Toggle */
.tog-wrap { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-sub); }
.tog { position: relative; width: 42px; height: 23px; }
.tog input { opacity: 0; width: 0; height: 0; }
.tog-track {
  position: absolute; inset: 0; background: var(--surface3); border: 1px solid var(--border2);
  border-radius: 12px; cursor: pointer; transition: all var(--trans);
}
.tog-track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--text-dim); transition: all var(--trans);
}
.tog input:checked + .tog-track { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: var(--accent); }
.tog input:checked + .tog-track::after { transform: translateX(19px); background: var(--accent); }

/* Card entries */
.entries { display: flex; flex-direction: column; gap: 8px; }
.entry {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; position: relative;
}
.entry-num { font-size: 11px; color: var(--text-dim); font-weight: 700; margin-bottom: 8px; font-family: 'Syne', sans-serif; }
.entry input { margin-bottom: 6px; background: var(--surface); }
.entry textarea { background: var(--surface); min-height: 56px; }
.entry-del {
  position: absolute; top: 8px; right: 8px;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  border-radius: 4px; font-size: 13px; color: var(--text-dim);
}
.entry-del:hover { background: rgba(255,80,80,.15); color: #ff5a5a; }

/* ── Rich Text Editor (Quill) container ── */
.ql-wrap { margin-bottom: 6px; }
.ql-container.ql-snow, .ql-toolbar.ql-snow {
  border-color: var(--border) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
}
.ql-toolbar.ql-snow { border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important; background: var(--surface2) !important; }
.ql-container.ql-snow { border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important; min-height: 80px; }
.ql-snow .ql-stroke { stroke: var(--text-sub) !important; }
.ql-snow .ql-fill { fill: var(--text-sub) !important; }
.ql-snow .ql-picker { color: var(--text-sub) !important; }
.ql-editor { color: var(--text); font-family: 'Pretendard', sans-serif; font-size: 14px; }
[data-theme="light"] .ql-toolbar.ql-snow { background: #f0f0f6 !important; }

/* ═══════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════ */
.toast-shelf { position: fixed; bottom: 22px; right: 22px; z-index: 900; display: flex; flex-direction: column; gap: 7px; pointer-events: none; }
.toast {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 18px; font-size: 13px;
  display: flex; align-items: center; gap: 7px;
  box-shadow: 0 6px 24px rgba(0,0,0,.3);
  animation: tin .3s ease, tout .3s ease 2.7s forwards;
  pointer-events: all;
}
.toast.ok   { border-left: 3px solid var(--teal); }
.toast.err  { border-left: 3px solid var(--pink); }
.toast.info { border-left: 3px solid var(--accent); }
@keyframes tin  { from { opacity:0; transform: translateX(18px); } to { opacity:1; transform: none; } }
@keyframes tout { to   { opacity:0; transform: translateY(4px); } }

/* ═══════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════ */
.empty { display: flex; flex-direction: column; align-items: center; padding: 72px 20px; text-align: center; grid-column: 1/-1; }
.empty-ico { font-size: 56px; margin-bottom: 14px; opacity: .35; }
.empty-t { font-size: 18px; color: var(--text-sub); margin-bottom: 6px; }
.empty-d { font-size: 13px; color: var(--text-dim); }

/* ═══════════════════════════════════════════════
   ADMIN PANEL
═══════════════════════════════════════════════ */
.admin-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .admin-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1200px) { .admin-grid { grid-template-columns: 1fr 1fr 1fr; } }
.admin-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.admin-card h3 { font-size: 15px; margin-bottom: 6px; display: flex; align-items: center; gap: 7px; }
.admin-desc { font-size: 12px; color: var(--text-dim); margin-bottom: 16px; line-height: 1.6; }

/* Transfer form pieces */
.tf-section { margin-bottom: 14px; }
.tf-radio-group { display: flex; gap: 14px; margin-top: 6px; flex-wrap: wrap; }
.tf-radio { display: flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; }
.tf-radio input { accent-color: var(--accent); }
.tf-select {
  width: 100%; margin-top: 6px; padding: 7px 10px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-xs); color: var(--text); font-size: 13px;
}
.tf-file-label {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin-top: 6px;
  background: var(--surface2); border: 2px dashed var(--border);
  border-radius: var(--radius-xs); cursor: pointer; font-size: 13px;
  transition: border-color .2s, background .2s;
}
.tf-file-label:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.tf-file-label input[type="file"] { display: none; }
.tf-file-icon { font-size: 20px; flex-shrink: 0; }
.tf-preview {
  margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: var(--surface2); padding: 10px; font-size: 12px;
}
.tf-prev-head { font-weight: 700; margin-bottom: 8px; color: var(--text); }
.tf-prev-list { display: flex; flex-direction: column; gap: 4px; }
.tf-prev-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tf-prev-name { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 65%; }
.tf-prev-cat  { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.tf-prev-more { text-align: center; color: var(--text-dim); font-size: 11px; padding-top: 4px; }
.tf-result {
  margin-top: 10px; padding: 10px 14px; border-radius: var(--radius-xs);
  font-size: 13px; line-height: 1.6;
}
.tf-result-ok  { background: color-mix(in srgb, #22c55e 12%, transparent); border: 1px solid #22c55e44; color: var(--text); }
.tf-result-err { background: color-mix(in srgb, #ef4444 12%, transparent); border: 1px solid #ef444444; color: var(--text); }
.tf-result-stat { margin-left: 10px; font-size: 12px; color: var(--text-sub); }
/* 카드 선택 체크리스트 */
.tf-checklist {
  max-height: 220px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface);
}
.tf-check-all {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--accent) 6%, transparent);
  font-size: 12px; font-weight: 700; color: var(--text-sub); position: sticky; top: 0; z-index: 1;
}
.tf-check-all input { accent-color: var(--accent); }
.tf-check-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; cursor: pointer; font-size: 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  transition: background .1s;
}
.tf-check-item:last-child { border-bottom: none; }
.tf-check-item:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.tf-check-item input { accent-color: var(--accent); flex-shrink: 0; }
.tf-check-name { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-check-meta { font-size: 10px; color: var(--text-dim); white-space: nowrap; flex-shrink: 0; }
/* 카드 선택 멀티셀렉트 */
.exp-card-multiselect {
  width: 100%; min-height: 140px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-size: 13px; font-family: inherit; padding: 4px;
  accent-color: var(--accent);
}
.exp-card-multiselect option {
  padding: 5px 8px; border-radius: 4px; cursor: pointer;
}
.exp-card-multiselect option:checked {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--text);
}

.cat-list-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-xs); margin-bottom: 7px;
}
.cat-list-item .name { flex: 1; font-size: 14px; font-weight: 600; }
.cat-list-item .icon-display { font-size: 18px; }

/* ═══════════════════════════════════════════════
   MY PAGE TABS
═══════════════════════════════════════════════ */
.my-tabs { display: flex; gap: 3px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 3px; width: fit-content; margin-bottom: 22px; }
.my-tab { padding: 6px 16px; border-radius: 5px; font-size: 13px; font-weight: 600; color: var(--text-sub); }
.my-tab:hover { color: var(--text); }
.my-tab.active { background: var(--surface3); color: var(--text); }

/* ═══════════════════════════════════════════════
   SKELETON
═══════════════════════════════════════════════ */
.skel {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 200% 100%; animation: skel 1.4s infinite; border-radius: var(--radius-sm);
}
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ═══════════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════════ */
.pagination { display: flex; justify-content: center; align-items: center; gap: 4px; margin-top: 32px; flex-wrap: wrap; }
.page-btn {
  min-width: 36px; height: 36px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-xs); background: var(--surface2); border: 1px solid var(--border);
  font-size: 13px; font-weight: 500; color: var(--text-sub);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  cursor: pointer; user-select: none;
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.page-btn:disabled { opacity: .3; cursor: default; }
/* 처음/마지막 버튼 — 조금 더 좁게 */
.page-btn.page-btn-edge { min-width: 32px; font-size: 14px; color: var(--text-dim); }
.page-btn.page-btn-edge:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
/* 이전/다음 버튼 */
.page-btn.page-btn-step { min-width: 32px; font-size: 16px; }
/* edge·step 버튼 주변에 미세한 여백 구분선 */
.page-btn.page-btn-edge:first-child,
.page-btn.page-btn-step:nth-child(2) { margin-right: 2px; }
.page-btn.page-btn-step:nth-last-child(2),
.page-btn.page-btn-edge:last-child  { margin-left: 2px; }

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .main { padding: 20px 0 50px; }
  .cards-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 21px; }
  .card-face { padding: 32px 22px; min-height: 240px; }
  .face-content { font-size: 21px; }
  .fg-row { grid-template-columns: 1fr; }
  .viewer-wrap { max-width: 100%; }
  .nav-tabs .nav-tab span { display: none; }
}
@media (max-width: 480px) {
  .logo { font-size: 18px; }
  .nav-right { gap: 5px; }
}

/* ═══════════════════════════════════════════════
   FONT SIZE CONTROL (Viewer 힌트/답 영역)
═══════════════════════════════════════════════ */
.face-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}
.font-size-ctrl {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 8px;
}
.fsc-btn {
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 6px;
  transition: background .15s, color .15s;
  line-height: 1;
}
.fsc-btn:hover { background: var(--accent); color: #fff; }
.fsc-val {
  font-size: 11px;
  color: var(--text-dim);
  min-width: 30px;
  text-align: center;
}

/* 카테고리가 적어 스크롤 불필요 시 화살표 숨김 */
.cat-bar-wrap.no-scroll .cat-arrow { display: none; }
.cat-bar-wrap.no-scroll .cat-bar-mask::before,
.cat-bar-wrap.no-scroll .cat-bar-mask::after { display: none; }

/* ═══════════════════════════════════════════════
   CONTENT ACTIONS BAR (뷰어 개별카드 액션)
═══════════════════════════════════════════════ */
.content-actions { margin: 10px 0 0; }
.ca-wrap {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-xs);
  padding: 8px 14px;
}
.ca-left  { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ca-right { font-size: 12px; color: var(--text-dim); }
.ca-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 11px; border-radius: 100px; font-size: 12px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-sub);
  cursor: pointer; transition: all var(--trans); white-space: nowrap;
}
.ca-btn:hover { border-color: var(--accent); color: var(--accent); }
.ca-btn.ca-liked    { background: color-mix(in srgb,#ef4444 12%,transparent); border-color:#ef4444; color:#ef4444; }
.ca-btn.ca-scrapped { background: color-mix(in srgb,var(--accent) 12%,transparent); border-color:var(--accent); color:var(--accent); }
.ca-index { font-size: 11px; color: var(--text-dim); }

/* ── 개별카드 의견 패널 ────────────────────────────────────── */
/* ── 개별카드 의견 섹션 (항상 표시) ──────────────────────── */
.ca-opinion-section {
  margin-top: 20px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
}
.ca-opinion-section-head {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 16px 10px; font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.ca-opinion-section-count { font-size: 12px; color: var(--text-dim); font-weight: 400; }
.ca-opinion-list { display: flex; flex-direction: column; gap: 0; }
.ca-opinion-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.ca-opinion-item:last-child { border-bottom: none; }
.ca-op-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--text-dim); margin-bottom: 5px;
}
.ca-op-author { font-weight: 700; color: var(--text-sub); }
.ca-op-date   { color: var(--text-dim); }
.ca-op-actions { margin-left: auto; display: flex; gap: 2px; }
.ca-op-del, .ca-op-edit-btn { padding: 2px 6px; font-size: 11px; }
.ca-op-reply-badge { font-size: 11px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 1px 6px; border-radius: 10px; }
.ca-op-body   { font-size: 13px; color: var(--text); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.ca-op-edit-form { margin-top: 6px; }
.ca-op-edit-textarea { width: 100%; padding: 7px 10px; border-radius: 8px; box-sizing: border-box; border: 1px solid var(--accent); background: var(--surface); color: var(--text); font-size: 13px; resize: vertical; font-family: inherit; }
.ca-op-edit-btns { display: flex; gap: 6px; justify-content: flex-end; margin-top: 5px; }
/* 댓글 토글 바 */
.ca-op-reply-bar { padding: 4px 0 2px; }
.ca-op-reply-toggle { font-size: 11px; color: var(--text-dim); padding: 2px 4px; }
/* 댓글 목록 */
.ca-op-replies { padding-left: 16px; border-left: 2px solid var(--border); margin: 6px 0 4px; display: flex; flex-direction: column; gap: 0; }
.ca-reply-item { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 6px; padding: 5px 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent); }
.ca-reply-item:last-child { border-bottom: none; }
.ca-reply-author { font-size: 11px; font-weight: 700; color: var(--text-sub); }
.ca-reply-date   { font-size: 10px; color: var(--text-dim); }
.ca-reply-body   { font-size: 12px; color: var(--text); grid-column: 1 / -1; padding-top: 2px; white-space: pre-wrap; word-break: break-word; }
.ca-reply-empty  { font-size: 11px; color: var(--text-dim); padding: 4px 0; }
/* 댓글 입력 */
.ca-reply-form { display: flex; gap: 6px; padding: 6px 0 2px; align-items: center; }
.ca-reply-input { flex: 1; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 12px; font-family: inherit; }
.ca-reply-input:focus { outline: none; border-color: var(--accent); }
.ca-op-loading, .ca-op-empty {
  padding: 16px; font-size: 13px; color: var(--text-dim); text-align: center;
}
.ca-opinion-form {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--border);
}
.ca-opinion-form textarea {
  width: 100%; padding: 8px 10px; border-radius: 8px; box-sizing: border-box;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 13px; resize: vertical; font-family: inherit;
}
.ca-opinion-form textarea:focus { outline: none; border-color: var(--accent); }
.ca-opinion-form .btn { align-self: flex-end; }
.ca-op-login-hint {
  padding: 12px 16px; font-size: 13px; color: var(--text-dim);
  border-top: 1px solid var(--border); text-align: center;
}

/* ── My Page 탭 (5탭 래퍼) ────────────────────────────────── */
.my-tabs-wrap {
  display: flex; flex-wrap: wrap; gap: 3px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-xs); padding: 3px;
  width: 100%; margin-bottom: 22px;
}
.my-tabs-wrap .my-tab { flex: 1; text-align: center; white-space: nowrap; min-width: 80px; }

/* 섹션 타이틀 (좋아요·의견 탭 내 구분선) */
.my-section-title {
  font-size: 13px; font-weight: 700; color: var(--text-sub);
  padding: 4px 0 12px; border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

/* 개별카드 미니 아이템 */
.content-item { cursor: pointer; }
.content-item:hover { border-color: var(--teal) !important; }

/* ── 메모 모달 ──────────────────────────────────────────────── */
.cc-item {
  padding: 10px 12px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius-xs); margin-bottom: 8px;
}
.cc-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--text-dim); margin-bottom: 5px;
}
.cc-author { font-weight: 700; color: var(--text-sub); }
.cc-date   { color: var(--text-dim); }
.cc-body   { font-size: 13px; line-height: 1.6; white-space: pre-wrap; }

/* ═══════════════════════════════════════════════
   NOTIFICATION BELL & DROPDOWN
═══════════════════════════════════════════════ */
.notif-bell {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--trans);
}
.notif-bell:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }

.notif-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 17px; height: 17px;
  background: #ef4444; color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 10px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
  animation: badge-pop .25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes badge-pop { from { transform: scale(0); } to { transform: scale(1); } }

.notif-drop {
  position: absolute; right: 0; top: calc(100% + 10px);
  width: 360px; max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.04);
  z-index: 500;
  opacity: 0; transform: translateY(-8px) scale(.97);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.notif-drop.open {
  opacity: 1; transform: translateY(0) scale(1);
  pointer-events: all;
}

.notif-drop-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.notif-drop-title { font-size: 14px; font-weight: 700; }

.notif-list {
  max-height: 440px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.notif-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--trans);
  position: relative;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface2); }
.notif-item.unread { background: color-mix(in srgb, var(--accent) 6%, transparent); }

.notif-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }

.notif-body { flex: 1; min-width: 0; }
.notif-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  margin-bottom: 4px; font-size: 12px;
}
.notif-type  { font-weight: 700; color: var(--accent); }
.notif-actor { color: var(--text); font-weight: 600; }
.notif-card  { color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.notif-time  { color: var(--text-dim); font-size: 11px; margin-left: auto; }

.notif-content-prev {
  font-size: 11px; color: var(--teal);
  background: color-mix(in srgb, var(--teal) 8%, transparent);
  border-radius: 4px; padding: 3px 7px;
  margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-preview {
  font-size: 12px; color: var(--text-sub);
  line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notif-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0; margin-top: 6px;
}
.notif-empty, .notif-loading {
  text-align: center; padding: 28px 16px;
  font-size: 13px; color: var(--text-dim);
}

/* ═══════════════════════════════════════════════
   COMMENT ITEMS (내 의견 탭)
═══════════════════════════════════════════════ */
.comment-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.comment-item:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); box-shadow: 0 4px 20px rgba(0,0,0,.15); }

.ci-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.ci-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 100px; font-size: 11px; font-weight: 700;
}
.ci-comment { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); border: 1px solid var(--accent); }
.ci-reply   { background: color-mix(in srgb, var(--pink)  14%, transparent); color: var(--pink);   border: 1px solid var(--pink);   }
.ci-memo    { background: color-mix(in srgb, var(--teal)  14%, transparent); color: var(--teal);   border: 1px solid var(--teal);   }

.ci-card-name { font-size: 13px; font-weight: 600; color: var(--text); }
.ci-cat       { font-size: 11px; color: var(--text-dim); }
.ci-time      { font-size: 11px; color: var(--text-dim); margin-left: auto; }

/* 원댓글 인용 */
.ci-quote {
  font-size: 12px; color: var(--text-dim);
  border-left: 3px solid var(--border);
  padding: 5px 10px; margin-bottom: 8px;
  border-radius: 0 4px 4px 0;
  background: var(--surface2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 개별카드 문제/답 미리보기 */
.ci-card-preview {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 10px 14px; margin-bottom: 10px;
}
.ci-q { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.ci-a { font-size: 12px; color: var(--text-sub); }

/* 내 의견 본문 */
.ci-body {
  font-size: 14px; line-height: 1.65; color: var(--text);
  margin-bottom: 12px; white-space: pre-wrap;
}

/* 의견 수정 폼 */
.ci-edit-form { margin-bottom: 10px; }
.ci-edit-textarea {
  width: 100%; box-sizing: border-box; padding: 8px 10px;
  border: 1px solid var(--accent); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-size: 13px; font-family: inherit; resize: vertical; min-height: 60px;
}
.ci-edit-textarea:focus { outline: none; }
.ci-edit-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 5px; }

/* 하단 footer */
.ci-footer {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.ci-total { font-size: 12px; color: var(--text-dim); }
.ci-action-btns { display: flex; gap: 4px; }

/* 답글 영역 */
.ci-reply-area {
  margin-top: 10px; padding: 10px 12px;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
}
.ci-sub-list { display: flex; flex-direction: column; gap: 0; margin-bottom: 8px; }
.ci-sub-reply {
  display: grid; grid-template-columns: auto auto 1fr auto;
  align-items: center; gap: 6px;
  padding: 5px 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}
.ci-sub-reply:last-child { border-bottom: none; }
.ci-sub-author { font-size: 11px; font-weight: 700; color: var(--text-sub); }
.ci-sub-date   { font-size: 10px; color: var(--text-dim); }
.ci-sub-body   { grid-column: 1/-1; font-size: 12px; color: var(--text); padding-top: 2px; white-space: pre-wrap; word-break: break-word; }
.ci-sub-empty  { font-size: 12px; color: var(--text-dim); padding: 4px 0 8px; }
.ci-sub-form   { display: flex; gap: 6px; align-items: center; }
.ci-sub-input  {
  flex: 1; padding: 5px 8px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 12px; font-family: inherit;
}
.ci-sub-input:focus { outline: none; border-color: var(--accent); }

/* my-grid가 block 일 때 (의견 탭) */
#my-grid[style*="display: block"] {
  display: block !important;
}

/* ═══════════════════════════════════════════════
   SUB TAB (공개/비공개 필터 탭)
═══════════════════════════════════════════════ */
.sub-tab {
  padding: 5px 14px; border-radius: 100px; font-size: 12px; font-weight: 600;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-sub);
  cursor: pointer; transition: all var(--trans); white-space: nowrap;
}
.sub-tab:hover  { border-color: var(--accent); color: var(--accent); }
.sub-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ═══════════════════════════════════════════════
   ADMIN LAYOUT (카드 관리 섹션 포함)
═══════════════════════════════════════════════ */
.admin-section {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 20px;
}
.admin-section-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px; margin-bottom: 18px;
}
.admin-section-title {
  font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 7px;
}
.admin-card-tabs { display: flex; gap: 6px; flex-wrap: wrap; }

/* 하단 3-패널 그리드 (기존 admin-grid 역할) */
.admin-grid-inner {
  display: grid; gap: 16px; grid-template-columns: 1fr;
}
@media (min-width: 900px)  { .admin-grid-inner { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1200px) { .admin-grid-inner { grid-template-columns: 1fr 1fr 1fr; } }

/* ── 관리자 배지 ──────────────────────────────────────── */
.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: 20px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 20%, transparent), color-mix(in srgb, var(--teal) 15%, transparent));
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}
[data-theme="light"] .admin-badge {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), color-mix(in srgb, var(--teal) 10%, transparent));
}

/* ── 관리자 페이지 카드에 소유자 강조 ────────────────── */
.admin-owner-tag {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}

/* ── 카드 에디터 관리자 수정 배너 ────────────────────── */
.ed-admin-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  margin-bottom: 16px;
  border-radius: var(--radius-xs);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
}
.ed-admin-banner-ico { font-size: 16px; flex-shrink: 0; }