    :root {
      color-scheme: dark;

      /* Arcane (Cocoa Brown + Gold) */
      --bg0: #070403;
      --bg1: #140a06;
      --surface: rgba(22, 11, 7, 0.88);
      --surface2: rgba(12, 6, 4, 0.72);

      --paper: #f3eee6;
      --text: #f3eee6;
      --text-soft: #c9bfb3;

      --gold0: #7a5a1e;
      --gold1: #b88a2c;
      --gold2: #e7c56a;
      --gold3: #fff1c2;
      --gold4: #d2aa45;

      --border: rgba(231, 197, 106, 0.22);
      --border-soft: rgba(231, 197, 106, 0.14);

      --accent: var(--gold2);
      --danger: #f97373;
      --ok: #22c55e;

      --shadow: 0 24px 60px rgba(0, 0, 0, 0.70);
      --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.55);
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      padding: 0;
      background:
        radial-gradient(1200px 800px at 50% 15%, rgba(255, 241, 194, 0.06), transparent 60%),
        radial-gradient(900px 900px at 50% 65%, var(--bg1), var(--bg0));
      color: var(--text);
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      height: 100dvh;            /* 모바일 URL 바 대응 (동적 뷰포트) */
      height: 100vh;             /* dvh 미지원 브라우저 폴백 */
      height: 100dvh;
    }

    /* subtle film grain */
    body::before{
      content:"";
      position: fixed;
      inset: 0;
      pointer-events: none;
      background-image:
        radial-gradient(circle at 10% 20%, rgba(255,255,255,0.015), transparent 30%),
        radial-gradient(circle at 80% 60%, rgba(255,255,255,0.012), transparent 35%),
        radial-gradient(circle at 30% 90%, rgba(255,255,255,0.010), transparent 40%);
      opacity: 1;
      mix-blend-mode: overlay;
    }

    .app-shell {
      width: 100%;
      height: 100vh;
      height: 100dvh;
      max-width: none;
      margin: 0;
      background: transparent;
      display: flex;
      flex-direction: column;
    }

    /* ---------- Header ---------- */
    .app-header {
      padding: 14px 20px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid rgba(231, 197, 106, 0.10);
      background: linear-gradient(135deg, rgba(22, 11, 7, 0.95), rgba(7, 4, 3, 0.75));
      backdrop-filter: blur(8px);
    }

    .brand { display: flex; align-items: center; gap: 10px; }
    .brand-logo {
      width: 26px; height: 26px; border-radius: 999px;
      border: 1px solid rgba(231, 197, 106, 0.30);
      background:
        radial-gradient(circle at 35% 25%, rgba(255, 241, 194, 0.20), transparent 55%),
        radial-gradient(circle at 70% 85%, rgba(231, 197, 106, 0.14), transparent 60%),
        rgba(7, 4, 3, 0.65);
      display: flex; align-items: center; justify-content: center;
      font-size: 14px;
      color: var(--gold3);
      box-shadow:
        inset 0 1px 0 rgba(255, 241, 194, 0.12),
        inset 0 -1px 0 rgba(122, 90, 30, 0.20);
    }
    .brand-text { display: flex; flex-direction: column; }
    .brand-title {
      font-size: 14px;
      font-weight: 650;
      letter-spacing: 0.2px;
      background: linear-gradient(135deg, var(--gold0) 0%, var(--gold2) 26%, var(--gold3) 42%, var(--gold4) 58%, var(--gold1) 100%);
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
    }
    .brand-sub { font-size: 11px; color: rgba(243, 238, 230, 0.72); }
    .header-actions { display: flex; align-items: center; gap: 8px; font-size: 11px; }

    /* ---------- Buttons ---------- */
    .pill-btn {
      border: 1px solid rgba(231, 197, 106, 0.22);
      border-radius: 999px;
      background: rgba(22, 11, 7, 0.70);
      padding: 6px 12px;
      color: rgba(243, 238, 230, 0.78);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 11px;
      box-shadow:
        inset 0 1px 0 rgba(255, 241, 194, 0.10),
        inset 0 -1px 0 rgba(122, 90, 30, 0.18);
    }
    .pill-btn:hover {
      color: var(--gold3);
      border-color: rgba(231, 197, 106, 0.35);
      background: rgba(22, 11, 7, 0.82);
    }
    .pill-ghost {
      background: transparent;
      border: 1px solid rgba(231, 197, 106, 0.25);
      color: rgba(243, 238, 230, 0.70);
    }
    .pill-ghost:hover { background: rgba(22, 11, 7, 0.55); }

    /* Status dot: no outer glow */
    .status-dot {
      width: 7px; height: 7px; border-radius: 999px;
      background: var(--ok);
      box-shadow: none;
      opacity: 0.95;
    }
    .status-dot.typing { animation: pulse 1s infinite alternate; background: var(--gold2); }
    @keyframes pulse { from { opacity: 0.55; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }

    /* ---------- Layout ---------- */
    .app-main {
      flex: 1;
      display: flex;
      padding: 16px 24px 20px;
      gap: 16px;
      overflow: hidden;
    }
    .chat-column {
      flex: 1 1 auto;
      display: flex;
      flex-direction: column;
      min-width: 0;
      min-height: 0;  /* flex 컬럼 레이아웃에서 컨텐츠 넘침 방지 → chat-log 스크롤 활성화 */
      position: relative;
    }

    /* ---------- Surfaces (gold frame w/ inner highlight) ---------- */
    .side-column,
    .chat-log,
    .chat-footer,
    .qmd-modal {
      position: relative;
      border: 1px solid rgba(231, 197, 106, 0.16);
      background: var(--surface2);
      box-shadow: var(--shadow);
      overflow: hidden;
    }
    .side-column::before,
    .chat-log::before,
    .chat-footer::before,
    .qmd-modal::before{
      content:"";
      position:absolute; inset:0;
      pointer-events:none;
      border-radius: inherit;
      box-shadow:
        inset 0 1px 0 rgba(255, 241, 194, 0.10),
        inset 0 -1px 0 rgba(122, 90, 30, 0.18),
        inset 0 0 0 1px rgba(231, 197, 106, 0.06);
    }

    /* ---------- Sidebar ---------- */
    .side-column {
      flex: 0 0 320px;
      max-width: 360px;
      border-radius: 20px;
      padding: 14px 14px 16px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      font-size: 11px;
      color: rgba(243, 238, 230, 0.72);
      box-shadow: var(--shadow-soft);
      opacity: 1;
      transform: translateX(0);
      transition: opacity 0.22s ease, transform 0.22s ease, max-width 0.22s ease, flex-basis 0.22s ease;
    }
    .sidebar-toolbar { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
    .sidebar-icon-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; font-size: 11px; width: auto; }
    .sidebar-icon-btn .icon { min-width: 14px; text-align: center; }
    .sidebar-icon-btn .label { white-space: nowrap; }
    .sidebar-content { flex: 1; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; }
    .sidebar-content::-webkit-scrollbar { width: 4px; }
    .sidebar-content::-webkit-scrollbar-thumb { background: rgba(231,197,106,0.18); border-radius: 4px; }
    .sidebar-content::-webkit-scrollbar-track { background: transparent; }

    .sidebar-section { padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid rgba(231, 197, 106, 0.08); }
    .sidebar-section:last-of-type { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

    .side-title-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
    .side-title { font-size: 12px; font-weight: 600; color: rgba(243, 238, 230, 0.92); display: flex; align-items: center; gap: 6px; }

    .session-list {
      margin-top: 6px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      max-height: 220px;
      overflow-y: auto;
      padding-right: 2px;
    }
    .session-empty { font-size: 11px; opacity: 0.7; padding: 4px 2px; }

    .session-item {
      width: 100%;
      text-align: left;
      border-radius: 12px;
      border: 1px solid rgba(231, 197, 106, 0.14);
      background: rgba(7, 4, 3, 0.55);
      padding: 6px 8px;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      gap: 2px;
      font-size: 11px;
      transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
    }
    .session-item:hover {
      background: rgba(22, 11, 7, 0.80);
      border-color: rgba(231, 197, 106, 0.28);
      transform: translateY(-1px);
    }
    .session-item.active {
      border-color: rgba(231, 197, 106, 0.45);
      background: linear-gradient(135deg, rgba(22, 11, 7, 0.92), rgba(7, 4, 3, 0.55));
      color: rgba(243, 238, 230, 0.98);
    }
    .session-item-title { font-weight: 520; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
    .session-item-meta { font-size: 10px; opacity: 0.75; }
    .session-item-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
    .session-item-main { flex: 1; min-width: 0; }

    .session-item-delete {
      border-radius: 999px;
      border: 1px solid rgba(231, 197, 106, 0.14);
      background: rgba(7, 4, 3, 0.65);
      color: rgba(243, 238, 230, 0.70);
      font-size: 11px;
      padding: 2px 8px;
      cursor: pointer;
      opacity: 0.9;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      white-space: nowrap;
    }
    .session-item-delete:hover { opacity: 1; border-color: rgba(249, 115, 115, 0.7); color: var(--danger); }
    .session-item.active .session-item-delete {
      background: rgba(7, 4, 3, 0.72);
      border-color: rgba(249, 115, 115, 0.6);
      color: var(--danger);
    }

    /* 세션 제목 수정 버튼 */
    .session-item-edit {
      border-radius: 999px;
      border: 1px solid rgba(231, 197, 106, 0.14);
      background: rgba(7, 4, 3, 0.65);
      color: rgba(243, 238, 230, 0.70);
      font-size: 11px;
      padding: 2px 8px;
      cursor: pointer;
      opacity: 0.9;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      white-space: nowrap;
    }
    .session-item-edit:hover { opacity: 1; border-color: rgba(231, 197, 106, 0.5); color: var(--gold2); }

    /* 제목 수정 인풋 */
    .session-title-input {
      width: 100%;
      background: rgba(7, 4, 3, 0.85);
      border: 1px solid rgba(231, 197, 106, 0.4);
      border-radius: 6px;
      color: var(--text);
      padding: 4px 8px;
      font-size: 12px;
      outline: none;
    }
    .session-title-input:focus {
      border-color: rgba(231, 197, 106, 0.7);
    }

    .session-item-buttons {
      display: flex;
      gap: 4px;
      flex-shrink: 0;
    }

    /* ---------- Saved Targets ---------- */
    .saved-targets-list {
      margin-top: 6px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      max-height: 180px;
      overflow-y: auto;
      padding-right: 2px;
    }
    .target-item {
      width: 100%;
      text-align: left;
      border-radius: 12px;
      border: 1px solid rgba(231, 197, 106, 0.14);
      background: rgba(7, 4, 3, 0.55);
      padding: 6px 8px;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      gap: 2px;
      font-size: 11px;
      transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
    }
    .target-item:hover {
      background: rgba(22, 11, 7, 0.80);
      border-color: rgba(231, 197, 106, 0.28);
      transform: translateY(-1px);
    }
    .target-item-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 4px;
    }
    .target-item-main { flex: 1; min-width: 0; }
    .target-item-name {
      font-weight: 520;
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
    }
    .target-item-meta {
      font-size: 10px;
      opacity: 0.75;
    }
    .target-item-buttons {
      display: flex;
      gap: 4px;
      flex-shrink: 0;
    }
    .target-item-edit,
    .target-item-delete {
      border-radius: 999px;
      border: 1px solid rgba(231, 197, 106, 0.14);
      background: rgba(7, 4, 3, 0.65);
      color: rgba(243, 238, 230, 0.70);
      font-size: 11px;
      padding: 2px 8px;
      cursor: pointer;
      opacity: 0.9;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      white-space: nowrap;
    }
    .target-item-edit:hover {
      opacity: 1;
      border-color: rgba(231, 197, 106, 0.5);
      color: var(--gold2);
    }
    .target-item-delete:hover {
      opacity: 1;
      border-color: rgba(249, 115, 115, 0.7);
      color: var(--danger);
    }
    .target-name-input {
      width: 100%;
      background: rgba(7, 4, 3, 0.85);
      border: 1px solid rgba(231, 197, 106, 0.4);
      border-radius: 6px;
      color: var(--text);
      padding: 4px 8px;
      font-size: 12px;
      outline: none;
    }
    .target-name-input:focus {
      border-color: rgba(231, 197, 106, 0.7);
    }
    .targets-empty {
      font-size: 11px;
      opacity: 0.7;
      padding: 4px 2px;
    }
    .target-item.selected {
      border-color: rgba(231, 197, 106, 0.6);
      background: rgba(231, 197, 106, 0.10);
    }
    .target-item.selected .target-item-name::before {
      content: "✓ ";
      color: var(--gold2);
    }
    .compat-bar {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-top: 6px;
      padding-top: 6px;
      border-top: 1px solid rgba(231, 197, 106, 0.12);
    }
    .compat-select {
      flex: 1;
      background: rgba(7, 4, 3, 0.75);
      border: 1px solid rgba(231, 197, 106, 0.25);
      border-radius: 8px;
      color: var(--text);
      font-size: 11px;
      padding: 5px 6px;
      outline: none;
      cursor: pointer;
    }
    .compat-select:focus {
      border-color: rgba(231, 197, 106, 0.5);
    }
    .compat-btn {
      background: linear-gradient(135deg, var(--gold1), var(--gold2)) !important;
      color: #1a0e08 !important;
      font-weight: 600;
      font-size: 11px;
      white-space: nowrap;
    }

    /* ---------- Compat Visual Card ---------- */
    .compat-card {
      border: 1.5px solid var(--gold1);
      border-radius: 14px;
      background: linear-gradient(160deg, rgba(30,20,10,0.95), rgba(45,30,15,0.92));
      padding: 0;
      overflow: hidden;
      font-size: 13px;
      line-height: 1.5;
      color: #d4c8a0;
    }
    .compat-card-header {
      background: linear-gradient(135deg, rgba(180,150,80,0.2), rgba(120,90,40,0.15));
      padding: 10px 14px;
      font-weight: 700;
      font-size: 14px;
      color: var(--gold1);
      border-bottom: 1px solid rgba(180,150,80,0.25);
    }
    .compat-card-versus {
      display: flex;
      align-items: stretch;
      padding: 12px 14px;
      gap: 0;
    }
    .compat-person {
      flex: 1;
      min-width: 0;
    }
    .compat-person-name {
      font-weight: 700;
      font-size: 14px;
      color: var(--gold1);
      margin-bottom: 4px;
    }
    .compat-person-palace {
      font-size: 12px;
      color: #a89870;
      margin-bottom: 2px;
    }
    .compat-person-detail {
      font-size: 11.5px;
      color: #c0b080;
      margin-bottom: 1px;
    }
    .compat-divider {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 40px;
      flex-shrink: 0;
      font-size: 13px;
      font-weight: 700;
      color: #a89870;
    }
    .compat-axes {
      border-top: 1px solid rgba(180,150,80,0.2);
      padding: 10px 14px;
    }
    .compat-axis-row {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 3px 0;
      font-size: 12px;
    }
    .compat-axis-name {
      font-weight: 600;
      color: #c0a860;
      min-width: 62px;
    }
    .compat-axis-detail {
      flex: 1;
      color: #b8a878;
    }
    .compat-dot-pos { color: #4caf50; }
    .compat-dot-neu { color: #ffc107; }
    .compat-dot-neg { color: #ef5350; }

    /* ---------- Streak & Badges Popup ---------- */
    .streak-fire-btn {
      width: 32px; height: 32px; border-radius: 50%;
      border: 1px solid rgba(231,197,106,0.22);
      background: rgba(7,4,3,0.60);
      color: #f97316; font-size: 16px;
      display: none; align-items: center; justify-content: center;
      cursor: pointer; padding: 0; margin-left: auto; flex-shrink: 0;
      transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    }
    .streak-fire-btn:hover {
      border-color: rgba(249,115,22,0.6);
      transform: scale(1.1);
      box-shadow: 0 0 10px rgba(249,115,22,0.3);
    }
    .streak-fire-btn.has-streak {
      animation: fire-glow 2s ease-in-out infinite;
    }
    @keyframes fire-glow {
      0%, 100% { box-shadow: 0 0 4px rgba(249,115,22,0.15); }
      50% { box-shadow: 0 0 12px rgba(249,115,22,0.4); }
    }
    .streak-popup-overlay {
      display: none; position: fixed; inset: 0; z-index: 8000;
      background: rgba(0,0,0,0.55);
      animation: streak-overlay-in 0.2s ease;
    }
    @keyframes streak-overlay-in { from { opacity: 0; } to { opacity: 1; } }
    .streak-popup {
      position: fixed; z-index: 8001;
      bottom: 70px; left: 20px;
      width: 300px; max-height: 70vh; overflow-y: auto;
      background: linear-gradient(165deg, rgba(22,14,8,0.98), rgba(12,8,4,0.97));
      border: 1.5px solid var(--gold1);
      border-radius: 14px;
      padding: 18px;
      box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 20px rgba(231,197,106,0.08);
      animation: streak-popup-in 0.25s ease;
    }
    @keyframes streak-popup-in {
      from { opacity: 0; transform: translateY(12px) scale(0.96); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }
    .streak-popup::-webkit-scrollbar { width: 4px; }
    .streak-popup::-webkit-scrollbar-thumb { background: rgba(231,197,106,0.18); border-radius: 4px; }
    .streak-popup-header {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 12px;
    }
    .streak-popup-title {
      font-size: 15px; font-weight: 700; color: var(--gold2);
    }
    .streak-popup-close {
      width: 26px; height: 26px; border-radius: 50%;
      border: 1px solid rgba(231,197,106,0.15);
      background: rgba(7,4,3,0.50);
      color: var(--text-soft); font-size: 14px;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; padding: 0;
    }
    .streak-popup-close:hover { border-color: var(--gold1); color: var(--gold2); }
    .streak-counter {
      font-size: 22px; font-weight: 700; color: var(--gold2);
      padding: 2px 0 6px;
    }
    .streak-bar-wrap {
      display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
    }
    .streak-bar {
      flex: 1; height: 10px; border-radius: 5px;
      background: rgba(255,255,255,0.08); overflow: hidden;
    }
    .streak-bar-fill {
      height: 100%; border-radius: 5px;
      background: linear-gradient(90deg, #f97316, #eab308, #22c55e);
      transition: width 0.6s ease;
    }
    .streak-bar-label {
      font-size: 10px; color: var(--text-soft); white-space: nowrap;
    }
    .streak-total {
      font-size: 11px; color: var(--text-soft); margin-bottom: 10px;
    }
    .badges-section-title {
      font-size: 11px; font-weight: 600; color: var(--gold1);
      margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;
    }
    .badges-grid {
      display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px;
    }
    .badge-item {
      width: 42px; height: 42px; border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      font-size: 18px; cursor: default;
      border: 2px solid rgba(231,197,106,0.12);
      background: rgba(7,4,3,0.55);
      position: relative;
      transition: transform 0.15s ease, border-color 0.15s ease;
    }
    .badge-item.locked {
      opacity: 0.25; filter: grayscale(1);
    }
    .badge-item.earned {
      opacity: 1; filter: none;
      border-color: rgba(231,197,106,0.5);
      background: rgba(22,11,7,0.80);
    }
    .badge-item.earned:hover {
      transform: scale(1.15);
      border-color: var(--gold2);
    }
    .badge-item .badge-tooltip {
      display: none; position: absolute; bottom: 115%; left: 50%;
      transform: translateX(-50%); white-space: nowrap;
      background: rgba(7,4,3,0.95); border: 1px solid var(--gold1);
      border-radius: 6px; padding: 4px 10px; font-size: 10px;
      color: var(--gold2); pointer-events: none; z-index: 10;
    }
    .badge-item:hover .badge-tooltip { display: block; }
    @keyframes badge-pulse {
      0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(231,197,106,0.4); }
      50% { transform: scale(1.15); box-shadow: 0 0 12px 4px rgba(231,197,106,0.3); }
    }
    .badge-item.new-badge {
      animation: badge-pulse 0.6s ease 2;
    }
    /* 뱃지 획득 토스트 */
    .badge-toast {
      position: fixed; top: 20px; right: 20px; z-index: 9999;
      background: linear-gradient(135deg, rgba(30,20,10,0.97), rgba(45,30,15,0.95));
      border: 1.5px solid var(--gold2); border-radius: 12px;
      padding: 12px 18px; display: flex; align-items: center; gap: 10px;
      color: var(--gold2); font-size: 13px; font-weight: 600;
      box-shadow: 0 8px 30px rgba(0,0,0,0.5);
      animation: toast-in 0.4s ease, toast-out 0.4s ease 2.6s forwards;
    }
    .badge-toast .toast-icon { font-size: 24px; }
    @keyframes toast-in { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
    @keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateY(-20px); } }

    /* ---------- 설정 팝업 ---------- */
    .settings-popup-overlay {
      display: none; position: fixed; inset: 0; z-index: 8000;
      background: rgba(0,0,0,0.55);
      animation: streak-overlay-in 0.2s ease;
    }
    .settings-popup {
      position: fixed; z-index: 8001;
      bottom: 70px; left: 20px;
      width: 320px; max-height: 75vh; overflow-y: auto;
      background: linear-gradient(165deg, rgba(22,14,8,0.98), rgba(12,8,4,0.97));
      border: 1.5px solid var(--gold1);
      border-radius: 14px;
      padding: 0;
      box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 20px rgba(231,197,106,0.08);
      animation: streak-popup-in 0.25s ease;
    }
    .settings-popup::-webkit-scrollbar { width: 4px; }
    .settings-popup::-webkit-scrollbar-thumb { background: rgba(231,197,106,0.2); border-radius: 2px; }
    .settings-popup-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 14px 16px 10px;
      border-bottom: 1px solid rgba(231,197,106,0.08);
    }
    .settings-popup-title { font-size: 14px; font-weight: 700; color: var(--gold1); }
    .settings-popup-close {
      width: 26px; height: 26px; border-radius: 50%;
      border: 1px solid rgba(231,197,106,0.15);
      background: rgba(7,4,3,0.50);
      color: var(--text-soft); font-size: 14px;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; padding: 0;
    }
    .settings-popup-close:hover { border-color: var(--gold1); color: var(--gold2); }
    .settings-popup-body { padding: 0; }
    .settings-section {
      padding: 12px 16px;
      border-bottom: 1px solid rgba(231,197,106,0.06);
    }
    .settings-section:last-child { border-bottom: none; }
    .settings-section-label {
      font-size: 10px; font-weight: 600; color: var(--gold1);
      text-transform: uppercase; letter-spacing: 0.5px;
      margin-bottom: 8px; opacity: 0.8;
    }
    .settings-profile-info {
      font-size: 12px; color: rgba(243,238,230,0.85); line-height: 1.6;
    }
    .settings-profile-info .sp-email { color: rgba(243,238,230,0.55); font-size: 11px; }
    .settings-profile-info .sp-birth { color: var(--text-soft); font-size: 11px; }
    .settings-sub-info {
      font-size: 12px; color: rgba(243,238,230,0.85);
      display: flex; align-items: center; gap: 8px;
    }
    .settings-sub-badge {
      display: inline-block; padding: 2px 8px; border-radius: 999px;
      font-size: 10px; font-weight: 600;
    }
    .settings-sub-badge.free {
      background: rgba(107,114,128,0.2); color: #9ca3af;
      border: 1px solid rgba(107,114,128,0.3);
    }
    .settings-sub-badge.premium {
      background: rgba(124,58,237,0.2); color: #c4b5fd;
      border: 1px solid rgba(124,58,237,0.4);
    }
    .settings-coin { font-size: 11px; color: #d97706; }
    .settings-upgrade-link {
      display: inline-block; margin-top: 8px; padding: 6px 14px;
      border-radius: 999px; font-size: 11px; font-weight: 600;
      background: linear-gradient(135deg, rgba(124,58,237,0.3), rgba(79,70,229,0.2));
      border: 1px solid rgba(124,58,237,0.5);
      color: #c4b5fd; text-decoration: none;
      transition: all 0.2s;
    }
    .settings-upgrade-link:hover {
      background: linear-gradient(135deg, rgba(124,58,237,0.45), rgba(79,70,229,0.35));
      border-color: rgba(167,139,250,0.8);
    }
    .settings-menu-item {
      display: flex; align-items: center; gap: 8px;
      width: 100%; padding: 9px 0; border: none; background: none;
      color: rgba(243,238,230,0.78); font-size: 13px;
      cursor: pointer; text-decoration: none;
      border-radius: 6px; transition: color 0.15s;
    }
    .settings-menu-item:hover { color: var(--gold2); }
    .settings-menu-item.settings-danger { color: rgba(249,115,115,0.85); }
    .settings-menu-item.settings-danger:hover { color: #f87171; }
    .settings-menu-item.settings-danger-muted { color: rgba(156,163,175,0.6); font-size: 12px; }
    .settings-menu-item.settings-danger-muted:hover { color: rgba(249,115,115,0.7); }

    /* ---------- 비밀번호 변경 모달 ---------- */
    .pw-modal-backdrop {
      position: fixed; inset: 0; z-index: 9000;
      background: rgba(0,0,0,0.72); backdrop-filter: blur(6px);
      display: none; align-items: center; justify-content: center;
    }
    .pw-modal {
      width: 100%; max-width: 340px; border-radius: 18px;
      padding: 20px;
      background: linear-gradient(165deg, rgba(22,14,8,0.98), rgba(12,8,4,0.97));
      border: 1.5px solid var(--gold1);
      box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    }
    .pw-modal h3 { font-size: 15px; font-weight: 700; color: var(--gold1); margin: 0 0 16px; }
    .pw-modal label { font-size: 11px; color: var(--text-soft); display: block; margin-bottom: 4px; }
    .pw-modal input {
      width: 100%; padding: 8px 10px; border-radius: 10px;
      border: 1px solid rgba(231,197,106,0.18);
      background: rgba(7,4,3,0.55); color: var(--text);
      font-size: 13px; margin-bottom: 12px;
    }
    .pw-modal input:focus { outline: none; border-color: rgba(231,197,106,0.4); }
    .pw-modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
    .pw-modal-msg { font-size: 12px; margin-top: 8px; }
    .pw-modal-msg.error { color: #f87171; }
    .pw-modal-msg.success { color: #4ade80; }

    /* ---------- AI 기억 관리 모달 ---------- */
    .memory-modal-backdrop {
      position: fixed; inset: 0; z-index: 9000;
      background: rgba(0,0,0,0.72); backdrop-filter: blur(6px);
      display: none; align-items: center; justify-content: center;
    }
    .memory-modal {
      width: 100%; max-width: 400px; max-height: 80vh;
      border-radius: 18px; padding: 20px;
      background: linear-gradient(165deg, rgba(22,14,8,0.98), rgba(12,8,4,0.97));
      border: 1.5px solid var(--gold1);
      box-shadow: 0 20px 60px rgba(0,0,0,0.5);
      overflow-y: auto;
    }
    .memory-modal h3 { font-size: 15px; font-weight: 700; color: var(--gold1); margin: 0 0 4px; }
    .memory-modal .memory-desc { font-size: 11px; color: var(--text-soft); margin-bottom: 16px; }
    .memory-list { display: flex; flex-direction: column; gap: 6px; }
    .memory-item {
      display: flex; align-items: flex-start; gap: 10px;
      padding: 8px 10px; border-radius: 10px;
      background: rgba(7,4,3,0.4);
      border: 1px solid rgba(231,197,106,0.06);
    }
    .memory-item-body { flex: 1; min-width: 0; }
    .memory-item-cat { font-size: 10px; color: var(--gold1); font-weight: 600; margin-bottom: 2px; }
    .memory-item-text { font-size: 12px; color: rgba(243,238,230,0.82); line-height: 1.4; }
    .memory-item-del {
      flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
      border: 1px solid rgba(249,115,115,0.3); background: none;
      color: rgba(249,115,115,0.6); font-size: 12px;
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      transition: all 0.15s;
    }
    .memory-item-del:hover { border-color: #f87171; color: #f87171; background: rgba(127,29,29,0.2); }
    .memory-empty { font-size: 13px; color: var(--text-soft); text-align: center; padding: 20px 0; }
    .memory-name-row {
      display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
      padding-bottom: 12px; border-bottom: 1px solid rgba(231,197,106,0.08);
    }
    .memory-name-input {
      flex: 1; padding: 6px 10px; border-radius: 8px;
      border: 1px solid rgba(231,197,106,0.18);
      background: rgba(7,4,3,0.55); color: var(--text);
      font-size: 12px;
    }
    .memory-name-input:focus { outline: none; border-color: rgba(231,197,106,0.4); }
    .memory-name-save {
      padding: 6px 12px; border-radius: 8px; font-size: 11px;
      border: 1px solid rgba(231,197,106,0.3);
      background: rgba(22,11,7,0.8); color: var(--gold2);
      cursor: pointer; font-weight: 600;
    }
    .memory-name-save:hover { border-color: var(--gold1); }

    /* ---------- Group Compat Card ---------- */
    .group-compat-card {
      border: 1.5px solid var(--gold1);
      border-radius: 14px;
      background: linear-gradient(160deg, rgba(30,20,10,0.95), rgba(45,30,15,0.92));
      padding: 0;
      overflow: hidden;
      font-size: 13px;
      line-height: 1.5;
      color: #d4c8a0;
    }
    .group-compat-card .gc-header {
      background: linear-gradient(135deg, rgba(180,150,80,0.2), rgba(120,90,40,0.15));
      padding: 10px 14px;
      font-weight: 700;
      font-size: 14px;
      color: var(--gold1);
      border-bottom: 1px solid rgba(180,150,80,0.25);
    }
    .group-compat-card .gc-section {
      padding: 10px 14px;
      border-bottom: 1px solid rgba(180,150,80,0.12);
    }
    .group-compat-card .gc-section:last-child { border-bottom: none; }
    .group-compat-card .gc-section-title {
      font-size: 11px;
      font-weight: 600;
      color: #a89870;
      margin-bottom: 8px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    /* 조화도 바 */
    .gc-score-wrap {
      display: flex; align-items: center; gap: 10px;
    }
    .gc-score-bar {
      flex: 1; height: 10px; border-radius: 5px;
      background: rgba(255,255,255,0.08);
      overflow: hidden;
    }
    .gc-score-fill {
      height: 100%; border-radius: 5px;
      background: linear-gradient(90deg, #EF4444, #EAB308, #22C55E);
      transition: width 0.6s ease;
    }
    .gc-score-text {
      font-size: 16px; font-weight: 700; color: var(--gold1);
      min-width: 44px; text-align: right;
    }
    /* 매트릭스 */
    .gc-matrix {
      width: 100%; border-collapse: collapse;
      font-size: 12px; text-align: center;
    }
    .gc-matrix th {
      padding: 4px 6px; font-weight: 600; color: #c0a860;
      font-size: 11px;
    }
    .gc-matrix td {
      padding: 4px 6px; min-width: 32px;
    }
    .gc-matrix .gc-name-cell {
      text-align: left; font-weight: 600; color: #c0a860;
      font-size: 11px; max-width: 60px; overflow: hidden;
      text-overflow: ellipsis; white-space: nowrap;
    }
    .gc-cell-pos { background: rgba(34,197,94,0.2); color: #4ade80; border-radius: 4px; cursor: pointer; }
    .gc-cell-neu { background: rgba(234,179,8,0.2); color: #facc15; border-radius: 4px; cursor: pointer; }
    .gc-cell-neg { background: rgba(239,68,68,0.2); color: #f87171; border-radius: 4px; cursor: pointer; }
    .gc-cell-self { color: #555; }
    .gc-legend {
      display: flex; gap: 12px; margin-top: 6px; font-size: 11px; color: #a89870;
    }
    .gc-legend span { display: flex; align-items: center; gap: 3px; }
    /* 쌍별 상세 */
    .gc-pair-row {
      display: flex; align-items: center; gap: 8px;
      padding: 4px 0; font-size: 12px;
    }
    .gc-pair-names {
      min-width: 90px; font-weight: 600; color: #c0a860;
    }
    .gc-pair-dots { display: flex; gap: 2px; }
    .gc-pair-score {
      min-width: 36px; text-align: right; font-weight: 600;
    }
    .gc-pair-tag {
      font-size: 10px; padding: 1px 6px; border-radius: 8px; font-weight: 600;
    }
    .gc-pair-tag-best { background: rgba(34,197,94,0.2); color: #4ade80; }
    .gc-pair-tag-warn { background: rgba(239,68,68,0.2); color: #f87171; }
    /* 역할 */
    .gc-role-item {
      display: flex; align-items: center; gap: 8px;
      padding: 4px 0; font-size: 12px;
    }
    .gc-role-name {
      font-weight: 600; color: var(--gold1); min-width: 50px;
    }
    .gc-role-info { color: #a89870; }
    .gc-role-label {
      font-weight: 600; color: #d4c8a0;
    }
    /* 쌍 상세 5축 (펼침) */
    .gc-pair-detail {
      display: none; padding: 6px 0 6px 16px;
      font-size: 11px; color: #b8a878;
    }
    .gc-pair-detail.open { display: block; }
    .gc-pair-detail-axis {
      display: flex; align-items: center; gap: 6px; padding: 2px 0;
    }

    /* ---------- Card Column (중간 컬럼) ---------- */
    .card-column {
      flex: 0 0 280px;
      max-width: 300px;
      border-radius: 20px;
      padding: 14px 12px;
      flex-direction: column;
      gap: 8px;
      position: relative;
      border: 1px solid rgba(231, 197, 106, 0.16);
      background: var(--surface2);
      box-shadow: var(--shadow);
      overflow: hidden;
      transition: flex-basis 0.25s ease, max-width 0.25s ease, padding 0.25s ease, opacity 0.25s ease;
    }
    .card-column::before {
      content:"";
      position:absolute; inset:0;
      pointer-events:none;
      border-radius: inherit;
      box-shadow:
        inset 0 1px 0 rgba(255, 241, 194, 0.10),
        inset 0 -1px 0 rgba(122, 90, 30, 0.18),
        inset 0 0 0 1px rgba(231, 197, 106, 0.06);
    }
    .card-column-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-shrink: 0;
    }
    .card-column-title {
      font-size: 12px;
      font-weight: 600;
      color: var(--gold1);
    }
    .card-column-toggle {
      font-size: 13px;
      padding: 2px 6px;
      cursor: pointer;
    }
    .card-column-body {
      flex: 1;
      overflow-y: auto;
      scrollbar-width: thin;
    }
    /* 접힌 상태 */
    body.card-collapsed .card-column {
      flex-basis: 36px !important;
      max-width: 36px !important;
      padding: 10px 4px;
    }
    body.card-collapsed .card-column-body,
    body.card-collapsed .card-column-title {
      display: none;
    }
    body.card-collapsed .card-column-header {
      justify-content: center;
    }
    body.card-collapsed .card-export-group {
      display: none;
    }

    /* 카드 컬럼 내 궁합 카드 조정 */
    .card-column .compat-card {
      font-size: 12px;
    }
    .card-column .compat-card-header {
      font-size: 12.5px;
      padding: 8px 10px;
    }
    .card-column .compat-card-versus {
      flex-direction: column;
      padding: 10px;
      gap: 0;
    }
    .card-column .compat-divider {
      width: auto;
      height: 24px;
      font-size: 11px;
      color: #887850;
      border-top: 1px solid rgba(180,150,80,0.15);
      border-bottom: 1px solid rgba(180,150,80,0.15);
      margin: 4px 0;
    }
    .card-column .compat-person { flex: none; }
    .card-column .compat-axes { padding: 8px 10px; }
    .card-column .compat-axis-row { font-size: 11px; gap: 5px; }
    .card-column .compat-axis-name { min-width: 54px; font-size: 11px; }

    .my-birth-display {
      font-size: 12px; color: var(--text-soft); padding: 2px 0; line-height: 1.5;
    }
    .my-birth-display.set { color: var(--gold2); }
    .qmd-save-birth {
      display: flex; align-items: center; gap: 6px; margin-top: 6px;
      font-size: 11px; color: var(--text-soft); cursor: pointer;
    }
    .qmd-save-birth input[type="checkbox"] {
      accent-color: var(--gold2); width: 14px; height: 14px;
    }

    /* ===== Daily Insight Section ===== */
    #daily-insight-section { padding-bottom: 8px; }
    .insight-card {
      background: rgba(22, 11, 7, 0.55);
      border: 1px solid rgba(231, 197, 106, 0.1);
      border-radius: 8px;
      padding: 8px 10px;
      margin-bottom: 6px;
      font-size: 11px;
      line-height: 1.5;
    }
    .insight-fortune-header {
      display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
    }
    .insight-level-badge {
      display: inline-block; padding: 2px 8px; border-radius: 10px;
      font-size: 10px; font-weight: 700; color: #000;
    }
    .insight-level-badge.lv5 { background: #4ade80; }
    .insight-level-badge.lv4 { background: #60a5fa; }
    .insight-level-badge.lv3 { background: #d4a574; }
    .insight-level-badge.lv2 { background: #fb923c; }
    .insight-level-badge.lv1 { background: #f87171; }
    .insight-date-label { font-size: 10px; color: var(--text-soft); }
    .insight-interp { color: var(--text); font-size: 11px; }
    .insight-subtitle {
      font-size: 10px; font-weight: 600; color: var(--gold2);
      margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center;
    }
    .insight-dodont-row { display: flex; flex-direction: column; gap: 4px; }
    .insight-do, .insight-dont { display: flex; gap: 6px; align-items: flex-start; }
    .insight-do-label {
      font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px;
      background: rgba(34, 197, 94, 0.2); color: #4ade80; flex-shrink: 0;
    }
    .insight-dont-label {
      font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px;
      background: rgba(248, 113, 113, 0.2); color: #f87171; flex-shrink: 0;
    }
    .insight-lucky-row {
      display: flex; justify-content: space-around; text-align: center;
    }
    .insight-lucky-item { display: flex; flex-direction: column; gap: 2px; }
    .insight-lucky-label { font-size: 9px; color: var(--text-soft); }
    .insight-lucky-val { font-size: 13px; font-weight: 700; color: var(--gold2); }
    .insight-career-text { color: var(--text); }
    .insight-tools-row { display: flex; gap: 8px; align-items: flex-end; }
    .insight-tool { display: flex; flex-direction: column; gap: 2px; flex: 1; }
    .insight-tool-label { font-size: 9px; color: var(--text-soft); }
    .insight-date-input {
      background: rgba(12, 6, 4, 0.72); border: 1px solid var(--border-soft);
      border-radius: 6px; padding: 4px 6px; font-size: 11px; color: var(--text); width: 100%;
    }
    .insight-taekil-btn { font-size: 10px; }
    .insight-taekil-form {
      display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-bottom: 6px;
    }
    .insight-select {
      background: rgba(12, 6, 4, 0.72); border: 1px solid var(--border-soft);
      border-radius: 6px; padding: 3px 6px; font-size: 10px; color: var(--text); flex: 1;
    }
    .taekil-results { max-height: 150px; overflow-y: auto; }
    .taekil-day-item {
      display: flex; justify-content: space-between; padding: 3px 0;
      border-bottom: 1px solid rgba(231, 197, 106, 0.06); font-size: 10px;
    }
    .taekil-badge {
      padding: 1px 6px; border-radius: 8px; font-size: 9px; font-weight: 600;
    }

    .start-analysis-btn {
      display: block;
      width: 100%;
      margin-top: 8px;
      padding: 9px 0;
      text-align: center;
      background: linear-gradient(135deg, var(--gold1), var(--gold2)) !important;
      color: #1a0e08 !important;
      font-weight: 700;
      font-size: 12px;
      border: none;
      border-radius: 10px;
      cursor: pointer;
    }
    .start-analysis-btn:hover { filter: brightness(1.1); }

    /* Individual Card */
    .individual-card {
      border: 1.5px solid var(--gold1);
      border-radius: 14px;
      background: linear-gradient(160deg, rgba(30,20,10,0.95), rgba(45,30,15,0.92));
      overflow: hidden;
      font-size: 12px;
      line-height: 1.55;
      color: #d4c8a0;
    }
    .individual-card-header {
      background: linear-gradient(135deg, rgba(180,150,80,0.2), rgba(120,90,40,0.15));
      padding: 8px 12px;
      font-weight: 700;
      font-size: 13px;
      color: var(--gold1);
      border-bottom: 1px solid rgba(180,150,80,0.25);
    }
    .individual-card-body {
      padding: 10px 12px;
    }
    .individual-card-row {
      display: flex;
      gap: 6px;
      padding: 2px 0;
    }
    .individual-card-label {
      color: #a89870;
      min-width: 52px;
      flex-shrink: 0;
    }
    .individual-card-value {
      color: #d4c8a0;
      font-weight: 500;
    }
    .individual-card-divider {
      border-top: 1px solid rgba(180,150,80,0.15);
      margin: 6px 0;
    }
    .individual-card-geok {
      padding: 6px 12px 10px;
      border-top: 1px solid rgba(180,150,80,0.2);
      font-size: 11.5px;
    }

    /* ---------- 9-Palace Grid ---------- */
    .nine-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      grid-template-rows: repeat(3, 1fr);
      gap: 3px;
      width: 100%;
      font-size: 10px;
      line-height: 1.35;
    }
    .nine-grid-cell {
      border: 1px solid rgba(231, 197, 106, 0.18);
      border-radius: 8px;
      background: rgba(7, 4, 3, 0.55);
      padding: 4px 5px;
      display: flex;
      flex-direction: column;
      gap: 1px;
      overflow: hidden;
      min-height: 56px;
    }
    .nine-grid-cell.yongshin {
      border-color: var(--gold2);
      border-width: 2px;
      background: rgba(231, 197, 106, 0.08);
      box-shadow: inset 0 0 8px rgba(231, 197, 106, 0.15);
    }
    .nine-grid-cell-palace { font-weight: 700; color: var(--gold1); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .nine-grid-cell-detail { color: #b8a878; font-size: 9.5px; }
    .nine-grid-cell-element { color: #a89870; font-size: 9px; }
    .nine-grid-title { margin-bottom: 6px; font-weight: 600; color: var(--gold1); font-size: 12px; }
    .card-view-tabs { display: flex; gap: 0; margin-bottom: 6px; flex-shrink: 0; }
    .card-view-tab {
      flex: 1; text-align: center; padding: 4px 0; font-size: 11px; cursor: pointer;
      border: 1px solid rgba(231, 197, 106, 0.16);
      background: rgba(7, 4, 3, 0.45);
      color: rgba(243, 238, 230, 0.60);
      transition: all 0.15s ease;
    }
    .card-view-tab:first-child { border-radius: 8px 0 0 8px; }
    .card-view-tab:last-child { border-radius: 0 8px 8px 0; }
    .card-view-tab.active {
      background: rgba(231, 197, 106, 0.12);
      color: var(--gold2);
      border-color: rgba(231, 197, 106, 0.35);
    }

    /* ---------- Timeline Compare ---------- */
    .timeline-compare {
      border: 1.5px solid var(--gold1);
      border-radius: 14px;
      background: linear-gradient(160deg, rgba(30,20,10,0.95), rgba(45,30,15,0.92));
      overflow: hidden;
      font-size: 11px;
      color: #d4c8a0;
    }
    .timeline-compare-header {
      background: linear-gradient(135deg, rgba(180,150,80,0.2), rgba(120,90,40,0.15));
      padding: 8px 12px;
      font-weight: 700; font-size: 12px; color: var(--gold1);
      border-bottom: 1px solid rgba(180,150,80,0.25);
    }
    .timeline-compare-table { width: 100%; border-collapse: collapse; }
    .timeline-compare-table th,
    .timeline-compare-table td { padding: 5px 6px; text-align: center; border-bottom: 1px solid rgba(180,150,80,0.12); font-size: 10.5px; }
    .timeline-compare-table th { color: var(--gold1); font-weight: 600; font-size: 10px; background: rgba(180,150,80,0.08); }
    .timeline-compare-table th:first-child,
    .timeline-compare-table td:first-child { text-align: left; font-weight: 600; color: #c0a860; min-width: 48px; }
    .tc-cell-pos { background: rgba(34, 197, 94, 0.12); color: #4caf50; }
    .tc-cell-neu { background: rgba(255, 193, 7, 0.10); color: #ffc107; }
    .tc-cell-neg { background: rgba(239, 83, 80, 0.12); color: #ef5350; }
    .timeline-compare-btn {
      background: linear-gradient(135deg, rgba(34,197,94,0.25), rgba(34,197,94,0.15)) !important;
      color: #4caf50 !important; font-weight: 600; font-size: 11px; white-space: nowrap;
    }

    /* ---------- Solar Term Suggestions ---------- */
    .solar-term-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; margin-bottom: 4px; }
    .solar-term-btn {
      border-radius: 999px; border: 1px solid rgba(231,197,106,0.18);
      padding: 3px 8px; font-size: 10px; color: rgba(243,238,230,0.72);
      background: rgba(7,4,3,0.55); cursor: pointer; white-space: nowrap; transition: all 0.15s ease;
    }
    .solar-term-btn:hover { color: var(--gold3); border-color: rgba(231,197,106,0.40); background: rgba(231,197,106,0.08); }

    /* ---------- Export ---------- */
    .card-export-group { position: relative; display: inline-flex; }
    .card-export-btn { font-size: 11px; padding: 2px 8px; cursor: pointer; }
    .card-export-dropdown {
      position: absolute; top: 100%; right: 0; margin-top: 4px;
      background: rgba(22,11,7,0.95); border: 1px solid rgba(231,197,106,0.30);
      border-radius: 10px; padding: 4px 0; min-width: 170px; z-index: 20;
      display: none; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    }
    .card-export-dropdown.open { display: block; }
    .card-export-option {
      display: block; width: 100%; padding: 6px 12px; font-size: 11px;
      color: rgba(243,238,230,0.80); background: transparent; border: none; text-align: left; cursor: pointer;
    }
    .card-export-option:hover { background: rgba(231,197,106,0.10); color: var(--gold3); }

    /* ---------- Chat ---------- */
    .chat-log {
      flex: 1;
      min-height: 0;             /* flex 자식 스크롤 활성화 */
      border-radius: 22px;
      padding: 14px 14px;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;  /* iOS 관성 스크롤 */
      scroll-behavior: smooth;
      font-size: 13px;
      background:
        radial-gradient(900px 500px at 20% 0%, rgba(255, 241, 194, 0.045), transparent 60%),
        rgba(7, 4, 3, 0.55);
    }
    .empty-state {
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      color: rgba(243, 238, 230, 0.65);
      text-align: center;
      font-size: 13px;
    }
    .chat-message { margin-bottom: 10px; max-width: 100%; }
    .chat-meta {
      font-size: 11px;
      margin-bottom: 4px;
      color: rgba(243, 238, 230, 0.62);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .chat-meta span.role { font-weight: 650; color: rgba(243, 238, 230, 0.92); }
    .chat-meta span.tag {
      font-size: 10px;
      padding: 2px 6px;
      border-radius: 999px;
      border: 1px solid rgba(231, 197, 106, 0.18);
      background: rgba(22, 11, 7, 0.65);
      color: rgba(243, 238, 230, 0.70);
    }

    .chat-bubble {
      display: inline-block;
      padding: 10px 14px;
      border-radius: 18px;
      border: 1px solid rgba(231, 197, 106, 0.10);
      background: rgba(22, 11, 7, 0.72);
    }
    .chat-bubble.user {
      background: rgba(231, 197, 106, 0.07);
      border-color: rgba(231, 197, 106, 0.18);
    }
    .chat-bubble.assistant {
      background:
        radial-gradient(circle at top left, rgba(255, 241, 194, 0.06), rgba(22, 11, 7, 0.78));
      border-color: rgba(231, 197, 106, 0.12);
    }

    /* ---------- 기문판 팝업 + 배경 ---------- */
    .gimun-bg {
      position: absolute;
      top: 50%; left: 50%;
      transform: translate(-50%, -50%);
      width: 90vmin; height: 90vmin;
      max-width: 700px; max-height: 700px;
      opacity: 0;
      pointer-events: none;
      z-index: 0;
      transition: opacity 1.5s ease;
    }
    .gimun-bg.visible { opacity: 0.30; }
    .gimun-bg svg {
      position: absolute;
      top: 0; left: 0;
      width: 100%; height: 100%;
      transition: transform 0.8s ease;
    }

    .gimun-popup {
      position: fixed;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 900;
      background: rgba(7, 4, 3, 0.80);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.6s ease;
    }
    .gimun-popup.visible {
      opacity: 1;
      pointer-events: auto;
    }
    .gimun-popup-inner {
      position: relative;
      width: min(80vmin, 480px); height: min(80vmin, 480px);
    }
    .gimun-popup-inner svg {
      position: absolute;
      top: 0; left: 0;
      width: 100%; height: 100%;
      transition: transform 0.8s ease;
    }
    .gimun-popup-label {
      position: absolute;
      bottom: -32px;
      left: 50%;
      transform: translateX(-50%);
      font-size: 12px;
      color: rgba(243, 238, 230, 0.5);
      white-space: nowrap;
    }


    .gimun-view-btn {
      display: none;
      position: absolute;
      top: 8px; right: 8px;
      z-index: 5;
      padding: 4px 10px;
      border-radius: 999px;
      border: 1px solid rgba(231, 197, 106, 0.25);
      background: rgba(22, 11, 7, 0.8);
      color: rgba(243, 238, 230, 0.7);
      font-size: 11px;
      cursor: pointer;
      backdrop-filter: blur(4px);
      transition: all 0.2s;
    }
    .gimun-view-btn.visible { display: inline-flex; align-items: center; gap: 4px; }
    .gimun-view-btn:hover {
      border-color: rgba(231, 197, 106, 0.5);
      color: rgba(243, 238, 230, 0.95);
    }

    /* ---------- Footer / input ---------- */
    .chat-footer {
      margin-top: 18px;
      border-radius: 18px;
      padding: 12px 16px 12px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      max-width: 100%;
      align-self: stretch;
      background: rgba(22, 11, 7, 0.72);
      box-shadow: var(--shadow-soft);
    }

    .suggest-row { display: flex; flex-wrap: wrap; gap: 6px; }
    .suggest-btn {
      border-radius: 999px;
      border: 1px solid rgba(231, 197, 106, 0.16);
      padding: 4px 10px;
      font-size: 11px;
      color: rgba(243, 238, 230, 0.72);
      background: rgba(7, 4, 3, 0.55);
      cursor: pointer;
    }
    .suggest-btn:hover {
      color: rgba(255, 241, 194, 0.92);
      border-color: rgba(231, 197, 106, 0.28);
      background: rgba(22, 11, 7, 0.72);
    }

    .input-row { display: flex; gap: 10px; align-items: stretch; }

    .input-wrap {
      flex: 1;
      border-radius: 999px;
      border: 1px solid rgba(231, 197, 106, 0.18);
      background: rgba(7, 4, 3, 0.65);
      display: flex;
      align-items: center;
      padding: 10px 18px;
      box-shadow:
        inset 0 1px 0 rgba(255, 241, 194, 0.10),
        inset 0 -1px 0 rgba(122, 90, 30, 0.16);
    }
    .input-wrap:focus-within{
      border-color: rgba(231, 197, 106, 0.38);
      background: rgba(7, 4, 3, 0.72);
    }
    .input-wrap input {
      width: 100%;
      background: transparent;
      border: none;
      outline: none;
      color: var(--text);
      font-size: 14px;
      line-height: 1.5;
    }

    /* Gold button (no outer glow, only inner metallic highlight) */
    .send-btn {
      border-radius: 999px;
      border: 1px solid rgba(231, 197, 106, 0.40);
      background: linear-gradient(135deg, var(--gold0) 0%, var(--gold2) 26%, var(--gold3) 44%, var(--gold4) 60%, var(--gold1) 100%);
      color: #1b110c;
      font-weight: 700;
      font-size: 13px;
      padding: 8px 20px;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      cursor: pointer;
      box-shadow:
        inset 0 1px 0 rgba(255, 241, 194, 0.20),
        inset 0 -1px 0 rgba(122, 90, 30, 0.22);
    }
    .send-btn:hover{
      border-color: rgba(255, 241, 194, 0.55);
      filter: brightness(1.03);
    }
    .send-btn:active{
      box-shadow:
        inset 0 2px 7px rgba(0,0,0,0.35),
        inset 0 1px 0 rgba(255, 241, 194, 0.14);
      transform: translateY(1px);
    }
    .send-btn span:last-child { font-size: 14px; transform: translateY(1px); }

    .status-line {
      font-size: 11px;
      color: rgba(243, 238, 230, 0.65);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .status-right { display: flex; align-items: center; gap: 6px; }

    /* ---------- Thinking overlay ---------- */
    .thinking-overlay {
      position: absolute;
      top: 10px;
      left: 50%;
      transform: translateX(-50%);
      display: none;
      align-items: center;
      justify-content: center;
      padding: 8px 12px;
      background: rgba(7, 4, 3, 0.55);
      border: 1px solid rgba(225, 180, 90, 0.25);
      border-radius: 999px;
      box-shadow: 0 8px 24px rgba(0,0,0,0.35);
      backdrop-filter: blur(6px);
      z-index: 50;
      pointer-events: none;
      max-width: 72%;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .thinking-core { display: flex; flex-direction: row; align-items: center; gap: 10px; }
    .thinking-spinner {
      width: 26px; height: 26px; border-radius: 999px;
      background-image: url("/static/images/loading_spinner.png");
      background-size: contain;
      background-repeat: no-repeat;
      background-position: center;
      animation: spin 1.2s linear infinite;
      /* no outer glow: only inner highlight + subtle depth */
      border: 1px solid rgba(231, 197, 106, 0.18);
      box-shadow:
        inset 0 1px 0 rgba(255, 241, 194, 0.12),
        inset 0 -1px 0 rgba(122, 90, 30, 0.18),
        0 16px 40px rgba(0,0,0,0.55);
    }
    .thinking-text { font-size: 11px; color: rgba(243, 238, 230, 0.70); }
    @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

    /* ---------- 선택영역 질의 (Selected-text Query) ---------- */
    .selection-popup {
      position: fixed;
      display: none;
      align-items: center;
      gap: 6px;
      padding: 6px 12px;
      background: linear-gradient(135deg, rgba(22, 11, 7, 0.95), rgba(7, 4, 3, 0.90));
      border: 1px solid rgba(231, 197, 106, 0.35);
      border-radius: 12px;
      box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 241, 194, 0.10);
      backdrop-filter: blur(8px);
      z-index: 100;
      cursor: pointer;
      transition: all 0.15s ease;
      font-size: 12px;
      color: var(--gold3);
    }
    .selection-popup:hover {
      border-color: rgba(231, 197, 106, 0.55);
      background: linear-gradient(135deg, rgba(32, 16, 10, 0.95), rgba(12, 6, 4, 0.90));
      transform: translateY(-1px);
      box-shadow: 
        0 12px 32px rgba(0, 0, 0, 0.65),
        inset 0 1px 0 rgba(255, 241, 194, 0.14);
    }
    .selection-popup .icon { font-size: 14px; }
    .selection-popup .text { font-weight: 500; }

    .selected-context-bar {
      display: none;
      align-items: flex-start;
      gap: 8px;
      padding: 8px 12px;
      margin-bottom: 8px;
      background: rgba(122, 90, 30, 0.15);
      border: 1px solid rgba(231, 197, 106, 0.25);
      border-radius: 10px;
      font-size: 12px;
      color: var(--text-soft);
    }
    .selected-context-bar.active { display: flex; }
    .selected-context-bar .context-label {
      font-weight: 600;
      color: var(--gold2);
      white-space: nowrap;
      padding-top: 2px;
    }
    .selected-context-bar .context-text {
      flex: 1;
      max-height: 60px;
      overflow-y: auto;
      line-height: 1.4;
      color: var(--text);
    }
    .selected-context-bar .context-text::before { content: '"'; color: var(--gold1); }
    .selected-context-bar .context-text::after { content: '"'; color: var(--gold1); }
    .selected-context-bar .context-close {
      background: transparent;
      border: none;
      color: var(--text-soft);
      cursor: pointer;
      padding: 2px 6px;
      font-size: 14px;
      opacity: 0.7;
      transition: opacity 0.15s ease;
    }
    .selected-context-bar .context-close:hover {
      opacity: 1;
      color: var(--danger);
    }

    .chat-bubble::selection {
      background: rgba(231, 197, 106, 0.35);
      color: inherit;
    }
    .chat-bubble *::selection {
      background: rgba(231, 197, 106, 0.35);
      color: inherit;
    }

    /* ---------- Modal ---------- */
    .qmd-modal-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.72);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 40;
      backdrop-filter: blur(6px);
    }
    .qmd-modal {
      width: 100%;
      max-width: 380px;
      border-radius: 18px;
      padding: 14px 16px;
      font-size: 13px;
      background:
        radial-gradient(700px 420px at 20% 0%, rgba(255, 241, 194, 0.05), transparent 60%),
        rgba(22, 11, 7, 0.86);
      box-shadow: var(--shadow);
    }
    .qmd-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; color: rgba(243, 238, 230, 0.95); }
    .qmd-desc { font-size: 12px; color: rgba(243, 238, 230, 0.70); margin-bottom: 8px; }
    .qmd-desc.small { font-size: 11px; margin-top: 2px; }
    .qmd-subtitle { font-size: 12px; font-weight: 600; margin: 6px 0 4px; color: rgba(243, 238, 230, 0.92); }

    .qmd-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
    .qmd-input {
      border-radius: 10px;
      border: 1px solid rgba(231, 197, 106, 0.18);
      background: rgba(7, 4, 3, 0.55);
      color: var(--text);
      padding: 6px 8px;
      font-size: 12px;
      width: 100%;
      box-shadow:
        inset 0 1px 0 rgba(255, 241, 194, 0.08),
        inset 0 -1px 0 rgba(122, 90, 30, 0.14);
    }
    .qmd-input:focus{
      outline: none;
      border-color: rgba(231, 197, 106, 0.40);
      background: rgba(7, 4, 3, 0.66);
    }
    .qmd-input::placeholder { color: rgba(201, 191, 179, 0.55); font-size: 11px; }
    .qmd-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 12px; }
    .qmd-label { color: rgba(243, 238, 230, 0.65); min-width: 36px; }
    .qmd-radio-group { display: flex; gap: 8px; flex-wrap: wrap; }
    .qmd-radio {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 4px 8px;
      border-radius: 999px;
      border: 1px solid rgba(231, 197, 106, 0.18);
      background: rgba(7, 4, 3, 0.55);
      cursor: pointer;
      font-size: 12px;
      color: rgba(243, 238, 230, 0.70);
    }
    .qmd-radio input { accent-color: var(--accent); }

    .qmd-footer { display: flex; justify-content: flex-end; gap: 6px; font-size: 12px; margin-top: 4px; }
    .btn-ghost {
      border-radius: 999px;
      border: 1px solid rgba(231, 197, 106, 0.18);
      background: rgba(7, 4, 3, 0.55);
      color: rgba(243, 238, 230, 0.70);
      padding: 5px 10px;
      cursor: pointer;
      box-shadow:
        inset 0 1px 0 rgba(255, 241, 194, 0.08),
        inset 0 -1px 0 rgba(122, 90, 30, 0.14);
    }
    .btn-ghost:hover{
      border-color: rgba(231, 197, 106, 0.28);
      color: rgba(255, 241, 194, 0.92);
      background: rgba(22, 11, 7, 0.70);
    }
    .btn-primary {
      border-radius: 999px;
      border: 1px solid rgba(231, 197, 106, 0.40);
      background: linear-gradient(135deg, var(--gold0) 0%, var(--gold2) 26%, var(--gold3) 44%, var(--gold4) 60%, var(--gold1) 100%);
      color: #1b110c;
      font-weight: 700;
      padding: 5px 12px;
      cursor: pointer;
      box-shadow:
        inset 0 1px 0 rgba(255, 241, 194, 0.20),
        inset 0 -1px 0 rgba(122, 90, 30, 0.22);
    }
    .btn-primary[disabled] { opacity: .5; cursor: default; }
    .error-text { color: var(--danger); }

    /* ---------- Sidebar collapse ---------- */
    body.sidebar-hidden .side-column {
      flex-basis: 52px;
      max-width: 52px;
      padding: 10px 8px;
      box-shadow: var(--shadow-soft);
    }
    body.sidebar-hidden .sidebar-content { display: none; }
    body.sidebar-hidden .sidebar-icon-btn .label { display: none; }
    body.sidebar-hidden .chat-column { flex: 1 1 calc(100% - 52px); }
    body.sidebar-hidden .app-main { gap: 8px; }

    /* ---------- User panel ---------- */
    .sidebar-user-panel {
      margin-top: auto;
      padding-top: 10px;
      border-top: 1px solid rgba(231, 197, 106, 0.10);
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .sidebar-user-avatar-btn {
      width: 36px; height: 36px; border-radius: 999px;
      border: 1px solid rgba(231, 197, 106, 0.18);
      background: rgba(7, 4, 3, 0.60);
      color: rgba(243, 238, 230, 0.65);
      display: flex; align-items: center; justify-content: center;
      font-size: 18px;
      cursor: pointer;
      padding: 0;
      box-shadow:
        inset 0 1px 0 rgba(255, 241, 194, 0.08),
        inset 0 -1px 0 rgba(122, 90, 30, 0.14);
    }
    .sidebar-user-avatar-btn:hover { border-color: rgba(231, 197, 106, 0.34); color: rgba(255, 241, 194, 0.92); }
    .sidebar-user-avatar-icon { pointer-events: none; }

    .sidebar-user-meta { display: flex; flex-direction: column; gap: 2px; }
    .sidebar-user-name { font-size: 12px; color: rgba(243, 238, 230, 0.92); font-weight: 600; }
    .sidebar-user-grade { font-size: 10px; color: rgba(243, 238, 230, 0.62); }

    .sidebar-user-auth-actions { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
    .sidebar-user-auth-link {
      border-radius: 999px;
      border: 1px solid rgba(231, 197, 106, 0.16);
      background: rgba(7, 4, 3, 0.55);
      color: rgba(243, 238, 230, 0.68);
      font-size: 11px;
      padding: 4px 8px;
      cursor: pointer;
    }
    .sidebar-user-auth-link.secondary { opacity: 0.85; }
    .sidebar-user-auth-link:hover { border-color: rgba(231, 197, 106, 0.28); color: rgba(255, 241, 194, 0.92); }

    .sidebar-logout-btn {
      margin-top: 4px;
      border-radius: 999px;
      border: 1px solid rgba(249, 115, 115, 0.55);
      background: rgba(7, 4, 3, 0.55);
      color: rgba(254, 202, 202, 0.92);
      font-size: 11px;
      padding: 4px 8px;
      cursor: pointer;
    }
    .sidebar-logout-btn:hover { background: rgba(127, 29, 29, 0.45); border-color: rgba(249, 115, 115, 0.85); }

    .sidebar-upgrade-btn {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      margin-top: 6px;
      padding: 5px 12px;
      border-radius: 999px;
      border: 1px solid rgba(124, 58, 237, 0.7);
      background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(79, 70, 229, 0.2));
      color: #c4b5fd;
      font-size: 11px;
      font-weight: 600;
      text-decoration: none;
      cursor: pointer;
      transition: all 0.2s;
    }
    .sidebar-upgrade-btn:hover {
      background: linear-gradient(135deg, rgba(124, 58, 237, 0.45), rgba(79, 70, 229, 0.35));
      border-color: rgba(167, 139, 250, 0.9);
      color: #e0d5ff;
      transform: translateY(-1px);
    }

    /* ═══════════════════════════════════════════════
       모바일 반응형
       ═══════════════════════════════════════════════ */

    /* ── 햄버거 메뉴 버튼 (기본 숨김) ── */
    .mobile-hamburger {
      display: none;
      width: 36px; height: 36px; border-radius: 10px;
      border: 1px solid rgba(231,197,106,0.22);
      background: rgba(22,11,7,0.70);
      color: var(--gold2); font-size: 18px;
      align-items: center; justify-content: center;
      cursor: pointer; padding: 0;
    }
    /* ── 햄버거 드롭다운 ── */
    .mobile-dropdown {
      display: none; position: absolute;
      top: 100%; right: 0; min-width: 160px;
      background: linear-gradient(165deg, rgba(22,14,8,0.98), rgba(12,8,4,0.97));
      border: 1.5px solid var(--gold1); border-radius: 14px;
      padding: 8px; z-index: 9100;
      flex-direction: column; gap: 4px;
      box-shadow: 0 12px 40px rgba(0,0,0,0.6);
      animation: dropdown-in 0.18s ease;
    }
    @keyframes dropdown-in { from { opacity:0; transform: translateY(-6px); } to { opacity:1; transform: translateY(0); } }
    .mobile-dropdown.open { display: flex; }
    .mobile-dropdown .pill-btn { width: 100%; justify-content: flex-start; font-size: 12px; padding: 8px 12px; }

    /* ── 모바일 사이드바 드로어 ── */
    .mobile-sidebar-overlay {
      display: none; position: fixed; inset: 0; z-index: 9000;
      background: rgba(0,0,0,0.55);
      animation: streak-overlay-in 0.2s ease;
    }
    body.mobile-sidebar-open .mobile-sidebar-overlay { display: block; }

    /* ── 모바일 사이드바 토글 버튼 (헤더) ── */
    .mobile-sidebar-toggle {
      display: none;
      width: 36px; height: 36px; border-radius: 10px;
      border: 1px solid rgba(231,197,106,0.22);
      background: rgba(22,11,7,0.70);
      color: var(--gold2); font-size: 16px;
      align-items: center; justify-content: center;
      cursor: pointer; padding: 0;
    }

    /* ── 768px 이하: 태블릿/대형 폰 ── */
    @media (max-width: 768px) {
      .app-shell { margin: 0; }
      .app-header { padding: 10px 12px; position: relative; }

      /* 헤더: 핵심 버튼만 표시 + 햄버거 */
      .header-actions .nav-link { display: none; }
      .mobile-hamburger { display: inline-flex; }
      .mobile-sidebar-toggle { display: inline-flex; }

      /* 레이아웃: 세로 스택 */
      .app-main {
        flex-direction: column;
        padding: 8px 8px 12px;
        gap: 8px;
      }

      /* 카드 컬럼 숨김 */
      .card-column { display: none !important; }

      /* 사이드바 → 슬라이드 드로어 */
      .side-column {
        position: fixed;
        top: 0; right: -100%;
        width: 85vw; max-width: 320px;
        height: 100vh; height: 100dvh;
        max-height: 100vh; max-height: 100dvh;
        z-index: 9001;
        border-radius: 20px 0 0 20px;
        padding: 16px 14px;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
      }
      body.mobile-sidebar-open .side-column {
        right: 0;
      }

      /* 사이드바 내부 토글 버튼 숨김 (모바일에서는 헤더 버튼 사용) */
      .sidebar-toolbar { display: none; }

      /* 채팅 영역 조정 */
      .chat-log { border-radius: 16px; padding: 10px; }
      .chat-footer {
        margin-top: 10px; border-radius: 14px;
        padding: 8px 10px;
      }
      .suggest-btn { font-size: 10px; padding: 3px 8px; }
      .input-wrap { padding: 8px 12px; }
      .input-wrap input { font-size: 13px; }
      .send-btn { padding: 8px 14px; font-size: 12px; min-height: 44px; }

      /* 스트릭 팝업 모바일 전체 폭 */
      .streak-popup {
        left: 12px; right: 12px; bottom: 12px;
        width: auto; max-width: none;
      }
      /* 설정 팝업 모바일 */
      .settings-popup {
        left: 12px; right: 12px; bottom: 12px;
        width: auto; max-width: none;
      }

      /* QMD 모달 폭 확장 */
      .qmd-modal { max-width: calc(100vw - 24px); margin: 0 12px; }
    }

    /* ── 480px 이하: 소형 폰 ── */
    @media (max-width: 480px) {
      .brand-sub { display: none; }
      .brand-title { font-size: 13px; }

      .app-main { padding: 4px 4px 8px; gap: 6px; }

      .chat-log { padding: 8px 6px; font-size: 12px; }
      .chat-bubble { padding: 8px 10px; font-size: 12px; }
      .chat-footer { padding: 6px 8px; gap: 6px; }
      .suggest-row { gap: 4px; }
      .suggest-btn { font-size: 9px; padding: 2px 6px; }
      .input-row { gap: 6px; }
      .input-wrap { padding: 7px 10px; }
      .input-wrap input { font-size: 12px; }
      .send-btn { padding: 7px 12px; font-size: 11px; }

      /* QMD 모달: 2열 그리드 */
      .qmd-grid-4 { grid-template-columns: repeat(2, 1fr); }
      .qmd-modal { padding: 12px; }
      .qmd-title { font-size: 13px; }
      .qmd-desc { font-size: 11px; }

      /* 사이드바 드로어 약간 더 넓게 */
      .side-column { width: 90vw; }

      /* 스트릭 팝업 */
      .streak-popup { left: 8px; right: 8px; bottom: 8px; padding: 14px; }
      .settings-popup { left: 8px; right: 8px; bottom: 8px; }
    }

/* =============================================
   Additional styles (export/card components)
   ============================================= */

:root{color-scheme:dark;--bg0:#070403;--bg1:#140a06;--gold0:#7a5a1e;--gold1:#b88a2c;--gold2:#e7c56a;--gold3:#fff1c2;--text:#f3eee6;--text-soft:#c9bfb3;--border:rgba(231,197,106,0.22)}
*{box-sizing:border-box;margin:0;padding:0}
body{background:linear-gradient(160deg,#0e0804,#1a0f08);color:var(--text);font-family:system-ui,-apple-system,sans-serif;padding:24px;min-height:100vh}
.export-wrapper{max-width:560px;margin:0 auto}
.export-header{text-align:center;margin-bottom:18px;padding-bottom:12px;border-bottom:1px solid rgba(231,197,106,0.15)}
.export-header h1{font-size:16px;font-weight:700;color:var(--gold2);margin-bottom:4px}
.export-header p{font-size:11px;color:var(--text-soft)}
.compat-card{border:1.5px solid var(--gold1);border-radius:14px;background:linear-gradient(160deg,rgba(30,20,10,0.95),rgba(45,30,15,0.92));overflow:hidden;font-size:12px;line-height:1.55;color:#d4c8a0}
.compat-card-header{background:linear-gradient(135deg,rgba(180,150,80,0.2),rgba(120,90,40,0.15));padding:8px 12px;font-weight:700;font-size:13px;color:var(--gold1);border-bottom:1px solid rgba(180,150,80,0.25)}
.compat-card-versus{display:flex;flex-direction:column;padding:10px;gap:0}
.compat-person{flex:none}
.compat-person-name{font-weight:700;font-size:13px;color:var(--gold1);margin-bottom:4px}
.compat-person-palace{font-size:12px;color:#a89870;margin-bottom:2px}
.compat-person-detail{font-size:11.5px;color:#c0b080;margin-bottom:1px}
.compat-divider{display:flex;align-items:center;justify-content:center;height:24px;font-size:11px;color:#887850;border-top:1px solid rgba(180,150,80,0.15);border-bottom:1px solid rgba(180,150,80,0.15);margin:4px 0}
.compat-axes{border-top:1px solid rgba(180,150,80,0.2);padding:8px 10px}
.compat-axis-row{display:flex;align-items:center;gap:5px;padding:3px 0;font-size:11px}
.compat-axis-name{min-width:54px;font-weight:600;color:#a89870;flex-shrink:0;font-size:11px}
.compat-axis-indicator{font-size:13px;flex-shrink:0}
.compat-axis-detail{color:#c0b080;flex:1;min-width:0;font-size:10.5px}
.individual-card{border:1.5px solid var(--gold1);border-radius:14px;background:linear-gradient(160deg,rgba(30,20,10,0.95),rgba(45,30,15,0.92));overflow:hidden;font-size:12px;line-height:1.55;color:#d4c8a0}
.individual-card-header{background:linear-gradient(135deg,rgba(180,150,80,0.2),rgba(120,90,40,0.15));padding:8px 12px;font-weight:700;font-size:13px;color:var(--gold1);border-bottom:1px solid rgba(180,150,80,0.25)}
.individual-card-body{padding:10px 12px}
.individual-card-row{display:flex;gap:6px;padding:2px 0}
.individual-card-label{color:#a89870;min-width:52px;flex-shrink:0}
.individual-card-value{color:#d4c8a0;font-weight:500}
.individual-card-divider{border-top:1px solid rgba(180,150,80,0.15);margin:6px 0}
.individual-card-geok{padding:6px 12px 10px;border-top:1px solid rgba(180,150,80,0.2);font-size:11.5px}
.nine-grid{display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);gap:3px;width:100%;font-size:10px;line-height:1.35}
.nine-grid-cell{border:1px solid rgba(231,197,106,0.18);border-radius:8px;background:rgba(7,4,3,0.55);padding:4px 5px;display:flex;flex-direction:column;gap:1px;overflow:hidden;min-height:56px}
.nine-grid-cell.yongshin{border-color:var(--gold2);border-width:2px;background:rgba(231,197,106,0.08);box-shadow:inset 0 0 8px rgba(231,197,106,0.15)}
.nine-grid-cell-palace{font-weight:700;color:var(--gold1);font-size:10.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.nine-grid-cell-detail{color:#b8a878;font-size:9.5px}
.nine-grid-cell-element{color:#a89870;font-size:9px}
.nine-grid-title{margin-bottom:6px;font-weight:600;color:var(--gold1);font-size:12px}
.timeline-compare{border:1.5px solid var(--gold1);border-radius:14px;background:linear-gradient(160deg,rgba(30,20,10,0.95),rgba(45,30,15,0.92));overflow:hidden;font-size:11px;color:#d4c8a0}
.timeline-compare-header{background:linear-gradient(135deg,rgba(180,150,80,0.2),rgba(120,90,40,0.15));padding:8px 12px;font-weight:700;font-size:12px;color:var(--gold1);border-bottom:1px solid rgba(180,150,80,0.25)}
.timeline-compare-table{width:100%;border-collapse:collapse}
.timeline-compare-table th,.timeline-compare-table td{padding:5px 6px;text-align:center;border-bottom:1px solid rgba(180,150,80,0.12);font-size:10.5px}
.timeline-compare-table th{color:var(--gold1);font-weight:600;font-size:10px;background:rgba(180,150,80,0.08)}
.timeline-compare-table th:first-child,.timeline-compare-table td:first-child{text-align:left;font-weight:600;color:#c0a860;min-width:48px}
.tc-cell-pos{background:rgba(34,197,94,0.12);color:#4caf50}
.tc-cell-neu{background:rgba(255,193,7,0.10);color:#ffc107}
.tc-cell-neg{background:rgba(239,83,80,0.12);color:#ef5350}
.ai-response-section{margin-top:16px;border:1px solid rgba(231,197,106,0.15);border-radius:14px;overflow:hidden;background:rgba(20,10,6,0.85)}
.ai-response-label{padding:8px 12px;font-weight:700;font-size:12px;color:var(--gold1);background:rgba(180,150,80,0.08);border-bottom:1px solid rgba(180,150,80,0.15)}
.ai-response-body{padding:12px 14px;font-size:12.5px;line-height:1.65;color:#d4c8a0;white-space:pre-wrap;word-break:break-word}
.ai-response-body p{margin:0 0 8px}
.ai-response-body strong{color:var(--gold2)}
.ai-response-body ul,.ai-response-body ol{margin:4px 0 8px 18px}
.export-footer{margin-top:18px;padding-top:10px;border-top:1px solid rgba(231,197,106,0.10);text-align:center;font-size:10px;color:rgba(201,191,179,0.45)}
