    :root {
      --space-1: 4px;
      --space-2: 8px;
      --space-3: 12px;
      --space-4: 16px;
      --space-6: 24px;
      --text-xs: 0.75rem;
      --text-sm: 0.875rem;
      --text-base: 1rem;
      --text-lg: 1.125rem;
      --text-xl: 1.25rem;

      /* ==== Card Theme Variables (default: Glass) ==== */
      --card-bg: rgba(255, 255, 255, 0.55);
      --card-border: rgba(255, 255, 255, 0.45);
      --card-blur: 20px;
      --card-shadow: 0 8px 32px rgba(31, 38, 135, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.4);
      --card-hover-border: rgba(255, 255, 255, 0.65);
      --card-hover-shadow: 0 8px 32px rgba(31, 38, 135, 0.16);
      --chip-bg: rgba(255, 255, 255, 0.28);
      --chip-border: rgba(255, 255, 255, 0.5);
      --accent: #6366F1;
      --accent-soft: rgba(99, 102, 241, 0.14);
      --bg-gradient: linear-gradient(-45deg, #FFFACD, #FFE4E1, #F0F8FF, #E6E6FA, #F0FFF0);
    }

    .dark:root, :root.dark {
      --card-bg: rgba(18, 18, 42, 0.75);
      --card-border: rgba(0, 245, 255, 0.15);
      --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 245, 255, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.05);
      --card-hover-border: rgba(0, 245, 255, 0.3);
      --card-hover-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 245, 255, 0.1);
      --chip-bg: rgba(26, 26, 62, 0.55);
      --chip-border: rgba(0, 245, 255, 0.2);
      --accent: #00F5FF;
      --accent-soft: rgba(0, 245, 255, 0.12);
      --bg-gradient: linear-gradient(-45deg, #050510, #0a0a1a, #0f0f2d, #0a1628, #050510);
    }

    /* ==== Theme: ?? Washi ==== */
    .theme-washi:root {
      --card-bg: rgba(250, 246, 237, 0.82);
      --card-border: rgba(180, 160, 130, 0.35);
      --card-blur: 8px;
      --card-shadow: 0 4px 16px rgba(120, 100, 70, 0.12);
      --card-hover-border: rgba(180, 160, 130, 0.6);
      --card-hover-shadow: 0 6px 20px rgba(120, 100, 70, 0.18);
      --chip-bg: rgba(244, 238, 224, 0.6);
      --chip-border: rgba(180, 160, 130, 0.4);
      --accent: #A0642D;
      --accent-soft: rgba(160, 100, 45, 0.12);
      --bg-gradient: linear-gradient(-45deg, #F5EFE0, #EFE7D3, #F8F3E7, #EDE4CF, #F5EFE0);
    }
    .theme-washi.dark:root {
      --card-bg: rgba(42, 36, 26, 0.85);
      --card-border: rgba(180, 160, 130, 0.25);
      --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
      --card-hover-border: rgba(200, 175, 140, 0.45);
      --card-hover-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
      --chip-bg: rgba(56, 48, 36, 0.6);
      --chip-border: rgba(180, 160, 130, 0.3);
      --accent: #D9A05B;
      --accent-soft: rgba(217, 160, 91, 0.14);
      --bg-gradient: linear-gradient(-45deg, #1a160f, #221c12, #2a2418, #1e1a10, #1a160f);
    }

    /* ==== Theme: ??? Neon ==== */
    .theme-neon:root {
      --card-bg: rgba(16, 14, 40, 0.72);
      --card-border: rgba(0, 245, 255, 0.3);
      --card-blur: 16px;
      --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 0 24px rgba(0, 245, 255, 0.1);
      --card-hover-border: rgba(255, 0, 200, 0.45);
      --card-hover-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 0 32px rgba(255, 0, 200, 0.18);
      --chip-bg: rgba(30, 26, 66, 0.6);
      --chip-border: rgba(0, 245, 255, 0.35);
      --accent: #00F5FF;
      --accent-soft: rgba(0, 245, 255, 0.14);
      --bg-gradient: linear-gradient(-45deg, #08061c, #120b2e, #1a0f3c, #0c1230, #08061c);
    }
    .theme-neon.dark:root {
      --card-bg: rgba(12, 10, 32, 0.8);
      --card-border: rgba(0, 245, 255, 0.35);
      --accent: #FF00C8;
      --accent-soft: rgba(255, 0, 200, 0.14);
    }

    /* ==== Theme: ?? Sakura ==== */
    .theme-sakura:root {
      --card-bg: rgba(255, 245, 248, 0.75);
      --card-border: rgba(255, 160, 190, 0.4);
      --card-blur: 14px;
      --card-shadow: 0 6px 24px rgba(240, 120, 160, 0.14);
      --card-hover-border: rgba(255, 130, 170, 0.6);
      --card-hover-shadow: 0 8px 28px rgba(240, 120, 160, 0.22);
      --chip-bg: rgba(255, 232, 240, 0.55);
      --chip-border: rgba(255, 170, 200, 0.5);
      --accent: #E85D8A;
      --accent-soft: rgba(232, 93, 138, 0.13);
      --bg-gradient: linear-gradient(-45deg, #FFF0F5, #FFE4EC, #FFF6FA, #FDE8F0, #FFF0F5);
    }
    .theme-sakura.dark:root {
      --card-bg: rgba(44, 24, 34, 0.82);
      --card-border: rgba(255, 140, 180, 0.28);
      --card-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
      --card-hover-border: rgba(255, 150, 190, 0.5);
      --card-hover-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
      --chip-bg: rgba(58, 32, 44, 0.6);
      --chip-border: rgba(255, 150, 190, 0.3);
      --accent: #FF8FB5;
      --accent-soft: rgba(255, 143, 181, 0.14);
      --bg-gradient: linear-gradient(-45deg, #1c0f16, #26141e, #2e1824, #22101a, #1c0f16);
    }

    /* ==== Theme: ?? Sumi (high contrast, no blur) ==== */
    .theme-sumi:root {
      --card-bg: rgba(255, 255, 255, 0.96);
      --card-border: rgba(30, 30, 30, 0.65);
      --card-blur: 0px;
      --card-shadow: 3px 3px 0 rgba(30, 30, 30, 0.85);
      --card-hover-border: rgba(30, 30, 30, 0.95);
      --card-hover-shadow: 4px 4px 0 rgba(30, 30, 30, 0.95);
      --chip-bg: rgba(245, 245, 245, 0.95);
      --chip-border: rgba(30, 30, 30, 0.55);
      --accent: #1E1E1E;
      --accent-soft: rgba(30, 30, 30, 0.08);
      --bg-gradient: linear-gradient(-45deg, #F7F7F5, #EFEFEB, #F7F7F5, #ECECE8, #F7F7F5);
    }
    .theme-sumi.dark:root {
      --card-bg: rgba(20, 20, 20, 0.96);
      --card-border: rgba(235, 235, 235, 0.55);
      --card-shadow: 3px 3px 0 rgba(235, 235, 235, 0.5);
      --card-hover-border: rgba(255, 255, 255, 0.85);
      --card-hover-shadow: 4px 4px 0 rgba(255, 255, 255, 0.6);
      --chip-bg: rgba(35, 35, 35, 0.95);
      --chip-border: rgba(235, 235, 235, 0.45);
      --accent: #EDEDED;
      --accent-soft: rgba(237, 237, 237, 0.1);
      --bg-gradient: linear-gradient(-45deg, #101010, #181818, #101010, #1c1c1c, #101010);
    }

    /* ==== Theme: ?? Matcha ==== */
    .theme-matcha:root {
      --card-bg: rgba(246, 250, 240, 0.78);
      --card-border: rgba(140, 170, 110, 0.4);
      --card-blur: 12px;
      --card-shadow: 0 6px 22px rgba(90, 130, 60, 0.12);
      --card-hover-border: rgba(120, 160, 90, 0.6);
      --card-hover-shadow: 0 8px 26px rgba(90, 130, 60, 0.18);
      --chip-bg: rgba(235, 244, 224, 0.55);
      --chip-border: rgba(150, 180, 120, 0.45);
      --accent: #5E8C3A;
      --accent-soft: rgba(94, 140, 58, 0.12);
      --bg-gradient: linear-gradient(-45deg, #F2F7EA, #E9F1DD, #F5FAEE, #E4EDD4, #F2F7EA);
    }
    .theme-matcha.dark:root {
      --card-bg: rgba(24, 34, 20, 0.85);
      --card-border: rgba(140, 180, 110, 0.28);
      --card-shadow: 0 6px 22px rgba(0, 0, 0, 0.5);
      --card-hover-border: rgba(160, 200, 120, 0.5);
      --card-hover-shadow: 0 8px 26px rgba(0, 0, 0, 0.6);
      --chip-bg: rgba(34, 46, 28, 0.6);
      --chip-border: rgba(150, 190, 120, 0.3);
      --accent: #9CCB6B;
      --accent-soft: rgba(156, 203, 107, 0.14);
      --bg-gradient: linear-gradient(-45deg, #0e160a, #142010, #1a2a14, #10190c, #0e160a);
    }

    * {
      box-sizing: border-box;
    }

    :root {
      --safe-top: env(safe-area-inset-top, 0px);
      --safe-right: env(safe-area-inset-right, 0px);
      --safe-bottom: env(safe-area-inset-bottom, 0px);
      --safe-left: env(safe-area-inset-left, 0px);
      /* ????????????? = ?? + Home Indicator */
      --mobile-nav-content: 64px;
      --mobile-nav-height: calc(var(--mobile-nav-content) + var(--safe-bottom));
    }

    html {
      height: 100%;
      height: 100dvh;
      width: 100%;
      overflow-x: hidden;
    }

    body {
      font-family: 'LXGW WenKai Mono TC', monospace;
      overflow-x: hidden;
      min-height: 100%;
      min-height: 100dvh;
      width: 100%;
    }

    /* PWA / Add-to-Home-Screen???? App ?????????? notch?Home ????? */
    @media (display-mode: standalone), (display-mode: fullscreen) {
      html, body {
        width: 100%;
        max-width: 100%;
        min-height: 100%;
        min-height: 100dvh;
        overflow-x: hidden;
      }
    }

    .font-jp {
      font-family: 'Noto Serif JP', serif;
    }

    /* Mesh Gradient Background */
    .mesh-gradient {
      background: var(--bg-gradient);
      background-size: 400% 400%;
      animation: gradient 15s ease infinite;
    }

    @keyframes gradient {
      0% { background-position: 0% 50%; }
      50% { background-position: 100% 50%; }
      100% { background-position: 0% 50%; }
    }

    /* Dark Mode Futuristic Neon Effects */
    .dark body {
      font-family: 'LXGW WenKai Mono TC', monospace;
    }

    .dark .font-jp {
      font-family: 'Noto Serif JP', serif;
    }

    .dark h1, .dark h2, .dark h3 {
      font-family: 'Noto Serif JP', serif;
      letter-spacing: 0.05em;
    }

    .dark .nav-item span, .dark .lib-tab {
      font-family: 'LXGW WenKai Mono TC', monospace;
      font-weight: 500;
      color: #d1d5db;
    }

    .dark .nav-item.active span {
      color: #00F5FF;
    }

    .dark aside p, .dark aside span {
      color: #9ca3af;
    }

    /* Glass Card ? driven by card theme variables */
    .glass-card {
      background: var(--card-bg);
      backdrop-filter: blur(var(--card-blur));
      -webkit-backdrop-filter: blur(var(--card-blur));
      border: 1px solid var(--card-border);
      box-shadow: var(--card-shadow);
    }

    .glass-card:hover {
      border-color: var(--card-hover-border);
      box-shadow: var(--card-hover-shadow);
    }

    /* Glass Chip */
    .glass-chip {
      background: var(--chip-bg);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      border: 1px solid var(--chip-border);
      transition: all 0.3s ease;
    }

    .glass-chip:hover {
      transform: scale(1.05);
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }

    /* Free-text input: no hover zoom (interferes with typing) */
    .life-freetext.glass-chip:hover,
    #life-freetext.glass-chip:hover {
      transform: none;
      box-shadow: none;
    }

    /* Popup Modal Card - Higher opacity for readability */
    .popup-card {
      background: rgba(255, 255, 255, 0.94) !important;
      border: 1px solid rgba(255, 255, 255, 0.6);
    }
    .dark .popup-card {
      background: rgba(18, 18, 42, 0.96) !important;
      border: 1px solid rgba(0, 245, 255, 0.2);
    }

    .dark .glass-chip {
      color: #e0e0ff;
    }

    .dark .glass-chip:hover {
      background: var(--accent-soft);
      border-color: var(--card-hover-border);
      box-shadow: 0 0 15px var(--accent-soft);
    }

    /* Card theme selector swatch */
    .card-theme-swatch {
      width: 16px;
      height: 16px;
      border-radius: 5px;
      border: 1px solid rgba(0, 0, 0, 0.15);
      flex-shrink: 0;
      display: inline-block;
    }

    /* Neon theme forces light text even in light mode (dark card bg) */
    .theme-neon body { color: #E5E7EB; }
    .theme-neon .glass-card { color: #E5E7EB; }
    .theme-neon .text-gray-800, .theme-neon .text-gray-700, .theme-neon .text-gray-600 { color: #D1D5DB; }
    .theme-neon .text-gray-500 { color: #9CA3AF; }

    /* Seasonal Theme Card */
    .seasonal-card {
      background: linear-gradient(135deg, rgba(255,182,193,0.2), rgba(255,218,233,0.15), rgba(255,255,255,0.2));
      border: 1px solid rgba(255,182,193,0.3);
      transition: all 0.4s ease;
    }
    .seasonal-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 12px 40px rgba(255,182,193,0.2);
    }
    .dark .seasonal-card {
      background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(59,130,246,0.1), rgba(18,18,42,0.8));
      border: 1px solid rgba(139,92,246,0.2);
    }
    .dark .seasonal-card:hover {
      border-color: rgba(139,92,246,0.4);
      box-shadow: 0 0 30px rgba(139,92,246,0.15);
    }
    .dash-seasonal-header.seasonal-card,
    .dash-seasonal-banner.seasonal-card {
      overflow: visible;
      border-radius: 12px;
    }
    .seasonal-bg-decoration {
      position: absolute;
      inset: 0;
      border-radius: inherit;
      background: radial-gradient(circle at 80% 20%, rgba(255,182,193,0.12) 0%, transparent 55%);
      pointer-events: none;
    }
    .dark .seasonal-bg-decoration {
      background: radial-gradient(circle at 80% 20%, rgba(139,92,246,0.08) 0%, transparent 55%);
    }
    @keyframes seasonal-float {
      0%, 100% { transform: translate(0, 0) rotate(0deg); }
      50% { transform: translate(-3%, 3%) rotate(2deg); }
    }
    @keyframes modal-in {
      from { opacity: 0; transform: scale(0.9); }
      to { opacity: 1; transform: scale(1); }
    }
    .animate-modal-in {
      animation: modal-in 0.25s ease-out forwards;
    }
    /* Scenario Quiz Styling */
    .scenario-passage {
      background: linear-gradient(135deg, rgba(255,255,255,0.3), rgba(255,255,255,0.1));
      border-radius: 1rem;
      padding: 1rem;
      white-space: pre-line;
      line-height: 1.8;
    }
    .dark .scenario-passage {
      background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(59,130,246,0.05));
    }
    .scenario-passage .scenario-context {
      color: #6b7280;
      font-size: 0.875rem;
      border-bottom: 1px solid rgba(0,0,0,0.1);
      padding-bottom: 0.5rem;
      margin-bottom: 0.5rem;
    }
    .dark .scenario-passage .scenario-context {
      color: #9ca3af;
      border-color: rgba(255,255,255,0.1);
    }
    .seasonal-event-tag {
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      padding: 0.25rem 0.625rem;
      border-radius: 9999px;
      font-size: 0.75rem;
      background: rgba(255,255,255,0.5);
      border: 1px solid rgba(255,182,193,0.3);
      color: #6b7280;
      transition: all 0.2s ease;
    }
    .seasonal-event-tag:hover {
      transform: scale(1.05);
      background: rgba(255,255,255,0.8);
    }
    .dark .seasonal-event-tag {
      background: rgba(139,92,246,0.15);
      border: 1px solid rgba(139,92,246,0.3);
      color: #c4b5fd;
    }
    .dark .seasonal-event-tag:hover {
      background: rgba(139,92,246,0.25);
    }
    .seasonal-vocab-chip {
      display: inline-flex;
      align-items: center;
      padding: 0.25rem 0.5rem;
      border-radius: 0.5rem;
      font-size: 0.75rem;
      font-family: 'Noto Serif JP', serif;
      background: linear-gradient(135deg, rgba(255,182,193,0.3), rgba(255,218,233,0.2));
      border: 1px solid rgba(255,182,193,0.4);
      color: #374151;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .seasonal-vocab-chip:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(255,182,193,0.3);
    }
    .dark .seasonal-vocab-chip {
      background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(59,130,246,0.15));
      border: 1px solid rgba(139,92,246,0.3);
      color: #e0e7ff;
    }
    .dark .seasonal-vocab-chip:hover {
      box-shadow: 0 4px 12px rgba(139,92,246,0.2);
    }
    /* Seasonal theme variations */
    .seasonal-card.spring { background: linear-gradient(135deg, rgba(255,182,193,0.2), rgba(255,218,233,0.15), rgba(255,255,255,0.2)); border-color: rgba(255,182,193,0.3); }
    .seasonal-card.summer { background: linear-gradient(135deg, rgba(34,197,94,0.15), rgba(59,130,246,0.15), rgba(255,255,255,0.2)); border-color: rgba(34,197,94,0.3); }
    .seasonal-card.autumn { background: linear-gradient(135deg, rgba(251,146,60,0.2), rgba(234,88,12,0.15), rgba(255,255,255,0.2)); border-color: rgba(251,146,60,0.3); }
    .seasonal-card.winter { background: linear-gradient(135deg, rgba(147,197,253,0.2), rgba(219,234,254,0.15), rgba(255,255,255,0.2)); border-color: rgba(147,197,253,0.3); }
    .dark .seasonal-card.spring { background: linear-gradient(135deg, rgba(244,114,182,0.15), rgba(139,92,246,0.1), rgba(18,18,42,0.8)); border-color: rgba(244,114,182,0.2); }
    .dark .seasonal-card.summer { background: linear-gradient(135deg, rgba(34,197,94,0.15), rgba(59,130,246,0.15), rgba(18,18,42,0.8)); border-color: rgba(34,197,94,0.2); }
    .dark .seasonal-card.autumn { background: linear-gradient(135deg, rgba(251,146,60,0.15), rgba(234,88,12,0.1), rgba(18,18,42,0.8)); border-color: rgba(251,146,60,0.2); }
    .dark .seasonal-card.winter { background: linear-gradient(135deg, rgba(147,197,253,0.15), rgba(99,102,241,0.1), rgba(18,18,42,0.8)); border-color: rgba(147,197,253,0.2); }

    /* Utility Classes */
    .section-title { font-family: 'Noto Serif JP', serif; font-size: var(--text-xl); font-weight: 700; color: #1f2937; }
    .dark .section-title { color: #fff; }
    .section-subtitle { font-size: var(--text-sm); }
    .section-subtitle { color: #4b5563; margin-top: 0.25rem; font-size: 0.875rem; }
    .dark .section-subtitle { color: #9ca3af; }
    .card-title { font-family: 'Noto Serif JP', serif; font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; color: #1f2937; display: flex; align-items: center; gap: 0.5rem; }
    .dark .card-title { color: #fff; }
    .label-text { font-size: 0.75rem; color: #4b5563; }
    .dark .label-text { color: #9ca3af; }
    .btn-action { padding: 0.5rem 1rem; border-radius: 0.75rem; font-size: 0.875rem; display: flex; align-items: center; gap: 0.5rem; }
    .btn-action:hover { background: rgba(255,255,255,0.3); }
    .view-mode-btn { opacity: 0.7; transition: all 0.2s ease; min-width: 2rem; min-height: 1.75rem; display: inline-flex; align-items: center; justify-content: center; }
    .view-mode-btn:hover { opacity: 0.9; }
    .view-mode-btn.active { opacity: 1; background: rgba(139, 92, 246, 0.25); border-color: rgba(139, 92, 246, 0.5); }
    .dark .view-mode-btn.active { background: rgba(0, 245, 255, 0.15); border-color: rgba(0, 245, 255, 0.4); }

    /* ?? List-row: one card per row ?? */
    .list-row {
      display: grid;
      grid-template-columns: auto 1fr auto;
      align-items: center;
      gap: 0 0.75rem;
      padding: 0.5rem 0.75rem;
      border-radius: 0.75rem;
      cursor: pointer;
      transition: background 0.15s ease, box-shadow 0.15s ease;
    }
    .list-row:hover {
      background: rgba(255,255,255,0.18);
      box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    }
    .dark .list-row:hover {
      background: rgba(0,245,255,0.06);
      box-shadow: 0 2px 12px rgba(0,245,255,0.08);
    }
    .list-row.new-card {
      border: 1.5px solid rgba(218,165,32,0.55);
      animation: new-card-glow-pulse 3s ease-in-out infinite;
    }
    /* Left zone: tags / strokes / connection chips ? fixed width, left-aligned */
    .list-row .lr-left {
      grid-column: 1;
      grid-row: 1 / 3;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      justify-content: center;
      gap: 0.25rem;
      min-width: 2.5rem;
    }
    /* Center zone: main text spanning two rows */
    .list-row .lr-center {
      grid-column: 2;
      grid-row: 1 / 3;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: flex-start;
      min-width: 0;
      overflow: hidden;
    }
    /* 4-column variant for kanji (left | kanji | readings | right) */
    .list-row.lr-4col { grid-template-columns: auto auto 1fr auto; }
    .list-row .lr-reading {
      grid-column: 3;
      grid-row: 1 / 3;
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 0.125rem;
      min-width: 0;
      overflow: hidden;
    }
    .list-row .lr-reading-row {
      display: flex;
      align-items: center;
      gap: 0.375rem;
      font-size: 0.8rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      min-width: 0;
    }
    .list-row.lr-4col .lr-right { grid-column: 4; }
    .list-row .lr-center-top {
      display: flex;
      align-items: baseline;
      gap: 0.5rem;
      font-weight: 700;
    }
    .list-row .lr-center-top .lr-main {
      font-size: 1.3rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      min-width: 0;
      color: var(--text-primary, #1f2937);
    }
    .dark .list-row .lr-center-top .lr-main { color: #fff; }
    .list-row .lr-center-top .lr-main.lr-kanji { font-size: 2rem; }
    /* Center-only: single item vertically centered spanning both rows */
    .list-row .lr-center.lr-center-solo .lr-main.lr-kanji { font-size: 2.25rem; line-height: 1.2; }
    .list-row .lr-center-top .lr-sub {
      font-size: 0.95rem;
      font-weight: 400;
      color: #6b7280;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      flex-shrink: 1;
      min-width: 0;
    }
    .dark .list-row .lr-center-top .lr-sub { color: #9ca3af; }
    .list-row .lr-center-bottom {
      display: flex;
      align-items: baseline;
      gap: 0.375rem;
      margin-top: 0.125rem;
      font-size: 0.75rem;
      color: #6b7280;
      overflow: hidden;
    }
    .list-row .lr-center-bottom > span {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      min-width: 0;
    }
    .list-row .lr-center-bottom .lr-main {
      font-size: 1.3rem;
      font-weight: 700;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      min-width: 0;
    }
    .dark .list-row .lr-center-bottom { color: #9ca3af; }
    /* Right zone: level / mastery / bookmark / folder */
    .list-row .lr-right {
      grid-column: 3;
      grid-row: 1 / 3;
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      justify-content: center;
      gap: 0.25rem;
      flex-shrink: 0;
      max-width: 12rem;
    }
    .list-row .lr-right-top {
      display: flex;
      align-items: center;
      gap: 0.375rem;
      flex-wrap: nowrap;
    }
    .list-row .lr-right-top .glass-chip {
      max-width: 4rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .list-row .lr-right-bottom {
      display: flex;
      align-items: center;
      gap: 0.25rem;
      white-space: nowrap;
    }

    /* ?? Accordion detail panel ?? */
    .list-row-detail {
      overflow: hidden;
      max-height: 0;
      opacity: 0;
      transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                  opacity 0.25s ease,
                  padding 0.3s ease;
      padding: 0 0.75rem;
      margin-top: -0.25rem;
      border-radius: 0 0 0.75rem 0.75rem;
    }
    .list-row-detail.open {
      max-height: 600px;
      opacity: 1;
      padding: 0.5rem 0.75rem 0.75rem;
    }
    .list-row-detail .detail-inner {
      border-top: 1px solid rgba(0,0,0,0.06);
      padding-top: 0.5rem;
    }
    .dark .list-row-detail .detail-inner {
      border-top-color: rgba(255,255,255,0.08);
    }
    /* When detail is open, flatten row bottom corners */
    .list-row.lr-expanded {
      border-radius: 0.75rem 0.75rem 0 0;
    }
    /* Batch selecting mode: add checkbox column to the left */
    .list-row.batch-selecting {
      grid-template-columns: auto auto 1fr auto;
    }
    .list-row.batch-selecting .batch-select-cb {
      grid-column: 1;
      grid-row: 1 / 3;
      align-self: center;
    }
    .list-row.batch-selecting .lr-left { grid-column: 2; }
    .list-row.batch-selecting .lr-center { grid-column: 3; }
    .list-row.batch-selecting .lr-right { grid-column: 4; }
    .list-row.lr-4col.batch-selecting {
      grid-template-columns: auto auto auto 1fr auto;
    }
    .list-row.lr-4col.batch-selecting .lr-center { grid-column: 3; }
    .list-row.lr-4col.batch-selecting .lr-reading { grid-column: 4; }
    .list-row.lr-4col.batch-selecting .lr-right { grid-column: 5; }

    /* ?? List-row responsive (mobile ?480px) ?? */
    @media (max-width: 480px) {
      .list-row {
        gap: 0 0.375rem;
        padding: 0.375rem 0.5rem;
      }
      .list-row .lr-left { min-width: 1.75rem; }
      .list-row .lr-left .glass-chip { padding: 1px 3px; font-size: 0.6rem; }
      .list-row .lr-left .grid { gap: 1px; }
      .list-row .lr-center-top { gap: 0.25rem; }
      .list-row .lr-center-top .lr-main { font-size: 0.95rem; }
      .list-row .lr-center-top .lr-main.lr-kanji { font-size: 1.2rem; }
      .list-row .lr-center-top .lr-sub { font-size: 0.65rem; }
      .list-row .lr-center-bottom { font-size: 0.65rem; }
      .list-row .lr-center-bottom .lr-main { font-size: 0.95rem; }
      .list-row .lr-center.lr-center-solo .lr-main.lr-kanji { font-size: 1.6rem; }
      .list-row .lr-reading-row { font-size: 0.65rem; gap: 0.2rem; }
      .list-row .lr-right { max-width: 8rem; }
      .list-row .lr-right-top .glass-chip { padding: 1px 4px; font-size: 0.55rem; }
      .list-row .lr-right-top { gap: 0.2rem; font-size: 0.65rem; }
      .list-row .lr-right-bottom { gap: 0.15rem; font-size: 0.65rem; }
      .list-row .lr-right-bottom .text-xs { font-size: 0.6rem; }
      .list-row-detail.open { max-height: 500px; }
    }

    .tab-btn { padding: 0.5rem 1rem; border-radius: 0.75rem; font-size: 0.875rem; font-weight: 500; }

    /* Conjugation Table Tab Active State */
    .conj-tab.active {
      background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(99, 102, 241, 0.2));
      border-color: rgba(139, 92, 246, 0.6);
      box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
    }

    .dark .conj-tab.active {
      background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(0, 245, 255, 0.15));
      border-color: rgba(139, 92, 246, 0.5);
      box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
    }

    /* Custom Table Editing */
    .ct-edit-cell {
      min-width: 60px;
      padding: 6px 8px;
      border: 1px solid transparent;
      border-radius: 8px;
      background: transparent;
      font-size: inherit;
      font-family: inherit;
      color: inherit;
      transition: all 0.2s ease;
      width: 100%;
      outline: none;
    }
    .ct-edit-cell:focus {
      border-color: rgba(99, 102, 241, 0.5);
      background: rgba(255,255,255,0.5);
      box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
    }
    .dark .ct-edit-cell:focus {
      border-color: rgba(0, 245, 255, 0.4);
      background: rgba(18, 18, 42, 0.6);
      box-shadow: 0 0 0 2px rgba(0, 245, 255, 0.1);
    }
    .ct-row-actions {
      opacity: 0;
      transition: opacity 0.15s ease;
    }
    tr:hover .ct-row-actions {
      opacity: 1;
    }
    @media (hover: none) {
      .ct-row-actions { opacity: 1; }
    }
    .ct-col-header {
      position: relative;
    }
    /* Inline action buttons for columns, rows, groups */
    .ct-col-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 20px;
      height: 20px;
      border-radius: 6px;
      font-size: 9px;
      opacity: 0;
      transform: scale(0.7);
      transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease, color 0.15s ease;
      vertical-align: middle;
      cursor: pointer;
      flex-shrink: 0;
      color: rgba(107,114,128,0.7);
    }
    .ct-col-btn:hover {
      opacity: 1 !important;
      transform: scale(1.15) !important;
      background: rgba(99,102,241,0.18);
      color: #6366F1;
    }
    .dark .ct-col-btn:hover {
      background: rgba(0,245,255,0.14);
      color: #00F5FF;
    }
    .ct-col-btn.ct-btn-danger:hover {
      background: rgba(239,68,68,0.15);
      color: #EF4444;
    }
    .ct-col-btn.ct-btn-move:hover {
      background: rgba(245,158,11,0.15);
      color: #F59E0B;
    }
    /* Show inline buttons on header hover */
    .ct-col-header:hover .ct-col-btn,
    .ct-group-bar:hover .ct-col-btn {
      opacity: 0.65;
      transform: scale(1);
    }
    /* Row action move buttons */
    tr:hover .ct-col-btn {
      opacity: 0.55;
      transform: scale(1);
    }
    @media (hover: none) {
      .ct-col-btn { opacity: 0.55 !important; transform: scale(1) !important; }
    }

    .ct-link-hint {
      font-size: 10px;
      line-height: 1.3;
      opacity: 0.5;
      margin-top: 2px;
    }
    .ct-group-bar {
      cursor: default;
    }
    .ct-group-bar .ct-group-actions {
      transition: opacity 0.15s;
    }

    /* Drag-move visual feedback */
    .ct-moving {
      background: rgba(99,102,241,0.08) !important;
      box-shadow: 0 0 0 2px rgba(99,102,241,0.2) inset;
    }
    .dark .ct-moving {
      background: rgba(0,245,255,0.06) !important;
      box-shadow: 0 0 0 2px rgba(0,245,255,0.15) inset;
    }
    .ct-col-moving {
      background: rgba(245,158,11,0.1) !important;
    }
    .ct-icon-option {
      width: 56px;
      height: 56px;
      display: inline-flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 3px;
      border-radius: 10px;
      cursor: pointer;
      transition: all 0.2s ease;
      border: 2px solid transparent;
      padding: 4px 2px;
    }
    .ct-icon-option:hover {
      transform: scale(1.08);
      background: rgba(99, 102, 241, 0.06);
    }
    .dark .ct-icon-option:hover {
      background: rgba(0, 245, 255, 0.06);
    }
    .ct-icon-option.selected {
      border-color: rgba(99, 102, 241, 0.6);
      background: rgba(99, 102, 241, 0.15);
    }
    .dark .ct-icon-option.selected {
      border-color: rgba(0, 245, 255, 0.5);
      background: rgba(0, 245, 255, 0.1);
    }
    .ct-icon-option .ct-icon-label {
      font-size: 8px;
      line-height: 1;
      opacity: 0.55;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 52px;
      text-align: center;
    }
    .ct-icon-option.selected .ct-icon-label {
      opacity: 0.85;
    }
    .ct-icon-grid {
      max-height: 200px;
      overflow-y: auto;
      scrollbar-width: thin;
    }
    .ct-icon-grid::-webkit-scrollbar {
      width: 4px;
    }
    .ct-icon-grid::-webkit-scrollbar-thumb {
      background: rgba(128,128,128,0.3);
      border-radius: 4px;
    }
    .ct-icon-cattab {
      padding: 4px 10px;
      font-size: 11px;
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.15s ease;
      white-space: nowrap;
      border: 1px solid transparent;
    }
    .ct-icon-cattab:hover {
      background: rgba(99, 102, 241, 0.1);
    }
    .ct-icon-cattab.active {
      background: rgba(99, 102, 241, 0.15);
      border-color: rgba(99, 102, 241, 0.3);
      font-weight: 600;
    }
    .dark .ct-icon-cattab.active {
      background: rgba(0, 245, 255, 0.1);
      border-color: rgba(0, 245, 255, 0.25);
    }
    .ct-icon-search {
      font-size: 14px;
      padding: 6px 10px 6px 30px;
      border-radius: 10px;
      border: 1px solid rgba(128,128,128,0.2);
      background: transparent;
      color: inherit;
      outline: none;
      width: 100%;
      transition: border-color 0.2s;
    }
    .ct-icon-search:focus {
      border-color: rgba(99, 102, 241, 0.5);
    }
    .dark .ct-icon-search:focus {
      border-color: rgba(0, 245, 255, 0.4);
    }
    .ct-color-swatch {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      cursor: pointer;
      transition: all 0.2s ease;
      border: 3px solid transparent;
    }
    .ct-color-swatch:hover {
      transform: scale(1.2);
    }
    .ct-color-swatch.selected {
      border-color: rgba(255,255,255,0.8);
      box-shadow: 0 0 0 2px rgba(99,102,241,0.5);
    }
    .dark .ct-color-swatch.selected {
      border-color: rgba(0,245,255,0.5);
      box-shadow: 0 0 0 2px rgba(0,245,255,0.3);
    }

    /* Decorative Circles ? sit behind page content, never bleed through glass cards */
    .deco-bg-layer {
      z-index: -1;
    }
    .deco-circle {
      position: absolute;
      border-radius: 50%;
      filter: blur(40px);
      opacity: 0.35;
      pointer-events: none;
    }

    /* 3D Flip Card */
    .flip-card {
      perspective: 1000px;
    }

    .flip-card-inner {
      transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
      transform-style: preserve-3d;
    }

    .flip-card.flipped .flip-card-inner {
      transform: rotateY(180deg);
    }

    .flip-card-front, .flip-card-back {
      backface-visibility: hidden;
      -webkit-backface-visibility: hidden;
      overflow: hidden;
    }

    .flip-card-back {
      transform: rotateY(180deg);
      overflow-x: hidden;
    }

    /* Hide front completely when flipped to prevent mirrored tags showing through */
    .flip-card.flipped .flip-card-front {
      visibility: hidden;
    }

    /* Golden shimmer for newly added cards */
    @keyframes golden-shimmer {
      0% { background-position: -200% center; }
      100% { background-position: 200% center; }
    }
    @keyframes new-card-glow-pulse {
      0%, 100% { box-shadow: 0 0 8px rgba(218,165,32,0.25), inset 0 0 8px rgba(218,165,32,0.04); }
      50% { box-shadow: 0 0 16px rgba(218,165,32,0.40), inset 0 0 12px rgba(218,165,32,0.08); }
    }
    .flip-card.new-card {
      border: 1.5px solid rgba(218,165,32,0.55);
      position: relative;
      overflow: hidden;
      animation: new-card-glow-pulse 3s ease-in-out infinite;
    }
    .flip-card.new-card::before {
      content: '';
      position: absolute;
      inset: 0;
      z-index: 1;
      pointer-events: none;
      border-radius: inherit;
      background: linear-gradient(
        105deg,
        transparent 35%,
        rgba(255,215,0,0.12) 42%,
        rgba(255,223,0,0.22) 50%,
        rgba(255,215,0,0.12) 58%,
        transparent 65%
      );
      background-size: 200% 100%;
      animation: golden-shimmer 3.5s ease-in-out infinite;
    }
    .flip-card.new-card::after {
      content: '? NEW';
      position: absolute;
      top: 0;
      right: 0;
      z-index: 2;
      font-size: 0.55rem;
      font-weight: 700;
      letter-spacing: 0.06em;
      padding: 2px 7px 2px 9px;
      border-radius: 0 0.95rem 0 0.6rem;
      color: #7c5a00;
      background: linear-gradient(135deg, rgba(255,215,0,0.35), rgba(218,165,32,0.45));
      backdrop-filter: blur(4px);
    }
    .dark .flip-card.new-card {
      border-color: rgba(255,215,0,0.40);
    }
    .dark .flip-card.new-card::before {
      background: linear-gradient(
        105deg,
        transparent 35%,
        rgba(255,215,0,0.08) 42%,
        rgba(255,223,0,0.16) 50%,
        rgba(255,215,0,0.08) 58%,
        transparent 65%
      );
      background-size: 200% 100%;
      animation: golden-shimmer 3.5s ease-in-out infinite;
    }
    .dark .flip-card.new-card::after {
      color: #ffd700;
      background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(218,165,32,0.22));
    }
    .dark .flip-card.new-card {
      animation: new-card-glow-pulse-dark 3s ease-in-out infinite;
    }
    @keyframes new-card-glow-pulse-dark {
      0%, 100% { box-shadow: 0 0 8px rgba(255,215,0,0.15), inset 0 0 6px rgba(255,215,0,0.03); }
      50% { box-shadow: 0 0 18px rgba(255,215,0,0.30), inset 0 0 10px rgba(255,215,0,0.06); }
    }

    /* Batch-select checkbox ? escape the flip-card 3D context */
    .batch-select-cb {
      transform: translateZ(60px);
      isolation: isolate;
      z-index: 50;
      -webkit-transform: translateZ(60px);
    }
    .flip-card.batch-selecting {
      isolation: isolate;
    }

    /* AI Enhance button & diff modal */
    #ai-diff-list label {
      border: 1px solid transparent;
      transition: border-color 0.2s, background 0.2s;
    }
    #ai-diff-list label:has(input:checked) {
      border-color: rgba(255, 145, 77, 0.35);
      background: rgba(255, 145, 77, 0.06);
    }
    .dark #ai-diff-list label:has(input:checked) {
      border-color: rgba(255, 145, 77, 0.45);
      background: rgba(255, 145, 77, 0.10);
    }
    #ai-diff-list input[type="checkbox"] {
      accent-color: var(--renyo, #ff914d);
    }

    /* Navigation Active State */
    .nav-item.active {
      background: linear-gradient(135deg, rgba(255, 209, 220, 0.4), rgba(135, 206, 235, 0.4));
    }

    .dark .nav-item.active {
      background: linear-gradient(135deg, rgba(0, 245, 255, 0.15), rgba(139, 92, 246, 0.15));
      border: 1px solid rgba(0, 245, 255, 0.3);
      box-shadow: 0 0 20px rgba(0, 245, 255, 0.1);
    }

    /* Dark mode neon text effects */
    .dark .text-neon {
      color: #00F5FF;
      text-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
    }

    .dark .text-neon-pink {
      color: #FF00FF;
      text-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
    }

    .dark .text-neon-green {
      color: #00FF88;
      text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
    }

    /* Dark mode activity chips with neon glow - using CSS variables */
    .dark .activity-chip { --c: 100,116,139; background: linear-gradient(135deg, rgba(var(--c),0.2), rgba(var(--c),0.05)); border-color: rgba(var(--c),0.6); box-shadow: 0 0 10px rgba(var(--c),0.2); }
    .dark .activity-chip.mizen { --c: 239,68,68; }
    .dark .activity-chip.mizen-o { --c: 244,114,182; }
    .dark .activity-chip.renyo { --c: 0,255,136; }
    .dark .activity-chip.shushi { --c: 0,245,255; }
    .dark .activity-chip.rentai { --c: 139,92,246; }
    .dark .activity-chip.katei { --c: 245,158,11; }
    .dark .activity-chip.meirei { --c: 100,116,139; }
    .dark .activity-chip.futsu { --c: 251,146,60; }

    /* POS tag tooltip */
    .pos-tag-tip { position: relative; cursor: pointer; }
    .pos-tag-tip::after {
      content: attr(data-tooltip);
      position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
      background: rgba(30,30,30,0.92); color: #f0f0f0;
      padding: 3px 8px; border-radius: 6px; font-size: 11px; line-height: 1.4;
      white-space: nowrap; z-index: 60; pointer-events: none;
      opacity: 0; transition: opacity 0.15s;
    }
    .pos-tag-tip:hover::after, .pos-tag-tip.tip-active::after { opacity: 1; }
    .dark .pos-tag-tip::after { background: rgba(220,220,220,0.95); color: #1a1a1a; }

    /* Progress Ring */
    .progress-ring {
      transform: rotate(-90deg);
    }

    .progress-ring__circle {
      transition: stroke-dashoffset 0.5s ease;
    }

    /* Scrollbar */
    ::-webkit-scrollbar {
      width: 6px;
      height: 6px;
    }

    ::-webkit-scrollbar-track {
      background: transparent;
    }

    ::-webkit-scrollbar-thumb {
      background: rgba(155, 155, 155, 0.5);
      border-radius: 3px;
    }

    ::-webkit-scrollbar-thumb:hover {
      background: rgba(155, 155, 155, 0.7);
    }

    /* Library Filters Responsive */
    .lib-filters-responsive {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
    }

    .lib-filters-responsive .lib-filter-item {
      flex: 1 1 auto;
      min-width: 100px;
      max-width: 100%;
    }

    /* On wider screens, limit filter width for better distribution */
    @media (min-width: 640px) {
      .lib-filters-responsive .lib-filter-item {
        min-width: 120px;
        flex: 1 1 0;
      }
    }

    @media (min-width: 1024px) {
      .lib-filters-responsive .lib-filter-item {
        min-width: 130px;
      }
    }

    /* ??????????????????????????
       SENSEI (?????) STYLES
       ?????????????????????????? */

    /* Chat Bubbles */
    .sensei-msg {
      display: flex;
      gap: 0.5rem;
      max-width: 88%;
      animation: senseiMsgIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
      opacity: 0;
    }
    @keyframes senseiMsgIn {
      from { opacity: 0; transform: translateY(12px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    .sensei-msg.user-msg {
      margin-left: auto;
      flex-direction: row-reverse;
    }

    .sensei-msg-avatar {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      font-size: 0.85rem;
      margin-top: 2px;
    }
    .sensei-msg.ai-msg .sensei-msg-avatar {
      background: linear-gradient(135deg, #FFD1DC, #87CEEB);
      color: #4a2040;
    }
    .dark .sensei-msg.ai-msg .sensei-msg-avatar {
      background: linear-gradient(135deg, #8B5CF6, #00F5FF);
      color: #fff;
    }
    .sensei-msg.user-msg .sensei-msg-avatar {
      background: linear-gradient(135deg, #8B5CF6, #6366F1);
      color: #fff;
    }
    .dark .sensei-msg.user-msg .sensei-msg-avatar {
      background: linear-gradient(135deg, #00F5FF, #00FF88);
      color: #0a0a1a;
    }

    .sensei-msg-bubble {
      padding: 0.75rem 1rem;
      border-radius: 1rem;
      line-height: 1.6;
      font-size: 0.9375rem;
      word-break: break-word;
      overflow-wrap: break-word;
    }

    .sensei-msg.user-msg .sensei-msg-bubble {
      background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(99, 102, 241, 0.2));
      border: 1px solid rgba(139, 92, 246, 0.35);
      border-top-right-radius: 4px;
      color: #1f2937;
    }
    .dark .sensei-msg.user-msg .sensei-msg-bubble {
      background: linear-gradient(135deg, rgba(0, 245, 255, 0.15), rgba(0, 255, 136, 0.1));
      border: 1px solid rgba(0, 245, 255, 0.3);
      color: #e0e0ff;
    }

    .sensei-msg.ai-msg .sensei-msg-bubble {
      background: rgba(255, 255, 255, 0.2);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid rgba(255, 255, 255, 0.35);
      border-top-left-radius: 4px;
      color: #1f2937;
      overflow-anchor: none;
    }
    .dark .sensei-msg.ai-msg .sensei-msg-bubble {
      background: rgba(18, 18, 42, 0.7);
      border: 1px solid rgba(0, 245, 255, 0.15);
      color: #d1d5db;
    }

    /* Per-message delete button */
    .sensei-msg-del {
      align-self: flex-start;
      flex-shrink: 0;
      margin-top: 6px;
      width: 22px;
      height: 22px;
      border: none;
      border-radius: 50%;
      background: transparent;
      color: rgba(107, 114, 128, 0.75);
      font-size: 0.7rem;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      opacity: 0;
      transition: opacity 0.2s ease, color 0.2s ease, background 0.2s ease;
    }
    .sensei-msg:hover .sensei-msg-del,
    .sensei-msg-del:focus-visible {
      opacity: 1;
    }
    .sensei-msg-del:hover {
      color: #e11d48;
      background: rgba(225, 29, 72, 0.12);
    }
    .dark .sensei-msg-del {
      color: rgba(209, 213, 219, 0.7);
    }
    .dark .sensei-msg-del:hover {
      color: #fda4af;
      background: rgba(244, 63, 94, 0.18);
    }
    /* 觸控裝置無 hover，常顯示但淡化 */
    @media (hover: none) {
      .sensei-msg-del {
        opacity: 0.5;
      }
    }

    /* Typing Indicator */
    .sensei-typing {
      display: flex;
      align-items: center;
      gap: 4px;
      padding: 0.5rem 0;
    }
    .sensei-typing-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: #8B5CF6;
      animation: senseiTypingBounce 1.4s ease-in-out infinite;
    }
    .dark .sensei-typing-dot {
      background: #00F5FF;
    }
    .sensei-typing-dot:nth-child(1) { animation-delay: 0s; }
    .sensei-typing-dot:nth-child(2) { animation-delay: 0.2s; }
    .sensei-typing-dot:nth-child(3) { animation-delay: 0.4s; }
    @keyframes senseiTypingBounce {
      0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
      30% { transform: translateY(-6px); opacity: 1; }
    }

    /* Addable Item Cards */
    .sensei-addable-card {
      background: rgba(255, 255, 255, 0.25);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      border: 1px solid rgba(139, 92, 246, 0.25);
      border-radius: 0.75rem;
      padding: 0.75rem 1rem;
      margin-top: 0.5rem;
      transition: all 0.3s ease;
    }
    .sensei-addable-card:hover {
      border-color: rgba(139, 92, 246, 0.45);
      box-shadow: 0 4px 16px rgba(139, 92, 246, 0.1);
    }
    .dark .sensei-addable-card {
      background: rgba(26, 26, 62, 0.5);
      border: 1px solid rgba(0, 245, 255, 0.15);
    }
    .dark .sensei-addable-card:hover {
      border-color: rgba(0, 245, 255, 0.35);
      box-shadow: 0 0 16px rgba(0, 245, 255, 0.1);
    }

    .sensei-add-btn {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      padding: 0.3rem 0.75rem;
      border-radius: 0.5rem;
      font-size: 0.8rem;
      font-weight: 600;
      background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(99, 102, 241, 0.15));
      border: 1px solid rgba(139, 92, 246, 0.35);
      color: #6d28d9;
      cursor: pointer;
      transition: all 0.25s ease;
    }
    .sensei-add-btn:hover {
      background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(99, 102, 241, 0.25));
      transform: scale(1.04);
    }
    .sensei-add-btn.added {
      background: rgba(16, 185, 129, 0.15);
      border-color: rgba(16, 185, 129, 0.4);
      color: #059669;
      cursor: default;
      pointer-events: none;
    }
    .dark .sensei-add-btn {
      background: linear-gradient(135deg, rgba(0, 245, 255, 0.1), rgba(0, 255, 136, 0.08));
      border: 1px solid rgba(0, 245, 255, 0.3);
      color: #00F5FF;
    }
    .dark .sensei-add-btn:hover {
      background: linear-gradient(135deg, rgba(0, 245, 255, 0.2), rgba(0, 255, 136, 0.15));
    }
    .dark .sensei-add-btn.added {
      background: rgba(0, 255, 136, 0.12);
      border-color: rgba(0, 255, 136, 0.35);
      color: #00FF88;
    }

    /* Chips Scroll Row */
    .sensei-chips-row {
      scrollbar-width: none;
      -ms-overflow-style: none;
    }
    .sensei-chips-row::-webkit-scrollbar {
      display: none;
    }

    /* Messages Area Custom Scrollbar */
    .sensei-messages-area {
      scrollbar-width: thin;
      scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
    }
    .dark .sensei-messages-area {
      scrollbar-color: rgba(0, 245, 255, 0.2) transparent;
    }
    .sensei-messages-area::-webkit-scrollbar {
      width: 5px;
    }
    .sensei-messages-area::-webkit-scrollbar-track {
      background: transparent;
    }
    .sensei-messages-area::-webkit-scrollbar-thumb {
      background: rgba(139, 92, 246, 0.3);
      border-radius: 10px;
    }
    .dark .sensei-messages-area::-webkit-scrollbar-thumb {
      background: rgba(0, 245, 255, 0.2);
    }

    /* Markdown Content in AI Bubbles */
    .sensei-md h1, .sensei-md h2, .sensei-md h3, .sensei-md h4 {
      font-family: 'Noto Serif JP', serif;
      font-weight: 700;
      margin: 0.8em 0 0.4em;
      line-height: 1.35;
    }
    .sensei-md h1 { font-size: 1.25rem; }
    .sensei-md h2 { font-size: 1.125rem; }
    .sensei-md h3 { font-size: 1rem; }
    .sensei-md h4 { font-size: 0.9375rem; }
    .sensei-md h1:first-child, .sensei-md h2:first-child,
    .sensei-md h3:first-child, .sensei-md h4:first-child {
      margin-top: 0;
    }

    .sensei-md p {
      margin: 0.5em 0;
    }

    .sensei-md ul, .sensei-md ol {
      margin: 0.5em 0;
      padding-left: 1.5em;
    }
    .sensei-md li {
      margin: 0.25em 0;
    }
    .sensei-md li::marker {
      color: #8B5CF6;
    }
    .dark .sensei-md li::marker {
      color: #00F5FF;
    }

    .sensei-md strong {
      font-weight: 700;
      font-family: 'Noto Serif JP', 'LXGW WenKai Mono TC', serif;
      color: #5b21b6;
      background: rgba(139, 92, 246, 0.12);
      padding: 0.05em 0.2em;
      border-radius: 3px;
    }
    .dark .sensei-md strong {
      color: #c4b5fd;
      background: rgba(167, 139, 250, 0.18);
    }

    .sensei-md em {
      font-style: italic;
      color: #6d28d9;
    }
    .dark .sensei-md em {
      color: #c4b5fd;
    }

    .sensei-md code {
      font-family: 'LXGW WenKai Mono TC', monospace;
      background: rgba(139, 92, 246, 0.1);
      padding: 0.15em 0.4em;
      border-radius: 4px;
      font-size: 0.875em;
      color: #6d28d9;
    }
    .dark .sensei-md code {
      background: rgba(0, 245, 255, 0.1);
      color: #00F5FF;
    }

    .sensei-md pre {
      background: rgba(0, 0, 0, 0.05);
      border: 1px solid rgba(0, 0, 0, 0.08);
      border-radius: 0.5rem;
      padding: 0.75rem 1rem;
      overflow-x: auto;
      margin: 0.6em 0;
    }
    .sensei-md pre code {
      background: none;
      padding: 0;
      color: inherit;
    }
    .dark .sensei-md pre {
      background: rgba(0, 0, 0, 0.3);
      border-color: rgba(0, 245, 255, 0.1);
    }

    .sensei-md blockquote {
      border-left: 3px solid #8B5CF6;
      padding: 0.4em 0.8em;
      margin: 0.6em 0;
      background: rgba(139, 92, 246, 0.06);
      border-radius: 0 0.5rem 0.5rem 0;
      font-style: italic;
    }
    .dark .sensei-md blockquote {
      border-left-color: #00F5FF;
      background: rgba(0, 245, 255, 0.05);
    }

    .sensei-md table {
      width: 100%;
      border-collapse: collapse;
      margin: 0.6em 0;
      font-size: 0.875rem;
    }
    .sensei-md th, .sensei-md td {
      padding: 0.45rem 0.6rem;
      border: 1px solid rgba(0, 0, 0, 0.1);
      text-align: left;
    }
    .sensei-md th {
      background: rgba(139, 92, 246, 0.1);
      font-weight: 600;
      font-family: 'Noto Serif JP', serif;
    }
    .sensei-md tr:nth-child(even) td {
      background: rgba(0, 0, 0, 0.02);
    }
    .dark .sensei-md th, .dark .sensei-md td {
      border-color: rgba(0, 245, 255, 0.12);
    }
    .dark .sensei-md th {
      background: rgba(0, 245, 255, 0.08);
    }
    .dark .sensei-md tr:nth-child(even) td {
      background: rgba(0, 245, 255, 0.03);
    }

    .sensei-md hr {
      border: none;
      border-top: 1px solid rgba(0, 0, 0, 0.1);
      margin: 0.8em 0;
    }
    .dark .sensei-md hr {
      border-top-color: rgba(0, 245, 255, 0.15);
    }

    .sensei-md a {
      color: #6d28d9;
      text-decoration: underline;
      text-underline-offset: 2px;
    }
    .dark .sensei-md a {
      color: #00F5FF;
    }

    /* Sensei Error Message */
    .sensei-error {
      background: rgba(239, 68, 68, 0.1);
      border: 1px solid rgba(239, 68, 68, 0.3);
      color: #b91c1c;
      border-radius: 0.75rem;
      padding: 0.6rem 1rem;
      font-size: 0.85rem;
    }
    .dark .sensei-error {
      background: rgba(239, 68, 68, 0.12);
      border-color: rgba(239, 68, 68, 0.3);
      color: #fca5a5;
    }

    .sensei-token-footer {
      margin-top: 0.65rem;
      padding-top: 0.5rem;
      border-top: 1px solid rgba(0, 0, 0, 0.06);
      font-size: 0.7rem;
      color: #9ca3af;
      font-variant-numeric: tabular-nums;
    }
    .dark .sensei-token-footer {
      border-top-color: rgba(255, 255, 255, 0.08);
      color: #9ca3af;
    }

    .sensei-history-item {
      border: 1px solid transparent;
    }

    /* 問道堂紀錄：以 session 為單位（對齊街角教練紀錄卡） */
    .sensei-sess-list .sensei-sess-card {
      border: 1px solid rgba(255, 255, 255, 0.2);
    }
    .sensei-sess-card.is-active {
      box-shadow: inset 0 0 0 1px rgba(244, 114, 182, 0.35);
      background: rgba(244, 114, 182, 0.08);
    }
    .sensei-sess-toggle {
      background: none;
      border: 0;
      padding: 0;
      cursor: pointer;
    }
    .sensei-sess-body {
      margin-top: 0.75rem;
      padding-top: 0.75rem;
      border-top: 1px dashed rgba(148, 163, 184, 0.35);
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }
    .sensei-sess-msg {
      padding: 0.55rem 0.7rem;
      border-radius: 0.75rem;
      background: rgba(255, 255, 255, 0.16);
      border: 1px solid rgba(255, 255, 255, 0.18);
    }
    .dark .sensei-sess-msg {
      background: rgba(30, 41, 59, 0.32);
      border-color: rgba(148, 163, 184, 0.2);
    }
    .sensei-sess-msg.is-user {
      border-left: 3px solid rgba(99, 102, 241, 0.55);
    }
    .sensei-sess-msg.is-ai {
      border-left: 3px solid rgba(244, 114, 182, 0.55);
    }
    .sensei-sess-msg-role {
      display: block;
      font-size: 0.68rem;
      font-weight: 700;
      letter-spacing: 0.02em;
      color: #6b7280;
      margin-bottom: 0.15rem;
    }
    .dark .sensei-sess-msg-role {
      color: #94a3b8;
    }
    .sensei-sess-msg-text {
      font-size: 0.8rem;
      line-height: 1.55;
      color: #374151;
      margin: 0;
      white-space: pre-wrap;
      word-break: break-word;
    }
    .dark .sensei-sess-msg-text {
      color: #e2e8f0;
    }
    .sensei-sess-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 0.4rem;
      margin-top: 0.15rem;
    }
    .sensei-sess-flag {
      display: inline-block;
      margin-left: 0.35rem;
      padding: 0.05rem 0.4rem;
      border-radius: 999px;
      font-size: 0.65rem;
      font-weight: 600;
      vertical-align: middle;
    }
    .sensei-sess-flag.is-active {
      background: rgba(244, 114, 182, 0.18);
      color: #be185d;
    }
    .dark .sensei-sess-flag.is-active {
      background: rgba(244, 114, 182, 0.22);
      color: #f9a8d4;
    }

    /* Desktop: pin sensei layout so only the message list scrolls */
    @media (min-width: 769px) {
      .main-content:has(#view-sensei:not(.hidden)) {
        overflow: hidden;
      }
      #view-sensei:not(.hidden) {
        height: calc(100dvh - 4rem);
        max-height: calc(100dvh - 4rem);
        overflow: hidden;
        display: flex;
        flex-direction: column;
        min-height: 0;
      }
    }

    /* Desktop main uses md:p-8 (2rem top + bottom); keep container flush to that content box */
    .sensei-container {
      height: calc(100dvh - 4rem);
      max-height: calc(100dvh - 4rem);
      min-height: 0;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    #sensei-chat-panel {
      flex: 1 1 0%;
      min-height: 0;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    #sensei-chat-panel.hidden {
      display: none;
    }

    .sensei-messages-area {
      flex: 1 1 0%;
      min-height: 0;
      overflow-x: hidden;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      /* 串流增長時交由 JS stick-to-bottom，避免瀏覽器 overflow-anchor 搶滾 */
      overflow-anchor: none;
    }

    #sensei-history-panel {
      flex: 1 1 0%;
      min-height: 0;
    }

    .sensei-header-desc {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .sensei-input-area {
      flex: 0 0 auto;
      margin-top: 0;
      padding-bottom: 0.5rem;
    }

    /* Mobile adjustments for sensei */
    @media (max-width: 768px) {
      /* Full-bleed above bottom nav */
      #view-sensei:not(.hidden) {
        position: fixed;
        top: max(0.75rem, calc(var(--safe-top) + 0.35rem));
        left: max(0.75rem, var(--safe-left));
        right: max(0.75rem, var(--safe-right));
        bottom: var(--mobile-nav-height);
        z-index: 20;
        display: flex;
        flex-direction: column;
        width: auto;
        max-width: none;
        height: auto;
        max-height: none;
        box-sizing: border-box;
        overflow: hidden;
      }
      .sensei-container {
        height: 100% !important;
        max-height: 100% !important;
        width: 100%;
        max-width: 100%;
        min-height: 0;
        flex: 1;
        box-sizing: border-box;
        overflow: hidden;
      }
      .sensei-messages-area {
        min-height: 0;
      }
      .sensei-input-area {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding-bottom: 0.25rem;
      }
      .sensei-msg {
        max-width: 92%;
      }
      .sensei-msg-bubble {
        font-size: 0.875rem;
        padding: 0.625rem 0.875rem;
      }
      .sensei-md table {
        font-size: 0.8rem;
      }
      .sensei-md th, .sensei-md td {
        padding: 0.35rem 0.45rem;
      }
    }

    /* Collapsible sections (G1) */
    .collapsible-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-2);
      width: 100%;
    }
    .collapsible-toggle {
      flex-shrink: 0;
      width: 2rem;
      height: 2rem;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 0.5rem;
      color: #9ca3af;
      transition: background 0.2s, color 0.2s;
    }
    .collapsible-toggle:hover {
      background: rgba(255, 255, 255, 0.25);
      color: #6b7280;
    }
    .dark .collapsible-toggle:hover {
      background: rgba(255, 255, 255, 0.08);
      color: #d1d5db;
    }
    .collapsible-chevron {
      transition: transform 0.2s ease;
    }
    .collapsible-chevron.rotated {
      transform: rotate(180deg);
    }
    .collapsible-body.collapsed {
      display: none;
    }

    /* Dashboard hero */
    .dash-hero-grid {
      display: grid;
      gap: var(--space-4);
    }
    @media (min-width: 768px) {
      .dash-hero-grid {
        grid-template-columns: 1fr 1fr 1fr;
      }
    }
    /* ==== Dashboard zone layout (???? ? ?????) ==== */
    /* ID display must not override Tailwind .hidden, or other views stack under the map. */
    #view-dashboard.hidden {
      display: none;
    }
    #view-dashboard:not(.hidden) {
      display: flex;
      flex-direction: column;
      min-height: 0;
      height: 100%;
      overflow: hidden;
    }
    .dash-layout--rpg {
      display: grid;
      grid-template-rows: minmax(0, 1fr);
      flex: 1;
      min-height: 0;
      height: 100%;
      gap: var(--space-2);
    }
    @media (min-width: 1024px) {
      #view-dashboard:not(.hidden) {
        height: calc(100vh - 4rem);
        max-height: calc(100vh - 4rem);
      }
    }
    .dash-left-panel {
      min-height: 0;
      overflow: hidden;
    }
    .dash-left-top {
      display: grid;
      grid-template-columns: 1fr;
      gap: 12px;
      align-items: center;
    }
    @media (min-width: 640px) {
      .dash-left-top {
        grid-template-columns: 1.2fr 1fr auto;
      }
    }
    .dash-left-rank {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
    }
    .dash-left-charts {
      display: grid;
      grid-template-columns: 1fr;
      gap: 10px;
      overflow: hidden;
    }
    @media (min-width: 900px) {
      .dash-left-charts {
        grid-template-columns: 1fr 1fr 1fr;
      }
    }
    .dash-left-charts .dash-chart-body {
      min-height: 120px;
      max-height: 150px;
      height: 130px;
    }
    .dash-right-col {
      min-height: 0;
      overflow: hidden;
    }
    .dash-right-top,
    .dash-right-bottom {
      min-height: 0;
      overflow: hidden;
    }
    .dash-season-inline {
      position: relative;
    }
    .dash-season-inline-btn {
      border: none;
      cursor: pointer;
      background: transparent;
    }
    .dash-seasonal-dropdown {
      max-height: min(70vh, 420px);
      overflow-y: auto;
    }
    .dash-seasonal-dropdown:not(.hidden) {
      display: block;
    }
    .dash-today-chips {
      flex-shrink: 0;
    }
    .dash-today-chip {
      padding: 4px 10px;
      border-radius: 999px;
      background: rgba(243, 244, 246, 0.8);
      color: #6b7280;
    }
    .dark .dash-today-chip {
      background: rgba(55, 65, 81, 0.6);
      color: #9ca3af;
    }
    .dash-quick-review-link {
      border: none;
      background: none;
      padding: 0;
      cursor: pointer;
      display: inline-block;
    }
    .dash-badge-icon-only {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
      gap: 6px;
      max-height: 72px;
      overflow-y: auto;
    }
    .dash-badge-icon-only .badge-item {
      width: 28px;
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 8px;
      cursor: default;
      position: relative;
      padding: 0;
    }
    .dash-badge-icon-only .badge-item.locked { opacity: 0.35; }
    .dash-badge-icon-only .badge-item.unlocked { opacity: 1; }
    .dash-badge-icon-only .badge-item svg {
      width: 24px;
      height: 24px;
      display: block;
    }
    .dash-badge-icon-only .badge-label,
    .dash-badge-icon-only .badge-group {
      display: none;
    }
    .dash-panel-section {
      flex-shrink: 0;
    }
    .dash-est-breakdown-compact .flex { gap: 4px; }
    .dash-est-breakdown-compact .text-xs { font-size: 0.65rem; }
    .dash-est-breakdown-compact .h-2\.5 { height: 6px; }
    @media (max-width: 768px) {
      /* ????? Dynamic Island???????????? */
      .main-content {
        padding-left: max(0.75rem, var(--safe-left)) !important;
        padding-right: max(0.75rem, var(--safe-right)) !important;
        padding-top: max(0.75rem, calc(var(--safe-top) + 0.35rem)) !important;
        overflow-x: hidden;
      }
      #view-dashboard:not(.hidden) {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        height: calc(100dvh - var(--mobile-nav-height) - 1.5rem - var(--safe-top));
        max-height: calc(100dvh - var(--mobile-nav-height) - 1.5rem - var(--safe-top));
        overflow: hidden;
      }
      .dash-layout--rpg {
        height: 100%;
        min-height: 0;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
      }
      .dash-atlas-card--rpg {
        height: 100%;
        min-height: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
        border-width: 1px;
        border-style: solid;
      }
      .dash-seasonal-head {
        gap: 8px;
        flex-wrap: nowrap;
      }
      .dash-seasonal-title-row {
        min-width: 0;
        flex: 1 1 auto;
      }
      .dash-seasonal-title-row #seasonal-title {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.95rem;
      }
      .dash-seasonal-nav {
        flex-shrink: 0;
      }
      .jp-map-panel {
        min-height: 0;
        flex: 1 1 auto;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
      }
      .jp-map-stage {
        min-height: min(48vh, 380px);
      }
      .jp-map-zoom-btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
        border-radius: 10px;
      }
      .jp-map-html-label {
        font-size: 0.82rem;
      }
      .dash-split {
        overflow: visible;
      }
      .dash-left-panel,
      .dash-right-col {
        overflow: visible;
      }
    }

    /* ==== Dashboard zone layout (???? ? RPG ? legacy hooks) ==== */
    .dash-layout {
      display: grid;
      gap: var(--space-3);
      grid-template-columns: 1fr;
      grid-template-rows: auto auto;
    }
    .dash-layout--rpg {
      grid-template-rows: minmax(0, 1fr);
      height: 100%;
      min-height: 0;
    }
    .dash-atlas-card {
      display: grid;
      grid-template-rows: auto 1fr;
      min-height: 280px;
      overflow: hidden;
    }
    .dash-atlas-card--rpg {
      min-height: 0;
      height: 100%;
    }
    .dash-atlas-season {
      min-height: 0;
      overflow: visible;
      border-radius: 16px 16px 0 0;
      z-index: 2;
      position: relative;
    }
    .dash-atlas-map {
      min-height: 0;
      display: flex;
      flex-direction: column;
      border-top: 1px solid rgba(128, 128, 128, 0.12);
      background: rgba(255, 255, 255, 0.15);
      z-index: 1;
      position: relative;
    }
    .dark .dash-atlas-map {
      background: rgba(0, 0, 0, 0.12);
    }
    .rpg-hud {
      position: absolute;
      z-index: 6;
      max-width: min(220px, 42vw);
      pointer-events: auto;
      backdrop-filter: blur(10px);
      background: rgba(255, 255, 255, 0.88);
      box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
      font-size: 13px;
      line-height: 1.4;
    }
    .dark .rpg-hud {
      background: rgba(17, 24, 39, 0.88);
    }
    .rpg-hud__title,
    .rpg-hud__label {
      font-size: 14px;
      font-weight: 600;
      color: #374151;
      margin-bottom: 0;
    }
    .dark .rpg-hud__title,
    .dark .rpg-hud__label { color: #e5e7eb; }
    .rpg-hud__section-title {
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.04em;
      color: #6b7280;
      margin-bottom: 0;
    }
    .dark .rpg-hud__section-title { color: #9ca3af; }
    .rpg-hud__text { font-size: 14px; }
    .dash-profile-title { font-size: 15px; line-height: 1.3; }
    .dash-profile-text { font-size: 14px; }
    .dash-exp-text { font-size: 14px; }
    .rpg-hud__muted {
      font-size: 12px;
      color: #6b7280;
    }
    .dark .rpg-hud__muted { color: #9ca3af; }
    .rpg-hud .weak-item {
      font-size: 12px;
      padding: 2px 0;
    }
    .rpg-hud .weak-item-label { font-size: 12px; }
    .rpg-hud .weak-item-count { font-size: 12px; }
    .dash-mission-block {
      padding: 6px 8px;
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.45);
    }
    .dark .dash-mission-block {
      background: rgba(31, 41, 55, 0.55);
    }
    .rpg-capsule-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: none;
      border-radius: 999px;
      padding: 6px 14px;
      font-size: 12px;
      font-weight: 600;
      line-height: 1.2;
      color: #374151;
      background: rgba(243, 244, 246, 0.95);
      cursor: pointer;
      white-space: nowrap;
      text-decoration: none;
    }
    .rpg-capsule-btn:hover { filter: brightness(0.97); }
    .dark .rpg-capsule-btn {
      color: #e5e7eb;
      background: rgba(55, 65, 81, 0.95);
    }
    .rpg-capsule-btn--primary {
      color: #fff;
      background: linear-gradient(90deg, #10B981, #06B6D4);
    }
    .rpg-capsule-btn--ghost {
      padding: 4px 10px;
      background: rgba(229, 231, 235, 0.9);
    }
    .dark .rpg-capsule-btn--ghost { background: rgba(75, 85, 99, 0.85); }
    .rpg-capsule-btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
    .rpg-hud--tl { top: 44px; left: 16px; }
    .rpg-hud--tr { top: 44px; right: 16px; max-width: min(260px, 44vw); }
    .rpg-hud--br { bottom: 16px; right: 16px; left: auto; }
    .rpg-hud-radar { max-width: 100%; }
    .dash-profile-tabs {
      display: flex;
      gap: 4px;
      padding: 3px;
      border-radius: 999px;
      background: rgba(243, 244, 246, 0.85);
    }
    .dark .dash-profile-tabs {
      background: rgba(55, 65, 81, 0.75);
    }
    .dash-profile-tab {
      flex: 1;
      border: none;
      border-radius: 999px;
      padding: 5px 6px;
      font-size: 11px;
      font-weight: 600;
      line-height: 1.2;
      color: #6b7280;
      background: transparent;
      cursor: pointer;
      transition: background 0.15s ease, color 0.15s ease;
    }
    .dark .dash-profile-tab { color: #9ca3af; }
    .dash-profile-tab--active {
      color: #111827;
      background: rgba(255, 255, 255, 0.95);
      box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
    }
    .dark .dash-profile-tab--active {
      color: #f3f4f6;
      background: rgba(31, 41, 55, 0.95);
    }
    .dash-profile-pane {
      min-height: 0;
    }
    #dash-profile-pane-radar.dash-profile-pane {
      min-height: 260px;
    }
    #dash-profile-pane-rank.dash-profile-pane {
      min-height: 0;
    }
    .dash-exp-bar {
      height: 12px;
      border-radius: 999px;
      overflow: hidden;
      background: #e5e7eb;
      box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
    }
    .dark .dash-exp-bar {
      background: #374151;
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    }
    .dash-exp-bar__fill {
      height: 100%;
      border-radius: 999px;
      background: linear-gradient(90deg, #10B981, #06B6D4);
      box-shadow: 0 0 8px rgba(16, 185, 129, 0.35);
      transition: width 0.35s ease;
    }
    .dash-radar-pane svg {
      width: 180px;
      height: 180px;
    }
    .dash-radar-legend {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 4px 6px;
      margin-top: 8px;
      width: 100%;
    }
    .dash-radar-legend-item {
      display: flex;
      align-items: center;
      gap: 4px;
      font-size: 11px;
      color: #4b5563;
      min-width: 0;
    }
    .dark .dash-radar-legend-item { color: #9ca3af; }
    .dash-radar-legend-dot {
      width: 7px;
      height: 7px;
      border-radius: 999px;
      flex-shrink: 0;
    }
    .dash-radar-legend-pct {
      margin-left: auto;
      font-variant-numeric: tabular-nums;
      color: #6b7280;
    }
    .dash-char-battle-stats {
      width: 100%;
      margin-top: 0.5rem;
      padding-top: 0.5rem;
      border-top: 1px solid rgba(156, 163, 175, 0.35);
    }
    .dash-char-battle-title {
      font-size: 0.68rem;
      font-weight: 700;
      text-align: center;
      color: #374151;
      margin: 0 0 0.35rem;
    }
    .dark .dash-char-battle-title { color: #e5e7eb; }
    .dash-char-battle-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 0.25rem;
      text-align: center;
    }
    .dash-char-battle-cell {
      position: relative;
      display: flex;
      flex-direction: column;
      gap: 0.1rem;
      cursor: help;
      border-radius: 0.35rem;
      padding: 0.15rem 0.1rem;
    }
    .dash-char-battle-cell:hover,
    .dash-char-battle-cell:focus {
      outline: none;
      background: rgba(15, 23, 42, 0.06);
    }
    .dark .dash-char-battle-cell:hover,
    .dark .dash-char-battle-cell:focus {
      background: rgba(248, 250, 252, 0.08);
    }
    .dash-char-battle-label {
      font-size: 0.58rem;
      color: #9ca3af;
    }
    .dash-char-battle-val {
      font-size: 0.78rem;
      font-weight: 700;
      color: #111827;
    }
    .dark .dash-char-battle-val { color: #f3f4f6; }
    .dash-char-battle-tip {
      display: none;
      position: fixed;
      left: 0;
      top: 0;
      width: max-content;
      max-width: min(15rem, calc(100vw - 1rem));
      padding: 0.45rem 0.55rem;
      border-radius: 0.45rem;
      background: #111827;
      color: #f9fafb;
      font-size: 0.62rem;
      font-weight: 500;
      line-height: 1.4;
      text-align: left;
      z-index: 10050;
      box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
      pointer-events: none;
      transform: none;
    }
    .dash-char-battle-tip.is-open {
      display: block;
    }
    .dash-char-battle-tip::after {
      content: '';
      position: absolute;
      left: var(--tip-arrow-x, 50%);
      transform: translateX(-50%);
      border: 5px solid transparent;
    }
    .dash-char-battle-tip.tip-above::after {
      top: 100%;
      border-top-color: #111827;
    }
    .dash-char-battle-tip.tip-below::after {
      bottom: 100%;
      border-bottom-color: #111827;
    }
    .dash-char-battle-tip strong {
      display: block;
      margin-bottom: 0.2rem;
      font-size: 0.68rem;
      color: #fde68a;
    }
    .dash-char-battle-tip span {
      display: block;
      margin-top: 0.15rem;
      color: #e5e7eb;
    }
    .dash-char-battle-collect,
    .dash-char-battle-hint {
      display: none;
    }
    .dash-char-battle-stats,
    .dash-radar-pane,
    #dash-profile-pane-radar.dash-profile-pane {
      overflow: visible;
    }
    .jp-map-stage {
      position: relative;
      flex: 1;
      min-height: 200px;
      width: 100%;
      overflow: hidden;
    }
    .jp-map-stage .rpg-hud--tl { top: 12px; left: 12px; }
    .jp-map-stage .rpg-hud--tr { top: 12px; right: 12px; max-width: min(260px, 36vw); }
    .rpg-hud--profile {
      width: min(300px, 42vw);
      max-width: min(300px, 42vw);
      max-height: calc(100% - 24px);
      overflow-y: auto;
      overscroll-behavior: contain;
    }
    .rpg-hud--profile.rpg-hud--profile-expanded {
      max-height: calc(100% - 24px);
      z-index: 7;
    }
    .rpg-hud-profile-stats .dash-chart-label {
      font-size: 12px;
      color: #6b7280;
      margin: 0;
    }
    .dash-band-progress {
      display: flex;
      flex-direction: column;
      gap: 0.28rem;
    }
    .dash-band-progress__row {
      display: flex;
      align-items: center;
      gap: 0.35rem;
      font-size: 0.68rem;
      color: #4b5563;
      line-height: 1.25;
    }
    .dark .dash-band-progress__row { color: #9ca3af; }
    .dash-band-progress__dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      flex-shrink: 0;
    }
    .dash-band-progress__label {
      font-weight: 700;
      width: 1.6rem;
      flex-shrink: 0;
      color: #374151;
    }
    .dark .dash-band-progress__label { color: #e5e7eb; }
    .dash-band-progress__val {
      flex: 1;
      min-width: 0;
    }
    .dash-badge-scroll {
      max-height: 220px;
      overflow-y: auto;
      overflow-x: hidden;
      scrollbar-gutter: stable;
      scrollbar-width: thin;
    }
    .dash-badge-grid {
      display: grid;
      grid-template-columns: repeat(8, 28px);
      gap: 4px;
      width: max-content;
    }
    #dash-profile-pane-badges .dash-badge-scroll {
      max-height: min(42vh, 280px);
    }
    .dash-badge-label {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      white-space: nowrap;
      flex-wrap: nowrap;
    }
    .dash-badge-count {
      flex-shrink: 0;
      white-space: nowrap;
      font-variant-numeric: tabular-nums;
    }
    .dash-level-details__summary {
      list-style: none;
      white-space: nowrap;
    }
    .dash-level-details__summary::-webkit-details-marker { display: none; }
    .dark .rpg-hud-profile-stats .dash-chart-label { color: #9ca3af; }
    .rpg-hud-radar svg { width: 92px; height: 92px; }
    .adventure-journal-overlay {
      background: rgba(15, 23, 42, 0.72);
    }
    .adventure-journal-panel {
      background: #f1f5f9 !important;
      border: 1px solid rgba(148, 163, 184, 0.35);
    }
    .dark .adventure-journal-panel {
      background: #1e293b !important;
      border-color: rgba(71, 85, 105, 0.5);
    }
    .rpg-action-bar {
      position: absolute;
      z-index: 7;
      left: 50%;
      bottom: 14px;
      transform: translateX(-50%);
      display: flex;
      gap: 8px;
      align-items: center;
      padding: 6px 10px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.86);
      backdrop-filter: blur(10px);
      box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
    }
    .dark .rpg-action-bar {
      background: rgba(17, 24, 39, 0.86);
    }
    .rpg-action-btn {
      border: none;
      border-radius: 999px;
      padding: 8px 14px;
      font-size: 12px;
      font-weight: 600;
      color: #374151;
      background: rgba(243, 244, 246, 0.95);
      cursor: pointer;
      white-space: nowrap;
    }
    .dark .rpg-action-btn { color: #e5e7eb; background: rgba(55, 65, 81, 0.9); }
    .rpg-action-btn--primary {
      color: #fff;
      background: linear-gradient(90deg, #10B981, #06B6D4);
    }
    .jp-map-svg .prefecture.jp-pref-area--settled {
      stroke: #059669;
      stroke-width: calc(2.2 * var(--jp-stroke-inv, 1));
    }
    .jp-map-svg .prefecture.jp-pref-area--soft-lock {
      filter: grayscale(0.35);
    }
    .jp-map-svg .prefecture.jp-pref-area--current,
    .jp-map-svg .prefecture.jp-pref-area--daily {
      stroke: #0284C7;
      stroke-width: calc(2.4 * var(--jp-stroke-inv, 1));
      animation: jp-next-pulse 1.6s ease-in-out infinite;
    }
    @keyframes jp-next-pulse {
      0%, 100% { filter: drop-shadow(0 0 2px rgba(14, 165, 233, 0.4)); }
      50% { filter: drop-shadow(0 0 8px rgba(14, 165, 233, 0.9)); }
    }
    /* --jp-map-bg set by seasonal.js (season file, else map-bg.jpg). Tint layer only ? never use `background:` shorthand. */
    .jp-map-canvas.season-skin-winter {
      background-image: var(--jp-map-bg), linear-gradient(165deg, rgba(191, 219, 254, 0.55) 0%, rgba(226, 232, 240, 0.35) 55%, rgba(186, 230, 253, 0.2) 100%);
      background-size: cover, auto;
      background-position: center, center;
    }
    .jp-map-canvas.season-skin-spring {
      background-image: var(--jp-map-bg), linear-gradient(165deg, rgba(252, 231, 243, 0.55) 0%, rgba(254, 243, 199, 0.28) 50%, rgba(187, 247, 208, 0.18) 100%);
      background-size: cover, auto;
      background-position: center, center;
    }
    .jp-map-canvas.season-skin-summer {
      background-image: var(--jp-map-bg), linear-gradient(165deg, rgba(167, 243, 208, 0.4) 0%, rgba(186, 230, 253, 0.32) 45%, rgba(254, 249, 195, 0.2) 100%);
      background-size: cover, auto;
      background-position: center, center;
    }
    .jp-map-canvas.season-skin-autumn {
      background-image: var(--jp-map-bg), linear-gradient(165deg, rgba(254, 215, 170, 0.5) 0%, rgba(254, 243, 199, 0.3) 45%, rgba(253, 186, 116, 0.18) 100%);
      background-size: cover, auto;
      background-position: center, center;
    }
    @media (max-width: 640px) {
      .rpg-hud { max-width: min(180px, 46vw); }
      /* Wide floating cards only when NOT in chip/compact mode */
      .jp-map-stage:not(.map-hud-compact) .rpg-hud--tr { max-width: min(220px, 48vw); }
      .jp-map-stage:not(.map-hud-compact) .rpg-hud--tl,
      .jp-map-stage:not(.map-hud-compact) .rpg-hud--tr {
        top: max(8px, calc(var(--safe-top) * 0.35 + 8px));
      }
      .jp-map-stage:not(.map-hud-compact) .rpg-hud--tl { left: 8px; }
      .jp-map-stage:not(.map-hud-compact) .rpg-hud--tr { right: 8px; }
      .jp-map-stage:not(.map-hud-compact) .rpg-hud--profile {
        width: min(280px, 64vw);
        max-width: min(280px, 64vw);
      }
      .dash-radar-pane svg { width: 140px; height: 140px; }
      .dash-profile-pane { min-height: 0; }
      .dash-badge-grid { grid-template-columns: repeat(8, 28px); }
      .rpg-action-bar {
        bottom: max(10px, calc(var(--safe-bottom) * 0.15 + 10px));
        padding: 5px 8px;
      }
      .rpg-action-btn { padding: 7px 11px; font-size: 11px; }
    }

    /* Map HUD chips / sheets — desktop: chips hidden, body always shown.
       Compact: .map-hud-compact (JS, map stage ≤900px) or max-width 900px fallback. */
    .map-hud-chip,
    .map-hud-close,
    .map-hud-sheet-head--mobile-only,
    .map-hud-backdrop {
      display: none;
    }
    .map-hud-body { display: block; min-height: 0; }
    .adventure-log-hud .map-hud-sheet-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 0;
    }

    @media (max-width: 900px) {
      .jp-map-stage .map-hud-backdrop,
      .jp-map-stage.map-hud-compact .map-hud-backdrop {
        display: block;
        position: absolute;
        inset: 0;
        z-index: 8;
        border: none;
        padding: 0;
        margin: 0;
        background: rgba(15, 23, 42, 0.35);
        backdrop-filter: blur(2px);
        cursor: pointer;
      }
      .jp-map-stage .map-hud-backdrop.hidden,
      .jp-map-stage.map-hud-compact .map-hud-backdrop.hidden {
        display: none !important;
      }

      .jp-map-stage > .rpg-hud[data-map-hud],
      .jp-map-stage.map-hud-compact > .rpg-hud[data-map-hud] {
        max-width: none;
        width: auto;
        padding: 0;
        background: transparent !important;
        box-shadow: none !important;
        backdrop-filter: none;
        overflow: visible;
      }
      .jp-map-stage > .rpg-hud[data-map-hud] .map-hud-chip,
      .jp-map-stage.map-hud-compact > .rpg-hud[data-map-hud] .map-hud-chip {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        border: none;
        border-radius: 999px;
        padding: 8px 12px;
        font-size: 12px;
        font-weight: 700;
        line-height: 1.2;
        color: #374151;
        background: rgba(255, 255, 255, 0.92);
        box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
        backdrop-filter: blur(10px);
        cursor: pointer;
        white-space: nowrap;
        pointer-events: auto;
      }
      .dark .jp-map-stage > .rpg-hud[data-map-hud] .map-hud-chip,
      .dark .jp-map-stage.map-hud-compact > .rpg-hud[data-map-hud] .map-hud-chip {
        color: #e5e7eb;
        background: rgba(17, 24, 39, 0.92);
      }
      .map-hud-chip__badge {
        font-size: 10px;
        font-weight: 700;
        padding: 1px 6px;
        border-radius: 999px;
        background: rgba(16, 185, 129, 0.18);
        color: #047857;
      }
      .dark .map-hud-chip__badge {
        background: rgba(16, 185, 129, 0.28);
        color: #6ee7b7;
      }

      .jp-map-stage > .rpg-hud[data-map-hud]:not(.map-hud--open) .map-hud-body,
      .jp-map-stage.map-hud-compact > .rpg-hud[data-map-hud]:not(.map-hud--open) .map-hud-body {
        display: none !important;
      }
      .jp-map-stage > .rpg-hud[data-map-hud].map-hud--open,
      .jp-map-stage.map-hud-compact > .rpg-hud[data-map-hud].map-hud--open {
        z-index: 12;
        position: absolute;
        left: 8px;
        right: 8px;
        top: auto;
        bottom: 8px;
        width: auto;
        max-width: none;
        max-height: min(72%, calc(100% - 16px));
        padding: 0;
        border-radius: 16px;
        overflow: hidden;
        background: rgba(255, 255, 255, 0.96) !important;
        box-shadow: 0 10px 32px rgba(15, 23, 42, 0.18) !important;
        backdrop-filter: blur(12px);
        display: flex;
        flex-direction: column;
      }
      .dark .jp-map-stage > .rpg-hud[data-map-hud].map-hud--open,
      .dark .jp-map-stage.map-hud-compact > .rpg-hud[data-map-hud].map-hud--open {
        background: rgba(17, 24, 39, 0.96) !important;
      }
      .jp-map-stage > .rpg-hud[data-map-hud].map-hud--open .map-hud-chip,
      .jp-map-stage.map-hud-compact > .rpg-hud[data-map-hud].map-hud--open .map-hud-chip {
        display: none;
      }
      .jp-map-stage > .rpg-hud[data-map-hud].map-hud--open .map-hud-body,
      .jp-map-stage.map-hud-compact > .rpg-hud[data-map-hud].map-hud--open .map-hud-body {
        display: flex !important;
        flex-direction: column;
        min-height: 0;
        flex: 1;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 10px 12px 12px;
      }
      .map-hud-sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 6px;
        flex-shrink: 0;
      }
      .map-hud-sheet-head--mobile-only {
        display: flex;
      }
      .map-hud-sheet-head .rpg-hud__title,
      .map-hud-sheet-head .adventure-log__toggle {
        flex: 1;
        min-width: 0;
      }
      .map-hud-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        border: none;
        border-radius: 8px;
        background: rgba(243, 244, 246, 0.95);
        color: #4b5563;
        cursor: pointer;
        flex-shrink: 0;
      }
      .dark .map-hud-close {
        background: rgba(55, 65, 81, 0.9);
        color: #e5e7eb;
      }

      .jp-map-stage .rpg-hud--tl { top: 8px; left: 8px; }
      .jp-map-stage .rpg-hud--tr { top: 8px; right: 8px; }
      .jp-map-stage .rpg-hud--bl { bottom: 8px; left: 8px; max-width: none; max-height: none; }

      .rpg-hud--profile.map-hud--open,
      .scroll-hud.map-hud--open {
        width: auto;
        max-width: none;
      }
      #dash-profile-pane-radar.dash-profile-pane {
        min-height: 0;
      }
      .jp-map-stage .scroll-board,
      .jp-map-stage .shop-list {
        max-height: min(42vh, 280px) !important;
      }
    }

    /* JS compact class: same chip mode even if viewport > 900px but map stage is narrow */
    .jp-map-stage.map-hud-compact .map-hud-backdrop {
      display: block;
      position: absolute;
      inset: 0;
      z-index: 8;
      border: none;
      padding: 0;
      margin: 0;
      background: rgba(15, 23, 42, 0.35);
      backdrop-filter: blur(2px);
      cursor: pointer;
    }
    .jp-map-stage.map-hud-compact .map-hud-backdrop.hidden {
      display: none !important;
    }
    .jp-map-stage.map-hud-compact > .rpg-hud[data-map-hud] {
      max-width: none;
      width: auto;
      padding: 0;
      background: transparent !important;
      box-shadow: none !important;
      backdrop-filter: none;
      overflow: visible;
    }
    .jp-map-stage.map-hud-compact > .rpg-hud[data-map-hud] .map-hud-chip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      border: none;
      border-radius: 999px;
      padding: 8px 12px;
      font-size: 12px;
      font-weight: 700;
      line-height: 1.2;
      color: #374151;
      background: rgba(255, 255, 255, 0.92);
      box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
      backdrop-filter: blur(10px);
      cursor: pointer;
      white-space: nowrap;
      pointer-events: auto;
    }
    .dark .jp-map-stage.map-hud-compact > .rpg-hud[data-map-hud] .map-hud-chip {
      color: #e5e7eb;
      background: rgba(17, 24, 39, 0.92);
    }
    .jp-map-stage.map-hud-compact > .rpg-hud[data-map-hud]:not(.map-hud--open) .map-hud-body {
      display: none !important;
    }
    .jp-map-stage.map-hud-compact > .rpg-hud[data-map-hud].map-hud--open {
      z-index: 12;
      position: absolute;
      left: 8px;
      right: 8px;
      top: auto;
      bottom: 8px;
      width: auto;
      max-width: none;
      max-height: min(72%, calc(100% - 16px));
      padding: 0;
      border-radius: 16px;
      overflow: hidden;
      background: rgba(255, 255, 255, 0.96) !important;
      box-shadow: 0 10px 32px rgba(15, 23, 42, 0.18) !important;
      backdrop-filter: blur(12px);
      display: flex;
      flex-direction: column;
    }
    .dark .jp-map-stage.map-hud-compact > .rpg-hud[data-map-hud].map-hud--open {
      background: rgba(17, 24, 39, 0.96) !important;
    }
    .jp-map-stage.map-hud-compact > .rpg-hud[data-map-hud].map-hud--open .map-hud-chip {
      display: none;
    }
    .jp-map-stage.map-hud-compact > .rpg-hud[data-map-hud].map-hud--open .map-hud-body {
      display: flex !important;
      flex-direction: column;
      min-height: 0;
      flex: 1;
      overflow-y: auto;
      overscroll-behavior: contain;
      padding: 10px 12px 12px;
    }
    .jp-map-stage.map-hud-compact .map-hud-sheet-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 6px;
      flex-shrink: 0;
    }
    .jp-map-stage.map-hud-compact .map-hud-sheet-head--mobile-only {
      display: flex;
    }
    .jp-map-stage.map-hud-compact .map-hud-close {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 28px;
      height: 28px;
      border: none;
      border-radius: 8px;
      background: rgba(243, 244, 246, 0.95);
      color: #4b5563;
      cursor: pointer;
      flex-shrink: 0;
    }
    .dark .jp-map-stage.map-hud-compact .map-hud-close {
      background: rgba(55, 65, 81, 0.9);
      color: #e5e7eb;
    }
    .jp-map-stage.map-hud-compact .rpg-hud--tl { top: 8px; left: 8px; }
    .jp-map-stage.map-hud-compact .rpg-hud--tr { top: 8px; right: 8px; }
    .jp-map-stage.map-hud-compact .rpg-hud--bl { bottom: 8px; left: 8px; max-width: none; max-height: none; }
    .jp-map-stage.map-hud-compact .rpg-hud--profile.map-hud--open,
    .jp-map-stage.map-hud-compact .scroll-hud.map-hud--open {
      width: auto;
      max-width: none;
    }
    .jp-map-stage.map-hud-compact #dash-profile-pane-radar.dash-profile-pane {
      min-height: 0;
    }
    .jp-map-stage.map-hud-compact .scroll-board,
    .jp-map-stage.map-hud-compact .shop-list {
      max-height: min(42vh, 280px) !important;
    }

    .jp-map-toolbar {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 10px;
      flex-shrink: 0;
    }
    .jp-map-title { flex-shrink: 0; margin-right: auto; }
    .jp-chapter-clear-overlay {
      position: fixed;
      inset: 0;
      z-index: 90;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 1.25rem;
      background: rgba(15, 23, 42, 0.65);
      backdrop-filter: blur(6px);
    }
    .jp-chapter-clear-card {
      max-width: 22rem;
      width: 100%;
      padding: 1.5rem 1.35rem;
      text-align: center;
      border-radius: 1rem;
    }
    .jp-chapter-clear-eyebrow {
      font-size: 0.72rem;
      font-weight: 600;
      color: #059669;
      margin: 0 0 0.35rem;
      letter-spacing: 0.04em;
    }
    .jp-chapter-clear-title {
      font-size: 1.25rem;
      font-weight: 700;
      margin: 0 0 0.5rem;
      color: #111827;
    }
    .dark .jp-chapter-clear-title { color: #f9fafb; }
    .jp-chapter-clear-msg {
      font-size: 0.95rem;
      font-weight: 600;
      color: #4f46e5;
      margin: 0 0 0.35rem;
    }
    .jp-map-canvas {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      min-height: 0;
      margin: 0;
      border-radius: 12px;
      --jp-map-bg: url('../data/ui/map-bg.jpg');
      background-image: var(--jp-map-bg), linear-gradient(165deg, rgba(186, 230, 253, 0.45) 0%, rgba(224, 242, 254, 0.28) 45%, rgba(167, 243, 208, 0.14) 100%);
      background-size: cover, auto;
      background-position: center, center;
      overflow: hidden;
      touch-action: none;
      cursor: grab;
      user-select: none;
    }
    .jp-map-canvas--dragging { cursor: grabbing; }
    .jp-map-canvas--zoomed { cursor: grab; }
    .jp-map-world {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      transform-origin: center center;
    }
    .jp-map-zoom-controls {
      display: flex;
      gap: 4px;
      margin-left: auto;
      flex-shrink: 0;
    }
    .jp-map-zoom-btn {
      width: 28px;
      height: 28px;
      border: none;
      border-radius: 8px;
      background: rgba(243, 244, 246, 0.95);
      color: #4b5563;
      cursor: pointer;
      font-size: 11px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .dark .jp-map-zoom-btn {
      background: rgba(55, 65, 81, 0.9);
      color: #e5e7eb;
    }
    .jp-map-zoom-btn:hover { filter: brightness(0.96); }
    .jp-map-svg {
      display: block;
      width: 100%;
      height: 100%;
    }
    .jp-map-svg .prefecture {
      cursor: pointer;
      stroke: rgba(30, 41, 59, 0.78);
      /* --jp-stroke-inv ?? world CSS scale?? zoom ???????? */
      stroke-width: calc(1.55 * var(--jp-stroke-inv, 1));
      transition: fill 0.15s ease, stroke 0.15s ease, filter 0.15s ease;
    }
    .jp-map-svg .prefecture polygon,
    .jp-map-svg .prefecture path {
      fill: inherit;
      stroke: inherit;
      stroke-width: inherit;
      stroke-dasharray: inherit;
      stroke-linecap: inherit;
      stroke-linejoin: inherit;
      vector-effect: non-scaling-stroke;
    }
    .jp-map-canvas--detail .jp-map-svg .prefecture {
      stroke: rgba(15, 23, 42, 0.88);
      stroke-width: calc(1.7 * var(--jp-stroke-inv, 1));
    }
    .jp-map-svg .prefecture.jp-pref-area--locked {
      cursor: not-allowed;
      opacity: 0.45;
    }
    /* ?????????????? */
    .jp-map-svg .prefecture.jp-pref-area--conquered,
    .jp-map-svg .prefecture.jp-pref-area--settled {
      stroke: #F59E0B;
      stroke-width: calc(2.2 * var(--jp-stroke-inv, 1));
    }
    /* ??????? */
    .jp-map-svg .prefecture.jp-pref-area--current {
      stroke: #1E3A8A;
      stroke-width: calc(2.35 * var(--jp-stroke-inv, 1));
    }
    /* SPOT???????????????????? */
    .jp-map-svg .prefecture.jp-pref-area--spot {
      fill: #F59E0B !important;
      fill-opacity: 0.92 !important;
      stroke: #D97706;
      stroke-width: calc(2.5 * var(--jp-stroke-inv, 1));
      stroke-dasharray: none;
      stroke-linecap: round;
      stroke-linejoin: round;
      animation: jp-spot-glow 1.8s ease-in-out infinite !important;
      z-index: 2;
    }
    @keyframes jp-spot-glow {
      0%, 100% { filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.5)); }
      50% { filter: drop-shadow(0 0 14px rgba(245, 158, 11, 0.95)); }
    }
    .jp-map-html-label--next {
      color: #92400E;
    }
    .jp-map-html-labels {
      position: absolute;
      inset: 0;
      pointer-events: none;
      z-index: 7;
    }
    .jp-map-html-label {
      position: absolute;
      /* ????????? --label-zoom ???????? */
      transform: translate(-50%, -50%) scale(var(--label-zoom, 1));
      transform-origin: center center;
      font-size: 1.05rem;
      font-weight: 700;
      line-height: 1.15;
      color: #1f2937;
      opacity: 0.38;
      text-shadow:
        0 0 3px rgba(255,255,255,0.65),
        0 0 5px rgba(255,255,255,0.4);
      white-space: nowrap;
      pointer-events: none;
    }
    .dark .jp-map-html-label {
      color: #f9fafb;
      opacity: 0.35;
      text-shadow:
        0 0 3px rgba(17,24,39,0.65),
        0 0 5px rgba(17,24,39,0.4);
    }
    .jp-map-label {
      display: none;
    }
    .jp-map-legend {
      display: flex;
      flex-wrap: nowrap;
      gap: 6px 10px;
      padding: 4px 10px 8px;
      font-size: 0.65rem;
      color: #6b7280;
      flex-shrink: 0;
      position: relative;
      z-index: 4;
      overflow-x: auto;
      white-space: nowrap;
    }
    .dark .jp-map-legend { color: #9ca3af; }
    .jp-map-legend-item {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      flex-shrink: 0;
      white-space: nowrap;
    }
    .jp-map-legend-item--hint {
      color: #B45309;
      font-weight: 600;
    }
    .dark .jp-map-legend-item--hint { color: #FBBF24; }
    .jp-map-legend-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
    }
    .jp-map-legend-swatch {
      width: 10px;
      height: 8px;
      border-radius: 2px;
      flex-shrink: 0;
      display: inline-block;
    }
    .jp-pref-node {
      position: absolute;
      transform: translate(-50%, -50%);
      width: 20px;
      height: 20px;
      border-radius: 6px;
      border: 2px solid rgba(255, 255, 255, 0.75);
      cursor: pointer;
      transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.5rem;
      font-weight: 700;
      color: #fff;
      text-shadow: 0 1px 2px rgba(0,0,0,0.3);
      z-index: 2;
      padding: 0;
      line-height: 1;
    }
    .jp-pref-node:hover {
      transform: translate(-50%, -50%) scale(1.15);
      z-index: 5;
      box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    }
    .jp-pref-node--locked {
      opacity: 0.35;
      filter: grayscale(0.6);
      cursor: not-allowed;
    }
    .jp-pref-node--conquered {
      box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.8);
    }
    .jp-pref-node--current {
      animation: jp-map-pulse 1.5s ease-in-out infinite;
      box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.6);
    }
    .jp-pref-node--boss {
      width: 24px;
      height: 24px;
      border-radius: 8px;
      font-size: 0.55rem;
      box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
    }
    .jp-pref-node--boss::after {
      content: '??';
      position: absolute;
      top: -9px;
      right: -7px;
      font-size: 0.55rem;
      pointer-events: none;
    }
    .jp-pref-node--boss-done::after {
      content: '??';
      position: absolute;
      top: -9px;
      right: -7px;
      font-size: 0.55rem;
      pointer-events: none;
    }
    .jp-pref-node--secret {
      border-style: dashed;
    }
    .jp-pref-tooltip {
      position: fixed;
      inset: 0;
      z-index: 250;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(0,0,0,0.35);
      backdrop-filter: blur(4px);
      padding: 1rem;
    }
    .jp-pref-modal {
      max-width: 28rem;
      width: calc(100% - 2rem);
      max-height: 90vh;
      overflow-y: auto;
    }
    .jp-pref-modal--split {
      max-width: min(52rem, calc(100vw - 2rem));
      text-align: left;
      padding: 1.5rem;
    }
    .jp-pref-split {
      display: grid;
      grid-template-columns: 1fr 1.25fr;
      gap: 1.25rem;
      align-items: start;
    }
    @media (max-width: 640px) {
      .jp-pref-split { grid-template-columns: 1fr; }
    }
    .jp-pref-close {
      border: none;
      background: transparent;
      font-size: 1.25rem;
      line-height: 1;
      cursor: pointer;
      margin-left: auto;
      padding: 0 4px;
    }
    .jp-pref-carousel {
      position: relative;
      width: 100%;
      aspect-ratio: 4 / 3;
      border-radius: 12px;
      overflow: hidden;
      background: #e5e7eb;
      cursor: zoom-in;
    }
    .jp-pref-carousel-img {
      position: absolute;
      inset: 0;
      z-index: 1;
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      cursor: zoom-in;
      pointer-events: auto;
    }
    .jp-pref-lightbox {
      position: fixed;
      inset: 0;
      z-index: 400;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(0, 0, 0, 0.82);
      backdrop-filter: blur(6px);
      padding: 1rem;
      cursor: zoom-out;
    }
    .jp-pref-lightbox-inner {
      position: relative;
      max-width: min(96vw, 1600px);
      max-height: 92vh;
      cursor: default;
    }
    .jp-pref-lightbox-img {
      display: block;
      max-width: 96vw;
      max-height: 92vh;
      width: auto;
      height: auto;
      object-fit: contain;
      border-radius: 8px;
      box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    }
    .jp-pref-lightbox-close {
      position: absolute;
      top: -10px;
      right: -10px;
      width: 32px;
      height: 32px;
      border: none;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.92);
      color: #374151;
      font-size: 1.25rem;
      line-height: 1;
      cursor: pointer;
      z-index: 1;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    }
    .jp-pref-lightbox-close:hover {
      background: #fff;
      color: #111827;
    }
    .jp-pref-carousel-placeholder {
      position: absolute;
      inset: 0;
      z-index: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.5rem;
      font-weight: 700;
      color: rgba(55, 65, 81, 0.55);
      pointer-events: none;
    }
    .jp-pref-carousel-nav {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      width: 28px;
      height: 28px;
      border: none;
      border-radius: 999px;
      background: rgba(255,255,255,0.85);
      cursor: pointer;
      font-size: 1rem;
      line-height: 1;
      z-index: 3;
      pointer-events: auto;
    }
    .jp-pref-carousel-prev { left: 6px; }
    .jp-pref-carousel-next { right: 6px; }
    .jp-pref-carousel-dots {
      position: absolute;
      bottom: 6px;
      left: 0;
      right: 0;
      display: flex;
      justify-content: center;
      gap: 4px;
      z-index: 2;
      pointer-events: none;
    }
    .jp-pref-dot {
      width: 6px;
      height: 6px;
      border-radius: 999px;
      background: rgba(255,255,255,0.55);
    }
    .jp-pref-dot--active { background: #fff; }
    .jp-pref-section-title {
      font-size: 12px;
      font-weight: 700;
      color: #6b7280;
      margin: 0 0 4px;
    }
    .jp-pref-intro {
      margin: 0 0 12px;
      padding: 10px 12px;
      border-radius: 12px;
      background: rgba(236, 72, 153, 0.08);
      border: 1px solid rgba(236, 72, 153, 0.18);
    }
    .dark .jp-pref-intro {
      background: rgba(244, 114, 182, 0.12);
      border-color: rgba(244, 114, 182, 0.22);
    }
    .jp-pref-intro-text {
      margin: 0;
      font-size: 13px;
      line-height: 1.55;
      color: #4b5563;
    }
    .dark .jp-pref-intro-text { color: #d1d5db; }
    .jp-pref-intro-text .font-jp {
      color: #be185d;
      font-weight: 600;
    }
    .dark .jp-pref-intro-text .font-jp { color: #f9a8d4; }
    .jp-pref-bars { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
    .jp-pref-bar-row {
      display: grid;
      grid-template-columns: 2.5rem 1fr 2.25rem;
      gap: 6px;
      align-items: center;
    }
    .jp-pref-bar-label { font-size: 11px; font-weight: 600; }
    .jp-pref-bar-track {
      height: 8px;
      border-radius: 999px;
      background: rgba(156, 163, 175, 0.25);
      overflow: hidden;
    }
    .jp-pref-bar-fill {
      height: 100%;
      border-radius: 999px;
      transition: width 0.3s ease;
    }
    .jp-pref-bar-pct {
      font-size: 11px;
      color: #6b7280;
      text-align: right;
      font-variant-numeric: tabular-nums;
    }
    .jp-pref-quest-chip {
      font-size: 12px;
      padding: 4px 8px;
      border-radius: 8px;
      background: rgba(16, 185, 129, 0.12);
      color: #047857;
      margin: 6px 0;
    }
    .dark .jp-pref-quest-chip { color: #6ee7b7; background: rgba(16, 185, 129, 0.18); }
    .jp-pref-stars { letter-spacing: 1px; }
    .jp-pref-star { color: #d1d5db; font-size: 12px; }
    .jp-pref-star--on { color: #F59E0B; }
    .jp-pref-soft-warn {
      font-size: 11px;
      color: #B45309;
      background: rgba(251, 191, 36, 0.15);
      padding: 4px 8px;
      border-radius: 8px;
      margin: 4px 0 6px;
    }
    .jp-pref-next-chip {
      font-size: 11px;
      color: #92400E;
      font-weight: 600;
      margin: 2px 0 4px;
    }
    .jp-boss-ready {
      margin: 8px 0;
      padding: 8px 10px;
      border-radius: 10px;
      background: rgba(239, 68, 68, 0.08);
      border: 1px solid rgba(239, 68, 68, 0.2);
    }
    .jp-boss-ready-bar {
      height: 8px;
      border-radius: 999px;
      background: rgba(156, 163, 175, 0.3);
      overflow: hidden;
      margin-top: 4px;
    }
    .jp-boss-ready-fill {
      height: 100%;
      border-radius: 999px;
      background: linear-gradient(90deg, #EF4444, #F59E0B);
      transition: width 0.3s ease;
    }
    .jp-boss-dialogue {
      font-size: 12px;
      color: #6b7280;
      margin-top: 6px;
      font-style: italic;
      line-height: 1.4;
    }
    .dark .jp-boss-dialogue { color: #9ca3af; }
    .jp-pref-radar-mini {
      width: 140px;
      height: 140px;
      margin: 0 auto;
    }
    .jp-pref-radar-mini svg { width: 100%; height: 100%; }
    .jp-pref-vocab-chip {
      display: inline-flex;
      align-items: center;
      gap: 2px;
      padding: 2px 4px 2px 8px;
      border-radius: 9999px;
      font-size: 0.75rem;
      background: rgba(128,128,128,0.1);
      border: 1px solid rgba(128,128,128,0.15);
    }
    .jp-pref-vocab-chip:hover { background: rgba(128,128,128,0.18); }
    .jp-pref-vocab-chip--collected {
      background: rgba(16, 185, 129, 0.12);
      border-color: rgba(16, 185, 129, 0.35);
    }
    .dark .jp-pref-vocab-chip--collected {
      background: rgba(16, 185, 129, 0.18);
      border-color: rgba(52, 211, 153, 0.4);
    }
    .jp-pref-vocab-mark {
      color: #059669;
      font-size: 0.55rem;
      margin-right: 1px;
    }
    .dark .jp-pref-vocab-mark { color: #6ee7b7; }
    .jp-pref-vocab-word {
      border: none;
      background: transparent;
      padding: 0;
      margin: 0;
      font: inherit;
      color: inherit;
      cursor: pointer;
      line-height: 1.3;
    }
    .jp-pref-vocab-add {
      border: none;
      background: rgba(16, 185, 129, 0.18);
      color: #047857;
      width: 1.15rem;
      height: 1.15rem;
      border-radius: 9999px;
      font-size: 0.7rem;
      font-weight: 700;
      line-height: 1;
      padding: 0;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .jp-pref-vocab-add:hover { background: rgba(16, 185, 129, 0.32); }
    .dark .jp-pref-vocab-add { color: #6ee7b7; background: rgba(16, 185, 129, 0.22); }
    .jp-pref-vocab-add--done {
      background: rgba(16, 185, 129, 0.28);
      color: #047857;
      cursor: default;
      font-size: 0.55rem;
    }
    .jp-pref-vocab-add--done:hover { background: rgba(16, 185, 129, 0.28); }
    .dark .jp-pref-vocab-add--done { color: #a7f3d0; background: rgba(16, 185, 129, 0.3); }
    .jp-pref-node--daily::before {
      content: '??';
      position: absolute;
      top: -11px;
      left: 50%;
      transform: translateX(-50%);
      font-size: 0.6rem;
      animation: jp-map-bounce 1s ease infinite;
      pointer-events: none;
    }
    @keyframes jp-map-pulse {
      0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.4); }
      50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.15); }
    }
    @keyframes jp-map-bounce {
      0%, 100% { transform: translateX(-50%) translateY(0); }
      50% { transform: translateX(-50%) translateY(-3px); }
    }
    .jp-band-label {
      position: absolute;
      left: 4px;
      font-size: 0.6rem;
      font-weight: 700;
      opacity: 0.5;
      pointer-events: none;
      z-index: 1;
    }
    .dash-profile-card {
      min-height: 0;
    }
    .dash-profile-split {
      display: grid;
      grid-template-columns: 1fr;
      gap: var(--space-3);
      height: 100%;
      min-height: 0;
    }
    @media (min-width: 768px) {
      .dash-profile-split {
        grid-template-columns: 1fr 1fr;
      }
    }
    .dash-profile-left,
    .dash-profile-right {
      min-width: 0;
      min-height: 0;
      display: flex;
      flex-direction: column;
    }
    .dash-profile-right .dash-chart-trio {
      border-top: none;
      padding-top: 0;
      margin-top: 0;
    }
    .dash-zone-header {
      display: flex;
      flex-direction: column;
      gap: var(--space-3);
    }
    .dash-welcome-block {
      min-width: 0;
    }
    /* Seasonal banner inside atlas */
    .dash-seasonal-banner,
    .dash-atlas-season {
      width: 100%;
      overflow: visible;
    }
    .dash-seasonal-banner-inner {
      padding: 14px 16px 20px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .dash-seasonal-details {
      display: flex;
      flex-direction: column;
      gap: 10px;
      min-height: 0;
    }
    /* Must beat .dash-seasonal-nav-btn { display: inline-flex } specificity */
    .dash-seasonal-nav-btn.dash-seasonal-toggle {
      display: none;
    }
    @media (max-width: 768px) {
      .dash-seasonal-banner-inner {
        padding: 8px 12px 10px;
        gap: 6px;
      }
      .dash-seasonal-nav-btn.dash-seasonal-toggle {
        display: inline-flex;
      }
      .dash-atlas-season.dash-seasonal--collapsed .dash-seasonal-details {
        display: none;
      }
      .dash-atlas-season:not(.dash-seasonal--collapsed) .dash-seasonal-toggle i {
        transform: rotate(180deg);
      }
      .dash-atlas-season:not(.dash-seasonal--collapsed) {
        max-height: min(42vh, 260px);
        overflow-y: auto;
        overscroll-behavior: contain;
        z-index: 3;
      }
    }
    .dash-seasonal-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
    }
    .dash-seasonal-title-row {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
    }
    .dash-seasonal-nav {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;
    }
    .dash-seasonal-nav-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 28px;
      height: 28px;
      padding: 0 8px;
      border-radius: 9999px;
      background: rgba(255, 255, 255, 0.35);
      border: 1px solid rgba(128, 128, 128, 0.15);
      color: #4b5563;
      font-size: 0.75rem;
      transition: background 0.2s;
      cursor: pointer;
    }
    .dash-seasonal-nav-btn:hover {
      background: rgba(255, 255, 255, 0.55);
    }
    .dark .dash-seasonal-nav-btn {
      background: rgba(255, 255, 255, 0.08);
      border-color: rgba(255, 255, 255, 0.12);
      color: #d1d5db;
    }
    .dark .dash-seasonal-nav-btn:hover {
      background: rgba(255, 255, 255, 0.14);
    }
    .dash-seasonal-desc {
      line-height: 1.55;
      margin: 0;
    }
    .dash-seasonal-vocab-block {
      border-top: 1px solid rgba(128, 128, 128, 0.15);
      padding-top: 10px;
      padding-bottom: 10px;
    }
    #seasonal-vocab {
      padding-bottom: 2px;
    }
    @media (min-width: 1024px) {
      #view-dashboard:not(.hidden) {
        height: calc(100vh - 4rem);
        max-height: calc(100vh - 4rem);
        overflow: hidden;
      }
      .dash-layout {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr);
        height: 100%;
        max-height: 100%;
        overflow: hidden;
        gap: var(--space-2);
      }
      .dash-layout--rpg {
        grid-template-rows: minmax(0, 1fr);
      }
      .dash-atlas-card {
        min-height: 0;
        overflow: hidden;
        grid-template-rows: auto 1fr;
      }
      .dash-atlas-season {
        overflow: visible;
      }
      .dash-profile-card {
        min-height: 0;
        overflow: hidden;
      }
      .jp-map-panel {
        min-height: 0;
      }
      .jp-map-canvas {
        min-height: 220px;
      }
      .dash-seasonal-banner-inner {
        padding: 8px 12px 10px;
        gap: 4px;
      }
      .dash-seasonal-desc {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 0.75rem;
        line-height: 1.4;
      }
      .dash-seasonal-vocab-block {
        padding-top: 6px;
        padding-bottom: 6px;
        position: relative;
        z-index: 2;
      }
      #seasonal-vocab {
        padding-bottom: 4px;
        max-height: none;
        overflow: visible;
      }
      .dash-chart-trio {
        min-height: 0;
      }
      .dash-badge-strip {
        max-height: 40px;
      }
      .jp-map-canvas {
        min-height: 120px;
      }
    }
    .dash-panel-profile,
    .dash-panel-daily,
    .dash-panel-boss,
    .dash-panel-weakness,
    .dash-panel-levels {
      overflow: visible;
    }
    .dash-insight-row {
      display: grid;
      grid-template-columns: 1fr;
      gap: var(--space-3);
    }
    @media (min-width: 640px) {
      .dash-insight-row {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-3);
        align-items: stretch;
      }
    }
    @media (min-width: 1024px) {
      .dash-panel-daily,
      .dash-panel-boss,
      .dash-panel-weakness,
      .dash-panel-levels {
        overflow: hidden;
      }
      .dash-panel-levels .dash-level-list {
        overflow: visible;
      }
    }
    .dash-panel-profile {
      display: flex;
      flex-direction: column;
      min-height: 0;
    }
    .dash-panel-weakness,
    .dash-panel-levels {
      display: flex;
      flex-direction: column;
      min-height: 0;
      height: 100%;
    }
    .dash-profile-upper {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
      padding-bottom: 4px;
    }
    @media (min-width: 1024px) {
      .dash-profile-upper {
        display: grid;
        grid-template-columns: auto auto minmax(140px, 1fr) auto auto;
        align-items: center;
        gap: 16px;
        flex-wrap: nowrap;
      }
      .dash-profile-today-stats {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        min-width: 0;
      }
    }
    .dash-profile-today-stats { min-width: 160px; }
    .dash-badge-zone {
      flex-shrink: 0;
    }
    .dash-badge-strip {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      align-items: center;
      max-height: 72px;
      overflow: hidden;
    }
    .dash-badge-strip .badge-strip-icon {
      width: 28px;
      height: 28px;
      flex-shrink: 0;
      cursor: default;
      opacity: 0.35;
      transition: opacity 0.2s;
    }
    .dash-badge-strip .badge-strip-icon.unlocked { opacity: 1; }
    .dash-badge-strip .badge-strip-icon svg { width: 24px; height: 24px; display: block; }
    .dash-chart-trio {
      display: grid;
      grid-template-columns: 1fr;
      gap: var(--space-2);
      min-height: 0;
      flex: 1;
    }
    @media (min-width: 640px) {
      .dash-chart-trio { grid-template-columns: 1fr 1fr; }
    }
    @media (min-width: 1024px) {
      .dash-chart-trio {
        min-height: 0;
        flex: 1;
      }
      .dash-chart-label {
        font-size: 0.7rem;
        margin-bottom: 4px;
      }
      .dash-chart-body {
        min-height: 0;
        max-height: none;
      }
    }
    .dash-chart-stack {
      display: flex;
      flex-direction: column;
      gap: var(--space-2);
      min-height: 0;
      height: 100%;
    }
    .dash-chart-stack .dash-chart-cell {
      border-left: none;
      padding-left: 0;
    }
    .dash-chart-stack .dash-chart-cell + .dash-chart-cell {
      border-top: 1px solid rgba(128, 128, 128, 0.15);
      padding-top: var(--space-2);
    }
    .dash-chart-cell {
      display: flex;
      flex-direction: column;
      min-height: 0;
      height: 100%;
      border-left: 1px solid rgba(128, 128, 128, 0.15);
      padding-left: 8px;
    }
    .dash-chart-cell--radar {
      overflow: visible;
      border-left: none;
      padding-left: 0;
    }
    @media (min-width: 640px) {
      .dash-chart-cell--radar {
        border-left: 1px solid rgba(128, 128, 128, 0.15);
        padding-left: 8px;
      }
    }
    .dash-chart-label {
      font-size: 0.65rem;
      font-weight: 600;
      color: var(--text-muted, #9ca3af);
      margin-bottom: 4px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .dash-chart-body {
      flex: 1;
      min-height: 100px;
      max-height: 140px;
      overflow: hidden;
    }
    @media (min-width: 1024px) {
      .dash-chart-body {
        min-height: 0;
        max-height: none;
      }
    }
    #dash-radar.dash-chart-body {
      max-height: none;
      min-height: 110px;
      overflow: visible;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }
    @media (min-width: 1024px) {
      #dash-radar.dash-chart-body {
        min-height: 0;
      }
    }
    .dash-radar-svg {
      display: block;
      width: 100%;
      height: auto;
      max-height: 110px;
    }
    @media (min-width: 1024px) {
      .dash-radar-svg {
        max-height: none;
        flex: 1;
        min-height: 100px;
      }
    }
    .dash-radar-legend {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 2px 4px;
      margin-top: 4px;
      font-size: 0.6rem;
      line-height: 1.2;
    }
    .dash-radar-legend-item {
      display: flex;
      align-items: center;
      gap: 3px;
      color: var(--text-muted, #9ca3af);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .dash-radar-legend-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      flex-shrink: 0;
    }
    .dash-insight-split {
      display: grid;
      grid-template-columns: 1fr;
      gap: var(--space-3);
    }
    @media (min-width: 640px) {
      .dash-insight-split {
        grid-template-columns: 1fr 1fr;
        align-items: start;
      }
    }
    .dash-insight-col {
      display: flex;
      flex-direction: column;
      min-width: 0;
    }
    .dash-scroll-body {
      max-height: 180px;
      overflow-y: auto;
      scrollbar-width: thin;
      flex: 1;
      min-height: 0;
    }
    .dash-insight-body {
      overflow: hidden;
      flex: 1;
      min-height: 0;
    }
    .dash-insight-heading {
      line-height: 1.3;
    }
    .dash-weak-chip {
      display: inline-flex;
      align-items: center;
      padding: 2px 8px;
      border-radius: 9999px;
      font-size: 0.625rem;
      font-weight: 600;
      line-height: 1.4;
      border: 1px solid rgba(0, 0, 0, 0.08);
      background: rgba(255, 255, 255, 0.5);
      color: #6b7280;
      transition: background 0.15s, color 0.15s, border-color 0.15s;
    }
    .dark .dash-weak-chip {
      border-color: rgba(255, 255, 255, 0.12);
      background: rgba(255, 255, 255, 0.06);
      color: #9ca3af;
    }
    .dash-weak-chip:hover {
      background: rgba(255, 255, 255, 0.75);
      color: #374151;
    }
    .dark .dash-weak-chip:hover {
      background: rgba(255, 255, 255, 0.1);
      color: #e5e7eb;
    }
    .dash-weak-chip-primary {
      border-color: rgba(239, 68, 68, 0.25);
      background: rgba(239, 68, 68, 0.1);
      color: #dc2626;
    }
    .dark .dash-weak-chip-primary {
      border-color: rgba(248, 113, 113, 0.3);
      background: rgba(239, 68, 68, 0.15);
      color: #f87171;
    }
    .dash-weak-chip-primary:hover {
      background: rgba(239, 68, 68, 0.18);
      color: #b91c1c;
    }
    .dark .dash-weak-chip-primary:hover {
      background: rgba(239, 68, 68, 0.25);
      color: #fca5a5;
    }
    .dash-mastery-legend {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 2px 5px;
      font-size: 0.55rem;
      font-weight: 500;
      color: #9ca3af;
    }
    @media (min-width: 640px) {
      .dash-insight-heading {
        flex-direction: row;
        align-items: center;
      }
      .dash-mastery-legend {
        margin-top: 0;
        justify-content: flex-end;
        flex: 1;
      }
    }
    .dash-insight-title-block {
      display: flex;
      flex-direction: column;
      gap: 2px;
      min-width: 0;
      flex: 1;
    }
    @media (min-width: 900px) {
      .dash-insight-title-block {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
      }
      .dash-mastery-legend {
        flex: 0 1 auto;
      }
    }
    .weak-item {
      display: grid;
      grid-template-columns: 1.1rem minmax(0, 1fr) 2.75rem 1.1rem;
      align-items: center;
      gap: 6px;
      padding: 4px 2px;
      border-radius: 8px;
      cursor: pointer;
    }
    .weak-item:hover {
      background: rgba(128, 128, 128, 0.08);
    }
    .weak-item-rank {
      font-size: 0.62rem;
      color: #9ca3af;
      text-align: center;
      font-variant-numeric: tabular-nums;
    }
    .weak-item-label {
      font-size: 0.75rem;
      color: #1f2937;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .dark .weak-item-label { color: #f3f4f6; }
    .weak-item-bar {
      height: 6px;
      border-radius: 9999px;
      background: #e5e7eb;
      overflow: hidden;
    }
    .dark .weak-item-bar { background: #374151; }
    .weak-item-bar > div {
      height: 100%;
      background: #ef4444;
      border-radius: 9999px;
    }
    .weak-item-count {
      font-size: 0.62rem;
      font-weight: 600;
      color: #ef4444;
      text-align: right;
      font-variant-numeric: tabular-nums;
    }
    .dash-mastery-tag {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      white-space: nowrap;
    }
    .dash-mastery-swatch {
      display: inline-block;
      width: 8px;
      height: 8px;
      border-radius: 2px;
      flex-shrink: 0;
    }
    .dash-levels-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 6px;
    }
    .dash-level-list {
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 5px;
      flex: 1;
      min-height: 0;
      overflow: visible;
      padding: 10px 6px;
    }
    .dash-level-row {
      display: grid;
      grid-template-columns: 1.85rem minmax(0, 1fr) auto;
      align-items: center;
      gap: 8px;
      min-height: 22px;
    }
    .dash-level-lv {
      font-size: 0.75rem;
      font-weight: 600;
      color: #374151;
    }
    .dark .dash-level-lv { color: #e5e7eb; }
    .dash-level-bar {
      display: flex;
      height: 11px;
      border-radius: 9999px;
      overflow: hidden;
      background: #f3f4f6;
    }
    .dark .dash-level-bar { background: #1f2937; }
    .dash-level-stat {
      font-size: 0.65rem;
      color: #9ca3af;
      white-space: nowrap;
      font-variant-numeric: tabular-nums;
    }
    .dash-quest-tasks {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    /* Season banner (replaces collapsible chip) */
    .dash-seasonal-header { position: relative; }
    .dash-panel-boss {
      border: 1px solid rgba(239, 68, 68, 0.2);
      background: linear-gradient(135deg, rgba(239, 68, 68, 0.07), rgba(239, 68, 68, 0.02));
    }
    .dark .dash-panel-boss {
      border-color: rgba(239, 68, 68, 0.24);
      background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.04));
    }

    .dash-daily-banner {
      border: 1px solid rgba(34, 197, 94, 0.25);
      background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(59, 130, 246, 0.06));
    }
    .dark .dash-daily-banner {
      border-color: rgba(34, 197, 94, 0.2);
      background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(59, 130, 246, 0.08));
    }

    /* Library filter drawer */
    .lib-filter-drawer {
      position: fixed;
      inset: 0;
      z-index: 50;
      display: flex;
      align-items: flex-end;
      justify-content: center;
    }
    .lib-filter-drawer.hidden { display: none; }
    .lib-filter-drawer-backdrop {
      position: absolute;
      inset: 0;
      background: rgba(0, 0, 0, 0.4);
    }
    .lib-filter-drawer-panel {
      position: relative;
      width: 100%;
      max-width: 32rem;
      max-height: 80vh;
      overflow-y: auto;
      border-radius: 1.25rem 1.25rem 0 0;
      padding: var(--space-4);
      margin-bottom: 0;
    }
    @media (min-width: 640px) {
      .lib-filter-drawer { align-items: center; }
      .lib-filter-drawer-panel {
        border-radius: 1.25rem;
        max-height: 85vh;
        margin: var(--space-4);
      }
    }
    .lib-active-chip {
      font-size: var(--text-xs);
      padding: 0.25rem 0.5rem;
      border-radius: 9999px;
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      cursor: pointer;
    }
    /* ==== ???: rank-up ceremony overlay ==== */
    .rankup-overlay {
      position: fixed;
      inset: 0;
      z-index: 100;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(10, 8, 20, 0.82);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      animation: rankup-fade 0.4s ease;
      cursor: pointer;
    }
    @keyframes rankup-fade {
      from { opacity: 0; }
      to { opacity: 1; }
    }
    .rankup-inner { text-align: center; color: #fff; }
    .rankup-label {
      font-size: 0.85rem;
      letter-spacing: 0.5em;
      text-indent: 0.5em;
      color: #e8c37a;
      animation: rankup-rise 0.6s ease 0.1s both;
    }
    .rankup-title {
      font-size: 3.2rem;
      font-weight: 800;
      margin-top: 12px;
      letter-spacing: 0.1em;
      text-shadow: 0 0 30px rgba(232, 195, 122, 0.55);
      animation: rankup-brush 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.2) 0.35s both;
    }
    .rankup-stroke {
      width: 180px;
      height: 6px;
      margin: 18px auto 0;
      border-radius: 3px;
      background: linear-gradient(90deg, transparent, #e8c37a 15%, #c9302c 85%, transparent);
      transform-origin: left center;
      animation: rankup-stroke-in 0.7s ease 0.9s both;
    }
    .rankup-sub {
      margin-top: 16px;
      font-size: 0.8rem;
      color: rgba(255, 255, 255, 0.65);
      letter-spacing: 0.25em;
      animation: rankup-rise 0.6s ease 1.3s both;
    }
    @keyframes rankup-rise {
      from { opacity: 0; transform: translateY(14px); }
      to { opacity: 1; transform: translateY(0); }
    }
    @keyframes rankup-brush {
      0% { opacity: 0; transform: scale(1.8) rotate(-6deg); filter: blur(6px); }
      100% { opacity: 1; transform: scale(1) rotate(0); filter: blur(0); }
    }
    @keyframes rankup-stroke-in {
      from { transform: scaleX(0); opacity: 0; }
      to { transform: scaleX(1); opacity: 1; }
    }

    /* ==== ???: vermilion seal accent on section titles ==== */
    .section-title {
      position: relative;
      padding-left: 18px;
    }
    .section-title::before {
      content: '';
      position: absolute;
      left: 0;
      top: 50%;
      transform: translateY(-50%) rotate(-3deg);
      width: 10px;
      height: 10px;
      border-radius: 2px;
      background: #C9302C;
      box-shadow: 0 0 0 1.5px rgba(201, 48, 44, 0.35);
    }

    /* Quiz preset home (C) */
    .quiz-home-grid {
      display: grid;
      gap: var(--space-3);
      grid-template-columns: 1fr;
    }
    @media (min-width: 640px) {
      .quiz-home-grid { grid-template-columns: repeat(2, 1fr); }
    }
    .quiz-preset-icon {
      width: 40px;
      height: 40px;
      border-radius: 12px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 1rem;
      flex-shrink: 0;
    }
    .quiz-preset-card { cursor: pointer; }
    .quiz-home-grid.hidden { display: none; }

    /* Quiz wizard (A) step transition */
    .quiz-wstep { animation: wstep-in 0.28s ease; }
    @keyframes wstep-in {
      from { opacity: 0; transform: translateX(24px); }
      to { opacity: 1; transform: translateX(0); }
    }

    /* Quiz step indicator */
    .quiz-steps {
      display: flex;
      align-items: center;
      gap: 0.25rem;
    }
    .quiz-step {
      flex: 1;
      text-align: center;
      font-size: var(--text-xs);
      padding: 0.35rem 0.25rem;
      border-radius: 0.5rem;
      color: #9ca3af;
      background: rgba(255, 255, 255, 0.2);
      transition: all 0.2s;
    }
    .quiz-step.active {
      color: #fff;
      background: linear-gradient(135deg, #22c55e, #3b82f6);
      font-weight: 600;
    }
    .quiz-step.done {
      color: #22c55e;
      background: rgba(34, 197, 94, 0.15);
    }
    .quiz-cat-btn {
      min-height: 5.5rem;
    }
    .quiz-cat-btn p:last-child {
      font-size: var(--text-xs);
      opacity: 0.75;
      margin-top: 0.15rem;
    }
    .quiz-loading-skeleton {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
      max-width: 20rem;
      margin: 0 auto 1rem;
    }
    .quiz-loading-skeleton .sk-line {
      height: 0.75rem;
      border-radius: 0.375rem;
      background: linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.12) 50%, rgba(0,0,0,0.06) 75%);
      background-size: 200% 100%;
      animation: skeleton-shimmer 1.2s infinite;
    }
    .dark .quiz-loading-skeleton .sk-line {
      background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.06) 75%);
      background-size: 200% 100%;
    }
    @keyframes skeleton-shimmer {
      0% { background-position: 200% 0; }
      100% { background-position: -200% 0; }
    }

    /* Sensei chips scroll fade */
    .sensei-chips-row {
      position: relative;
      mask-image: linear-gradient(to right, transparent, black 12px, black calc(100% - 24px), transparent);
      -webkit-mask-image: linear-gradient(to right, transparent, black 12px, black calc(100% - 24px), transparent);
    }

    /* Table horizontal scroll hint */
    .table-scroll-wrap {
      position: relative;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }
    .table-scroll-wrap::after {
      content: '';
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      width: 2rem;
      pointer-events: none;
      background: linear-gradient(to left, rgba(255,255,255,0.85), transparent);
    }
    .dark .table-scroll-wrap::after {
      background: linear-gradient(to left, rgba(18,18,42,0.9), transparent);
    }

    /* Empty state */
    .empty-state {
      text-align: center;
      padding: var(--space-6) var(--space-4);
      color: #9ca3af;
    }
    .empty-state-icon {
      font-size: 2.5rem;
      opacity: 0.45;
      margin-bottom: var(--space-3);
      display: block;
    }
    .empty-state-title {
      font-size: var(--text-sm);
      font-weight: 600;
      color: #6b7280;
      margin-bottom: 0.25rem;
    }
    .dark .empty-state-title { color: #9ca3af; }

    /* Settings accordion */
    details.settings-group {
      border-radius: 1rem;
      overflow: hidden;
    }
    details.settings-group > summary {
      list-style: none;
      cursor: pointer;
      padding: var(--space-4);
      font-weight: 600;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-2);
    }
    details.settings-group > summary::-webkit-details-marker { display: none; }
    details.settings-group > summary::after {
      content: '?';
      font-size: 0.75rem;
      color: #9ca3af;
      transition: transform 0.2s;
    }
    details.settings-group:not([open]) > summary::after {
      transform: rotate(-90deg);
    }
    details.settings-group .settings-group-body {
      padding: 0 var(--space-4) var(--space-4);
    }
    .api-last-error {
      font-size: var(--text-xs);
      word-break: break-word;
      border-radius: 0.5rem;
      padding: 0.5rem 0.75rem;
      background: rgba(239, 68, 68, 0.08);
      border: 1px solid rgba(239, 68, 68, 0.2);
      color: #b91c1c;
    }
    .dark .api-last-error {
      background: rgba(239, 68, 68, 0.12);
      color: #fca5a5;
    }
    body.api-prompt-log-modal-open {
      overflow: hidden;
    }
    /* z-index must be in custom CSS — Tailwind arbitrary z-[n] is not in this build */
    .api-prompt-log-modal {
      position: fixed;
      inset: 0;
      z-index: 10060;
      display: flex;
      align-items: stretch;
      justify-content: center;
      padding: 0.75rem;
    }
    .api-prompt-log-modal.hidden {
      display: none;
    }
    .api-prompt-log-modal__backdrop {
      position: absolute;
      inset: 0;
      z-index: 0;
      background: rgba(15, 23, 42, 0.72);
      backdrop-filter: blur(6px);
    }
    /* Solid opaque panel — avoid glass transparency washing out text */
    .api-prompt-log-modal__panel {
      position: relative;
      z-index: 1;
      width: min(960px, 100%);
      max-height: calc(100vh - 1.5rem);
      display: flex;
      flex-direction: column;
      border-radius: 1rem;
      overflow: hidden;
      animation: modal-in 0.22s ease-out;
      background: #ffffff !important;
      border: 1px solid #d1d5db;
      box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
      color: #111827;
      backdrop-filter: none !important;
      -webkit-backdrop-filter: none !important;
    }
    .dark .api-prompt-log-modal__panel {
      background: #111827 !important;
      border-color: #374151;
      color: #f3f4f6;
      box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
    }
    .api-prompt-log-modal__header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
      padding: 0.55rem 0.85rem;
      border-bottom: 1px solid #e5e7eb;
      flex-shrink: 0;
      background: #f9fafb;
    }
    .dark .api-prompt-log-modal__header {
      border-bottom-color: #374151;
      background: #0f172a;
    }
    .api-prompt-log-modal__title {
      color: #111827;
    }
    .dark .api-prompt-log-modal__title {
      color: #f9fafb;
    }
    .api-prompt-log-modal__sub {
      margin-top: 0.1rem;
      font-size: 0.65rem;
      line-height: 1.3;
      color: #4b5563;
    }
    .dark .api-prompt-log-modal__sub {
      color: #d1d5db;
    }
    .api-prompt-log-modal__btn-muted {
      font-size: 0.75rem;
      color: #374151;
      padding: 0.35rem 0.55rem;
      border-radius: 0.5rem;
      border: 1px solid #d1d5db;
      background: #ffffff;
    }
    .api-prompt-log-modal__btn-muted:hover {
      color: #b91c1c;
      border-color: #fca5a5;
      background: #fef2f2;
    }
    .dark .api-prompt-log-modal__btn-muted {
      color: #e5e7eb;
      border-color: #4b5563;
      background: #1f2937;
    }
    .dark .api-prompt-log-modal__btn-muted:hover {
      color: #fecaca;
      border-color: #f87171;
      background: rgba(239, 68, 68, 0.15);
    }
    .api-prompt-log-modal__btn-close {
      width: 2.25rem;
      height: 2.25rem;
      border-radius: 0.65rem;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      color: #111827;
      border: 1px solid #d1d5db;
      background: #ffffff;
    }
    .api-prompt-log-modal__btn-close:hover {
      background: #f3f4f6;
    }
    .dark .api-prompt-log-modal__btn-close {
      color: #f9fafb;
      border-color: #4b5563;
      background: #1f2937;
    }
    .dark .api-prompt-log-modal__btn-close:hover {
      background: #374151;
    }
    .api-prompt-log-modal__stats {
      padding: 0.5rem 0.85rem 0.45rem;
      border-bottom: 1px solid #e5e7eb;
      flex-shrink: 0;
      background: #ffffff;
    }
    .dark .api-prompt-log-modal__stats {
      border-bottom-color: #374151;
      background: #111827;
    }
    .api-prompt-log-stat-row {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 0.4rem;
    }
    .api-prompt-log-stat {
      border-radius: 0.5rem;
      padding: 0.3rem 0.35rem;
      text-align: center;
      background: #f3f4f6;
      border: 1px solid #d1d5db;
      min-width: 0;
    }
    .dark .api-prompt-log-stat {
      background: #1f2937;
      border-color: #4b5563;
    }
    .api-prompt-log-stat__label {
      font-size: 0.6rem;
      color: #4b5563;
      margin-bottom: 0.05rem;
      line-height: 1.2;
    }
    .dark .api-prompt-log-stat__label {
      color: #d1d5db;
    }
    .api-prompt-log-stat__value {
      font-size: 0.8rem;
      font-weight: 600;
      font-variant-numeric: tabular-nums;
      color: #111827;
      line-height: 1.25;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .dark .api-prompt-log-stat__value {
      color: #f9fafb;
    }
    .api-prompt-log-modal__meta {
      margin-top: 0.3rem;
      font-size: 0.65rem;
      line-height: 1.3;
      color: #374151;
    }
    .api-prompt-log-modal__meta a {
      color: #0369a1;
      text-decoration: underline;
    }
    .dark .api-prompt-log-modal__meta {
      color: #d1d5db;
    }
    .dark .api-prompt-log-modal__meta a {
      color: #7dd3fc;
    }
    .api-prompt-log-modal__section-label {
      font-size: 0.7rem;
      font-weight: 600;
      color: #111827;
      margin-bottom: 0;
      line-height: 1.3;
    }
    .dark .api-prompt-log-modal__section-label {
      color: #f3f4f6;
    }
    .api-prompt-log-modal__link {
      font-size: 0.7rem;
      color: #0369a1;
      font-weight: 600;
    }
    .api-prompt-log-modal__link:hover {
      text-decoration: underline;
    }
    .dark .api-prompt-log-modal__link {
      color: #7dd3fc;
    }
    .api-prompt-log-modal__features-wrap {
      margin-top: 0.3rem;
      display: flex;
      align-items: flex-start;
      gap: 0.5rem;
    }
    .api-prompt-log-modal__features-wrap > .api-prompt-log-modal__section-label {
      flex-shrink: 0;
      margin-top: 0.15rem;
      color: #6b7280;
      font-weight: 500;
    }
    .dark .api-prompt-log-modal__features-wrap > .api-prompt-log-modal__section-label {
      color: #9ca3af;
    }
    .api-prompt-log-modal__features {
      flex: 1 1 auto;
      min-width: 0;
      max-height: 2.6rem;
      overflow: auto;
    }
    .api-prompt-log-feat-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      padding: 0.1rem 0;
      font-size: 0.65rem;
      line-height: 1.25;
      color: #1f2937;
      border-bottom: none;
    }
    .dark .api-prompt-log-feat-row {
      color: #e5e7eb;
      border-bottom-color: transparent;
    }
    .api-prompt-log-modal__body {
      flex: 1 1 auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
      padding: 0.5rem 0.85rem 0.75rem;
      background: #ffffff;
    }
    .dark .api-prompt-log-modal__body {
      background: #111827;
    }
    .api-prompt-log-modal__body-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      margin-bottom: 0.35rem;
    }
    .api-prompt-log-flat {
      flex: 1 1 auto;
      min-height: 12rem;
      overflow: auto;
      border-radius: 0.75rem;
      background: #0b1220;
      border: 1px solid #1f2937;
      padding: 0.55rem;
      color: #e5e7eb;
    }
    .api-prompt-log-flat > p {
      color: #cbd5e1 !important;
      padding: 0.75rem 0.35rem;
    }
    .api-prompt-log-flat__entry {
      margin-bottom: 0.45rem;
      border-radius: 0.65rem;
      border: 1px solid #334155;
      background: #111827;
      overflow: hidden;
    }
    .api-prompt-log-flat__entry.is-fail {
      border-color: #f87171;
      background: #291415;
    }
    .api-prompt-log-flat__toggle {
      width: 100%;
      display: flex;
      align-items: flex-start;
      gap: 0.55rem;
      padding: 0.55rem 0.65rem;
      text-align: left;
      color: #e5e7eb;
      background: transparent;
      border: 0;
      cursor: pointer;
    }
    .api-prompt-log-flat__toggle:hover {
      background: rgba(148, 163, 184, 0.08);
    }
    .api-prompt-log-flat__chevron {
      flex-shrink: 0;
      width: 1rem;
      margin-top: 0.15rem;
      color: #94a3b8;
      transition: transform 0.15s ease;
    }
    .api-prompt-log-flat__entry.is-expanded .api-prompt-log-flat__chevron {
      transform: rotate(90deg);
      color: #7dd3fc;
    }
    .api-prompt-log-flat__summary {
      flex: 1 1 auto;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 0.15rem;
    }
    .api-prompt-log-flat__summary-title {
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      font-size: 0.72rem;
      font-weight: 600;
      line-height: 1.4;
      color: #f1f5f9;
      word-break: break-word;
    }
    .api-prompt-log-flat__summary-meta {
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      font-size: 0.65rem;
      line-height: 1.4;
      color: #94a3b8;
      word-break: break-word;
    }
    .api-prompt-log-flat__entry.is-fail .api-prompt-log-flat__summary-title {
      color: #fecaca;
    }
    .api-prompt-log-flat__hint {
      flex-shrink: 0;
      margin-top: 0.1rem;
      font-size: 0.65rem;
      font-weight: 600;
      color: #7dd3fc;
    }
    .api-prompt-log-flat__body {
      padding: 0 0.65rem 0.5rem;
      border-top: 1px solid #334155;
    }
    .api-prompt-log-flat__body[hidden] {
      display: none !important;
    }
    .api-prompt-log-flat__pre {
      margin: 0.45rem 0 0;
      white-space: pre-wrap;
      word-break: break-word;
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      font-size: 0.72rem;
      line-height: 1.5;
      color: #e5e7eb;
      max-height: min(50vh, 28rem);
      overflow: auto;
    }
    .api-prompt-log-flat__copy {
      display: inline-block;
      margin-top: 0.3rem;
      margin-bottom: 0.15rem;
      color: #7dd3fc !important;
      font-weight: 600;
    }
    .srs-adjust-btn {
      min-width: 2rem;
      min-height: 2rem;
      width: 2rem;
      height: 2rem;
    }

    /* Error heatmap */
    .err-heat-1 { border-left: 3px solid rgba(249, 115, 22, 0.5); }
    .err-heat-2 { border-left: 3px solid rgba(239, 68, 68, 0.65); }
    .err-heat-3 { border-left: 3px solid rgba(220, 38, 38, 0.85); }

    /* Responsive Layout */
    @media (max-width: 768px) {
      .desktop-sidebar { display: none; }
      .mobile-nav { display: flex; }
      .main-content {
        padding-bottom: 0;
        min-height: calc(100dvh - var(--mobile-nav-height) - var(--safe-top));
        margin-bottom: var(--mobile-nav-height);
      }
    }

    @media (min-width: 769px) {
      .desktop-sidebar { display: flex; }
      .mobile-nav { display: none; }
      .main-content { margin-left: 240px; transition: margin-left 0.3s ease; }
      .sidebar-collapsed .main-content { margin-left: 72px; }
    }

    /* Mobile Bottom Nav??? Home Indicator ???????? */
    .mobile-nav {
      box-sizing: border-box;
      height: var(--mobile-nav-height);
      min-height: var(--mobile-nav-height);
      overflow: visible;
      padding-top: 0.2rem;
      padding-bottom: var(--safe-bottom);
      padding-left: max(0.25rem, var(--safe-left));
      padding-right: max(0.25rem, var(--safe-right));
      align-items: center;
    }

    .mobile-nav .nav-item {
      padding: 6px 4px;
      min-width: 0;
      flex: 1;
      max-width: 72px;
    }

    .mobile-nav .nav-item i {
      font-size: 1.15rem;
    }

    .mobile-nav .nav-item span {
      font-size: 0.7rem;
      line-height: 1.1;
      white-space: nowrap;
    }

    .mobile-nav-fab {
      flex: 0 0 auto !important;
      max-width: none !important;
      width: 3.5rem;
      height: 3.5rem;
      margin-top: 0;
      border-radius: 1rem;
      background: linear-gradient(135deg, #0891B2, #22D3EE);
      color: #fff;
      box-shadow: 0 4px 16px rgba(8, 145, 178, 0.45);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 0;
      padding: 0;
    }
    .mobile-nav-fab i {
      font-size: 1.35rem !important;
      color: #fff !important;
    }
    .mobile-nav-fab span {
      font-size: 0.55rem !important;
      color: #fff !important;
      font-weight: 600;
    }
    .mobile-nav-fab.active {
      box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.5), 0 4px 16px rgba(8, 145, 178, 0.45);
    }

    .mobile-nav-more-sheet {
      position: fixed;
      inset: 0;
      z-index: 45;
      display: flex;
      align-items: flex-end;
      justify-content: center;
    }
    .mobile-nav-more-sheet.hidden { display: none; }
    .mobile-nav-more-backdrop {
      position: absolute;
      inset: 0;
      background: rgba(0, 0, 0, 0.4);
    }
    .mobile-nav-more-panel {
      position: relative;
      width: 100%;
      max-width: 24rem;
      border-radius: 1.25rem 1.25rem 0 0;
      padding: var(--space-4);
      margin-bottom: var(--mobile-nav-height);
      padding-bottom: max(var(--space-4), calc(var(--space-4) + 0.25rem));
    }
    .mobile-nav-more-item {
      width: 100%;
      display: flex;
      align-items: center;
      gap: var(--space-3);
      padding: 0.75rem 1rem;
      border-radius: 0.75rem;
      text-align: left;
      font-size: var(--text-sm);
      transition: background 0.15s;
    }
    .mobile-nav-more-item:hover,
    .mobile-nav-more-item.active {
      background: rgba(255, 255, 255, 0.2);
    }
    .dark .mobile-nav-more-item:hover,
    .dark .mobile-nav-more-item.active {
      background: rgba(255, 255, 255, 0.08);
    }

    /* Desktop Sidebar Collapse */
    .desktop-sidebar {
      transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar-collapsed .desktop-sidebar {
      width: 72px;
    }

    .desktop-sidebar .sidebar-title,
    .desktop-sidebar .sidebar-subtitle,
    .desktop-sidebar .nav-item span,
    .desktop-sidebar .theme-toggle-text {
      opacity: 1;
      max-width: 200px;
      overflow: hidden;
      white-space: nowrap;
      transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1) 0.1s, max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar-collapsed .desktop-sidebar .sidebar-title,
    .sidebar-collapsed .desktop-sidebar .sidebar-subtitle,
    .sidebar-collapsed .desktop-sidebar .nav-item span,
    .sidebar-collapsed .desktop-sidebar .theme-toggle-text {
      opacity: 0;
      max-width: 0;
      transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .desktop-sidebar .nav-item {
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar-collapsed .desktop-sidebar .nav-item {
      justify-content: center;
      padding: 0.75rem;
      gap: 0;
    }

    /* Theme toggle button - always centered */
    .desktop-sidebar .theme-toggle-btn {
      transform-origin: center center;
    }

    /* Theme toggle button collapsed state */
    .sidebar-collapsed .desktop-sidebar .theme-toggle-btn {
      padding: 0.625rem;
      gap: 0;
    }

    .sidebar-collapsed .desktop-sidebar .theme-toggle-text {
      opacity: 0;
      max-width: 0;
      overflow: hidden;
    }

    .desktop-sidebar .nav-item i {
      transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar-collapsed .desktop-sidebar .nav-item i {
      margin: 0;
    }

    .sidebar-collapsed .desktop-sidebar nav {
      padding-left: 0.75rem;
      padding-right: 0.75rem;
    }

    .desktop-sidebar .sidebar-header {
      transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), justify-content 0.3s;
    }

    .sidebar-collapsed .desktop-sidebar .sidebar-header {
      padding: 1rem;
      justify-content: center;
    }

    .desktop-sidebar .collapse-btn i {
      transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar-collapsed .desktop-sidebar .collapse-btn i {
      transform: rotate(180deg);
    }

    /* Activity Form Chips */
    .activity-chip {
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .activity-chip.mizen { background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(239, 68, 68, 0.1)); border-color: rgba(239, 68, 68, 0.5); }
    .activity-chip.mizen-o { background: linear-gradient(135deg, rgba(244, 114, 182, 0.3), rgba(244, 114, 182, 0.1)); border-color: rgba(244, 114, 182, 0.5); }
    .activity-chip.renyo { background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(16, 185, 129, 0.1)); border-color: rgba(16, 185, 129, 0.5); }
    .activity-chip.shushi { background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(99, 102, 241, 0.1)); border-color: rgba(99, 102, 241, 0.5); }
    .activity-chip.rentai { background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(139, 92, 246, 0.1)); border-color: rgba(139, 92, 246, 0.5); }
    .activity-chip.katei { background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(245, 158, 11, 0.1)); border-color: rgba(245, 158, 11, 0.5); }
    .activity-chip.meirei { background: linear-gradient(135deg, rgba(100, 116, 139, 0.3), rgba(100, 116, 139, 0.1)); border-color: rgba(100, 116, 139, 0.5); }
    .activity-chip.futsu { background: linear-gradient(135deg, rgba(251, 146, 60, 0.3), rgba(251, 146, 60, 0.1)); border-color: rgba(251, 146, 60, 0.5); }
    .activity-chip.gokan { background: linear-gradient(135deg, rgba(226, 232, 240, 0.5), rgba(226, 232, 240, 0.2)); border-color: rgba(226, 232, 240, 0.6); }

    /* Tab Animation */
    .tab-indicator {
      transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .parent-mode-indicator {
      transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .parent-mode-tab {
      color: rgba(75, 85, 99, 0.85);
    }
    .dark .parent-mode-tab {
      color: rgba(209, 213, 219, 0.75);
    }
    .parent-mode-tab.active {
      color: rgb(31, 41, 55);
      font-weight: 600;
    }
    .dark .parent-mode-tab.active {
      color: rgb(243, 244, 246);
    }

    /* View header: title + centered parent-mode tabs + optional actions */
    .view-page-header {
      margin-bottom: 1rem;
    }
    .view-header-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
      align-items: center;
      gap: 0.5rem 1rem;
      min-height: 2.75rem;
    }
    .view-header-row .section-title {
      margin: 0;
      min-width: 0;
      grid-column: 1;
      justify-self: start;
    }
    .view-header-row .parent-mode-bar {
      grid-column: 2;
      justify-self: center;
      flex: 0 0 auto;
    }
    .view-header-row .view-header-actions {
      grid-column: 3;
      justify-self: end;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0.5rem;
      flex-shrink: 0;
    }
    @media (max-width: 540px) {
      .view-header-row {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        min-height: 0;
      }
      .view-header-row .section-title {
        grid-column: 1;
        grid-row: 1;
      }
      .view-header-row .parent-mode-bar {
        grid-column: 1;
        grid-row: 2;
        justify-self: center;
      }
      .view-header-row .view-header-actions {
        grid-column: 1;
        grid-row: 3;
        justify-self: end;
      }
    }
    .view-header-meta {
      display: flex;
      flex-wrap: wrap;
      align-items: end;
      justify-content: space-between;
      gap: 0.75rem;
      margin-top: 0.25rem;
    }

    /* Pulse Effect on Correct Answer */
    @keyframes heartbeat {
      0%, 100% { transform: scale(1); }
      25% { transform: scale(1.1); }
      50% { transform: scale(1); }
      75% { transform: scale(1.05); }
    }

    .heartbeat {
      animation: heartbeat 0.6s ease-in-out;
    }

    /* Stagger Animation */
    .stagger-item {
      opacity: 0;
      transform: translateY(20px);
      animation: fadeInUp 0.5s ease forwards;
    }
    /* Once animated, lock visible state so view-switch never hides cards */
    .stagger-item.stagger-done {
      opacity: 1 !important;
      transform: translateY(0) !important;
      animation: none !important;
    }

    @keyframes fadeInUp {
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    @keyframes shake {
      0%, 100% { transform: translateX(0); }
      20%, 60% { transform: translateX(-6px); }
      40%, 80% { transform: translateX(6px); }
    }
    .animate-shake { animation: shake 0.4s ease-in-out; }

    /* Listening quiz pulse animation */
    @keyframes listeningPulse {
      0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.5); }
      50% { box-shadow: 0 0 0 14px rgba(245,158,11,0); }
    }
    .listening-pulse {
      animation: listeningPulse 1.2s ease-in-out infinite;
    }

    .stagger-item:nth-child(1) { animation-delay: 0.1s; }
    .stagger-item:nth-child(2) { animation-delay: 0.2s; }
    .stagger-item:nth-child(3) { animation-delay: 0.3s; }
    .stagger-item:nth-child(4) { animation-delay: 0.4s; }
    .stagger-item:nth-child(5) { animation-delay: 0.5s; }
    .stagger-item:nth-child(6) { animation-delay: 0.6s; }
    .stagger-item:nth-child(7) { animation-delay: 0.7s; }
    .stagger-item:nth-child(8) { animation-delay: 0.8s; }

    /* Dashboard flame animation */
    @keyframes flame-flicker {
      0%, 100% { transform: scaleY(1) scaleX(1); filter: brightness(1); }
      25% { transform: scaleY(1.08) scaleX(0.96); filter: brightness(1.1); }
      50% { transform: scaleY(0.95) scaleX(1.04); filter: brightness(0.95); }
      75% { transform: scaleY(1.05) scaleX(0.98); filter: brightness(1.05); }
    }
    .flame-active { animation: flame-flicker 1.5s ease-in-out infinite; }
    @keyframes pulse-glow {
      0%, 100% { box-shadow: 0 0 8px rgba(245,158,11,0.2); }
      50% { box-shadow: 0 0 20px rgba(245,158,11,0.4); }
    }
    .streak-card-active { animation: pulse-glow 2.5s ease-in-out infinite; }
    @keyframes countUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
    .count-up { animation: countUp 0.6s ease-out forwards; }

    /* Badge grid */
    .badge-item { transition: transform 0.2s, box-shadow 0.2s; }
    .badge-item:hover { transform: translateY(-2px); }
    .badge-item.locked svg { opacity: 0.25; }
    .badge-item.locked .badge-label { color: #9CA3AF; }
    .dark .badge-item.locked .badge-label { color: #6B7280; }
    .badge-item.unlocked .badge-glow { position: absolute; inset: -2px; border-radius: 1rem; opacity: 0.3; z-index: 0; pointer-events: none; }

    /* Bar chart */
    .bar-col { transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }

    /* Line chart */
    .chart-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
    .chart-dot { transition: r 0.2s; }
    .chart-dot:hover { r: 5; }

    /* Weakness list */
    .weak-item { transition: background 0.2s; }
    .weak-item:hover { background: rgba(0,0,0,0.03); }
    .dark .weak-item:hover { background: rgba(255,255,255,0.03); }

    /* Rank / EXP */
    @keyframes expFloatUp {
      0% { opacity: 1; transform: translateY(0) scale(1); }
      100% { opacity: 0; transform: translateY(-36px) scale(1.1); }
    }
    .exp-float {
      position: fixed; z-index: 9999; pointer-events: none;
      font-weight: 700; font-size: 1.1rem;
      animation: expFloatUp 1.2s ease-out forwards;
      text-shadow: 0 1px 3px rgba(0,0,0,0.2);
    }

    /* ??????????? modal?overlay?? z-999??? margin ????? animation transform ?? */
    .app-toast {
      position: fixed;
      top: 1rem;
      left: 50%;
      margin-left: 0;
      translate: -50% 0;
      z-index: 10050;
      pointer-events: none;
      max-width: min(92vw, 28rem);
      text-align: center;
    }
    .rank-color-dot { width: 10px; height: 10px; border-radius: 50%; transition: transform 0.2s; }
    .rank-color-dot.active { transform: scale(1.25); box-shadow: 0 0 0 2px rgba(255,255,255,0.5); }
    .rank-color-dot.future { opacity: 0.25; }
    @keyframes rankPulse { 0%, 100% { box-shadow: 0 0 0 0 var(--rank-accent, rgba(239,68,68,0.4)); } 50% { box-shadow: 0 0 0 6px transparent; } }
    .rank-svg-wrap.rank-pulse { animation: rankPulse 2s ease-in-out infinite; border-radius: 12px; }

    /* ?? Player character card (HUD + battle) ?? */
    .player-char-card-slot--hud {
      width: 3.25rem;
      height: 3.25rem;
      flex: 0 0 auto;
    }
    .player-char-card-slot--battle {
      flex: 0 0 auto;
      width: 3.25rem;
    }
    .player-char-card {
      --char-accent: #38BDF8;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.2rem;
      width: 100%;
      height: 100%;
    }
    .player-char-card__frame {
      position: relative;
      width: 100%;
      flex: 1 1 auto;
      min-height: 0;
      aspect-ratio: 1 / 1;
      border-radius: 0.55rem;
      border: 2px solid color-mix(in srgb, var(--char-accent) 78%, #fff 22%);
      background:
        linear-gradient(160deg, color-mix(in srgb, var(--char-accent) 22%, #fff 78%) 0%, rgba(255,255,255,0.92) 48%, color-mix(in srgb, var(--char-accent) 16%, #f3f4f6 84%) 100%);
      box-shadow:
        0 1px 0 rgba(255,255,255,0.65) inset,
        0 2px 8px color-mix(in srgb, var(--char-accent) 28%, transparent);
      overflow: hidden;
    }
    .dark .player-char-card__frame {
      background:
        linear-gradient(160deg, color-mix(in srgb, var(--char-accent) 35%, #111827 65%) 0%, #1f2937 55%, color-mix(in srgb, var(--char-accent) 18%, #0f172a 82%) 100%);
      border-color: color-mix(in srgb, var(--char-accent) 70%, #94a3b8 30%);
      box-shadow:
        0 1px 0 rgba(255,255,255,0.08) inset,
        0 2px 10px rgba(0,0,0,0.35);
    }
    .player-char-card__art {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      padding: 0;
      overflow: hidden;
    }
    .player-char-card__art svg {
      width: 86%;
      height: 86%;
      display: block;
    }
    .player-char-card__portrait,
    .player-avatar-picker__face {
      /* sheet ???????????????????????? */
      --avatar-cols: 6;
      --avatar-rows: 4;
      --avatar-view-shift-x: 0.5%;
      --avatar-view-shift-y: 0%;
    }
    .player-char-card__portrait {
      width: 100%;
      height: 100%;
      background-repeat: no-repeat;
      background-size: calc(var(--avatar-cols) * 100%) calc(var(--avatar-rows) * 100%);
      background-position:
        calc(var(--avatar-col, 0) * 100% / calc(var(--avatar-cols) - 1) + var(--avatar-view-shift-x))
        calc(var(--avatar-row, 0) * 100% / calc(var(--avatar-rows) - 1) + var(--avatar-view-shift-y));
      image-rendering: auto;
    }
    .player-char-card__corner {
      position: absolute;
      width: 0.42rem;
      height: 0.42rem;
      border-color: color-mix(in srgb, var(--char-accent) 85%, #fff 15%);
      border-style: solid;
      opacity: 0.9;
      pointer-events: none;
    }
    .player-char-card__corner--tl { top: 3px; left: 3px; border-width: 1.5px 0 0 1.5px; border-radius: 2px 0 0 0; }
    .player-char-card__corner--tr { top: 3px; right: 3px; border-width: 1.5px 1.5px 0 0; border-radius: 0 2px 0 0; }
    .player-char-card__corner--bl { bottom: 3px; left: 3px; border-width: 0 0 1.5px 1.5px; border-radius: 0 0 0 2px; }
    .player-char-card__corner--br { bottom: 3px; right: 3px; border-width: 0 1.5px 1.5px 0; border-radius: 0 0 2px 0; }
    .player-char-card__caption {
      display: flex;
      flex-direction: column;
      align-items: center;
      line-height: 1.05;
      max-width: 100%;
    }
    .player-char-card__title {
      font-size: 0.62rem;
      font-weight: 700;
      color: #fef3c7;
      letter-spacing: 0.02em;
      white-space: nowrap;
    }
    .player-char-card__color {
      font-size: 0.52rem;
      color: color-mix(in srgb, var(--char-accent) 75%, #fff 25%);
      white-space: nowrap;
    }
    .player-char-card--hud {
      height: 100%;
    }
    .player-char-card--hud .player-char-card__frame {
      aspect-ratio: 1 / 1;
      width: 100%;
      height: 100%;
    }
    .player-char-card--battle {
      width: 3.25rem;
    }
    .player-char-card--battle .player-char-card__frame {
      width: 3.25rem;
      height: 3.25rem;
      aspect-ratio: 1 / 1;
      border-color: color-mix(in srgb, var(--char-accent) 65%, #fde68a 35%);
      background:
        linear-gradient(165deg, color-mix(in srgb, var(--char-accent) 28%, #0f172a 72%), #111827 70%);
      box-shadow:
        0 0 0 1px rgba(253, 230, 138, 0.22),
        0 2px 8px rgba(0,0,0,0.35);
    }
    .player-char-card--pulse .player-char-card__frame {
      animation: charCardPulse 2s ease-in-out infinite;
    }
    @keyframes charCardPulse {
      0%, 100% { box-shadow: 0 1px 0 rgba(255,255,255,0.65) inset, 0 0 0 0 color-mix(in srgb, var(--char-accent) 45%, transparent); }
      50% { box-shadow: 0 1px 0 rgba(255,255,255,0.65) inset, 0 0 0 5px transparent; }
    }
    .player-char-card--clickable {
      cursor: pointer;
      padding: 0;
      border: none;
      background: transparent;
      display: block;
      width: 100%;
      height: 100%;
    }
    .player-char-card--clickable:hover .player-char-card__frame,
    .player-char-card--clickable:focus-visible .player-char-card__frame {
      transform: translateY(-1px);
      box-shadow:
        0 1px 0 rgba(255,255,255,0.7) inset,
        0 4px 12px color-mix(in srgb, var(--char-accent) 35%, transparent);
    }
    .player-char-card--clickable:focus-visible {
      outline: none;
    }
    .player-avatar-picker {
      position: fixed;
      inset: 0;
      z-index: 10040;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 1rem;
      background: rgba(15, 23, 42, 0.45);
      backdrop-filter: blur(4px);
    }
    .player-avatar-picker__panel {
      width: min(42rem, 96vw);
      max-height: min(90vh, 52rem);
      padding: 1rem 1.1rem 1.15rem;
      border-radius: 1.15rem;
      box-shadow: 0 16px 40px rgba(15, 23, 42, 0.25);
      overflow: auto;
    }
    .player-avatar-picker__head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      margin-bottom: 0.75rem;
    }
    .player-avatar-picker__title {
      margin: 0;
      font-size: 1.15rem;
      font-weight: 700;
      color: #111827;
    }
    .dark .player-avatar-picker__title { color: #f3f4f6; }
    .player-avatar-picker__close {
      border: none;
      background: transparent;
      color: #9ca3af;
      cursor: pointer;
      padding: 0.35rem 0.5rem;
      border-radius: 0.4rem;
      font-size: 1.1rem;
    }
    .player-avatar-picker__close:hover { color: #4b5563; background: rgba(0,0,0,0.05); }
    .player-avatar-picker__grid {
      display: grid;
      grid-template-columns: repeat(6, minmax(0, 1fr));
      gap: 0.55rem;
    }
    .player-avatar-picker__opt {
      display: block;
      padding: 0.28rem;
      border-radius: 0.7rem;
      border: 2px solid transparent;
      background: rgba(243, 244, 246, 0.85);
      cursor: pointer;
      transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
      aspect-ratio: 1 / 1;
    }
    .dark .player-avatar-picker__opt {
      background: rgba(31, 41, 55, 0.9);
    }
    .player-avatar-picker__opt:hover {
      transform: translateY(-1px);
      border-color: rgba(56, 189, 248, 0.45);
    }
    .player-avatar-picker__opt--active {
      border-color: #38bdf8;
      background: rgba(224, 242, 254, 0.95);
      box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.25);
    }
    .dark .player-avatar-picker__opt--active {
      background: rgba(12, 74, 110, 0.55);
    }
    .player-avatar-picker__face {
      display: block;
      width: 100%;
      height: 100%;
      border-radius: 0.5rem;
      overflow: hidden;
      background-repeat: no-repeat;
      background-size: calc(var(--avatar-cols) * 100%) calc(var(--avatar-rows) * 100%);
      background-position:
        calc(var(--avatar-col, 0) * 100% / calc(var(--avatar-cols) - 1) + var(--avatar-view-shift-x))
        calc(var(--avatar-row, 0) * 100% / calc(var(--avatar-rows) - 1) + var(--avatar-view-shift-y));
      background-color: rgba(255,255,255,0.35);
      box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
    }

    /* Line clamp for text overflow */
    .line-clamp-2 {
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    /* Responsive card sizing */
    @media (max-width: 480px) {
      /* Mobile: compact cards with all content visible */
      .flip-card .flip-card-inner {
        min-height: 120px !important;
      }
      .flip-card .flip-card-front,
      .flip-card .flip-card-back {
        padding: 8px !important;
      }
      /* Scale down text - center content stays larger */
      .flip-card .flip-card-front .text-3xl,
      .flip-card .flip-card-front .text-4xl {
        font-size: 1.4rem !important;
      }
      .flip-card .flip-card-front .text-xl,
      .flip-card .flip-card-front .text-2xl {
        font-size: 1.1rem !important;
      }
      .flip-card .flip-card-front .text-lg {
        font-size: 0.9rem !important;
      }
      .flip-card .flip-card-front .text-base {
        font-size: 0.75rem !important;
      }
      .flip-card .flip-card-front .text-sm {
        font-size: 0.65rem !important;
      }
      .flip-card .flip-card-front .text-xs {
        font-size: 0.55rem !important;
      }
      /* Tags and chips smaller */
      .flip-card .glass-chip {
        padding: 1px 3px !important;
        font-size: 0.5rem !important;
      }
      /* Ensure flex-1 doesn't overflow */
      .flip-card .flip-card-front .flex-1 {
        min-height: 0 !important;
        padding: 2px 0 !important;
      }
    }

    @media (min-width: 481px) and (max-width: 768px) {
      /* Tablet: smaller cards */
      .flip-card .flip-card-inner {
        min-height: 145px !important;
      }
    }

    @media (min-width: 769px) {
      /* Desktop: compact cards */
      .flip-card .flip-card-inner {
        min-height: 155px !important;
      }
    }

    /* Flip card scrolling - vertical only */
    .flip-card .flip-card-back {
      -webkit-overflow-scrolling: touch;
      overflow-x: hidden !important;
    }
    .flip-card.flipped .flip-card-back {
      overflow-y: auto;
      overflow-x: hidden !important;
    }

    /* Dark mode decorative circles with neon colors */
    .dark .deco-circle {
      opacity: 0.2;
      filter: blur(48px);
    }

    /* Dark mode progress bars */
    .dark .bg-renyo { background-color: #00FF88; }
    .dark .bg-shushi { background-color: #00F5FF; }
    .dark .bg-rentai { background-color: #8B5CF6; }
    .dark .bg-mizen { background-color: #FF6B6B; }
    .dark .bg-katei { background-color: #FFD93D; }

    /* Dark mode text colors */
    .dark .text-renyo { color: #00FF88; }
    .dark .text-shushi { color: #00F5FF; }
    .dark .text-rentai { color: #A78BFA; }
    .dark .text-mizen { color: #FF6B6B; }
    .dark .text-katei { color: #FFD93D; }

    /* Nav accent colors (high chroma, one hue each) */
    .text-aobi { color: #0891B2; }
    .text-sora { color: #0284C7; }
    .text-beni { color: #E11D48; }
    .text-ocha { color: #65A30D; }
    .text-kinpaku { color: #CA8A04; }
    .dark .text-aobi { color: #22D3EE; }
    .dark .text-sora { color: #38BDF8; }
    .dark .text-beni { color: #FB7185; }
    .dark .text-ocha { color: #A3E635; }
    .dark .text-kinpaku { color: #FACC15; }

    /* Sidebar / mobile nav icons ? punchier chroma than global text-* tokens */
    .desktop-sidebar .nav-item i.text-aobi,
    .mobile-nav .nav-item i.text-aobi,
    .mobile-nav-more-item i.text-aobi { color: #00C2E8; }
    .desktop-sidebar .nav-item i.text-sora,
    .mobile-nav .nav-item i.text-sora,
    .mobile-nav-more-item i.text-sora { color: #1AB0FF; }
    .desktop-sidebar .nav-item i.text-beni,
    .mobile-nav .nav-item i.text-beni,
    .mobile-nav-more-item i.text-beni { color: #FF3B63; }
    .desktop-sidebar .nav-item i.text-ocha,
    .mobile-nav .nav-item i.text-ocha,
    .mobile-nav-more-item i.text-ocha { color: #8FE015; }
    .desktop-sidebar .nav-item i.text-kinpaku,
    .mobile-nav .nav-item i.text-kinpaku,
    .mobile-nav-more-item i.text-kinpaku { color: #F5C400; }
    .desktop-sidebar .nav-item i.text-shushi,
    .mobile-nav .nav-item i.text-shushi,
    .mobile-nav-more-item i.text-shushi { color: #5B5FFF; }
    .desktop-sidebar .nav-item i.text-renyo,
    .mobile-nav .nav-item i.text-renyo,
    .mobile-nav-more-item i.text-renyo { color: #00D68A; }
    .desktop-sidebar .nav-item i.text-rentai,
    .mobile-nav .nav-item i.text-rentai,
    .mobile-nav-more-item i.text-rentai { color: #A855F7; }
    .desktop-sidebar .nav-item i.text-katei,
    .mobile-nav .nav-item i.text-katei,
    .mobile-nav-more-item i.text-katei { color: #FFB020; }
    .desktop-sidebar .nav-item i.text-meirei,
    .mobile-nav .nav-item i.text-meirei,
    .mobile-nav-more-item i.text-meirei { color: #5B8CFF; }

    .dark .desktop-sidebar .nav-item i.text-aobi,
    .dark .mobile-nav .nav-item i.text-aobi,
    .dark .mobile-nav-more-item i.text-aobi { color: #2EEBFF; }
    .dark .desktop-sidebar .nav-item i.text-sora,
    .dark .mobile-nav .nav-item i.text-sora,
    .dark .mobile-nav-more-item i.text-sora { color: #4DC8FF; }
    .dark .desktop-sidebar .nav-item i.text-beni,
    .dark .mobile-nav .nav-item i.text-beni,
    .dark .mobile-nav-more-item i.text-beni { color: #FF6B8A; }
    .dark .desktop-sidebar .nav-item i.text-ocha,
    .dark .mobile-nav .nav-item i.text-ocha,
    .dark .mobile-nav-more-item i.text-ocha { color: #B8F03A; }
    .dark .desktop-sidebar .nav-item i.text-kinpaku,
    .dark .mobile-nav .nav-item i.text-kinpaku,
    .dark .mobile-nav-more-item i.text-kinpaku { color: #FFE033; }
    .dark .desktop-sidebar .nav-item i.text-shushi,
    .dark .mobile-nav .nav-item i.text-shushi,
    .dark .mobile-nav-more-item i.text-shushi { color: #00F5FF; }
    .dark .desktop-sidebar .nav-item i.text-renyo,
    .dark .mobile-nav .nav-item i.text-renyo,
    .dark .mobile-nav-more-item i.text-renyo { color: #00FF88; }
    .dark .desktop-sidebar .nav-item i.text-rentai,
    .dark .mobile-nav .nav-item i.text-rentai,
    .dark .mobile-nav-more-item i.text-rentai { color: #C084FC; }
    .dark .desktop-sidebar .nav-item i.text-katei,
    .dark .mobile-nav .nav-item i.text-katei,
    .dark .mobile-nav-more-item i.text-katei { color: #FFD93D; }
    .dark .desktop-sidebar .nav-item i.text-meirei,
    .dark .mobile-nav .nav-item i.text-meirei,
    .dark .mobile-nav-more-item i.text-meirei { color: #7BA3FF; }

    /* Flip card dark mode enhancement */
    .dark .flip-card:hover .flip-card-inner {
      box-shadow: 0 0 25px rgba(0, 245, 255, 0.15);
    }

    /* Dark mode select/option styling */
    .dark select {
      background-color: rgba(18, 18, 42, 0.9);
      color: #e0e0ff;
    }

    .dark select option {
      background-color: #12122a;
      color: #e0e0ff;
    }

    .dark select optgroup {
      background-color: #0a0a1a;
      color: #00F5FF;
      font-weight: 600;
    }

    /* Dark mode input placeholder color */
    .dark input::placeholder,
    .dark textarea::placeholder {
      color: #9ca3af;
      opacity: 1;
    }

    .dark input, .dark textarea {
      color: #e5e7eb;
    }

    /* ?? Conjugation Modal CSS ?? */
    .conj-modal-overlay {
      position: fixed; inset: 0; background: rgba(0,0,0,0.5);
      display: flex; align-items: center; justify-content: center;
      z-index: 999; padding: 1rem;
    }
    .conj-modal {
      width: 100%; max-width: 48rem; max-height: 85vh;
      border-radius: 1.25rem; overflow: hidden;
      display: flex; flex-direction: column;
    }
    .conj-modal-header {
      padding: 1rem 1.25rem; border-bottom: 1px solid rgba(128,128,128,0.2);
      display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
      flex-shrink: 0;
    }
    .conj-modal-body {
      overflow-y: auto; padding: 0.75rem 1rem; flex: 1;
    }
    /* Table header */
    .conj-table-header {
      display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem;
      padding: 0 0.5rem 0.5rem; margin-bottom: 0.25rem;
      border-bottom: 2px solid rgba(128,128,128,0.2);
      font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em;
      color: rgba(128,128,128,0.6);
    }
    .conj-table-header > div:last-child { padding-left: 0.5rem; }
    /* Grouped row: school left + edu right, aligned */
    .conj-group-row {
      display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem;
      padding: 0.4rem 0.5rem; border-radius: 0.5rem;
      border-bottom: 1px solid rgba(128,128,128,0.08);
    }
    .conj-group-even { background: rgba(128,128,128,0.035); }
    .dark .conj-group-even { background: rgba(255,255,255,0.025); }
    .conj-group-left { display: flex; flex-direction: column; justify-content: center; }
    .conj-group-right {
      display: flex; flex-direction: column; justify-content: center;
      padding-left: 0.5rem; border-left: 1px solid rgba(128,128,128,0.12);
    }
    .conj-row {
      display: flex; align-items: baseline; gap: 0.4rem;
      padding: 0.15rem 0; font-size: 0.9rem;
    }
    .conj-form-label {
      font-size: 0.68rem; font-weight: 600; min-width: 4.5rem;
      flex-shrink: 0; opacity: 0.65;
    }
    .conj-form-value { font-family: 'Noto Serif JP', serif; font-size: 1.05rem; }
    .conj-stem { color: inherit; }
    .conj-ending { font-weight: 700; }
    .conj-aux { font-weight: 700; color: #3B82F6; }
    .dark .conj-aux { color: #60A5FA; }
    .conj-variant-sep { font-size: 0.7rem; opacity: 0.35; margin: 0 0.1rem; }
    /* Conjugation button on cards */
    .conj-btn {
      width: 1.5rem; height: 1.5rem;
      display: inline-flex; align-items: center; justify-content: center;
      border-radius: 0.375rem; font-size: 0.7rem;
      transition: all 0.15s ease;
    }
    .conj-btn:hover { opacity: 0.8; }
    /* Mobile responsive */
    @media (max-width: 639px) {
      .conj-modal { max-height: 90vh; }
      .conj-table-header { display: none; }
      .conj-group-row {
        grid-template-columns: 1fr;
        gap: 0; padding: 0.3rem 0.4rem;
      }
      .conj-group-right {
        padding-left: 0.75rem; border-left: 3px solid rgba(128,128,128,0.1);
        margin-top: 0.15rem;
      }
      .conj-form-label { min-width: 3.8rem; font-size: 0.62rem; }
      .conj-form-value { font-size: 0.95rem; }
    }

    /* Micro-feedback: combo float */
    @keyframes comboFloatUp {
      0% { opacity: 1; transform: translateY(0) scale(1); }
      100% { opacity: 0; transform: translateY(-48px) scale(1.15); }
    }
    .combo-float-text {
      position: absolute; left: 50%; top: 40%; transform: translateX(-50%);
      pointer-events: none; z-index: 30;
      font-weight: 800; font-size: 1.25rem;
      text-shadow: 0 1px 6px rgba(0,0,0,0.25);
      animation: comboFloatUp 0.85s ease-out forwards;
    }
    .combo-float-text--hot {
      font-size: 1.45rem;
      color: #DC2626;
      text-shadow: 0 0 12px rgba(239, 68, 68, 0.45);
    }
    .combo-badge-active { animation: pulse 0.35s ease; }
    .combo-badge--hot {
      background: linear-gradient(90deg, rgba(239, 68, 68, 0.2), rgba(245, 158, 11, 0.25)) !important;
      color: #DC2626 !important;
    }

    /* ?? Module full-bleed backgrounds (inside main; never intercepts clicks) ?? */
    .main-content { isolation: isolate; }
    .module-bg-layer {
      position: fixed;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      z-index: 0;
      pointer-events: none !important;
      opacity: 0;
      transition: opacity 0.35s ease;
      background-color: transparent;
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
    }
    .main-content > .view-section { position: relative; z-index: 1; }
    @media (min-width: 769px) {
      .module-bg-layer { left: 240px; }
      .sidebar-collapsed .module-bg-layer { left: 72px; }
    }
    @media (max-width: 768px) {
      .module-bg-layer { bottom: var(--mobile-nav-height); }
    }
    .module-bg-layer.is-active { opacity: 0.22; }
    .dark .module-bg-layer.is-active { opacity: 0.16; }
    .module-bg-layer[data-bg="dojo"] {
      background-image:
        linear-gradient(160deg, rgba(40, 28, 20, 0.55) 0%, rgba(25, 18, 14, 0.42) 45%, rgba(50, 34, 24, 0.5) 100%),
        url('../data/ui/dojo-bg.jpg');
    }
    .module-bg-layer[data-bg="library"] {
      background-image:
        linear-gradient(155deg, rgba(36, 32, 28, 0.52) 0%, rgba(28, 26, 32, 0.4) 50%, rgba(42, 36, 30, 0.48) 100%),
        url('../data/ui/library-bg.jpg');
    }
    .module-bg-layer[data-bg="errors"] {
      background-image:
        linear-gradient(155deg, rgba(32, 28, 34, 0.55) 0%, rgba(40, 26, 24, 0.42) 50%, rgba(28, 30, 38, 0.5) 100%),
        url('../data/ui/errors-bg.jpg');
    }
    .module-bg-layer[data-bg="sensei"] {
      background-image:
        linear-gradient(155deg, rgba(28, 36, 32, 0.5) 0%, rgba(24, 30, 36, 0.4) 50%, rgba(36, 32, 28, 0.48) 100%),
        url('../data/ui/sensei-bg.jpg');
    }
    .module-bg-layer[data-bg="conjugation"] {
      background-image:
        linear-gradient(155deg, rgba(30, 34, 40, 0.5) 0%, rgba(26, 28, 36, 0.4) 50%, rgba(34, 32, 30, 0.48) 100%),
        url('../data/ui/conjugation-bg.jpg');
    }
    .module-bg-layer[data-bg="customtables"] {
      background-image:
        linear-gradient(155deg, rgba(34, 30, 36, 0.5) 0%, rgba(28, 32, 38, 0.4) 50%, rgba(36, 34, 30, 0.48) 100%),
        url('../data/ui/customtables-bg.jpg');
    }
    .module-bg-layer[data-bg="settings"] {
      background-image:
        linear-gradient(155deg, rgba(32, 34, 36, 0.5) 0%, rgba(28, 30, 34, 0.4) 50%, rgba(36, 32, 30, 0.48) 100%),
        url('../data/ui/settings-bg.jpg');
    }
    .dark .module-bg-layer[data-bg="dojo"] {
      background-image:
        linear-gradient(160deg, rgba(12, 10, 8, 0.72) 0%, rgba(18, 12, 10, 0.62) 50%, rgba(16, 12, 10, 0.7) 100%),
        url('../data/ui/dojo-bg.jpg');
    }
    .dark .module-bg-layer[data-bg="library"] {
      background-image:
        linear-gradient(155deg, rgba(10, 10, 14, 0.72) 0%, rgba(14, 12, 10, 0.62) 50%, rgba(12, 10, 12, 0.7) 100%),
        url('../data/ui/library-bg.jpg');
    }
    .dark .module-bg-layer[data-bg="errors"] {
      background-image:
        linear-gradient(155deg, rgba(12, 10, 14, 0.74) 0%, rgba(16, 10, 10, 0.64) 50%, rgba(10, 12, 16, 0.72) 100%),
        url('../data/ui/errors-bg.jpg');
    }
    .dark .module-bg-layer[data-bg="sensei"] {
      background-image:
        linear-gradient(155deg, rgba(8, 12, 10, 0.72) 0%, rgba(10, 12, 14, 0.62) 50%, rgba(12, 10, 8, 0.7) 100%),
        url('../data/ui/sensei-bg.jpg');
    }
    .dark .module-bg-layer[data-bg="conjugation"] {
      background-image:
        linear-gradient(155deg, rgba(10, 12, 16, 0.72) 0%, rgba(12, 10, 14, 0.62) 50%, rgba(12, 12, 10, 0.7) 100%),
        url('../data/ui/conjugation-bg.jpg');
    }
    .dark .module-bg-layer[data-bg="customtables"] {
      background-image:
        linear-gradient(155deg, rgba(12, 10, 14, 0.72) 0%, rgba(10, 12, 16, 0.62) 50%, rgba(14, 12, 10, 0.7) 100%),
        url('../data/ui/customtables-bg.jpg');
    }
    .dark .module-bg-layer[data-bg="settings"] {
      background-image:
        linear-gradient(155deg, rgba(10, 12, 14, 0.72) 0%, rgba(12, 12, 14, 0.62) 50%, rgba(14, 12, 10, 0.7) 100%),
        url('../data/ui/settings-bg.jpg');
    }

    /* Phase 3: Dojo skin accents (full-bleed bg is on #module-bg-layer) */
    #view-quiz.dojo-skin-active #quiz-progress .glass-card {
      border: 1px solid rgba(180, 120, 60, 0.35);
      box-shadow: 0 8px 28px rgba(40, 20, 10, 0.18), inset 0 0 0 1px rgba(255, 240, 220, 0.2);
      background: rgba(255, 252, 245, 0.9);
    }
    .dark #view-quiz.dojo-skin-active #quiz-progress .glass-card {
      background: rgba(30, 25, 22, 0.9);
      border-color: rgba(180, 120, 60, 0.28);
    }
    #view-quiz.dojo-skin-active #quiz-options button,
    #view-quiz.dojo-skin-active #quiz-options .quiz-option {
      border-radius: 12px;
      border: 1px solid rgba(180, 120, 60, 0.22);
    }
    .dojo-srs-modal {
      background: rgba(20, 14, 10, 0.55) !important;
      /* Room atmosphere comes from #module-bg-layer while dojo-session is on */
    }
    .dojo-srs-card {
      border: 1px solid rgba(180, 120, 60, 0.4) !important;
      box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 240, 220, 0.15) !important;
    }
    body.dojo-session #quiz-combo-display,
    body.dojo-session #srs-combo-display {
      border: 1px solid rgba(245, 158, 11, 0.45);
    }

    /* App boot overlay ? covers UI until dict / curriculum / packs are ready */
    .app-boot-overlay {
      position: fixed;
      inset: 0;
      z-index: 300;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 1rem;
      background: rgba(15, 23, 42, 0.78);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      transition: opacity 0.35s ease, visibility 0.35s ease;
    }
    .app-boot-overlay.app-boot-overlay--done {
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
    }
    .app-boot-overlay.hidden {
      display: none !important;
    }
    .app-boot-card { max-width: 22rem; }
    .app-boot-track {
      height: 0.45rem;
      border-radius: 999px;
      background: rgba(148, 163, 184, 0.28);
      overflow: hidden;
    }
    .app-boot-bar {
      height: 100%;
      width: 0;
      border-radius: 999px;
      background: linear-gradient(90deg, #38bdf8, #a78bfa, #f472b6);
      transition: width 0.18s ease-out;
    }
    .app-boot-spinner {
      width: 2.25rem;
      height: 2.25rem;
      margin: 0 auto;
      border-radius: 999px;
      border: 3px solid rgba(148, 163, 184, 0.35);
      border-top-color: #38bdf8;
      animation: app-boot-spin 0.8s linear infinite;
    }
    @keyframes app-boot-spin {
      to { transform: rotate(360deg); }
    }
    body.app-booting {
      overflow: hidden;
    }

    /* Onboarding overlay ? z-index must be in custom CSS (z-[100] not in Tailwind build) */
    .onboarding-overlay {
      position: fixed;
      inset: 0;
      z-index: 200;
      background: rgba(0,0,0,0.65);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
    }
    .onboarding-card { max-width: 22rem; }

    /* Weekly Boss card */
    .boss-card-glow {
      box-shadow: 0 0 24px rgba(239, 68, 68, 0.25);
    }
    .boss-timer-pulse { animation: pulse 2s infinite; }

    /* Word web / topic network */
    .word-web-overlay {
      position: fixed; inset: 0; z-index: 200;
      background: rgba(0,0,0,0.55);
      backdrop-filter: blur(4px);
      display: flex; align-items: center; justify-content: center; padding: 1rem;
    }
    .word-web-modal {
      width: min(560px, 100%); max-height: 90vh; overflow-y: auto;
      border-radius: 1rem; padding: 1.25rem;
    }
    .word-web-card-modal {
      width: min(420px, 100%);
      max-height: 85vh;
      overflow-y: auto;
      border-radius: 1rem;
      padding: 1.25rem;
    }
    .word-web-canvas {
      position: relative;
      width: 100%;
      height: min(55vh, 440px);
      border-radius: 0.75rem;
      overflow: hidden;
      background: rgba(148, 163, 184, 0.08);
      touch-action: none;
      cursor: grab;
      user-select: none;
    }
    .word-web-canvas.is-dragging { cursor: grabbing; }
    .word-web-svg {
      width: 100%;
      height: 100%;
      display: block;
    }
    .word-web-edge { pointer-events: none; }
    .word-web-zoom-controls {
      position: absolute;
      right: 0.55rem;
      bottom: 0.55rem;
      z-index: 2;
      display: flex;
      flex-direction: column;
      gap: 0.3rem;
    }
    .word-web-zoom-controls button {
      width: 2rem;
      height: 2rem;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 0.5rem;
      border: 1px solid rgba(148, 163, 184, 0.35);
      background: rgba(255, 255, 255, 0.88);
      color: #475569;
      font-size: 0.75rem;
      box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
      cursor: pointer;
      transition: background 0.15s, color 0.15s;
    }
    .dark .word-web-zoom-controls button {
      background: rgba(30, 41, 59, 0.9);
      color: #cbd5e1;
      border-color: rgba(148, 163, 184, 0.25);
    }
    .word-web-zoom-controls button:hover {
      background: rgba(244, 114, 182, 0.18);
      color: #db2777;
    }
    @keyframes wordWebBubble {
      0%, 100% { transform: translateY(0); }
      50% { transform: translateY(-4px); }
    }
    .word-web-node, .word-web-center {
      cursor: pointer;
      pointer-events: auto;
      animation: wordWebBubble 3.5s ease-in-out infinite;
      transform-box: fill-box;
      transform-origin: center;
      transition: opacity 0.15s;
    }
    .word-web-node:hover, .word-web-center:hover { opacity: 0.88; }
    .word-web-center { animation-duration: 4s; }
    .word-web-legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; font-size: 0.72rem; margin-bottom: 0.75rem; }
    .word-web-legend-item { display: flex; align-items: center; gap: 0.35rem; }
    .word-web-legend-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; flex-shrink: 0; }
    .topic-badge {
      display: inline-flex; align-items: center; gap: 0.2rem;
      font-size: 0.65rem; padding: 0.15rem 0.45rem; border-radius: 0.5rem;
      border: 1px solid rgba(255,255,255,0.25); cursor: pointer;
    }
    .topic-badge:hover { opacity: 0.85; }
    /* Dedicated topic colors (bypass Tailwind purge so every badge paints) */
    .topic-c-sky { background: #e0f2fe; color: #075985; border-color: rgba(14,165,233,0.28); }
    .topic-c-teal { background: #ccfbf1; color: #115e59; border-color: rgba(20,184,166,0.28); }
    .topic-c-amber { background: #fef3c7; color: #92400e; border-color: rgba(245,158,11,0.28); }
    .topic-c-violet { background: #ede9fe; color: #5b21b6; border-color: rgba(139,92,246,0.28); }
    .topic-c-rose { background: #ffe4e6; color: #9f1239; border-color: rgba(244,63,94,0.28); }
    .topic-c-red { background: #fee2e2; color: #991b1b; border-color: rgba(239,68,68,0.28); }
    .topic-c-pink { background: #fce7f3; color: #9d174d; border-color: rgba(236,72,153,0.28); }
    .topic-c-blush { background: #fecdd3; color: #881337; border-color: rgba(251,113,133,0.30); }
    .topic-c-orange { background: #ffedd5; color: #9a3412; border-color: rgba(249,115,22,0.28); }
    .topic-c-emerald { background: #d1fae5; color: #065f46; border-color: rgba(16,185,129,0.28); }
    .topic-c-stone { background: #e7e5e4; color: #44403c; border-color: rgba(120,113,108,0.28); }
    .topic-c-cyan { background: #cffafe; color: #155e75; border-color: rgba(6,182,212,0.28); }
    .topic-c-indigo { background: #e0e7ff; color: #3730a3; border-color: rgba(99,102,241,0.28); }
    .topic-c-navy { background: #bfdbfe; color: #1e3a8a; border-color: rgba(37,99,235,0.32); }
    .topic-c-blue { background: #dbeafe; color: #1e40af; border-color: rgba(59,130,246,0.28); }
    .topic-c-slate { background: #e2e8f0; color: #334155; border-color: rgba(100,116,139,0.28); }
    .topic-c-lime { background: #ecfccb; color: #3f6212; border-color: rgba(132,204,22,0.28); }
    .topic-c-purple { background: #f3e8ff; color: #6b21a8; border-color: rgba(168,85,247,0.28); }
    .topic-c-fuchsia { background: #fae8ff; color: #86198f; border-color: rgba(217,70,239,0.28); }
    .topic-c-yellow { background: #fef9c3; color: #854d0e; border-color: rgba(234,179,8,0.28); }
    .topic-c-azure { background: #bae6fd; color: #0c4a6e; border-color: rgba(14,165,233,0.32); }
    .topic-c-gold { background: #fde68a; color: #78350f; border-color: rgba(245,158,11,0.35); }
    .topic-c-steel { background: #e4e4e7; color: #27272a; border-color: rgba(113,113,122,0.30); }
    .topic-c-charcoal { background: #cbd5e1; color: #0f172a; border-color: rgba(71,85,105,0.32); }
    .topic-c-forest { background: #bbf7d0; color: #14532d; border-color: rgba(34,197,94,0.32); }
    .topic-c-orchid { background: #f5d0fe; color: #701a75; border-color: rgba(192,38,211,0.32); }
    .topic-c-midnight { background: #c7d2fe; color: #312e81; border-color: rgba(79,70,229,0.32); }
    .topic-c-green { background: #dcfce7; color: #166534; border-color: rgba(22,163,74,0.28); }
    .topic-c-magenta { background: #fbcfe8; color: #831843; border-color: rgba(219,39,119,0.32); }
    .topic-c-grape { background: #ddd6fe; color: #4c1d95; border-color: rgba(124,58,237,0.32); }
    .topic-c-coral { background: #fed7aa; color: #7c2d12; border-color: rgba(251,146,60,0.32); }
    .topic-c-moss { background: #a7f3d0; color: #064e3b; border-color: rgba(5,150,105,0.32); }
    .topic-c-zinc { background: #f4f4f5; color: #3f3f46; border-color: rgba(113,113,122,0.28); }
    .topic-c-aqua { background: #a5f3fc; color: #164e63; border-color: rgba(8,145,178,0.32); }
    .topic-c-gray { background: #f3f4f6; color: #374151; border-color: rgba(107,114,128,0.28); }
    .dark .topic-c-sky { background: rgba(12,74,110,0.45); color: #bae6fd; border-color: rgba(56,189,248,0.35); }
    .dark .topic-c-teal { background: rgba(19,78,74,0.45); color: #99f6e4; border-color: rgba(45,212,191,0.35); }
    .dark .topic-c-amber { background: rgba(120,53,15,0.45); color: #fde68a; border-color: rgba(251,191,36,0.35); }
    .dark .topic-c-violet { background: rgba(76,29,149,0.45); color: #ddd6fe; border-color: rgba(167,139,250,0.35); }
    .dark .topic-c-rose { background: rgba(136,19,55,0.45); color: #fecdd3; border-color: rgba(251,113,133,0.35); }
    .dark .topic-c-red { background: rgba(127,29,29,0.45); color: #fecaca; border-color: rgba(248,113,113,0.35); }
    .dark .topic-c-pink { background: rgba(131,24,67,0.45); color: #fbcfe8; border-color: rgba(244,114,182,0.35); }
    .dark .topic-c-blush { background: rgba(159,18,57,0.5); color: #fecdd3; border-color: rgba(251,113,133,0.4); }
    .dark .topic-c-orange { background: rgba(124,45,18,0.45); color: #fed7aa; border-color: rgba(251,146,60,0.35); }
    .dark .topic-c-emerald { background: rgba(6,78,59,0.45); color: #a7f3d0; border-color: rgba(52,211,153,0.35); }
    .dark .topic-c-stone { background: rgba(68,64,60,0.5); color: #e7e5e4; border-color: rgba(168,162,158,0.35); }
    .dark .topic-c-cyan { background: rgba(22,78,99,0.45); color: #a5f3fc; border-color: rgba(34,211,238,0.35); }
    .dark .topic-c-indigo { background: rgba(49,46,129,0.45); color: #c7d2fe; border-color: rgba(129,140,248,0.35); }
    .dark .topic-c-navy { background: rgba(30,58,138,0.55); color: #bfdbfe; border-color: rgba(96,165,250,0.4); }
    .dark .topic-c-blue { background: rgba(30,64,175,0.45); color: #bfdbfe; border-color: rgba(96,165,250,0.35); }
    .dark .topic-c-slate { background: rgba(51,65,85,0.5); color: #e2e8f0; border-color: rgba(148,163,184,0.35); }
    .dark .topic-c-lime { background: rgba(54,83,20,0.45); color: #d9f99d; border-color: rgba(163,230,53,0.35); }
    .dark .topic-c-purple { background: rgba(88,28,135,0.45); color: #e9d5ff; border-color: rgba(192,132,252,0.35); }
    .dark .topic-c-fuchsia { background: rgba(112,26,117,0.45); color: #f5d0fe; border-color: rgba(232,121,249,0.35); }
    .dark .topic-c-yellow { background: rgba(113,63,18,0.45); color: #fef08a; border-color: rgba(250,204,21,0.35); }
    .dark .topic-c-azure { background: rgba(12,74,110,0.55); color: #bae6fd; border-color: rgba(56,189,248,0.4); }
    .dark .topic-c-gold { background: rgba(120,53,15,0.55); color: #fde68a; border-color: rgba(251,191,36,0.4); }
    .dark .topic-c-steel { background: rgba(39,39,42,0.55); color: #e4e4e7; border-color: rgba(161,161,170,0.35); }
    .dark .topic-c-charcoal { background: rgba(30,41,59,0.6); color: #cbd5e1; border-color: rgba(148,163,184,0.4); }
    .dark .topic-c-forest { background: rgba(20,83,45,0.55); color: #bbf7d0; border-color: rgba(74,222,128,0.4); }
    .dark .topic-c-orchid { background: rgba(112,26,117,0.55); color: #f0abfc; border-color: rgba(232,121,249,0.4); }
    .dark .topic-c-midnight { background: rgba(49,46,129,0.55); color: #c7d2fe; border-color: rgba(129,140,248,0.4); }
    .dark .topic-c-green { background: rgba(20,83,45,0.45); color: #bbf7d0; border-color: rgba(74,222,128,0.35); }
    .dark .topic-c-magenta { background: rgba(131,24,67,0.55); color: #f9a8d4; border-color: rgba(244,114,182,0.4); }
    .dark .topic-c-grape { background: rgba(76,29,149,0.55); color: #c4b5fd; border-color: rgba(167,139,250,0.4); }
    .dark .topic-c-coral { background: rgba(124,45,18,0.55); color: #fdba74; border-color: rgba(251,146,60,0.4); }
    .dark .topic-c-moss { background: rgba(6,78,59,0.55); color: #6ee7b7; border-color: rgba(52,211,153,0.4); }
    .dark .topic-c-zinc { background: rgba(39,39,42,0.5); color: #d4d4d8; border-color: rgba(161,161,170,0.35); }
    .dark .topic-c-aqua { background: rgba(22,78,99,0.55); color: #67e8f9; border-color: rgba(34,211,238,0.4); }
    .dark .topic-c-gray { background: rgba(55,65,81,0.5); color: #e5e7eb; border-color: rgba(156,163,175,0.35); }
    .card-back-topic-corner {
      position: absolute;
      top: 0.5rem;
      right: 0.5rem;
      z-index: 10;
      display: flex;
      flex-wrap: wrap;
      gap: 0.125rem;
      justify-content: flex-end;
      max-width: 75%;
      pointer-events: auto;
    }
    .flip-card-back.card-back-has-topics,
    .card-back-detail-wrap.card-back-has-topics {
      padding-top: 1.75rem;
    }
    .card-back-detail-wrap { position: relative; }
    .topic-overview-badge {
      font-size: 0.72rem; padding: 0.25rem 0.6rem; border-radius: 9999px;
      cursor: pointer; border: 1px solid rgba(255,255,255,0.2);
      transition: transform 0.12s, opacity 0.12s;
    }
    .topic-overview-badge:hover { transform: translateY(-1px); opacity: 0.9; }
    .topic-overview-badge.active,
    .topic-overview-badge-active { box-shadow: 0 0 0 2px rgba(244,114,182,0.5); }
    .assoc-chip { font-size: 0.8rem; }
    .assoc-chip-synonym { color: #dc2626; border-color: rgba(220,38,38,0.3); }
    .dark .assoc-chip-synonym { color: #f87171; }
    .assoc-chip-contrast { color: #7c3aed; border-color: rgba(124,58,237,0.3); }
    .dark .assoc-chip-contrast { color: #a78bfa; }
    .assoc-chip-antonym { color: #16a34a; border-color: rgba(22,163,74,0.3); }
    .dark .assoc-chip-antonym { color: #4ade80; }
    .assoc-chip-collocation { color: #d97706; border-color: rgba(217,119,6,0.3); }
    .dark .assoc-chip-collocation { color: #fbbf24; }
    .assoc-chip-derivative { color: #64748b; border-color: rgba(100,116,139,0.3); }
    .dark .assoc-chip-derivative { color: #94a3b8; }
    .nuance-modal { width: min(720px, 100%); max-height: 90vh; overflow-y: auto; border-radius: 1rem; padding: 1.25rem; }
    .nuance-compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; }
    .nuance-word-card { padding: 0.75rem; border-radius: 0.75rem; border: 1px solid rgba(255,255,255,0.15); }
    .topic-cb-label { font-size: 0.72rem; padding: 0.2rem 0.5rem; border-radius: 0.5rem; cursor: pointer; border: 1px solid rgba(255,255,255,0.15); }
    .word-web-btn {
      width: 1.5rem; height: 1.5rem;
      display: inline-flex; align-items: center; justify-content: center;
      border-radius: 0.375rem; font-size: 0.7rem;
      transition: all 0.15s ease;
    }
    .word-web-btn:hover { opacity: 0.8; }
    .topic-cb-label input { position: absolute; opacity: 0; width: 0; height: 0; }
    .topic-cb-label:has(input:checked) { background: rgba(244,114,182,0.2); border-color: rgba(244,114,182,0.4); }

    /* ???? ? structured SVG scene illustration */
    .utterance-scene-wrap {
      display: flex;
      justify-content: center;
      margin-bottom: 0.75rem;
    }
    .utterance-scene-svg {
      width: 100%;
      max-width: 400px;
      height: auto;
      display: block;
      border-radius: 0.5rem;
      background: #fffef9;
    }
    .dark .utterance-scene-svg {
      background: #1f2937;
    }
    .utterance-scene-svg .utterance-scene-label {
      font-family: 'Noto Sans JP', 'Hiragino Sans', sans-serif;
    }
    .utterance-scene-svg .utterance-arrow line {
      filter: drop-shadow(0 1px 1px rgba(220, 38, 38, 0.3));
    }
    .utterance-scene-fallback pre {
      font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
    }

/* ===== Map Battle Overlay ===== */
.battle-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}
.battle-panel {
  width: min(32rem, calc(100vw - 1.5rem));
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 1rem 1.1rem 1.15rem;
  border-radius: 1rem;
}
.battle-hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.5rem;
  align-items: start;
  margin-bottom: 0.65rem;
}
.battle-side { min-width: 0; }
.battle-name {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: #1f2937;
}
.dark .battle-name { color: #f3f4f6; }
.battle-vs {
  font-size: 0.7rem;
  font-weight: 700;
  color: #9ca3af;
  padding-top: 0.45rem;
}
.battle-bar-wrap {
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(156, 163, 175, 0.35);
  overflow: hidden;
}
.battle-bar {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  transition: width 0.28s ease;
}
.battle-bar--hp { background: linear-gradient(90deg, #34d399, #059669); }
.battle-bar--enemy { background: linear-gradient(90deg, #f87171, #dc2626); }
.battle-meta {
  font-size: 0.68rem;
  color: #6b7280;
  margin-top: 0.2rem;
  line-height: 1.35;
}
.dark .battle-meta { color: #9ca3af; }
.battle-status {
  font-size: 0.72rem;
  color: #b45309;
  margin-bottom: 0.45rem;
}
.dark .battle-status { color: #fbbf24; }
.battle-prompt {
  white-space: pre-wrap;
  font-size: 1.05rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.75rem;
  min-height: 2.5rem;
}
.dark .battle-prompt { color: #f9fafb; }
.battle-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}
.battle-opt {
  text-align: left;
  padding: 0.65rem 0.8rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(156, 163, 175, 0.45);
  background: rgba(255, 255, 255, 0.85);
  color: #1f2937;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.dark .battle-opt {
  background: rgba(55, 65, 81, 0.9);
  color: #f3f4f6;
  border-color: rgba(75, 85, 99, 0.9);
}
.battle-opt:hover:not(:disabled) {
  border-color: #d97706;
  background: rgba(254, 243, 199, 0.55);
}
.dark .battle-opt:hover:not(:disabled) {
  background: rgba(120, 53, 15, 0.35);
}
.battle-opt:disabled { opacity: 0.7; cursor: default; }
.battle-opt--correct {
  border-color: #047857 !important;
  background: #6ee7b7 !important;
  color: #064e3b !important;
  font-weight: 700;
}
.battle-opt--wrong {
  border-color: #b91c1c !important;
  background: #fca5a5 !important;
  color: #7f1d1d !important;
  font-weight: 700;
}
.battle-opt--removed {
  opacity: 0.35;
  text-decoration: line-through;
}
.battle-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}
.battle-skill--moko {
  background: linear-gradient(90deg, #ef4444, #b91c1c) !important;
  color: #fff !important;
}
.battle-footer {
  display: none !important;
}
.battle-log {
  display: none !important;
}
.battle-result-card { text-align: center; padding: 0.75rem 1rem; }
.battle-result-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  color: #fef3c7;
  text-shadow: 0 2px 8px rgba(0,0,0,0.65);
}
.dark .battle-result-title { color: #fef3c7; }
.battle-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
}
.battle-result-actions .rpg-capsule-btn {
  min-width: 8.5rem;
}
.battle-settle {
  text-align: left;
  margin: 0.35rem 0 0.85rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.55rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(253, 230, 138, 0.22);
}
.battle-settle__label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fde68a;
  margin-bottom: 0.35rem;
  letter-spacing: 0.04em;
}
.battle-settle__row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: #e5e7eb;
  padding: 0.18rem 0;
}
.battle-settle__row strong {
  color: #fef3c7;
  font-weight: 800;
}
.battle-settle__row--total {
  margin-top: 0.2rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.9rem;
}
.battle-settle__row--total strong { color: #86efac; }
.battle-settle__notes {
  margin-top: 0.45rem;
  font-size: 0.72rem;
  color: #cbd5e1;
  line-height: 1.4;
}
.battle-settle--defeat .battle-settle__label { color: #fca5a5; }
.battle-settle--defeat .battle-settle__row--total strong { color: #fca5a5; }
.battle-flash--hit .battle-bar--enemy { filter: brightness(1.35); }
.battle-flash--hurt .battle-bar--hp { filter: brightness(1.35); }
.battle-flash--crit .battle-bar--enemy { filter: brightness(1.55) saturate(1.25); }
.battle-flash--defend .battle-bar--hp { filter: brightness(1.25) hue-rotate(-10deg); }
@media (min-width: 480px) {
  .battle-options { grid-template-columns: 1fr 1fr; }
}

/* ===== Equipment (square SVG icon cells) ===== */
.dash-equipment-panel { font-size: 0.72rem; }
.equip-section-title,
.equip-bag-title {
  margin: 0.15rem 0 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: #4b5563;
}
.dark .equip-section-title,
.dark .equip-bag-title { color: #9ca3af; }
.equip-bag-title { margin-top: 0.45rem; }
.equip-slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem;
}
.equip-bag-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.28rem;
  max-height: 6.4rem;
  overflow-y: auto;
  padding-bottom: 0.1rem;
}
.equip-bag-empty {
  grid-column: 1 / -1;
  margin: 0.35rem 0;
  text-align: center;
  font-size: 0.62rem;
}
.equip-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  padding: 0;
  border: 2px solid #c4b59a;
  border-radius: 0.35rem;
  background:
    linear-gradient(160deg, rgba(255,252,245,0.92), rgba(236,226,208,0.75));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), inset 0 -1px 2px rgba(120,90,40,0.12);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-sizing: border-box;
}
.dark .equip-cell {
  background: linear-gradient(160deg, rgba(55,65,81,0.85), rgba(31,41,55,0.9));
  border-color: #6b7280;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), inset 0 -1px 2px rgba(0,0,0,0.35);
}
.equip-cell--empty {
  border-style: dashed;
  opacity: 0.72;
}
.equip-cell--selected {
  outline: 2px solid #0f766e;
  outline-offset: 1px;
}
.dark .equip-cell--selected { outline-color: #2dd4bf; }
.equip-cell--locked { opacity: 0.55; }
.equip-cell__icon {
  display: flex;
  width: 72%;
  height: 72%;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(60, 40, 10, 0.18));
}
.equip-cell--empty .equip-cell__icon {
  filter: none;
}
.equip-cell__icon svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.equip-cell__slot {
  position: absolute;
  left: 2px;
  bottom: 1px;
  font-size: 0.42rem;
  line-height: 1;
  color: rgba(55,65,81,0.75);
  font-weight: 700;
  letter-spacing: -0.02em;
  pointer-events: none;
  max-width: calc(100% - 4px);
  overflow: hidden;
  white-space: nowrap;
}
.dark .equip-cell__slot { color: rgba(209,213,219,0.7); }
.equip-cell__badge {
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 0.4rem;
  line-height: 1;
  font-weight: 800;
  color: #78716c;
  pointer-events: none;
}
.dark .equip-cell__badge { color: #a8a29e; }
.equip-cell__lock {
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: 0.4rem;
  line-height: 1;
  font-weight: 800;
  color: #b45309;
  pointer-events: none;
}
.equip-token-hint { color: #0f766e; font-weight: 600; }
.dark .equip-token-hint { color: #5eead4; }
.equip-qty--common { border-color: #9ca3af; }
.equip-qty--fine { border-color: #22c55e; }
.equip-qty--superior { border-color: #3b82f6; }
.equip-qty--rare { border-color: #a855f7; }
.equip-qty--masterwork {
  border-color: #eab308;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), 0 0 0 1px rgba(234,179,8,0.35);
}
.equip-detail {
  margin-top: 0.4rem;
  padding: 0.35rem 0.4rem;
  border: 1px solid rgba(180,150,100,0.35);
  border-radius: 0.4rem;
  background: rgba(255,255,255,0.4);
}
.dark .equip-detail {
  background: rgba(31,41,55,0.45);
  border-color: #4b5563;
}
.equip-detail--empty { padding: 0.3rem 0.4rem; }
.equip-detail__hint {
  margin: 0;
  font-size: 0.58rem;
  color: #6b7280;
  text-align: center;
}
.dark .equip-detail__hint { color: #9ca3af; }
.equip-detail__head { margin-bottom: 0.15rem; }
.equip-detail__name {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  color: #374151;
  line-height: 1.25;
}
.dark .equip-detail__name { color: #e5e7eb; }
.equip-detail__meta {
  margin: 0.05rem 0 0;
  font-size: 0.55rem;
  color: #6b7280;
}
.dark .equip-detail__meta { color: #9ca3af; }
.equip-detail__stats {
  margin: 0.15rem 0 0.25rem;
  font-size: 0.55rem;
  color: #4b5563;
  line-height: 1.35;
}
.dark .equip-detail__stats { color: #d1d5db; }
.equip-detail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.equip-detail__btn {
  margin: 0;
  padding: 0.15rem 0.4rem;
  font-size: 0.55rem;
  font-weight: 700;
  border-radius: 0.3rem;
  border: 1px solid #d1d5db;
  background: rgba(255,255,255,0.7);
  cursor: pointer;
  line-height: 1.3;
}
.dark .equip-detail__btn {
  background: rgba(55,65,81,0.7);
  border-color: #4b5563;
  color: #e5e7eb;
}
.equip-detail__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.equip-detail__btn--wear { color: #0f766e; border-color: #99f6e4; }
.equip-detail__btn--unequip { color: #059669; }
.equip-detail__btn--upgrade { color: #0f766e; }
.dark .equip-detail__btn--upgrade { color: #5eead4; }
.equip-detail__btn--sell { color: #b45309; }
.dark .equip-detail__btn--sell { color: #fbbf24; }

/* ===== Simplified commission scroll ===== */
.daily-task-list { display: flex; flex-direction: column; gap: 0.2rem; }
.daily-task-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
}
.daily-task-row__label { flex: 1; color: #374151; }
.dark .daily-task-row__label { color: #e5e7eb; }
.daily-task-row__val { color: #6b7280; font-variant-numeric: tabular-nums; }
.commission-list { display: flex; flex-direction: column; gap: 0.35rem; }
.commission-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 0.5rem;
  background: rgba(255,255,255,0.45);
}
.dark .commission-row { background: rgba(31,41,55,0.45); }
.commission-row--done { opacity: 0.72; }
.commission-row__title {
  font-size: 0.72rem;
  font-weight: 700;
  margin: 0;
  color: #1f2937;
}
.dark .commission-row__title { color: #f3f4f6; }
.commission-row__hint {
  margin: 0.1rem 0 0;
  font-size: 0.58rem;
  color: #9ca3af;
}
.commission-row__btn { font-size: 0.62rem !important; padding: 0.2rem 0.55rem !important; }
.commission-row__done {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
}
.commission-check {
  display: block;
  width: 1.35rem;
  height: 1.35rem;
}
.commission-row--done .commission-row__title {
  color: #059669;
}
.dark .commission-row--done .commission-row__title { color: #34d399; }
.dash-mission-block--compact { padding-top: 0.15rem; }

/* ===== Commission scroll revamp ===== */
.scroll-hud .scroll-tabs {
  margin-bottom: 0.4rem;
}
.scroll-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}
.scroll-tab__icon {
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
  opacity: 0.85;
}
.scroll-tab--active .scroll-tab__icon { opacity: 1; }
.scroll-tab__badge {
  margin-left: 0.1rem;
  font-size: 0.62rem;
  font-weight: 700;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}
.scroll-tab--active .scroll-tab__badge { color: #111827; }
.dark .scroll-tab__badge { color: #9ca3af; }
.dark .scroll-tab--active .scroll-tab__badge { color: #f3f4f6; }
.scroll-pane__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  font-size: 0.62rem;
}
.scroll-pane__progress {
  font-weight: 700;
  color: #4b5563;
}
.dark .scroll-pane__progress { color: #d1d5db; }
.scroll-hud__wallet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  font-size: 0.62rem;
}
.scroll-hud__wallet-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #6b7280;
}
.dark .scroll-hud__wallet-label { color: #9ca3af; }
.scroll-wallet-icon {
  width: 0.85rem;
  height: 0.85rem;
  color: #d97706;
}
.dark .scroll-wallet-icon { color: #fbbf24; }
.scroll-hud__wallet-val {
  font-weight: 700;
  color: #b45309;
}
.dark .scroll-hud__wallet-val { color: #fbbf24; }
.scroll-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(243, 244, 246, 0.85);
}
.dark .scroll-tabs { background: rgba(55, 65, 81, 0.75); }
.scroll-tab {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 5px 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  color: #6b7280;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.scroll-tab--active {
  color: #111827;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.dark .scroll-tab { color: #9ca3af; }
.dark .scroll-tab--active {
  color: #f3f4f6;
  background: rgba(31, 41, 55, 0.95);
}
.scroll-next-btn {
  font-size: 0.68rem !important;
  padding: 0.35rem 0.55rem !important;
}
.shop-list { display: flex; flex-direction: column; gap: 0.35rem; }
.shop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.4rem 0.5rem;
  border-radius: 0.5rem;
  background: rgba(255,255,255,0.45);
}
.dark .shop-row { background: rgba(31,41,55,0.45); }
.shop-row--locked { opacity: 0.72; }
.shop-row__title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: #1f2937;
}
.dark .shop-row__title { color: #f3f4f6; }
.shop-row__desc {
  margin: 0.08rem 0 0;
  font-size: 0.58rem;
  color: #9ca3af;
}
.shop-row__price {
  margin: 0.12rem 0 0;
  font-size: 0.62rem;
  font-weight: 700;
  color: #b45309;
}
.dark .shop-row__price { color: #fbbf24; }
.shop-row__buy { font-size: 0.62rem !important; padding: 0.2rem 0.55rem !important; }
.shop-row__buy--disabled { opacity: 0.55; cursor: not-allowed; }

/* Radar ? larger & darker in profile HUD */
.rpg-hud--profile .dash-radar-svg {
  width: 100%;
  max-width: 230px;
  height: auto;
  min-height: 190px;
  color: #64748b;
}
.dark .rpg-hud--profile .dash-radar-svg { color: #94a3b8; }
.rpg-hud--profile .dash-radar-legend {
  display: none;
}
.rpg-hud--profile #dash-radar.dash-radar-pane {
  width: 100%;
}

.dash-rank-pane {
  position: relative;
  padding-bottom: 0;
}
.dash-rank-hud-corner {
  position: absolute;
  top: 0.2rem;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(6px);
  font-size: 0.68rem;
  color: #374151;
  pointer-events: none;
}
.dark .dash-rank-hud-corner {
  background: rgba(17, 24, 39, 0.78);
  color: #e5e7eb;
}
.dash-rank-hud-streak { display: inline-flex; align-items: center; gap: 0.2rem; }
.dash-rank-hud-target {
  font-weight: 700;
  color: #059669;
}
.dark .dash-rank-hud-target { color: #34d399; }
.dash-rank-hud-unit { color: #9ca3af; margin-left: 0.1rem; }
.dash-rank-head {
  align-items: center;
  padding-right: 7rem;
  gap: 0.75rem;
  margin-top: 0.35rem;
}
.dash-rank-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
  min-width: 0;
}
.dash-rank-color-dots {
  margin-top: 0;
}
.dash-rank-pane .dash-exp-block {
  margin-top: 0.45rem;
}
.dash-exp-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 0 1rem;
  width: 100%;
}
.dash-rank-next {
  justify-self: start;
  padding-left: 0.75rem;
  border-left: 1px solid rgba(156, 163, 175, 0.45);
  white-space: nowrap;
}
.dark .dash-rank-next { border-left-color: rgba(148, 163, 184, 0.35); }
.dash-rank-today { justify-self: end; }
.dash-char-battle-grid--5 {
  grid-template-columns: repeat(5, 1fr);
}
.dash-char-battle-grid--7 {
  grid-template-columns: repeat(7, 1fr);
}
@media (max-width: 640px) {
  .dash-char-battle-grid--7 {
    grid-template-columns: repeat(4, 1fr);
  }
}
.battle-timer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}
.battle-timer--top {
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
  min-width: 5.5rem;
  max-width: 7.5rem;
  margin: 0 auto;
  padding: 0.28rem 0.45rem 0.32rem;
  border-radius: 0.55rem;
  border: 2px solid #111827;
  background: #fff;
  box-shadow: 0 0 0 1px #fff inset, 0 2px 8px rgba(0, 0, 0, 0.35);
}
.battle-timer--top.battle-timer--hidden {
  visibility: hidden;
  pointer-events: none;
}
.battle-timer--top .battle-timer__label {
  font-size: 0.82rem;
  font-weight: 800;
  color: #111827;
  min-width: 0;
  text-align: center;
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.battle-timer--top .battle-timer__track {
  height: 0.45rem;
  background: #e5e7eb;
  border: 1px solid #111827;
}
.battle-timer--top .battle-timer__bar {
  background: linear-gradient(90deg, #22d3ee, #06b6d4);
}
.battle-timer--top .battle-timer__bar.battle-timer--urgent {
  background: linear-gradient(90deg, #fb923c, #ef4444);
  animation: battle-timer-pulse 0.55s ease-in-out infinite alternate;
}
@keyframes battle-timer-pulse {
  from { filter: brightness(1); }
  to { filter: brightness(1.18); }
}
.battle-timer__label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #b45309;
  min-width: 1.8rem;
  text-align: right;
}
.battle-timer__track {
  flex: 1;
  height: 0.4rem;
  border-radius: 999px;
  background: rgba(156, 163, 175, 0.35);
  overflow: hidden;
}
.battle-timer__bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
  transition: width 0.1s linear;
}
.battle-timer__bar.battle-timer--urgent {
  background: linear-gradient(90deg, #f87171, #dc2626);
}

/* Map node markers ? ???? + ????????????? */
.jp-map-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
.jp-map-marker {
  position: absolute;
  /* ?????????? --span-scale */
  transform: translate(-50%, -50%) scale(var(--marker-zoom, 1));
  transform-origin: center center;
  width: 6px;
  height: 6px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--marker-color, #64748B);
  pointer-events: auto;
  cursor: pointer;
  /* ?????????????????????????? */
  filter: drop-shadow(0 0 2px rgba(15, 23, 42, 0.35));
  opacity: 1;
}
.jp-map-marker::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--marker-color, #64748B);
  opacity: 0;
  pointer-events: none;
  display: none;
}
.jp-map-marker--uncleared::before,
.jp-map-marker--pulse::before {
  display: block;
  animation: jp-marker-ring 1.4s ease-out infinite;
  border-width: 1.5px;
}
/* ??????????????? 40px */
.jp-map-marker::after {
  content: '';
  display: block;
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  background: transparent;
  pointer-events: auto;
}
.jp-map-marker--lord,
.jp-map-marker--secret,
.jp-map-marker--field-sweep,
.jp-map-canvas--detail .jp-map-marker,
.jp-map-canvas--detail .jp-map-marker--lord,
.jp-map-canvas--detail .jp-map-marker--secret {
  width: 6px;
  height: 6px;
}
@media (max-width: 768px) {
  .jp-map-marker,
  .jp-map-marker--lord,
  .jp-map-marker--secret,
  .jp-map-marker--field-sweep,
  .jp-map-canvas--detail .jp-map-marker,
  .jp-map-canvas--detail .jp-map-marker--lord,
  .jp-map-canvas--detail .jp-map-marker--secret {
    width: 9px;
    height: 9px;
  }
  .jp-map-marker::after {
    inset: -14px;
  }
  .jp-map-marker--lord,
  .jp-map-marker--secret,
  .jp-map-marker--field-sweep {
    width: 10.5px;
    height: 10.5px;
  }
}
/* ?????????????? */
.jp-map-marker--pulse {
  animation: none;
  opacity: 1;
}
.jp-map-marker--cleared {
  animation: none;
  opacity: 1;
  filter: drop-shadow(0 0 2px rgba(15, 23, 42, 0.35));
}
@keyframes jp-marker-ring {
  0% { transform: scale(0.55); opacity: 0.55; }
  70% { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.45); opacity: 0; }
}
.jp-map-marker--mini {
  position: relative;
  transform: none;
  width: 7.5px;
  height: 7.5px;
  display: inline-block;
  vertical-align: middle;
  filter: drop-shadow(0 0 2px rgba(15, 23, 42, 0.35));
}
.jp-map-marker--mini::before,
.jp-map-marker--mini::after {
  display: none;
}
.jp-map-marker__dot {
  display: none;
}
.jp-map-marker--field-sweep {
  width: 6px;
  height: 6px;
  z-index: 6;
  display: block !important;
}
.jp-map-marker--npc {
  --marker-color: #0EA5E9;
  z-index: 5;
}
.jp-map-marker--learn {
  --marker-color: #D97706;
  z-index: 5;
}
.jp-map-marker--npc.jp-map-marker--seen,
.jp-map-marker--learn.jp-map-marker--seen {
  opacity: 0.72;
  filter: drop-shadow(0 0 2px rgba(15, 23, 42, 0.28));
}
/* SPOT????POI ?????????????????????????? */
.jp-map-marker--garrison:not(.jp-map-marker--in-spot):not(.jp-map-marker--show-garrison),
.jp-map-marker--npc:not(.jp-map-marker--in-spot),
.jp-map-marker--learn:not(.jp-map-marker--in-spot) {
  display: none !important;
}
.jp-map-poi-body {
  text-align: left;
  max-width: 22rem;
}
.jp-map-poi-lines {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  line-height: 1.55;
  color: #374151;
}
.dark .jp-map-poi-lines { color: #e5e7eb; }
.jp-map-poi-lines li + li { margin-top: 0.35rem; }
.jp-map-poi-words {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.jp-map-poi-word {
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
  border-radius: 0.4rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.35);
}
.jp-map-poi-empty {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-top: 0.5rem;
}
.jp-map-canvas--spot .jp-map-marker--out-spot.jp-map-marker--lord::before,
.jp-map-canvas--spot .jp-map-marker--out-spot.jp-map-marker--secret::before {
  display: none;
}
.jp-pref-nodes { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0.35rem 0; }
.jp-pref-node-chip {
  font-size: 0.62rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(156,163,175,0.5);
  background: rgba(255,255,255,0.55);
  cursor: pointer;
}
.jp-pref-node-chip--done { opacity: 0.65; border-color: #34D399; }
.jp-pref-node-chip--locked,
.jp-pref-node-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Adventure log HUD ? ??????? 40%????? */
.rpg-hud--bl {
  bottom: 16px;
  left: 16px;
  max-width: min(300px, 48vw);
  max-height: 40%;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.adventure-log-hud .adventure-log__toggle { flex-shrink: 0; }
.adventure-log-hud .adventure-log__panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.adventure-log__row {
  display: grid;
  grid-template-columns: 4.6rem 1fr;
  gap: 0.15rem 0.35rem;
  font-size: 0.62rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(229,231,235,0.45);
}
.adventure-log__time {
  font-variant-numeric: tabular-nums;
  color: #6b7280;
  white-space: nowrap;
}
.dark .adventure-log__time { color: #9ca3af; }
.adventure-log__gain { grid-column: 2; font-size: 0.58rem; }
.adventure-log__exp { color: #0891b2; }
.dark .adventure-log__exp { color: #22d3ee; }
.adventure-log__mon { color: #d97706; }
.dark .adventure-log__mon { color: #fbbf24; }
.adventure-log__equip { color: #b45309; }
.dark .adventure-log__equip { color: #fbbf24; }
.adventure-log__gain-sep { color: #9ca3af; }
.dark .adventure-log__gain-sep { color: #6b7280; }

/* Vertical battle UI */
.battle-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  background: rgba(15, 23, 42, 0.72);
}
html.battle-open,
html.battle-open body {
  overflow: hidden;
  touch-action: none;
}
.battle-scene {
  position: relative;
  width: min(520px, 100%);
  max-width: 100%;
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
}
.battle-scene__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
}
.battle-scene__mid {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}
.battle-panel--vertical {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  /* ??Dynamic Island???Home Indicator?????????? */
  padding: max(0.55rem, calc(var(--safe-top) + 0.45rem))
    max(0.55rem, var(--safe-right))
    max(0.85rem, calc(var(--safe-bottom) + 0.45rem))
    max(0.55rem, var(--safe-left));
  border-radius: 0;
  background: linear-gradient(180deg, rgba(15,23,42,0.35), rgba(15,23,42,0.82));
}
.secret-realm-panel {
  background: linear-gradient(180deg, rgba(15,23,42,0.28), rgba(15,23,42,0.78));
}
.secret-realm-progress {
  margin: 0;
  justify-self: center;
  align-self: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #f9a8d4;
  text-shadow: 0 1px 2px rgba(0,0,0,0.45);
}
.secret-loading-card {
  padding: 1.25rem 1.5rem;
  text-align: center;
}
.battle-top-hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 0.35rem;
  flex: 0 0 auto;
}
.battle-top-hud .battle-top-hud__spacer { justify-self: start; min-height: 1px; }
.battle-top-hud .battle-leave-top { justify-self: start; } /* secret realm still uses leave */
.battle-top-hud .battle-timer--top { justify-self: center; }
.battle-top-hud .battle-combo-wrap {
  justify-self: end;
}
.battle-bar-row { display: flex; align-items: center; gap: 0.3rem; margin-bottom: 0.15rem; }
.battle-bar-label { font-size: 0.62rem; width: 1.3rem; color: #e5e7eb; font-weight: 700; }
.battle-bar-val {
  font-size: 0.78rem;
  color: #fff;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  min-width: 2.6rem;
  text-align: right;
  -webkit-text-stroke: 0.4px rgba(0, 0, 0, 0.45);
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.85),
    0 2px 3px rgba(0, 0, 0, 0.55);
}
.battle-bar--mp { background: linear-gradient(90deg, #38bdf8, #2563eb); }
.battle-enemy-stage {
  text-align: center;
  margin: 0 0 0;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  padding-bottom: 0;
  gap: 0;
  overflow: hidden;
  z-index: 1;
}
.battle-enemy-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 0.08rem;
  min-height: 0;
  flex: 1 1 auto;
  height: 100%;
}
.battle-enemy-title-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  order: 1;
  flex: 0 0 auto;
  width: 100%;
  padding: 0 0.4rem;
}
.battle-enemy-title-row .battle-status {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fbbf24;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
  flex: 0 0 auto;
}
.battle-enemy-name {
  font-weight: 700;
  color: #fef3c7;
  margin-bottom: 0;
  font-size: 0.95rem;
  flex: 0 1 auto;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}
.battle-bar-wrap--enemy {
  width: min(250px, 64vw);
  margin: 0 auto;
  height: 1.05rem;
  position: relative;
  order: 2;
  flex: 0 0 auto;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid rgba(254, 202, 202, 0.45);
  background: rgba(0, 0, 0, 0.45);
  border-radius: 999px;
  z-index: 2;
}
.battle-bar-wrap--enemy .battle-bar--enemy {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
}
.battle-enemy-hp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  font-size: 0.88rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #fff;
  letter-spacing: 0.03em;
  -webkit-text-stroke: 0.6px rgba(0, 0, 0, 0.55);
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.9),
    0 2px 0 rgba(0, 0, 0, 0.55),
    0 3px 6px rgba(0, 0, 0, 0.65),
    0 0 10px rgba(254, 202, 202, 0.35);
  pointer-events: none;
}
.battle-enemy-portrait {
  /* Default = AI 16:9 sheet 1792?1008 ? 4 frames of 448?1008 (~4:9). JS overwrites vars from natural size. */
  --battle-frame-w: 448;
  --battle-frame-h: 1008;
  /* Prefer full body (incl. legs) over aggressive shrink that looks cut-off / floating. */
  width: min(190px, 52vw, calc(50vh * var(--battle-frame-w) / var(--battle-frame-h)));
  height: auto;
  aspect-ratio: var(--battle-frame-w) / var(--battle-frame-h);
  max-height: 50vh;
  margin: 0 auto;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  position: relative;
  order: 3;
  flex: 0 1 auto;
  overflow: visible;
  /* Tight ground-contact shadow ? avoid large soft blur (ghost float). */
  filter:
    drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7))
    drop-shadow(0 3px 4px rgba(0, 0, 0, 0.35))
    drop-shadow(0 1px 0 rgba(127, 29, 29, 0.4));
  transform-origin: center bottom;
}
.battle-enemy-portrait__canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.battle-enemy-portrait[data-frame="idle"] { }
.battle-enemy-portrait[data-frame="hurt"] { }
.battle-enemy-portrait[data-frame="attack"] { }
.battle-enemy-portrait[data-frame="ko"] { }
.battle-enemy-stage .battle-meta {
  order: 3;
  margin-top: 0;
  margin-bottom: 0;
  color: #e5e7eb;
  min-height: 0;
  line-height: 1.2;
  flex: 0 0 auto;
}
.battle-enemy-stage .battle-meta:empty {
  display: none;
}
.battle-cmd-row {
  display: grid;
  grid-template-columns: 8.6rem minmax(0, 1fr);
  gap: 0.28rem;
  flex: 0 0 auto;
  align-items: stretch;
  min-height: 0;
  height: auto;
  position: relative;
  z-index: 3;
}
.battle-player-hud {
  flex: none;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.1rem 0.28rem;
  border-radius: 0.45rem;
  background: rgba(17, 24, 39, 0.72);
  border: 1px solid rgba(255,255,255,0.14);
  box-sizing: border-box;
}
.battle-player-avatar {
  display: block;
  flex: 0 0 auto;
  width: 2.05rem;
  height: 2.05rem;
}
.battle-player-avatar .player-char-card,
.battle-player-avatar .player-char-card--battle {
  width: 100%;
  height: 100%;
}
.battle-player-avatar .player-char-card--battle .player-char-card__frame {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
}
.player-char-card-slot--battle {
  display: block;
}
.battle-player-bars {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  justify-content: center;
}
.battle-bar-wrap--player {
  position: relative;
  height: 1.05rem;
  min-height: 1.05rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.45);
  border-radius: 999px;
}
.battle-bar-wrap--player .battle-bar {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: inherit;
}
.battle-player-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  font-size: 0.78rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #fff;
  letter-spacing: 0.02em;
  -webkit-text-stroke: 0.45px rgba(0, 0, 0, 0.5);
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.9),
    0 2px 0 rgba(0, 0, 0, 0.5),
    0 3px 5px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.battle-cmd-grid {
  display: none;
}
.battle-commands {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
  gap: 0.18rem;
  min-width: 0;
  min-height: 0;
  height: 100%;
  align-self: stretch;
}
.battle-talisman-slots {
  display: none;
}
.battle-cmd-btn {
  flex: none;
  min-width: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
  border-radius: 0.4rem;
  border: 1px solid rgba(253, 230, 138, 0.35);
  background: rgba(17, 24, 39, 0.65);
  color: #f3f4f6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.02rem;
  padding: 0.1rem 0.04rem;
  position: relative;
  overflow: hidden;
}
.battle-skills {
  flex: 1;
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0;
  align-items: center;
}
.battle-skills .rpg-capsule-btn {
  flex: 1;
  font-size: 0.72rem;
  padding: 0.35rem 0.4rem;
  white-space: nowrap;
}
.battle-skill-slot--empty {
  flex: 1;
  min-height: 2rem;
  border-radius: 999px;
  border: 1px dashed rgba(156, 163, 175, 0.45);
  background: rgba(255,255,255,0.06);
}
.battle-answer-block {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  /* ???????????? 1/3 */
  height: 33dvh;
  min-height: 33dvh;
  max-height: 36dvh;
  box-sizing: border-box;
  position: relative;
  z-index: 3;
}
.battle-prompt-wrap {
  padding: 0.4rem 0.55rem;
  border-radius: 0.5rem;
  background: rgba(254, 243, 199, 0.92);
  color: #1f2937;
  flex: 0 0 auto;
  min-height: 2.9rem;
  max-height: 4.2rem;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.battle-prompt-wrap .battle-prompt {
  margin-bottom: 0;
  min-height: 0;
  width: 100%;
  font-size: 1.15rem;
  color: #111827;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.28;
}
.battle-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  margin-bottom: 0;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}
.battle-opt {
  height: 100%;
  min-height: 0;
  max-height: 100%;
  padding: 0.35rem 0.45rem;
  font-size: 1.05rem;
  line-height: 1.22;
  border-radius: 0.55rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}
.battle-answer-key {
  display: none !important;
}
.battle-dmg-float {
  position: absolute;
  left: 50%;
  top: 14%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 30;
  animation: battle-dmg-rise 1.05s cubic-bezier(0.2, 0.85, 0.25, 1) forwards;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
}
.battle-dmg-float__tag {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 1;
  color: #fff7ed;
  -webkit-text-stroke: 0.5px #7c2d12;
  text-shadow:
    0 1px 0 #9a3412,
    0 2px 0 #7c2d12,
    0 0 12px rgba(251, 146, 60, 0.75);
}
.battle-dmg-float__num {
  font-size: 2.35rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: #fef08a;
  -webkit-text-stroke: 1.5px #78350f;
  text-shadow:
    0 1px 0 #a16207,
    0 2px 0 #854d0e,
    0 3px 0 #713f12,
    0 4px 0 #451a03,
    0 6px 10px rgba(0, 0, 0, 0.55),
    0 0 18px rgba(250, 204, 21, 0.55);
}
.battle-dmg-float__unit {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fef9c3;
  opacity: 0.92;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}
.battle-dmg-float--hurt {
  left: 18%;
  top: auto;
  bottom: 10%;
}
.battle-dmg-float--hurt .battle-dmg-float__num {
  color: #fecaca;
  -webkit-text-stroke: 1.5px #7f1d1d;
  text-shadow:
    0 1px 0 #991b1b,
    0 2px 0 #7f1d1d,
    0 3px 0 #450a0a,
    0 4px 0 #1c1917,
    0 6px 10px rgba(0, 0, 0, 0.55),
    0 0 16px rgba(248, 113, 113, 0.45);
}
.battle-dmg-float--hurt .battle-dmg-float__unit {
  color: #fecaca;
}
.battle-dmg-float--crit .battle-dmg-float__num {
  font-size: 2.85rem;
  color: #fff7ed;
  -webkit-text-stroke: 1.8px #9a3412;
  text-shadow:
    0 1px 0 #ea580c,
    0 2px 0 #c2410c,
    0 3px 0 #9a3412,
    0 4px 0 #7c2d12,
    0 5px 0 #431407,
    0 8px 14px rgba(0, 0, 0, 0.55),
    0 0 22px rgba(251, 146, 60, 0.75);
  animation: battle-dmg-crit-pulse 0.45s ease-out;
}
.battle-dmg-float--heal .battle-dmg-float__num {
  color: #bbf7d0;
  -webkit-text-stroke: 1.4px #14532d;
  text-shadow:
    0 1px 0 #16a34a,
    0 2px 0 #15803d,
    0 3px 0 #166534,
    0 4px 0 #052e16,
    0 6px 10px rgba(0, 0, 0, 0.5),
    0 0 16px rgba(74, 222, 128, 0.5);
}
.battle-dmg-float--heal .battle-dmg-float__unit {
  color: #dcfce7;
}
@keyframes battle-dmg-rise {
  0% { opacity: 0; transform: translate(-50%, 16px) scale(0.55); }
  18% { opacity: 1; transform: translate(-50%, -4px) scale(1.18); }
  32% { transform: translate(-50%, -10px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -52px) scale(1.08); }
}
@keyframes battle-dmg-crit-pulse {
  0% { transform: scale(0.7) rotate(-4deg); }
  55% { transform: scale(1.12) rotate(2deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes battle-scene-shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-6px, 2px); }
  40% { transform: translate(7px, -3px); }
  60% { transform: translate(-5px, 1px); }
  80% { transform: translate(4px, -2px); }
}
@keyframes battle-scene-shake-hit {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(3px, -2px); }
  50% { transform: translate(-4px, 1px); }
  75% { transform: translate(2px, 2px); }
}
.battle-shake.battle-shake--hurt {
  animation: battle-scene-shake 0.4s ease-in-out;
}
.battle-shake.battle-shake--hit {
  animation: battle-scene-shake-hit 0.35s ease-in-out;
}
.battle-status { margin-bottom: 0; flex: 0 0 auto; }
.battle-feed {
  --battle-feed-h: 4.6rem;
  flex: 0 0 auto;
  width: 100%;
  height: var(--battle-feed-h);
  min-height: var(--battle-feed-h);
  max-height: var(--battle-feed-h);
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #e5e7eb;
  text-align: left;
  padding: 0.2rem 0.45rem;
  border-radius: 0.45rem;
  /* ?????? 50%?alpha ??? */
  background: rgba(15, 23, 42, 0.275);
  border: 1px solid rgba(255, 255, 255, 0.12);
  scrollbar-width: thin;
  position: relative;
  z-index: 2;
}
.battle-feed__line { opacity: 0.92; }
.battle-feed__line--hit { color: #86efac; font-weight: 600; }
.battle-feed__line--hurt { color: #fca5a5; font-weight: 600; }
.battle-feed__line--result { color: #fde68a; font-weight: 700; }
.battle-panel--vertical { position: relative; }
.battle-result {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.42);
  pointer-events: auto;
}
.battle-result.hidden { display: none !important; }
.battle-result-card {
  pointer-events: auto;
  background: rgba(17, 24, 39, 0.88);
  border: 1px solid rgba(253, 230, 138, 0.35);
  border-radius: 0.85rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  max-width: 92%;
}
.battle-footer { display: none !important; }
.battle-answer-block { flex: 0 0 auto; }

/* ===== Battle RPG feel (#1?20) ===== */
.battle-timer--ring {
  position: relative;
  width: 3.4rem;
  height: 3.4rem;
  min-width: 3.4rem;
  max-width: 3.4rem;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}
.battle-timer--ring.battle-timer--top {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  min-width: 3.4rem;
  max-width: 3.4rem;
}
.battle-timer--ring::before {
  content: '';
  position: absolute;
  inset: 0.35rem;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.72);
  pointer-events: none;
  z-index: 0;
}
.battle-timer--ring .battle-timer__ring {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.battle-timer__ring-bg {
  fill: none;
  stroke: rgba(253, 230, 138, 0.28);
  stroke-width: 3;
}
.battle-timer__ring-fg {
  fill: none;
  stroke: #f59e0b;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.12s linear;
  filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.45));
}
.battle-timer__ring-fg--urgent,
.battle-timer--urgent .battle-timer__ring-fg {
  stroke: #ef4444;
  filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.55));
}
.battle-timer--ring .battle-timer__label,
.battle-timer--ring.battle-timer--top .battle-timer__label {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fbbf24;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  letter-spacing: 0.02em;
}
.battle-timer--urgent .battle-timer__label {
  color: #fca5a5;
}
.battle-combo-wrap {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  min-height: 2rem;
  opacity: 0.35;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.battle-combo-wrap--active,
.battle-combo-wrap--hot,
.battle-combo-wrap--moko {
  opacity: 1;
}
.battle-combo-wrap--hot {
  animation: battle-combo-pulse 0.85s ease-in-out infinite alternate;
}
.battle-combo-badge {
  width: 1.35rem;
  height: 1.35rem;
  display: inline-flex;
  flex: 0 0 auto;
  color: #fbbf24;
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.45));
}
.battle-combo-badge svg {
  width: 100%;
  height: 100%;
  display: block;
}
.battle-combo-wrap .battle-combo {
  min-width: 1.6rem;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  color: #fbbf24;
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
  white-space: nowrap;
}
@keyframes battle-combo-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}
.battle-enemy-stage--multi .battle-enemy-main {
  transform: scale(1);
}
.battle-enemy-squad {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  order: 0;
  margin-bottom: 0.15rem;
}
.battle-squad-slot {
  flex: 0 1 auto;
  min-width: 3.2rem;
  max-width: 4.5rem;
  padding: 0.15rem 0.25rem;
  border-radius: 0.35rem;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.35);
  font-size: 0.58rem;
  line-height: 1.2;
  opacity: 0.7;
}
.battle-squad-slot--active {
  opacity: 1;
  border-color: rgba(253, 230, 138, 0.65);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.35);
  transform: scale(1.05);
}
.battle-squad-slot--down { opacity: 0.35; text-decoration: line-through; }
.battle-squad-slot__name {
  display: block;
  color: #fef3c7;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.battle-squad-slot__hp { color: #fca5a5; font-weight: 700; }
.battle-enemy-portrait-wrap {
  position: relative;
  order: 4;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0;
  /* Feet extend into battle history; feed overlaps bottom half of this contact zone. */
  margin-bottom: 0;
  z-index: 1;
}
.battle-enemy-ground {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 58%;
  height: 0.22rem;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.12) 50%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.battle-enemy-portrait-wrap .battle-enemy-portrait {
  position: relative;
  z-index: 1;
  margin-bottom: 0;
  transition: transform 0.22s ease;
}
/* ????? battle history ?? 100%?? feed ???? */
.battle-enemy-stage + .battle-feed {
  margin-top: calc(-0.22rem - var(--battle-feed-h, 4.6rem));
}
.battle-enemy-portrait[data-frame="hurt"] {
  transform: translateX(5px) rotate(2deg) scale(0.98);
  filter:
    drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7))
    drop-shadow(0 3px 4px rgba(0, 0, 0, 0.4))
    drop-shadow(0 1px 0 rgba(127, 29, 29, 0.55))
    brightness(1.08);
}
.battle-enemy-portrait[data-frame="attack"] {
  transform: translateX(-8px) scale(1.04);
  filter:
    drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7))
    drop-shadow(0 3px 4px rgba(0, 0, 0, 0.35))
    drop-shadow(0 0 8px rgba(239, 68, 68, 0.3));
}
.battle-enemy-portrait[data-frame="ko"] {
  transform: translateY(4px) rotate(-4deg) scale(0.94);
  opacity: 0.82;
}
.battle-bar-wrap--enemy {
  height: 1.25rem;
  border-width: 2px;
}
.battle-bar-wrap--enemy .battle-bar--enemy {
  transition: width 0.18s ease-out;
}
.battle-enemy-hp-text {
  font-size: 0.95rem;
}
.battle-feed {
  background:
    linear-gradient(180deg, rgba(254, 243, 199, 0.04), rgba(15, 23, 42, 0.36)),
    rgba(15, 23, 42, 0.275);
  border: 1px solid rgba(253, 230, 138, 0.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.battle-cmd-btn--skill {
  border-style: dashed;
  border-color: rgba(156, 163, 175, 0.5);
  background: rgba(255,255,255,0.04);
}
.battle-cmd-btn--skill.battle-cmd-btn--filled {
  border-style: solid;
  border-color: rgba(253, 230, 138, 0.45);
  background: rgba(127, 29, 29, 0.18);
}
.battle-cmd-btn:not(:disabled):hover {
  border-color: rgba(253, 230, 138, 0.55);
  background: rgba(30, 41, 59, 0.75);
}
.battle-cmd-btn:disabled { opacity: 0.45; }
.battle-cmd-btn--active {
  border-style: solid;
  border-color: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.35);
}
.battle-cmd-btn__icon {
  width: 1.2rem;
  height: 1.2rem;
  aspect-ratio: 1 / 1;
  display: block;
  flex: 0 0 auto;
  overflow: visible;
  color: #fde68a;
}
.battle-cmd-btn__icon svg {
  width: 100%;
  height: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
}
.battle-cmd-btn__label {
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.battle-cmd-btn__cost {
  font-size: 0.45rem;
  color: #93c5fd;
  font-weight: 700;
  line-height: 1;
}
.battle-answer-block {
  padding: 0.4rem;
  border-radius: 0.55rem;
  border: 2px solid rgba(253, 230, 138, 0.35);
  background: rgba(15, 23, 42, 0.42);
}
.battle-answer-block--defend {
  border-color: rgba(148, 163, 184, 0.55);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.25);
}
.battle-opt--correct {
  background: rgba(34, 197, 94, 0.85) !important;
  border-color: #166534 !important;
  color: #052e16 !important;
}
.battle-opt--wrong {
  background: rgba(239, 68, 68, 0.85) !important;
  border-color: #991b1b !important;
  color: #450a0a !important;
}
.battle-particle-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 25;
}
.battle-particle {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  opacity: 0.95;
  animation: battle-particle-burst 0.85s ease-out forwards;
}
@keyframes battle-particle-burst {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--bx), var(--by)) scale(0.2); }
}
/* FX sprites (spark/slash on black ? screen blend hides black) */
.battle-fx {
  position: absolute;
  pointer-events: none;
  user-select: none;
  mix-blend-mode: screen;
  transform: translate(-50%, -50%) rotate(var(--fx-rot, 0deg)) scale(var(--fx-scale, 1));
  will-change: transform, opacity;
  z-index: 26;
}
.battle-fx--spark {
  width: 64px;
  height: 64px;
  max-width: none;
  animation: battle-fx-spark 0.55s ease-out forwards;
}
.battle-fx--spark-fly {
  animation-name: battle-fx-spark-fly;
  animation-duration: 0.7s;
}
.battle-fx--slash {
  width: 128px;
  height: 64px;
  max-width: none;
  animation: battle-fx-slash 0.42s ease-out forwards;
}
.battle-fx--slash-heavy {
  width: 160px;
  height: 80px;
  max-width: none;
  animation: battle-fx-slash 0.45s ease-out forwards;
}
.battle-fx--impact,
.battle-fx--pulse,
.battle-fx--motes,
.battle-fx--swirl {
  width: 96px;
  height: 96px;
  max-width: none;
  animation: battle-fx-spark 0.55s ease-out forwards;
}
.battle-fx--crit,
.battle-fx--smoke,
.battle-fx--glitter {
  width: 128px;
  height: 128px;
  max-width: none;
  animation: battle-fx-spark 0.6s ease-out forwards;
}
.battle-fx--streak {
  width: 160px;
  height: 64px;
  max-width: none;
  animation: battle-fx-slash 0.48s ease-out forwards;
}
.battle-fx--motes-rise {
  animation-name: battle-fx-motes-rise;
  animation-duration: 0.85s;
}
.battle-fx--slash-cut {
  animation-timing-function: cubic-bezier(0.15, 0.85, 0.35, 1);
}
@keyframes battle-fx-spark {
  0% {
    opacity: 0.2;
    transform: translate(-50%, -50%) rotate(var(--fx-rot, 0deg)) scale(calc(var(--fx-scale, 1) * 0.35));
  }
  35% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--fx-rot, 0deg)) scale(var(--fx-scale, 1));
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--fx-rot, 0deg)) scale(calc(var(--fx-scale, 1) * 1.15));
  }
}
@keyframes battle-fx-spark-fly {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--fx-rot, 0deg)) scale(var(--fx-scale, 1));
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--bx, 0px)), calc(-50% + var(--by, 0px)))
      rotate(calc(var(--fx-rot, 0deg) + 40deg))
      scale(calc(var(--fx-scale, 1) * 0.25));
  }
}
@keyframes battle-fx-slash {
  0% {
    opacity: 0;
    transform: translate(-62%, -50%) rotate(var(--fx-rot, 0deg)) scale(calc(var(--fx-scale, 1) * 0.55)) skewX(-10deg);
  }
  22% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-38%, -50%) rotate(var(--fx-rot, 0deg)) scale(var(--fx-scale, 1)) skewX(4deg);
  }
}
@keyframes battle-fx-motes-rise {
  0% {
    opacity: 0.3;
    transform: translate(-50%, -40%) rotate(var(--fx-rot, 0deg)) scale(calc(var(--fx-scale, 1) * 0.7));
  }
  30% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(-50%, -120%) rotate(var(--fx-rot, 0deg)) scale(var(--fx-scale, 1));
  }
}
.battle-fx--defend {
  filter: hue-rotate(-25deg) brightness(1.15);
}
.battle-screen-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 24;
  animation: battle-screen-flash-fade 0.38s ease-out forwards;
}
.battle-screen-flash--hit {
  background: radial-gradient(circle at 50% 42%, rgba(251, 191, 36, 0.28), transparent 62%);
}
.battle-screen-flash--crit {
  background: radial-gradient(circle at 50% 40%, rgba(254, 243, 199, 0.45), rgba(239, 68, 68, 0.18) 45%, transparent 70%);
  animation-duration: 0.48s;
}
.battle-screen-flash--kill {
  background: radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.35), rgba(251, 191, 36, 0.2) 40%, transparent 72%);
}
.battle-screen-flash--hurt {
  background: radial-gradient(circle at 50% 70%, rgba(127, 29, 29, 0.35), transparent 65%);
}
.battle-screen-flash--defend {
  background: radial-gradient(circle at 30% 75%, rgba(96, 165, 250, 0.28), transparent 60%);
}
.battle-screen-flash--heal {
  background: radial-gradient(circle at 35% 70%, rgba(74, 222, 128, 0.28), transparent 62%);
}
.battle-screen-flash--skill {
  background: radial-gradient(circle at 50% 55%, rgba(253, 224, 71, 0.22), transparent 58%);
}
.battle-screen-flash--start,
.battle-screen-flash--win {
  background: radial-gradient(circle at 50% 45%, rgba(254, 243, 199, 0.3), transparent 68%);
}
@keyframes battle-screen-flash-fade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
.battle-shake.battle-shake--crit {
  animation: battle-scene-shake-crit 0.5s ease-in-out;
}
@keyframes battle-scene-shake-crit {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-5px, 2px) rotate(-0.4deg); }
  30% { transform: translate(6px, -2px) rotate(0.5deg); }
  45% { transform: translate(-4px, 1px); }
  60% { transform: translate(5px, -1px); }
  75% { transform: translate(-2px, 1px); }
}

/* Learn / Quiz / SRS micro FX */
.learn-fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 40;
}
.learn-fx-flash {
  position: absolute;
  inset: 0;
  animation: learn-fx-flash-fade 0.4s ease-out forwards;
}
.learn-fx-flash--correct {
  background: radial-gradient(circle at 50% 40%, rgba(34, 197, 94, 0.22), transparent 60%);
}
.learn-fx-flash--combo {
  background: radial-gradient(circle at 50% 38%, rgba(251, 191, 36, 0.28), rgba(239, 68, 68, 0.12) 50%, transparent 68%);
}
.learn-fx-flash--wrong {
  background: radial-gradient(circle at 50% 45%, rgba(239, 68, 68, 0.2), transparent 58%);
}
@keyframes learn-fx-flash-fade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
.learn-fx-spark {
  position: absolute;
  width: 48px;
  height: 48px;
  max-width: none;
  mix-blend-mode: screen;
  transform: translate(-50%, -50%) scale(var(--fx-scale, 1));
  animation: learn-fx-spark-fly 0.65s ease-out forwards;
}
.learn-fx-spark--wrong {
  filter: hue-rotate(-40deg) saturate(1.2);
}
@keyframes learn-fx-spark-fly {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(var(--fx-scale, 1));
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--bx, 0px)), calc(-50% + var(--by, 0px))) scale(0.2);
  }
}
.learn-fx-ring {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 2px solid rgba(34, 197, 94, 0.75);
  border-radius: 9999px;
  transform: translate(-50%, -50%);
  animation: learn-fx-ring-expand 0.6s ease-out forwards;
}
.learn-fx-ring--hot {
  border-color: rgba(245, 158, 11, 0.9);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.45);
}
@keyframes learn-fx-ring-expand {
  0% { opacity: 0.95; width: 20px; height: 20px; }
  100% { opacity: 0; width: 120px; height: 120px; }
}
.battle-result-card--victory {
  border-color: rgba(253, 230, 138, 0.65);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.25), 0 12px 40px rgba(0, 0, 0, 0.45);
}
.battle-result-card--defeat {
  border-color: rgba(248, 113, 113, 0.55);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2), 0 12px 40px rgba(0, 0, 0, 0.45);
}
.battle-result-subtitle {
  font-size: 0.78rem;
  color: #cbd5e1;
  margin: -0.35rem 0 0.65rem;
}
.battle-settle--victory {
  border-color: rgba(253, 230, 138, 0.45);
}
.battle-shake.battle-shake--hurt {
  animation: battle-scene-shake 0.48s ease-in-out;
}
.battle-shake.battle-shake--hit {
  animation: battle-scene-shake-hit 0.38s ease-in-out;
}
.battle-shake.battle-shake--crit {
  animation: battle-scene-shake-crit 0.5s ease-in-out;
}
@media (max-width: 380px) {
  .battle-cmd-row {
    grid-template-columns: 7.2rem minmax(0, 1fr);
    height: auto;
    min-height: 0;
    gap: 0.18rem;
  }
  .battle-player-avatar {
    width: 1.9rem;
    height: 1.9rem;
  }
  .battle-cmd-btn__label { font-size: 0.62rem; }
  .battle-cmd-btn__icon { width: 1.05rem; height: 1.05rem; }
  .battle-player-bar-text { font-size: 0.72rem; }
}

/* ??????????????? .battle-panel ? 100vw-1.5rem? */
@media (max-width: 768px) {
  .battle-overlay {
    padding: 0;
    width: 100%;
    max-width: none;
  }
  .battle-scene {
    width: 100%;
    max-width: none;
    margin: 0;
  }
  .battle-panel.battle-panel--vertical {
    width: 100%;
    max-width: none;
  }
}

/* ???????????????? 1/3 */
@media (max-width: 430px) {
  .battle-panel--vertical {
    gap: 0.14rem;
    padding-top: max(0.5rem, calc(var(--safe-top) + 0.4rem));
    padding-bottom: max(0.95rem, calc(var(--safe-bottom) + 0.5rem));
  }
  .battle-enemy-portrait {
    /* Keep enough height for full body (legs), pinned into feed overlap. */
    width: min(165px, 46vw, calc(42vh * var(--battle-frame-w) / var(--battle-frame-h)));
    max-height: 42vh;
  }
  .battle-enemy-stage + .battle-feed {
    margin-top: calc(-0.14rem - var(--battle-feed-h, 4.2rem));
  }
  .battle-feed {
    --battle-feed-h: 4.2rem;
    height: var(--battle-feed-h);
    min-height: var(--battle-feed-h);
    max-height: var(--battle-feed-h);
  }
  .battle-cmd-row {
    grid-template-columns: 7.4rem minmax(0, 1fr);
    height: auto;
    min-height: 0;
    gap: 0.2rem;
  }
  .battle-commands {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.12rem;
  }
  .battle-player-avatar {
    width: 1.95rem;
    height: 1.95rem;
  }
  .battle-bar-wrap--player {
    height: 0.98rem;
    min-height: 0.98rem;
  }
  .battle-answer-block {
    height: 33dvh;
    min-height: 33dvh;
    max-height: 36dvh;
    padding: 0.32rem;
    gap: 0.28rem;
  }
  .battle-options {
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
  .battle-opt {
    font-size: 0.98rem;
    padding: 0.28rem 0.35rem;
  }
  .battle-prompt-wrap {
    min-height: 2.6rem;
    max-height: 3.8rem;
    padding: 0.35rem 0.45rem;
  }
  .battle-prompt-wrap .battle-prompt {
    font-size: 1.05rem;
  }
  .battle-timer--ring {
    width: 2.9rem;
    height: 2.9rem;
  }
  .battle-player-bar-text {
    font-size: 0.74rem;
  }
  .battle-cmd-btn__label {
    font-size: 0.64rem;
  }
  .battle-cmd-btn__icon {
    width: 1.1rem;
    height: 1.1rem;
  }
  .battle-enemy-hp-text {
    font-size: 0.82rem;
  }
}

/* Reading hall tokens: POS fill = activity-chip colors; underline = uncollected */
.reading-token {
  display: inline;
  padding: 0 0.08em;
  margin: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 0.25em;
  line-height: 1.85;
}
.reading-token:hover {
  filter: brightness(0.97);
}
/* POS fills aligned with .activity-chip.* */
.reading-token.mizen {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(239, 68, 68, 0.1));
}
.reading-token.mizen-o {
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.3), rgba(244, 114, 182, 0.1));
}
.reading-token.renyo {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(16, 185, 129, 0.1));
}
.reading-token.shushi {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(99, 102, 241, 0.1));
}
.reading-token.rentai {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(139, 92, 246, 0.1));
}
.reading-token.katei {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(245, 158, 11, 0.1));
}
.reading-token.meirei {
  background: linear-gradient(135deg, rgba(100, 116, 139, 0.3), rgba(100, 116, 139, 0.1));
}
.reading-token.futsu {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.3), rgba(251, 146, 60, 0.1));
}
.reading-token.gokan {
  background: linear-gradient(135deg, rgba(226, 232, 240, 0.5), rgba(226, 232, 240, 0.2));
}
.dark .reading-token.mizen { background: linear-gradient(135deg, rgba(239, 68, 68, 0.35), rgba(239, 68, 68, 0.12)); }
.dark .reading-token.mizen-o { background: linear-gradient(135deg, rgba(244, 114, 182, 0.35), rgba(244, 114, 182, 0.12)); }
.dark .reading-token.renyo { background: linear-gradient(135deg, rgba(0, 255, 136, 0.28), rgba(0, 255, 136, 0.08)); }
.dark .reading-token.shushi { background: linear-gradient(135deg, rgba(0, 245, 255, 0.28), rgba(0, 245, 255, 0.08)); }
.dark .reading-token.rentai { background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(139, 92, 246, 0.12)); }
.dark .reading-token.katei { background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(245, 158, 11, 0.12)); }
.dark .reading-token.meirei { background: linear-gradient(135deg, rgba(100, 116, 139, 0.4), rgba(100, 116, 139, 0.15)); }
.dark .reading-token.futsu { background: linear-gradient(135deg, rgba(251, 146, 60, 0.35), rgba(251, 146, 60, 0.12)); }
.dark .reading-token.gokan { background: linear-gradient(135deg, rgba(226, 232, 240, 0.22), rgba(226, 232, 240, 0.08)); }
/* Uncollected: underline */
.reading-token.is-uncollected {
  box-shadow: inset 0 -2.5px 0 rgba(71, 85, 105, 0.72);
}
.dark .reading-token.is-uncollected {
  box-shadow: inset 0 -2.5px 0 rgba(203, 213, 225, 0.75);
}
/* Grammar: light green (no badge) */
.reading-token.is-grammar {
  background: rgba(167, 243, 208, 0.55);
  box-shadow: none;
  padding: 0 0.15em;
  margin: 0 0.04em;
}
.dark .reading-token.is-grammar {
  background: rgba(16, 185, 129, 0.28);
  box-shadow: none;
}
.reading-token ruby {
  ruby-align: center;
}
.reading-token rt {
  font-size: 0.55em;
  color: rgba(100, 116, 139, 0.95);
}
.dark .reading-token rt {
  color: rgba(148, 163, 184, 0.95);
}

/* Legend samples use the same token classes */
.reading-token-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.9rem;
  margin-top: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.75rem;
  background: rgba(148, 163, 184, 0.1);
  font-size: 0.72rem;
  line-height: 1.45;
  color: rgb(100, 116, 139);
}
.dark .reading-token-legend {
  background: rgba(148, 163, 184, 0.14);
  color: rgb(148, 163, 184);
}
.reading-yt-legend-dock .reading-token-legend {
  margin-top: 0;
  border-radius: 0;
  background: transparent; /* ???? dock ???????????? */
}

/* ??? switch????? */
.reading-yt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.6rem;
  margin-bottom: 0.75rem;
}
.reading-yt-title {
  outline: none;
  cursor: text;
  border-radius: 0.5rem;
  padding: 0.1rem 0.35rem;
  margin-left: -0.35rem;
  border: 1px solid transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
  max-width: 100%;
  word-break: break-word;
}
.reading-yt-title:hover {
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.08);
}
.reading-yt-title:focus {
  border-color: color-mix(in srgb, var(--renyo, #2a9d8f) 45%, transparent);
  background: color-mix(in srgb, var(--renyo, #2a9d8f) 8%, transparent);
}
.dark .reading-yt-title:hover {
  border-color: rgba(100, 116, 139, 0.45);
  background: rgba(100, 116, 139, 0.12);
}
.dark .reading-yt-title:focus {
  border-color: rgba(0, 255, 136, 0.35);
  background: rgba(0, 255, 136, 0.06);
}
.reading-yt-toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem 0.6rem;
  flex-wrap: wrap;
}
.reading-yt-toolbar-divider {
  display: inline-block;
  width: 1px;
  height: 1.25rem;
  margin: 0 0.15rem;
  flex-shrink: 0;
  background: rgba(148, 163, 184, 0.35);
  align-self: center;
}
.dark .reading-yt-toolbar-divider {
  background: rgba(148, 163, 184, 0.45);
}
.reading-switch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border-radius: 0.75rem;
  background: var(--chip-bg, rgba(255, 255, 255, 0.28));
  border: 1px solid var(--chip-border, rgba(255, 255, 255, 0.5));
  font-size: 0.875rem;
  color: rgb(55, 65, 81);
}
.dark .reading-switch-wrap {
  color: rgb(229, 231, 235);
}
.reading-switch-wrap.is-on {
  border-color: color-mix(in srgb, var(--renyo, #2a9d8f) 40%, transparent);
  background: color-mix(in srgb, var(--renyo, #2a9d8f) 10%, transparent);
}
.reading-switch-wrap.is-disabled {
  opacity: 0.7;
}
.reading-switch-label {
  font-weight: 500;
  line-height: 1.2;
}
.reading-switch {
  position: relative;
  width: 2.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  background: #d1d5db;
  cursor: pointer;
  transition: background-color 0.2s ease;
  padding: 0;
}
.dark .reading-switch {
  background: #4b5563;
}
.reading-switch.is-on {
  background: var(--renyo, #2a9d8f);
}
.dark .reading-switch.is-on {
  background: #00FF88;
}
.reading-switch:disabled {
  cursor: not-allowed;
}
.reading-switch-knob {
  position: absolute;
  left: 0.15rem;
  top: 0.15rem;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
  transition: transform 0.2s ease;
}
.reading-switch.is-on .reading-switch-knob {
  transform: translateX(1rem);
}
.reading-switch-hint {
  font-size: 0.7rem;
  line-height: 1.2;
  color: #9ca3af;
}
.reading-switch-hint.is-ready {
  color: var(--renyo, #2a9d8f);
  font-weight: 600;
}
.dark .reading-switch-hint.is-ready {
  color: #00FF88;
}
.reading-switch-hint.is-auto {
  color: var(--katei, #f59e0b);
  font-weight: 600;
}
.reading-switch-hint.is-pending {
  color: #9ca3af;
}
.reading-token-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}
.reading-token-legend-item.is-off {
  opacity: 0.4;
}
.reading-token-legend.is-parse-off {
  opacity: 0.72;
}
.reading-token-legend .reading-token {
  cursor: default;
  pointer-events: none;
  font-size: 0.85rem;
  line-height: 1.5;
}
.reading-token-legend-label {
  opacity: 0.95;
}

/* 品詞標示篩選（圖例可點） */
.reading-pos-filter {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}
.reading-pos-filter.is-disabled {
  opacity: 0.55;
}
.reading-pos-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  padding: 0.15rem 0.4rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.35);
  color: inherit;
  font: inherit;
  font-size: 0.72rem;
  line-height: 1.35;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.dark .reading-pos-filter-chip {
  background: rgba(15, 23, 42, 0.35);
  border-color: rgba(148, 163, 184, 0.28);
}
.reading-pos-filter-chip.is-on {
  border-color: color-mix(in srgb, var(--renyo, #2a9d8f) 50%, transparent);
  background: color-mix(in srgb, var(--renyo, #2a9d8f) 12%, transparent);
}
.reading-pos-filter-chip:not(.is-on) {
  opacity: 0.42;
}
.reading-pos-filter-chip:not(.is-on) .reading-token {
  background: transparent !important;
  box-shadow: none !important;
}
.reading-pos-filter-chip.is-disabled,
.reading-pos-filter-chip:disabled {
  cursor: not-allowed;
}
.reading-pos-filter-chip .reading-token {
  pointer-events: none;
  font-size: 0.8rem;
  line-height: 1.35;
}
.reading-pos-filter-label {
  opacity: 0.95;
}

.reading-lookup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, 0.28);
}
.dark .reading-lookup-backdrop {
  background: rgba(0, 0, 0, 0.45);
}
.reading-lookup-pop {
  position: fixed;
  left: 50%;
  /* ????????????????? */
  bottom: calc(var(--mobile-nav-height, 4rem) + 0.75rem);
  transform: translateX(-50%);
  z-index: 201;
  width: min(28rem, calc(100vw - 1.5rem));
  max-height: min(65vh, 32rem);
  overflow-y: auto;
  margin: 0;
  padding-bottom: 0.85rem;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.22);
  pointer-events: auto;
  /* ?????????????????????????? */
  background: rgba(252, 252, 253, 0.97) !important;
  border: 1px solid rgba(226, 232, 240, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.dark .reading-lookup-pop {
  background: rgba(30, 32, 48, 0.96) !important;
  border: 1px solid rgba(100, 116, 139, 0.4);
}
@media (min-width: 768px) {
  .reading-lookup-pop {
    bottom: 1.25rem;
  }
}
.reading-lookup-pop .reading-lookup-actions {
  position: relative;
  z-index: 1;
  padding-bottom: 0.15rem;
}
.reading-lookup-pop .reading-lookup-detail {
  margin-top: 0.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
}
.dark .reading-lookup-pop .reading-lookup-detail {
  border-top-color: rgba(100, 116, 139, 0.35);
}
.reading-seg {
  word-break: break-word;
  cursor: pointer;
  border-radius: 0.6rem;
  padding: 0.15rem 0.4rem;
  margin-left: -0.4rem;
  margin-right: -0.4rem;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.reading-seg:hover {
  background: rgba(148, 163, 184, 0.14);
}
.dark .reading-seg:hover {
  background: rgba(148, 163, 184, 0.16);
}
.reading-seg.is-speaking {
  background: color-mix(in srgb, var(--accent, #6366f1) 14%, transparent);
  box-shadow: inset 3px 0 0 var(--accent, #6366f1);
}
.reading-seg.is-tts-loading {
  background: rgba(148, 163, 184, 0.18);
  box-shadow: inset 3px 0 0 rgba(148, 163, 184, 0.7);
}

/* 讀本朗讀工具列 */
.reading-tts-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  margin-bottom: 0.5rem;
}
.reading-tts-bar__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(71, 85, 105, 0.95);
  flex-shrink: 0;
}
.dark .reading-tts-bar__label {
  color: rgba(203, 213, 225, 0.9);
}
.reading-tts-bar__hint {
  font-size: 0.7rem;
  color: rgba(100, 116, 139, 0.85);
}
.dark .reading-tts-bar__hint {
  color: rgba(148, 163, 184, 0.85);
}
.reading-tts-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.reading-tts-chip {
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.55);
  color: rgba(51, 65, 85, 0.95);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}
.dark .reading-tts-chip {
  background: rgba(15, 23, 42, 0.45);
  border-color: rgba(100, 116, 139, 0.5);
  color: rgba(226, 232, 240, 0.92);
}
.reading-tts-chip:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent, #6366f1) 45%, transparent);
}
.reading-tts-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.reading-tts-chip.is-active {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(15, 23, 42, 0.92);
  color: #fff;
}
.dark .reading-tts-chip.is-active {
  background: color-mix(in srgb, var(--accent, #6366f1) 78%, #0f172a);
  border-color: transparent;
  color: #fff;
}

/* YouTube reading layout */
.reading-yt-layout {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
  grid-template-areas:
    "player"
    "cues";
}
@media (min-width: 900px) {
  .reading-yt-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    grid-template-areas: "player cues";
    align-items: start;
  }
}
.reading-yt-player-col {
  grid-area: player;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}
@media (min-width: 900px) {
  .reading-yt-player-col {
    position: sticky;
    top: 0.75rem;
    z-index: 1;
  }
}
.reading-yt-player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0f172a;
  z-index: 1;
  isolation: isolate;
  overflow: hidden;
}
.reading-yt-speed-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  padding: 0.35rem 0.15rem 0;
}
.reading-yt-speed-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(71, 85, 105, 0.95);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.dark .reading-yt-speed-label {
  color: rgba(203, 213, 225, 0.9);
}
.reading-yt-speed-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.reading-yt-speed-chip {
  min-width: 2.5rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.55);
  color: rgba(51, 65, 85, 0.95);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}
.dark .reading-yt-speed-chip {
  background: rgba(15, 23, 42, 0.45);
  border-color: rgba(100, 116, 139, 0.5);
  color: rgba(226, 232, 240, 0.92);
}
.reading-yt-speed-chip:hover {
  border-color: color-mix(in srgb, var(--accent, #6366f1) 45%, transparent);
}
.reading-yt-speed-chip.is-active {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(15, 23, 42, 0.92);
  color: #fff;
}
.dark .reading-yt-speed-chip.is-active {
  background: color-mix(in srgb, var(--accent, #6366f1) 78%, #0f172a);
  border-color: transparent;
  color: #fff;
}
.reading-yt-cues-tools {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: -0.15rem 0 0.45rem;
}
.reading-yt-cues.reading-yt-zh-off .reading-yt-zh {
  display: none !important;
}
/* 純文字読本：中文對照逐句顯示／隱藏 */
.reading-yt-zh-off .reading-seg-zh {
  display: none !important;
}
.reading-yt-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: auto;
}
.reading-yt-player iframe,
#reading-yt-player-el,
.reading-yt-player > div {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border: 0;
  max-width: none !important;
  pointer-events: auto !important;
  z-index: 2;
}
.reading-yt-player video,
#reading-html5-player {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}
.reading-yt-cues {
  grid-area: cues;
  max-height: min(70vh, 36rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 12rem;
}
.reading-yt-cues-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-bottom: 0.15rem;
}
.reading-yt-legend-dock {
  flex-shrink: 0;
  /* ?? .reading-yt-cues ? p-3????????????? */
  margin: 0.5rem -0.75rem -0.75rem;
  padding: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 0 0 1rem 1rem;
  background: rgba(148, 163, 184, 0.1);
  z-index: 2;
}
.dark .reading-yt-legend-dock {
  border-top-color: rgba(100, 116, 139, 0.35);
  background: rgba(148, 163, 184, 0.14);
}
.reading-yt-byoc {
  flex-shrink: 0;
  background: color-mix(in srgb, var(--renyo, #2a9d8f) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--renyo, #2a9d8f) 22%, transparent);
}
.dark .reading-yt-byoc {
  background: color-mix(in srgb, var(--renyo, #2a9d8f) 14%, transparent);
}
.reading-yt-cue {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.28rem 0.45rem;
  border-radius: 0.55rem;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.25);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.reading-yt-cue + .reading-yt-cue {
  margin-top: 0.2rem;
}
.reading-yt-cue-row {
  display: flex;
  align-items: flex-start;
  gap: 0.3rem;
}
/* 左側控制區：分兩行（序號＋時間一行、動作按鈕一行），收窄闊度 */
.reading-yt-time-col {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.16rem;
  flex-shrink: 0;
  width: auto;
  min-width: 0;
  max-width: 5rem;
}
.reading-yt-time-row {
  display: inline-flex;
  align-items: center;
  gap: 0.14rem;
}
.reading-yt-cue-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0.95rem;
  height: 0.95rem;
  padding: 0 0.12rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  color: #64748b;
  font-size: 0.55rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
}
.dark .reading-yt-cue-number {
  background: rgba(100, 116, 139, 0.28);
  color: #94a3b8;
}
.reading-yt-action-group {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
}
.reading-yt-cue-body {
  flex: 1;
  min-width: 0;
}
.reading-yt-ja {
  display: block;
  line-height: 1.55;
}
.reading-yt-zh {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #6b7280;
}
.dark .reading-yt-zh {
  color: #9ca3af;
}
.reading-yt-seek-placeholder {
  flex-shrink: 0;
  margin: 0;
  min-width: 1.7rem;
  font-size: 0.58rem;
  color: #9ca3af;
  text-align: center;
}
.reading-yt-seek-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  flex-shrink: 0;
  margin: 0;
  min-width: 0;
  padding: 0.08rem 0.28rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.55);
  color: #64748b;
  font-size: 0.58rem;
  line-height: 1.2;
  cursor: pointer;
}
.reading-yt-seek-btn i {
  font-size: 0.45rem;
  color: var(--renyo, #2a9d8f);
}
.reading-yt-cue.is-active .reading-yt-seek-btn {
  border-color: color-mix(in srgb, var(--renyo, #2a9d8f) 45%, transparent);
  background: color-mix(in srgb, var(--renyo, #2a9d8f) 12%, white);
  color: var(--renyo, #2a9d8f);
}
.dark .reading-yt-seek-btn {
  background: rgba(15, 23, 42, 0.45);
  border-color: rgba(100, 116, 139, 0.45);
  color: #94a3b8;
}
.dark .reading-yt-cue.is-active .reading-yt-seek-btn {
  background: color-mix(in srgb, var(--renyo, #2a9d8f) 22%, transparent);
}
.reading-yt-mark-btn,
.reading-yt-clear-time-btn,
.reading-yt-split-btn,
.reading-yt-merge-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-shrink: 0;
  margin: 0;
  width: 1.1rem;
  height: 1.1rem;
  min-height: 0;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.45);
  color: #94a3b8;
  font-size: 0.55rem;
  line-height: 1;
  cursor: pointer;
}
.reading-yt-mark-btn:hover {
  color: var(--renyo, #2a9d8f);
  border-color: color-mix(in srgb, var(--renyo, #2a9d8f) 55%, transparent);
  background: color-mix(in srgb, var(--renyo, #2a9d8f) 10%, transparent);
}
.reading-yt-clear-time-btn {
  border-color: rgba(244, 63, 94, 0.28);
  color: #e11d48;
}
.reading-yt-clear-time-btn:hover {
  border-color: rgba(244, 63, 94, 0.55);
  background: rgba(244, 63, 94, 0.08);
}
.reading-yt-split-btn {
  border-color: rgba(14, 165, 233, 0.3);
  color: #0284c7;
}
.reading-yt-split-btn:hover {
  border-color: rgba(14, 165, 233, 0.55);
  background: rgba(14, 165, 233, 0.08);
}
.reading-yt-merge-btn {
  border-color: rgba(100, 116, 139, 0.35);
  color: #64748b;
}
.reading-yt-merge-btn:hover {
  border-color: rgba(100, 116, 139, 0.55);
  background: rgba(100, 116, 139, 0.08);
}
.dark .reading-yt-mark-btn,
.dark .reading-yt-clear-time-btn,
.dark .reading-yt-split-btn,
.dark .reading-yt-merge-btn {
  color: #94a3b8;
  border-color: rgba(100, 116, 139, 0.45);
  background: rgba(15, 23, 42, 0.35);
}
.dark .reading-yt-mark-btn:hover {
  color: #00FF88;
  border-color: rgba(0, 255, 136, 0.45);
  background: rgba(0, 255, 136, 0.08);
}
.dark .reading-yt-clear-time-btn:hover {
  color: #fb7185;
  border-color: rgba(251, 113, 133, 0.5);
  background: rgba(251, 113, 133, 0.1);
}
.dark .reading-yt-split-btn:hover {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.1);
}
.dark .reading-yt-merge-btn:hover {
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.55);
  background: rgba(148, 163, 184, 0.1);
}
.reading-yt-help {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.7rem;
  line-height: 1.4;
}
.reading-yt-help__summary {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  list-style: none;
  color: #64748b;
  user-select: none;
}
.reading-yt-help__summary::-webkit-details-marker { display: none; }
.reading-yt-help__summary::after {
  content: '▸';
  margin-left: 0.25rem;
  font-size: 0.65rem;
  opacity: 0.7;
}
.reading-yt-help[open] > .reading-yt-help__summary::after {
  content: '▾';
}
.reading-yt-help__summary:hover {
  color: #0ea5e9;
}
.reading-yt-help__body {
  margin-top: 0.35rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 0.65rem;
  background: rgba(14, 165, 233, 0.07);
}
.reading-yt-help__body p {
  margin: 0 0 0.3rem;
}
.reading-yt-help__body p:last-child {
  margin-bottom: 0;
}
.dark .reading-yt-help,
.dark .reading-yt-help__summary {
  color: #94a3b8;
}
.dark .reading-yt-help__summary:hover {
  color: #38bdf8;
}
.dark .reading-yt-help__body {
  border-color: rgba(56, 189, 248, 0.2);
  background: rgba(56, 189, 248, 0.07);
}
.dark .reading-yt-cue {
  background: rgba(255, 255, 255, 0.04);
}
.reading-yt-cue:hover {
  background: rgba(125, 211, 252, 0.12);
}
.reading-yt-cue.is-active {
  border-left-color: var(--renyo, #2a9d8f);
  border-color: color-mix(in srgb, var(--renyo, #2a9d8f) 35%, transparent);
  background: rgba(42, 157, 143, 0.16);
}
.dark .reading-yt-cue.is-active {
  background: rgba(42, 157, 143, 0.22);
}
.reading-yt-cue .reading-token {
  pointer-events: auto;
}
/* YouTube cues: same POS colors + uncollected underline as body text */
.reading-yt-cue .reading-token.is-grammar {
  background: rgba(167, 243, 208, 0.55);
  box-shadow: none;
}
.dark .reading-yt-cue .reading-token.is-grammar {
  background: rgba(16, 185, 129, 0.28);
  box-shadow: none;
}


#quiz-paper-timer.paper-timer-warn {
  color: #c45c26;
  animation: paper-timer-pulse 1s ease-in-out infinite;
}
#quiz-paper-timer.paper-timer-critical {
  color: #c23b4a;
  animation: paper-timer-pulse 0.5s ease-in-out infinite;
}
@keyframes paper-timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.quiz-paper-score-bar {
  height: 0.5rem;
  border-radius: 999px;
  background: rgba(120, 120, 120, 0.2);
  overflow: hidden;
}
.quiz-paper-score-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--color-shushi, #e8a87c), var(--color-rentai, #85cdca));
  transition: width 0.4s ease;
}
.quiz-paper-pass {
  color: var(--color-renyo, #41b3a3);
}
.quiz-paper-fail {
  color: var(--color-mizen, #c23b4a);
}
.quiz-option.paper-selected {
  background: rgba(133, 205, 202, 0.25);
  box-shadow: 0 0 0 2px rgba(133, 205, 202, 0.7);
}

/* ???????????????????????????????????????????????????????????
   ?? (Life Corner) ? hub + immersive stage shell
   ??????????????????????????????????????????????????????????? */

.module-bg-layer[data-bg="life"] {
  background: linear-gradient(145deg, rgba(232, 168, 124, 0.35) 0%, rgba(133, 205, 202, 0.28) 45%, rgba(65, 179, 163, 0.22) 100%);
}
.module-bg-layer[data-bg="notebook"] {
  background: linear-gradient(150deg, rgba(255, 183, 197, 0.30) 0%, rgba(199, 178, 243, 0.24) 50%, rgba(255, 224, 178, 0.22) 100%);
}
.dark .module-bg-layer[data-bg="notebook"] {
  background: linear-gradient(150deg, rgba(120, 60, 90, 0.42) 0%, rgba(70, 55, 120, 0.35) 55%, rgba(90, 70, 40, 0.35) 100%);
}
.dark .module-bg-layer[data-bg="life"] {
  background: linear-gradient(145deg, rgba(120, 80, 50, 0.45) 0%, rgba(40, 90, 85, 0.35) 50%, rgba(25, 55, 52, 0.4) 100%);
}

/* Cinematic mode cards — fixed 3-card grid (2 side + 1 hero). */
.life-mode-cards {
  --life-side-h: 10.5rem;
  display: grid;
  grid-template-columns: minmax(12rem, 0.72fr) minmax(0, 1.55fr);
  grid-template-rows: var(--life-side-h) var(--life-side-h);
  grid-template-areas:
    "side-one hero"
    "side-two hero";
  gap: 0.75rem;
}
.life-mode-card {
  position: relative;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.34);
  box-shadow: 0 12px 30px rgba(42, 51, 78, 0.12);
  transition: transform 0.32s ease, box-shadow 0.32s ease, border-color 0.32s ease;
}
.life-mode-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  border-radius: inherit;
  background-position: center;
  background-size: cover;
  transform: scale(1.03);
  transition: transform 0.55s ease, filter 0.35s ease, opacity 0.35s ease;
}
.life-mode-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(115deg, rgba(252, 251, 255, 0.88) 5%, rgba(252, 251, 255, 0.68) 52%, rgba(252, 251, 255, 0.4) 100%);
  transition: opacity 0.35s ease, background 0.35s ease;
}
.dark .life-mode-card {
  border-color: rgba(255, 255, 255, 0.13);
  background: rgba(15, 23, 42, 0.5);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}
.dark .life-mode-card::after {
  background: linear-gradient(115deg, rgba(15, 23, 42, 0.91) 5%, rgba(15, 23, 42, 0.72) 55%, rgba(15, 23, 42, 0.46) 100%);
}
.life-mode-card--place::before {
  background-image:
    url("../data/life-bg/cards/life-card-place.webp"),
    url("../data/life-bg/plates/tokyo_shibuya-street-sunset.jpg"),
    linear-gradient(135deg, #b8e2eb, #7bb7c7);
}
.life-mode-card--day::before {
  background-image:
    url("../data/life-bg/cards/life-card-day.webp"),
    url("../data/life-bg/plates/momiji-park-morning.jpg"),
    linear-gradient(135deg, #ffe0a8, #e7a789);
}
.life-mode-card--free::before {
  background-image:
    url("../data/life-bg/cards/life-card-free.webp"),
    url("../data/life-bg/plates/hakone_onsen-street-sunset.jpg"),
    linear-gradient(135deg, #c8c0ff, #8b88d8);
}
.life-mode-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 38px rgba(42, 51, 78, 0.18);
}
.life-mode-card:hover::before {
  transform: scale(1.08);
}
.life-mode-card.is-active {
  grid-area: hero;
  height: 100%;
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 20px 46px rgba(42, 51, 78, 0.2), 0 0 0 2px rgba(225, 29, 72, 0.22);
}
/* 設定留喺卡內右側：外層三卡高度完全唔變 */
.life-mode-card.is-active:has(.life-mode-card-body:not(.hidden)) {
  display: grid;
  grid-template-columns: minmax(7.5rem, 0.62fr) minmax(0, 1.38fr);
  grid-template-rows: 1fr;
  align-items: stretch;
  column-gap: 0.4rem;
  padding-right: 0.5rem;
  height: 100%;
}
.life-mode-card.is-active:has(.life-mode-card-body:not(.hidden))::after {
  background: linear-gradient(105deg, rgba(252, 251, 255, 0.9) 0%, rgba(252, 251, 255, 0.55) 48%, rgba(252, 251, 255, 0.22) 100%);
}
.dark .life-mode-card.is-active:has(.life-mode-card-body:not(.hidden))::after {
  background: linear-gradient(105deg, rgba(15, 23, 42, 0.92) 0%, rgba(15, 23, 42, 0.62) 50%, rgba(15, 23, 42, 0.28) 100%);
}
.life-mode-card.is-active:has(.life-mode-card-body:not(.hidden)) .life-mode-cta-desc,
.life-mode-card.is-active:has(.life-mode-card-body:not(.hidden)) .life-mode-card-kicker {
  display: none;
}
.life-mode-card.is-active:has(.life-mode-card-body:not(.hidden)) .life-mode-cta-title {
  font-size: 1.05rem;
}
.life-mode-card:not(.is-active) {
  height: var(--life-side-h);
}
.life-mode-card:not(.is-active)::before {
  filter: saturate(0.78) brightness(0.94);
}
.life-mode-card-cover,
.life-mode-card-main {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 1.15rem 1.25rem;
  text-align: left;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.life-mode-card.is-active .life-mode-card-cover,
.life-mode-card.is-active .life-mode-card-main {
  min-height: 0;
  height: 100%;
  padding: 1.25rem 1.35rem;
}
.life-mode-card.is-active:has(.life-mode-card-body:not(.hidden)) .life-mode-card-cover,
.life-mode-card.is-active:has(.life-mode-card-body:not(.hidden)) .life-mode-card-main {
  padding: 0.85rem 0.7rem 0.85rem 1rem;
}
.life-mode-card-cover > i:first-child {
  position: absolute;
  top: 1rem;
  left: 1.15rem;
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  font-size: 1.15rem;
  border-radius: 999px;
  color: #fff !important;
  background: rgba(15, 23, 42, 0.42);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
}
.life-mode-card.is-active:has(.life-mode-card-body:not(.hidden)) .life-mode-card-cover > i:first-child {
  width: 1.85rem;
  height: 1.85rem;
  font-size: 0.95rem;
  top: 0.7rem;
  left: 0.75rem;
}
.life-mode-card-kicker {
  display: block;
  margin-bottom: 0.32rem;
  max-width: 100%;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(51, 65, 85, 0.68);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.life-mode-card:not(.is-active) .life-mode-card-kicker {
  font-size: 0.52rem;
}
.dark .life-mode-card-kicker {
  color: rgba(226, 232, 240, 0.68);
}
.life-mode-cta-title {
  font-size: 1.05rem;
  line-height: 1.2;
}
.life-mode-card.is-active .life-mode-cta-title {
  font-size: 1.35rem;
}
.life-mode-cta-desc {
  display: block;
  margin-top: 0.25rem;
  line-height: 1.4;
}
.life-mode-card-body,
.life-mode-card-aside {
  position: relative;
  z-index: 2;
  min-width: 0;
  margin: 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 20px rgba(51, 65, 85, 0.1);
  backdrop-filter: blur(14px) saturate(1.1);
}
.life-mode-card.is-active:has(.life-mode-card-body:not(.hidden)) .life-mode-card-body,
.life-mode-card.is-active:has(.life-mode-card-aside:not(.hidden)) .life-mode-card-aside {
  align-self: center;
  width: 100%;
  height: auto;
  max-height: calc(100% - 0.7rem);
  margin: 0.35rem 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.dark .life-mode-card-body,
.dark .life-mode-card-aside {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.82);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

/* Story scrap compose: flowing prose + tiny picks (not form grids) */
.life-story {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.15rem 0.1rem;
}
.life-story--day,
.life-story--free,
.life-story--place {
  gap: 0.35rem;
  padding: 0.05rem 0.1rem 0.1rem;
  height: auto;
}
.life-story-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  font-style: italic;
  letter-spacing: 0.01em;
  line-height: 1.4;
  color: rgba(190, 24, 93, 0.72);
}
.dark .life-story-panel-title {
  color: rgba(253, 164, 175, 0.85);
}
.life-story-panel-title .life-story-dice {
  margin-left: auto;
  flex: 0 0 auto;
}
.life-story--day .life-story-verse,
.life-story--free .life-story-verse,
.life-story--place .life-story-verse {
  display: block;
  margin: 0;
  padding: 0;
  font-size: 0.86rem;
  line-height: 1.85;
  color: rgba(71, 85, 105, 0.9);
}
.dark .life-story--day .life-story-verse,
.dark .life-story--free .life-story-verse,
.dark .life-story--place .life-story-verse {
  color: rgba(203, 213, 225, 0.88);
}
.life-story--day .life-story-words,
.life-story--free .life-story-words,
.life-story--place .life-story-words {
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}
.life-story--day .life-story-inline,
.life-story--free .life-story-inline,
.life-story--place .life-story-inline {
  display: inline-flex;
  vertical-align: baseline;
  max-width: min(100%, 9.5rem);
  margin: 0 0.05em;
}
.life-story--day .life-organic-trigger,
.life-story--free .life-organic-trigger,
.life-story--place .life-organic-trigger {
  max-width: 100%;
  padding: 0 0.1rem 0.05rem;
}
.life-story--day .life-organic-trigger-text,
.life-story--free .life-organic-trigger-text,
.life-story--place .life-organic-trigger-text {
  font-size: 0.9rem;
}
.life-story-inline--grow {
  max-width: min(100%, 11rem);
  width: auto;
  min-width: 0;
}
.life-story-inline--grow .life-organic-trigger {
  width: auto;
  max-width: 100%;
}
.life-story--day .life-story-echo {
  margin-top: 0.1rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.7rem;
  line-height: 1.35;
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
}
.life-story--free .life-story-hint,
.life-story--place .life-story-hint {
  margin: 0.05rem 0 0;
  font-size: 0.7rem;
}
.life-story-echo-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.45rem;
  margin-bottom: 0.15rem;
}
.life-story--day .life-story-echo-kicker {
  margin: 0;
}
.life-story--day .life-story-echo-meta-line {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
}
.life-story--day .life-story-echo-hook {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.life-story--day .life-story-echo-tasks {
  margin: 0.12rem 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.life-story--day .life-day-intro-teaser {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.35rem;
  margin-top: 0.15rem;
  padding-top: 0.15rem;
  border-top: 1px dashed rgba(244, 163, 143, 0.35);
}
.life-story--day .life-story-echo-teaser-name {
  margin: 0;
  font-size: 0.72rem;
}
.life-story-verse {
  margin: 0;
  line-height: 1.85;
}
.life-story-words {
  color: rgba(71, 85, 105, 0.88);
  font-size: inherit;
}
.dark .life-story-words {
  color: rgba(203, 213, 225, 0.86);
}
.life-story-inline {
  position: relative;
  display: inline-flex;
  vertical-align: baseline;
  max-width: min(100%, 9.5rem);
}
.life-organic-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.life-organic-shell {
  position: relative;
  display: inline-flex;
  max-width: 100%;
}
.life-organic-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  max-width: 100%;
  padding: 0.05rem 0.15rem;
  text-align: left;
  color: #9f1239;
  border: 0;
  border-bottom: 1.5px dashed rgba(225, 29, 72, 0.45);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.dark .life-organic-trigger {
  color: #fecdd3;
  border-bottom-color: rgba(251, 113, 133, 0.5);
  background: transparent;
  box-shadow: none;
}
.life-organic-trigger:hover {
  transform: none;
  color: #be123c;
  border-bottom-color: rgba(225, 29, 72, 0.8);
  background: rgba(255, 228, 230, 0.35);
  box-shadow: none;
}
.life-organic-shell.is-open .life-organic-trigger {
  border-bottom-style: solid;
  background: rgba(255, 228, 230, 0.45);
  box-shadow: none;
}
.life-organic-trigger-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}
.life-organic-trigger-text.is-placeholder {
  color: rgba(190, 24, 93, 0.55);
  font-weight: 500;
  font-style: italic;
}
.dark .life-organic-trigger-text.is-placeholder {
  color: rgba(254, 205, 211, 0.55);
}
.life-organic-trigger-icon {
  flex: 0 0 auto;
  font-size: 0.58rem;
  opacity: 0.55;
  transition: transform 0.2s ease;
}
.life-organic-shell.is-open .life-organic-trigger-icon {
  transform: rotate(180deg);
  opacity: 0.9;
}
.life-organic-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 0.35rem);
  z-index: 40;
  min-width: 9.5rem;
  max-width: min(18rem, 72vw);
  max-height: calc(5 * (0.78rem * 1.35 + 0.8rem) + 0.56rem);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0.28rem;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 0.85rem;
  background: rgba(255, 251, 247, 0.97);
  box-shadow: 0 14px 28px rgba(51, 65, 85, 0.16);
  backdrop-filter: blur(14px);
}
.life-organic-menu.is-portal {
  position: fixed;
  z-index: 80;
  box-shadow: 0 18px 40px rgba(51, 65, 85, 0.22);
}
.dark .life-organic-menu {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.97);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
}
.dark .life-organic-menu.is-portal {
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.life-organic-option {
  width: 100%;
  display: block;
  padding: 0.4rem 0.55rem;
  text-align: left;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #334155;
  border: 0;
  border-radius: 0.55rem;
  background: transparent;
}
.dark .life-organic-option {
  color: #e2e8f0;
}
.life-organic-option:hover {
  background: rgba(244, 163, 143, 0.18);
}
.life-organic-option.is-selected {
  background: rgba(254, 205, 211, 0.55);
  color: #9f1239;
  font-weight: 600;
}
.dark .life-organic-option.is-selected {
  background: rgba(190, 24, 93, 0.35);
  color: #fecdd3;
}
.life-story-petals {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
  padding: 0.08rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}
.dark .life-story-petals {
  background: rgba(15, 23, 42, 0.28);
}
.life-story-petal {
  width: 1.55rem;
  height: 1.55rem;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 650;
  color: rgba(71, 85, 105, 0.78);
  border: 0;
  border-radius: 999px;
  background: transparent;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.dark .life-story-petal {
  color: rgba(203, 213, 225, 0.8);
}
.life-story-petal:hover {
  transform: translateY(-1px);
  background: rgba(255, 228, 230, 0.55);
}
.life-story-petal.is-active {
  color: #fff;
  background: linear-gradient(145deg, #fb7185, #f59e0b);
  box-shadow: 0 4px 10px rgba(190, 24, 93, 0.22);
}
.life-story-dice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  min-height: 1.55rem;
  margin-left: 0.15rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
  color: #be123c;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 228, 230, 0.55);
  transition: transform 0.18s ease;
}
.life-story-dice > i {
  font-size: 0.72rem;
}
.dark .life-story-dice {
  color: #fecdd3;
  background: rgba(190, 24, 93, 0.28);
}
.life-story-dice:hover {
  transform: scale(1.04);
}
.life-story-ink {
  display: inline-block;
  vertical-align: baseline;
  width: 4.5em;
  min-width: 3.2em;
  max-width: 8em;
  margin: 0 0.05em;
  padding: 0 0.08rem 0.05rem;
  font-size: inherit;
  line-height: inherit;
  color: #9f1239;
  font-weight: 650;
  border: 0;
  border-bottom: 1.5px dashed rgba(225, 29, 72, 0.45);
  border-radius: 0;
  background: transparent;
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.dark .life-story-ink {
  color: #fecdd3;
  border-bottom-color: rgba(251, 113, 133, 0.5);
}
.life-story-ink:hover {
  border-bottom-color: rgba(225, 29, 72, 0.8);
  background: rgba(255, 228, 230, 0.35);
}
.life-story-ink:focus {
  border-bottom-style: solid;
  background: rgba(255, 228, 230, 0.45);
}
.dark .life-story-ink:hover,
.dark .life-story-ink:focus {
  background: rgba(190, 24, 93, 0.22);
}
.life-story-ink::placeholder {
  color: rgba(190, 24, 93, 0.55);
  font-weight: 500;
  font-style: italic;
}
.dark .life-story-ink::placeholder {
  color: rgba(254, 205, 211, 0.55);
}
.life-story-ink--name {
  width: 4.2em;
  max-width: 6em;
}
.life-story-ink--hook {
  width: 7em;
  max-width: 11em;
}
.life-story-echo {
  margin-top: 0.25rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(244, 163, 143, 0.4);
  font-size: 0.78rem;
  line-height: 1.5;
  color: #475569;
}
.dark .life-story-echo {
  background: rgba(15, 23, 42, 0.38);
  border-color: rgba(244, 114, 182, 0.28);
  color: #cbd5e1;
}
.life-story-echo-kicker {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #be123c;
  margin-bottom: 0.2rem;
}
.dark .life-story-echo-kicker {
  color: #fda4af;
}
.life-story-echo-who {
  margin: 0 0 0.1rem;
  font-size: 0.72rem;
  color: rgba(100, 116, 139, 0.95);
}
.dark .life-story-echo-who {
  color: rgba(148, 163, 184, 0.95);
}
.life-story-echo-meta-line {
  margin: 0 0 0.28rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #9f1239;
}
.dark .life-story-echo-meta-line {
  color: #fecdd3;
}
.life-story-echo-label {
  font-size: 0.66rem;
  font-weight: 600;
  color: rgba(100, 116, 139, 0.9);
}
.dark .life-story-echo-label {
  color: rgba(148, 163, 184, 0.9);
}
.life-story-echo-hook {
  margin: 0;
  color: #334155;
  font-weight: 500;
}
.dark .life-story-echo-hook {
  color: #e2e8f0;
}
.life-story-echo-tasks {
  margin: 0.25rem 0 0;
  color: rgba(100, 116, 139, 0.95);
}
.life-day-intro-teaser {
  margin-top: 0.35rem;
  padding-top: 0.3rem;
  border-top: 1px dashed rgba(244, 163, 143, 0.35);
}
.life-story-echo-teaser-name {
  margin: 0.1rem 0 0;
  font-weight: 600;
  color: #334155;
}
.dark .life-story-echo-teaser-name {
  color: #e2e8f0;
}
.life-story-petal[data-value=""] {
  width: auto;
  min-width: 2.35rem;
  padding: 0 0.4rem;
  font-size: 0.66rem;
  letter-spacing: 0.02em;
}
.life-story-hint {
  margin: 0.1rem 0 0;
  font-size: 0.72rem;
  color: rgba(100, 116, 139, 0.85);
}
.dark .life-story-hint {
  color: rgba(148, 163, 184, 0.85);
}
@media (max-width: 639px) {
  .life-story-inline {
    max-width: min(100%, 11rem);
  }
  .life-organic-menu {
    max-width: min(16rem, 82vw);
  }
}
@media (max-width: 639px) {
  .life-mode-cards {
    --life-side-h: 8.25rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto var(--life-side-h);
    grid-template-areas:
      "hero hero"
      "side-one side-two";
    gap: 0.55rem;
  }
  .life-mode-card.is-active {
    grid-area: hero;
    height: auto;
    min-height: var(--life-side-h);
  }
  .life-mode-card.is-active:has(.life-mode-card-body:not(.hidden)) {
    display: flex;
    flex-direction: column;
    padding-right: 0;
    height: auto;
    max-height: 18rem;
  }
  .life-mode-card.is-active:has(.life-mode-card-body:not(.hidden)) .life-mode-card-cover,
  .life-mode-card.is-active:has(.life-mode-card-body:not(.hidden)) .life-mode-card-main {
    height: auto;
    min-height: 5.5rem;
    flex: 0 0 auto;
  }
  .life-mode-card.is-active:has(.life-mode-card-body:not(.hidden)) .life-mode-card-body {
    max-height: 11rem;
    margin: 0 0.55rem 0.55rem;
  }
  .life-mode-card:not(.is-active) {
    height: var(--life-side-h);
  }
  .life-mode-card-cover,
  .life-mode-card-main {
    padding: 0.9rem;
  }
  .life-mode-card-cover > i:first-child {
    top: 0.75rem;
    left: 0.8rem;
  }
  .life-mode-card:not(.is-active) .life-mode-cta-desc,
  .life-mode-card:not(.is-active) .life-mode-card-kicker {
    display: none;
  }
}

.life-place-card.is-selected {
  box-shadow: 0 0 0 2px rgba(190, 24, 93, 0.45);
  border-color: rgba(190, 24, 93, 0.4);
}
.life-place-card.is-current {
  opacity: 0.92;
}
.life-free-arrive-wander {
  user-select: none;
}
.life-free-arrive-event-wrap {
  margin-bottom: 0.5rem;
}
.life-travel-beat {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 20, 0.72);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.life-travel-beat.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.life-travel-beat-inner {
  text-align: center;
  padding: 1rem 1.25rem;
  max-width: 90%;
}
.life-travel-beat-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #f8fafc;
  letter-spacing: 0.02em;
}
.life-travel-beat-sub {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.85);
}
.life-free-setup-hint {
  line-height: 1.5;
}
#life-hub-start-btn:disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

.life-phase-tab.active,
.life-kind-tab.active,
.life-zone-tab.active {
  background: rgba(133, 205, 202, 0.35);
  font-weight: 600;
}

#life-zone-tabs,
#life-free-zone-tabs {
  max-width: 100%;
}

.life-place-grid .life-place-card {
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
/* Free-mode hub: select-highlight start place (JS toggles .is-selected) */
.life-place-grid .life-place-card.is-selected {
  box-shadow: 0 0 0 2px rgba(190, 24, 93, 0.55);
  border-color: rgba(190, 24, 93, 0.45);
}
.dark .life-place-grid .life-place-card.is-selected {
  box-shadow: 0 0 0 2px rgba(244, 114, 182, 0.5);
  border-color: rgba(244, 114, 182, 0.4);
}
#life-hub-body.is-free-mode .life-place-grid .life-place-card {
  cursor: pointer;
}
.life-place-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, rgba(232, 168, 124, 0.25), rgba(133, 205, 202, 0.2));
  overflow: hidden;
}
.life-place-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.life-place-thumb img.life-place-thumb--missing,
.life-place-thumb img[src=""] {
  opacity: 0;
}
.life-errors-list .life-err-card {
  border: 1px solid rgba(255, 255, 255, 0.2);
}
#view-life-log .life-errors-list {
  max-height: none;
}
.life-err-count {
  margin-left: 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: #be123c;
}

/* 街角紀錄：教練紀錄／錯句紀錄 分頁 */
.life-log-tabs {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.25rem;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.dark .life-log-tabs {
  background: rgba(30, 41, 59, 0.35);
  border-color: rgba(148, 163, 184, 0.22);
}
.life-log-tab {
  padding: 0.4rem 0.9rem;
  border-radius: 0.65rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #4b5563;
  transition: background-color 0.2s, color 0.2s;
}
.dark .life-log-tab {
  color: #cbd5e1;
}
.life-log-tab:hover {
  background: rgba(255, 255, 255, 0.3);
}
.life-log-tab.active {
  background: linear-gradient(90deg, rgba(184, 138, 74, 0.45), rgba(93, 141, 176, 0.45));
  color: #1f2937;
  font-weight: 600;
}
.dark .life-log-tab.active {
  color: #f8fafc;
}

/* 街角教練紀錄卡 */
.life-sess-list .life-sess-card {
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.life-sess-toggle {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.life-sess-body {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.life-sess-item {
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.dark .life-sess-item {
  background: rgba(30, 41, 59, 0.32);
  border-color: rgba(148, 163, 184, 0.2);
}
.life-sess-item--scene {
  border-left: 3px solid rgba(190, 24, 93, 0.5);
}
.life-sess-item-head {
  font-size: 0.7rem;
  color: #6b7280;
  margin-bottom: 0.3rem;
}
.dark .life-sess-item-head {
  color: #94a3b8;
}
.life-sess-text {
  font-size: 0.8rem;
  line-height: 1.6;
  color: #374151;
  margin-top: 0.25rem;
}
.dark .life-sess-text {
  color: #e2e8f0;
}
.life-sess-text--muted {
  font-size: 0.75rem;
  color: #6b7280;
}
.dark .life-sess-text--muted {
  color: #94a3b8;
}
.life-sess-inline-label {
  color: #6b7280;
  margin-right: 0.25rem;
}
.dark .life-sess-inline-label {
  color: #94a3b8;
}
.life-sess-block {
  margin-top: 0.45rem;
}
.life-sess-block-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #6b7280;
  margin-bottom: 0.15rem;
}
.dark .life-sess-block-label {
  color: #94a3b8;
}
.life-sess-list-item,
.life-sess-list li {
  font-size: 0.78rem;
  line-height: 1.55;
  list-style: disc;
  margin-left: 1.1rem;
}
/* Session report reuses live coach block／compare styles */
.life-sess-report {
  margin-top: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.life-sess-report .life-coach-block {
  margin: 0;
}
.life-sess-report .life-coach-eval {
  white-space: pre-wrap;
}
.life-sess-phrase {
  font-size: 0.78rem;
  line-height: 1.55;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: baseline;
}
.life-sess-phrase-reading {
  font-size: 0.68rem;
  color: #6b7280;
}
.dark .life-sess-phrase-reading {
  color: #94a3b8;
}
.life-sess-phrase-meaning {
  font-size: 0.72rem;
  color: #4b5563;
}
.dark .life-sess-phrase-meaning {
  color: #cbd5e1;
}
.life-sess-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.45rem;
}
.life-sess-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  background: rgba(93, 141, 176, 0.18);
  border: 1px solid rgba(93, 141, 176, 0.28);
}
.life-sess-chip.is-grammar {
  background: rgba(184, 138, 74, 0.18);
  border-color: rgba(184, 138, 74, 0.3);
}
.life-sess-chip-reading {
  font-size: 0.62rem;
  opacity: 0.75;
}
.life-sess-chip-meaning {
  font-size: 0.65rem;
  opacity: 0.85;
}
.life-sess-flag {
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
}
.life-sess-flag.is-warn {
  background: rgba(190, 18, 60, 0.15);
  color: #be123c;
}
.life-sess-flag.is-ok {
  background: rgba(21, 128, 61, 0.15);
  color: #15803d;
}
.life-sess-flag.is-live {
  background: rgba(93, 141, 176, 0.2);
  color: #2f6690;
}
.life-phase-badge,
.life-kind-badge {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  backdrop-filter: blur(4px);
}

.life-stage-panel {
  position: relative;
}

/* Free-mode in-stage travel picker (overlay above the stage layout) */
.life-free-travel-panel {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
}
.dark .life-free-travel-panel {
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(71, 85, 105, 0.55);
}
.life-free-travel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}
.dark .life-free-travel-head {
  border-bottom-color: rgba(71, 85, 105, 0.45);
}
.life-free-travel-body {
  padding: 0.85rem 1rem 1.1rem;
  overflow-y: auto;
  flex: 1 1 auto;
}

/* Free-mode leave-confirm modal: optional NPC reaction line */
.life-free-leave-npc {
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0.55rem 0.65rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.35);
}
.dark .life-free-leave-npc {
  background: rgba(0, 0, 0, 0.22);
}
.life-free-leave-npc-loading {
  padding: 0.45rem 0.55rem;
  border-radius: 0.65rem;
  background: rgba(148, 163, 184, 0.18);
}
.life-stage-layout {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.life-stage-layout--immersive {
  --life-drawer-w: min(380px, 42vw);
  --life-drawer-toggle-w: 2.1rem;
  height: min(86vh, 900px);
  min-height: min(70vh, 640px);
  max-height: min(86vh, 900px);
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.12);
}
.dark .life-stage-layout--immersive {
  border-color: rgba(71, 85, 105, 0.55);
  background: rgba(15, 23, 42, 0.45);
}
.life-stage-layout--immersive > .life-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  min-height: 0;
  aspect-ratio: auto;
  flex: none;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
}
/* Classic VN bottom textbox — full-width plate over the stage, not a floating card */
.life-stage-layout--immersive .life-stage-ui {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  /* Explicit width so the dock never shrink-wraps to the TTS button. */
  width: 100%;
  max-width: none;
  min-width: 0;
  box-sizing: border-box;
  max-height: min(42vh, 360px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.7rem 0.9rem 0.75rem;
  border-radius: 0;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.32);
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.72) 0%, rgba(248, 250, 252, 0.92) 28%, rgba(248, 250, 252, 0.96) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.16);
}
.life-stage-layout--immersive .life-dialogue {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0.15rem 0.15rem 0.35rem;
  max-height: none;
}
.life-stage-layout--immersive .life-dialogue-head {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.4rem;
  padding: 0.18rem 0.7rem 0.18rem 0.55rem;
  border-radius: 0.35rem 0.55rem 0.55rem 0.15rem;
  border: 1px solid rgba(201, 168, 124, 0.45);
  border-left: 3px solid var(--color-shushi, #c9a87c);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.dark .life-stage-layout--immersive .life-dialogue {
  background: transparent;
  border: none;
}
.dark .life-stage-layout--immersive .life-dialogue-head {
  background: rgba(20, 26, 34, 0.88);
  border-color: rgba(201, 168, 124, 0.35);
  border-left-color: var(--color-shushi, #c9a87c);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}
.dark .life-stage-layout--immersive .life-stage-ui {
  border-top-color: rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(12, 16, 22, 0.72) 0%, rgba(12, 16, 22, 0.90) 32%, rgba(12, 16, 22, 0.95) 100%);
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.42);
}
@media (min-width: 960px) {
  .life-stage-layout--immersive {
    --life-drawer-w: min(380px, 42vw);
  }
  .life-stage-layout--immersive .life-side-drawer {
    --life-drawer-w: min(380px, 42vw);
  }
  .life-stage-layout--immersive .life-stage-ui {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    padding: 0.8rem 1.15rem 0.9rem;
    max-height: min(38vh, 340px);
  }
  /* Chat history full-height to bottom; mic dock shortens and meets drawer flush.
     Toggle hangs over the dock's right rim (does not reserve a visible gutter). */
  .life-stage-layout--immersive.is-drawer-open .life-side-drawer,
  .life-stage-layout--immersive:has(#life-side-drawer.is-open) .life-side-drawer {
    bottom: 0;
  }
  .life-stage-layout--immersive.is-drawer-open .life-stage-ui,
  .life-stage-layout--immersive:has(#life-side-drawer.is-open) .life-stage-ui {
    width: calc(100% - var(--life-drawer-w));
    right: auto;
    border-top-right-radius: 0;
  }
  .life-stage-layout--immersive.is-drawer-open .life-side-drawer-panel,
  .life-stage-layout--immersive:has(#life-side-drawer.is-open) .life-side-drawer-panel {
    border-bottom-left-radius: 0;
  }
}

/* Right dialogue log drawer
   Toggle lives INSIDE the sliding panel so it always moves with the panel
   (no separate right/transform animation that can visually detach). */
.life-side-drawer {
  /* Inherit --life-drawer-w / --life-drawer-toggle-w from .life-stage-layout--immersive */
  --life-drawer-w: min(380px, 92vw);
  --life-drawer-toggle-w: 2.1rem;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  width: 0;
  overflow: visible;
  pointer-events: none;
}
.life-side-drawer.is-open {
  width: var(--life-drawer-w);
}
.life-side-drawer-panel {
  pointer-events: auto;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--life-drawer-w);
  display: flex;
  flex-direction: column;
  overflow: visible;
  background: rgba(255, 255, 255, 0.80);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-left: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: -8px 0 28px rgba(15, 23, 42, 0.16);
  transform: translateX(100%);
  transition: transform 0.28s ease;
}
.dark .life-side-drawer-panel {
  background: rgba(15, 20, 28, 0.80);
  border-left-color: rgba(255, 255, 255, 0.12);
  box-shadow: -8px 0 28px rgba(0, 0, 0, 0.4);
}
.life-side-drawer.is-open .life-side-drawer-panel {
  transform: translateX(0);
}
.life-side-drawer-toggle {
  pointer-events: auto;
  position: absolute;
  top: 50%;
  left: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: var(--life-drawer-toggle-w);
  min-height: 5.5rem;
  padding: 0.55rem 0.2rem;
  /* Hang on the panel's left rim; moves with panel transform */
  transform: translate(-100%, -50%);
  border-radius: 0.65rem 0 0 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-right: none;
  background: rgba(255, 255, 255, 0.80);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #334155;
  cursor: pointer;
  box-shadow: none;
}
.dark .life-side-drawer-toggle {
  background: rgba(15, 20, 28, 0.80);
  border-color: rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
}
.life-side-drawer-toggle-label {
  writing-mode: vertical-rl;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.life-side-drawer .life-side-top {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0.75rem;
  overflow: hidden;
}
.life-side-drawer .life-log-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Coach popover (scheme 2) */
.life-coach-popover {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: none;
}
.life-coach-popover.hidden {
  display: none !important;
}
.life-coach-popover-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  pointer-events: auto;
  cursor: pointer;
}
/* Higher specificity beats later .life-coach-panel { width:100%; max-height:none } */
.life-coach-popover .life-coach-panel.life-coach-popover-card {
  pointer-events: auto;
  position: relative;
  z-index: 1;
  width: min(720px, calc(100% - 1.5rem)) !important;
  max-width: 720px !important;
  max-height: min(78vh, 640px) !important;
  margin: 0;
  flex: none !important;
  height: auto !important;
  min-height: 0 !important;
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
  border-radius: 1rem !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
  background: rgba(255, 255, 255, 0.88) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.28) !important;
  padding: 0.85rem !important;
}
.dark .life-coach-popover .life-coach-panel.life-coach-popover-card {
  background: rgba(15, 20, 28, 0.88) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}
.life-coach-popover .life-coach-popover-card .life-coach-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.life-coach-panel-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.life-coach-close-btn {
  line-height: 1;
}
.life-hud-season {
  font-weight: 600;
}
@media (max-width: 959px) {
  .life-side-drawer {
    --life-drawer-w: min(92vw, 360px);
  }
  .life-side-drawer.is-open {
    width: var(--life-drawer-w);
  }
  .life-stage-layout--immersive .life-stage-ui {
    left: 0;
    right: 0;
    width: 100%;
    padding: 0.55rem 0.7rem 0.65rem;
  }
  /* Hide crushed dock under near-fullscreen drawer */
  .life-side-drawer.is-open ~ .life-stage-ui {
    display: none !important;
  }
  .life-input-mode-tabs--segment {
    flex: 1 1 auto;
    max-width: none;
  }
  .life-input-mode-tabs--segment .life-input-mode-btn {
    font-size: 0.68rem;
    padding: 0.3rem 0.35rem;
  }
  /* Narrow + open: keep toggle flush inside panel so stage overflow
     doesn't clip it (still rides the panel's slide via being a child). */
  .life-side-drawer.is-open .life-side-drawer-toggle {
    transform: translate(0, -50%);
    border-radius: 0 0.65rem 0.65rem 0;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-left: none;
  }
  .dark .life-side-drawer.is-open .life-side-drawer-toggle {
    border-color: rgba(255, 255, 255, 0.14);
  }
}
.life-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  flex: 0 0 auto;
  min-height: 280px;
  max-height: min(58vh, 620px);
  background: linear-gradient(180deg, #3d4f5f 0%, #1a2430 55%, #0f1419 100%);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  /* cqh/cqi for bust sizing — keep sprite cell 3:4 */
  container-type: size;
  container-name: life-stage;
}
.life-plate {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.5s ease;
  background: transparent;
}
.life-plate.life-plate--placeholder {
  opacity: 0;
  visibility: hidden;
}
.life-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  background-image: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.life-overlay.is-active {
  opacity: 0.55;
  background-image: var(--life-ox-img, none);
}
/* Rain / snow: dual-sheet scroll so precipitation actually falls */
.life-overlay.life-overlay--anim-rain.is-active,
.life-overlay.life-overlay--anim-snow.is-active {
  background-image: none;
  opacity: 0.72;
}
.life-overlay.life-overlay--anim-rain.is-active::before,
.life-overlay.life-overlay--anim-rain.is-active::after,
.life-overlay.life-overlay--anim-snow.is-active::before,
.life-overlay.life-overlay--anim-snow.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: var(--life-ox-img, none);
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  will-change: transform;
  pointer-events: none;
}
.life-overlay.life-overlay--anim-rain.is-active::before,
.life-overlay.life-overlay--anim-snow.is-active::before {
  top: 0;
}
.life-overlay.life-overlay--anim-rain.is-active::after,
.life-overlay.life-overlay--anim-snow.is-active::after {
  top: -100%;
}
.life-overlay.life-overlay--anim-rain.is-active::before,
.life-overlay.life-overlay--anim-rain.is-active::after {
  animation: life-rain-fall 0.85s linear infinite;
}
.life-overlay.life-overlay--anim-snow.is-active::before,
.life-overlay.life-overlay--anim-snow.is-active::after {
  animation: life-snow-fall 4.2s linear infinite;
}
.life-overlay.life-overlay--rain-mild.life-overlay--anim-rain.is-active::before,
.life-overlay.life-overlay--rain-mild.life-overlay--anim-rain.is-active::after {
  animation-duration: 1.15s;
  opacity: 0.85;
}
.life-overlay.life-overlay--rain-medium.life-overlay--anim-rain.is-active::before,
.life-overlay.life-overlay--rain-medium.life-overlay--anim-rain.is-active::after {
  animation-duration: 0.85s;
}
.life-overlay.life-overlay--rain-heavy.life-overlay--anim-rain.is-active::before,
.life-overlay.life-overlay--rain-heavy.life-overlay--anim-rain.is-active::after {
  animation-duration: 0.55s;
  opacity: 1;
}
.life-overlay.life-overlay--snow-mild.life-overlay--anim-snow.is-active::before,
.life-overlay.life-overlay--snow-mild.life-overlay--anim-snow.is-active::after {
  animation-duration: 5.5s;
}
.life-overlay.life-overlay--snow-medium.life-overlay--anim-snow.is-active::before,
.life-overlay.life-overlay--snow-medium.life-overlay--anim-snow.is-active::after {
  animation-duration: 4.2s;
}
.life-overlay.life-overlay--snow-heavy.life-overlay--anim-snow.is-active::before,
.life-overlay.life-overlay--snow-heavy.life-overlay--anim-snow.is-active::after {
  animation-duration: 2.8s;
  opacity: 1;
}
.life-overlay.life-overlay--anim-windy.is-active {
  background-image: none;
  opacity: 0.62;
}
.life-overlay.life-overlay--anim-windy.is-active::before,
.life-overlay.life-overlay--anim-windy.is-active::after {
  content: '';
  position: absolute;
  top: 0;
  height: 100%;
  width: 100%;
  background-image: var(--life-ox-img, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  will-change: transform;
  pointer-events: none;
}
.life-overlay.life-overlay--anim-windy.is-active::before {
  left: 0;
  animation: life-wind-blow 2.4s linear infinite;
}
.life-overlay.life-overlay--anim-windy.is-active::after {
  left: -100%;
  animation: life-wind-blow 2.4s linear infinite;
  opacity: 0.85;
}
.life-overlay.life-overlay--anim-sun.is-active {
  opacity: 0.55;
  animation: life-sun-pulse 3.2s ease-in-out infinite;
  transform-origin: 70% 18%;
}
.life-overlay.life-overlay--anim-sun.is-active::before {
  content: '';
  position: absolute;
  inset: -8%;
  background-image: var(--life-ox-img, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.55;
  animation: life-sun-flare 5s ease-in-out infinite;
  pointer-events: none;
  will-change: transform, opacity;
}
@keyframes life-rain-fall {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(0, 100%, 0); }
}
@keyframes life-snow-fall {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(5%, 100%, 0); }
}
@keyframes life-wind-blow {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(100%, 0, 0); }
}
@keyframes life-sun-pulse {
  0%, 100% { opacity: 0.42; filter: brightness(1); }
  50% { opacity: 0.78; filter: brightness(1.18); }
}
@keyframes life-sun-flare {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.4; }
  50% { transform: scale(1.06) rotate(2deg); opacity: 0.7; }
}
@media (prefers-reduced-motion: reduce) {
  .life-overlay.life-overlay--anim-rain.is-active,
  .life-overlay.life-overlay--anim-snow.is-active,
  .life-overlay.life-overlay--anim-windy.is-active,
  .life-overlay.life-overlay--anim-sun.is-active {
    animation: none;
    filter: none;
  }
  .life-overlay.life-overlay--anim-rain.is-active::before,
  .life-overlay.life-overlay--anim-rain.is-active::after,
  .life-overlay.life-overlay--anim-snow.is-active::before,
  .life-overlay.life-overlay--anim-snow.is-active::after,
  .life-overlay.life-overlay--anim-windy.is-active::before,
  .life-overlay.life-overlay--anim-windy.is-active::after,
  .life-overlay.life-overlay--anim-sun.is-active::before {
    animation: none;
    top: 0;
    left: 0;
    inset: 0;
    transform: none;
  }
  .life-overlay.life-overlay--anim-rain.is-active::after,
  .life-overlay.life-overlay--anim-snow.is-active::after,
  .life-overlay.life-overlay--anim-windy.is-active::after,
  .life-overlay.life-overlay--anim-sun.is-active::before {
    display: none;
  }
  .life-overlay.life-overlay--anim-rain.is-active,
  .life-overlay.life-overlay--anim-snow.is-active,
  .life-overlay.life-overlay--anim-windy.is-active,
  .life-overlay.life-overlay--anim-sun.is-active {
    background-image: var(--life-ox-img, none);
  }
}

.life-stage-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0.18) 0%, transparent 40%, rgba(0,0,0,0.22) 100%);
}

/* Character bust — VN style: 3:4 cell (1536×1024 sheet ÷ 4×2), hem sits behind dialogue dock.
   Anchored to the horizontal center of the call dock (full stage, or dock strip when drawer open). */
.life-portrait-layer {
  --life-portrait-dock-center: 50%;
  position: absolute;
  left: var(--life-portrait-dock-center);
  right: auto;
  bottom: 0;
  transform: translateX(-50%);
  /* Height-led; width from 3:4 so sprite sheet cells never squash */
  height: min(78%, 640px);
  width: auto;
  aspect-ratio: 3 / 4;
  z-index: 3;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0.96;
  transition: opacity 180ms ease, left 0.28s ease;
}
@supports (width: 1cqh) {
  .life-portrait-layer {
    --life-bust-h: min(78cqh, 640px);
    --life-bust-w: min(42cqi, 360px, calc(var(--life-bust-h) * 3 / 4));
    width: var(--life-bust-w);
    height: calc(var(--life-bust-w) * 4 / 3);
    aspect-ratio: auto;
  }
}
/* Desktop: when log drawer is open, dock shrinks — keep bust centered over that dock strip. */
@media (min-width: 960px) {
  .life-stage-layout--immersive.is-drawer-open .life-portrait-layer,
  .life-stage-layout--immersive:has(#life-side-drawer.is-open) .life-portrait-layer {
    --life-portrait-dock-center: calc((100% - var(--life-drawer-w)) / 2);
  }
}
.life-portrait-layer.hidden {
  display: none;
}
.life-portrait {
  width: 100%;
  height: 100%;
  background-color: transparent;
  background-repeat: no-repeat;
  background-size: 400% 200%;
  background-position: 0% 0%;
  /* Instant cell swap — no background-position slide between emotions */
  transition: opacity 180ms ease;
  filter: drop-shadow(0 10px 28px rgba(15, 20, 25, 0.45));
  opacity: 1;
}
/* Tiny “familiar” mark when situation locks a known character */
.life-portrait-familiar {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 1;
  display: none;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(15, 20, 25, 0.48);
  color: #f0a8a0;
  font-size: 0.65rem;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(15, 20, 25, 0.28);
  pointer-events: none;
}
.life-portrait-layer.has-familiar .life-portrait-familiar {
  display: inline-flex;
}
.dark .life-portrait-familiar {
  background: rgba(8, 12, 18, 0.62);
  border-color: rgba(255, 255, 255, 0.22);
  color: #f4b4ac;
}
@media (max-width: 640px) {
  .life-portrait-layer {
    height: min(70%, 520px);
    width: auto;
    aspect-ratio: 3 / 4;
    bottom: 0;
    left: var(--life-portrait-dock-center);
    right: auto;
    transform: translateX(-50%);
    justify-content: center;
    opacity: 0.88;
  }
  @supports (width: 1cqh) {
    .life-portrait-layer {
      --life-bust-h: min(70cqh, 520px);
      --life-bust-w: min(56cqi, 240px, calc(var(--life-bust-h) * 3 / 4));
      width: var(--life-bust-w);
      height: calc(var(--life-bust-w) * 4 / 3);
      aspect-ratio: auto;
    }
  }
  .life-portrait {
    filter: drop-shadow(0 6px 16px rgba(15, 20, 25, 0.35));
  }
  .life-portrait-familiar {
    top: 0.2rem;
    right: 0.15rem;
    width: 1.15rem;
    height: 1.15rem;
    font-size: 0.55rem;
  }
  /* Keep choice / dock controls above any residual portrait fade */
  .life-stage-layout--immersive .life-stage-ui {
    z-index: 7;
  }
  .life-stage-layout--immersive .life-input-area,
  .life-stage-layout--immersive .life-choices {
    position: relative;
    z-index: 1;
  }
}

.life-jlpt-picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.life-jlpt-tab.is-active {
  background: rgba(65, 179, 163, 0.28);
  border-color: rgba(65, 179, 163, 0.55);
  font-weight: 700;
  color: #0f766e;
}
.dark .life-jlpt-tab.is-active {
  color: #5eead4;
}

.life-hud {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  z-index: 3;
  pointer-events: none;
}

/* Day-mode collapsible storyline (top-left, under HUD clock) */
.life-day-mission {
  position: absolute;
  top: 3.15rem;
  left: 0.75rem;
  z-index: 4;
  max-width: min(17.5rem, calc(100% - 1.5rem));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  pointer-events: auto;
}
.life-day-mission.hidden {
  display: none;
}
.life-day-mission-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  padding: 0.35rem 0.65rem;
  border-radius: 0.65rem;
  background: rgba(15, 20, 25, 0.62);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f3f4f6;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.life-day-mission-toggle:hover {
  background: rgba(15, 20, 25, 0.78);
  border-color: rgba(255, 255, 255, 0.28);
}
.life-day-mission-toggle-title {
  letter-spacing: 0.02em;
}
.life-day-mission-progress {
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #e5e7eb;
}
.life-day-mission-progress.is-complete {
  background: color-mix(in srgb, var(--renyo, #2a9d8f) 55%, transparent);
  color: #ecfdf5;
}
.life-day-mission-chevron {
  font-size: 0.65rem;
  opacity: 0.7;
  transition: transform 0.18s ease;
}
.life-day-mission:not(.is-collapsed) .life-day-mission-chevron {
  transform: rotate(180deg);
}
.life-day-mission-body {
  padding: 0.55rem 0.65rem 0.65rem;
  border-radius: 0.75rem;
  background: rgba(15, 20, 25, 0.72);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f3f4f6;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}
.life-day-mission-body[hidden] {
  display: none !important;
}
.life-day-mission-hook {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  line-height: 1.45;
  color: #e5e7eb;
  opacity: 0.95;
}
.life-day-mission-tasks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}
.life-day-mission-task {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #f9fafb;
}
.life-day-mission-task-icon {
  flex-shrink: 0;
  width: 0.95rem;
  margin-top: 0.1rem;
  font-size: 0.78rem;
  color: rgba(156, 163, 175, 0.9);
}
.life-day-mission-task.is-done .life-day-mission-task-icon {
  color: var(--renyo, #2a9d8f);
}
.life-day-mission-task.is-done .life-day-mission-task-label {
  text-decoration: line-through;
  opacity: 0.62;
}
.life-day-mission-task.is-just-done .life-day-mission-task-icon {
  animation: life-day-mission-check 0.45s ease;
}
@keyframes life-day-mission-check {
  0% { transform: scale(0.7); }
  45% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
.life-day-mission-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  margin-top: 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.6rem;
  border: 1px solid color-mix(in srgb, var(--renyo, #2a9d8f) 55%, transparent);
  background: color-mix(in srgb, var(--renyo, #2a9d8f) 28%, rgba(15, 20, 25, 0.5));
  color: #ecfdf5;
  font-size: 0.75rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.life-day-mission-next:hover {
  background: color-mix(in srgb, var(--renyo, #2a9d8f) 42%, rgba(15, 20, 25, 0.4));
  border-color: color-mix(in srgb, var(--renyo, #2a9d8f) 75%, transparent);
}
.life-day-mission-next.hidden {
  display: none;
}
@media (max-width: 640px) {
  .life-day-mission {
    top: 3.4rem;
    max-width: min(15.5rem, calc(100% - 1.5rem));
  }
}
.life-hud-clock,
.life-hud-place {
  pointer-events: auto;
  padding: 0.35rem 0.65rem;
  border-radius: 0.65rem;
  background: rgba(15, 20, 25, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f3f4f6;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.life-hud-time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.life-hud-time--tick {
  animation: life-clock-tick 0.4s ease;
}
@keyframes life-clock-tick {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); color: #fde68a; }
  100% { transform: scale(1); }
}
.life-hud-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  flex-shrink: 0;
}
.life-tod-dot--morning { background: #7dd3fc; box-shadow: 0 0 6px #7dd3fc; }
.life-tod-dot--day { background: #fde047; box-shadow: 0 0 6px #fde047; }
.life-tod-dot--sunset { background: #fb923c; box-shadow: 0 0 6px #fb923c; }
.life-tod-dot--night { background: #818cf8; box-shadow: 0 0 6px #818cf8; }
.life-hud-place-ja {
  font-weight: 600;
}
.life-hud-place-zh {
  display: none;
}
.life-hud-weather-sep {
  opacity: 0.45;
}
.life-hud-weather {
  opacity: 0.95;
}

.life-stage-ui {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.7rem 0.8rem 0.85rem;
  flex-shrink: 0;
  pointer-events: auto;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
  min-width: 0;
}
.dark .life-stage-ui {
  background: rgba(15, 23, 32, 0.92);
  border-color: rgba(71, 85, 105, 0.45);
}
/* Hide mode: hide dialogue card; TTS lives in the dock bar with mode tabs */
.life-stage-ui.is-text-hidden .life-dialogue {
  display: none;
}
.life-dialogue {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: auto;
  flex-shrink: 0;
  max-height: 7.5rem;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}
.dark .life-dialogue {
  background: rgba(20, 24, 30, 0.88);
  border-color: rgba(255, 255, 255, 0.12);
}
.life-dialogue-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.life-speaker-name {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-shushi, #c9a87c);
}
.life-emotion-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.65rem;
  padding: 0.12rem 0.45rem 0.12rem 0.2rem;
  border-radius: 999px;
  background: rgba(65, 179, 163, 0.2);
  color: #0f766e;
  line-height: 1;
}
.life-emotion-chip .life-emo-svg {
  width: 18px;
  height: 18px;
}
.life-emotion-chip-label {
  white-space: nowrap;
}
.dark .life-emotion-chip {
  color: #5eead4;
}
.life-emotion-chip[data-emotion="confused"],
.life-emotion-chip[data-emotion="worried"] {
  background: rgba(232, 168, 124, 0.25);
  color: #b45309;
}
.life-emotion-chip[data-emotion="annoyed"] {
  background: rgba(225, 29, 72, 0.18);
  color: #be123c;
}
.life-tts-btn {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.55);
  color: #4b5563;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.dark .life-tts-btn {
  background: rgba(0, 0, 0, 0.25);
  color: #d1d5db;
}
.life-tts-btn:hover {
  background: rgba(65, 179, 163, 0.25);
  color: #0f766e;
}
.life-tts-btn.is-playing {
  color: #0f766e;
  animation: life-tts-pulse 1s ease-in-out infinite;
}
@keyframes life-tts-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.75; }
}
.life-dialogue-text {
  font-size: 1rem;
  line-height: 1.55;
  color: #1f2937;
}
.dark .life-dialogue-text {
  color: #e5e7eb;
}

.life-input-area {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: auto;
  flex-shrink: 0;
}
/* Collapse choices / freetext / mode toggle while AI turn is loading */
.life-input-area.is-turn-loading #life-choices,
.life-input-area.is-turn-loading #life-freetext-wrap,
.life-input-area.is-turn-loading #life-live-wrap,
.life-input-area.is-turn-loading .life-input-mode-row,
.life-input-area.is-turn-loading #life-next-scene-wrap {
  display: none !important;
}
.life-input-area.is-turn-loading .life-dock-bar {
  justify-content: flex-start;
}
.life-input-area.is-turn-loading .life-turn-loading {
  margin-bottom: 0;
}
/* >=16px prevents iOS Safari zoom-on-focus */
.life-freetext {
  font-size: 16px;
}
.life-turn-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 5.5rem;
  margin-bottom: 0.5rem;
  border-radius: 0.85rem;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.life-turn-loading.hidden {
  display: none;
}
.life-turn-loading-inner {
  text-align: center;
  padding: 0.85rem 1rem;
}
.life-turn-loading-icon {
  font-size: 1.25rem;
  color: var(--color-shushi, #c9a87c);
  margin-bottom: 0.35rem;
}
.life-turn-loading-text {
  font-size: 0.85rem;
  color: #f8fafc;
  font-weight: 600;
}
.life-turn-loading-sub {
  font-size: 0.68rem;
  color: rgba(226, 232, 240, 0.8);
  margin-top: 0.15rem;
}
.life-choices.life-choices--loading {
  opacity: 0.45;
  pointer-events: none;
}
.life-choices .life-choice-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(6px);
}
.dark .life-choices .life-choice-btn {
  background: rgba(30, 35, 42, 0.8);
}
.life-input-mode-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 1 1 auto;
  min-width: 0;
  margin-top: 0;
  gap: 0.5rem;
}
.life-dock-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.4rem;
  min-width: 0;
}
.life-dock-bar .life-input-mode-row {
  margin-top: 0;
}
.life-dock-bar .life-input-mode-tabs--segment {
  flex: 1 1 auto;
  width: auto;
  max-width: none;
  margin-inline: 0;
}
.life-hub-mode-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.life-hub-mode-row .life-input-mode-tabs--segment {
  width: auto;
  flex: 1 1 auto;
  max-width: 24rem;
  margin-inline: 0;
}
.life-hub-start-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  color: #fff;
  border: 1px solid rgba(225, 29, 72, 0.5);
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.92), rgba(190, 24, 93, 0.92));
  box-shadow: 0 2px 10px rgba(190, 24, 93, 0.3);
  transition: all 0.2s ease;
}
.life-hub-start-btn:hover:not(:disabled) {
  transform: scale(1.04);
  box-shadow: 0 4px 16px rgba(190, 24, 93, 0.4);
}
@media (max-width: 380px) {
  .life-hub-start-btn {
    padding: 0.45rem 0.6rem;
    font-size: 0.72rem;
  }
}
.life-input-mode-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.life-input-mode-tabs--segment {
  flex: 0 1 24rem;
  width: 100%;
  flex-wrap: nowrap;
  gap: 0;
  max-width: 24rem;
  margin-inline: auto;
  padding: 0.15rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(6px);
}
.dark .life-input-mode-tabs--segment {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(20, 24, 30, 0.45);
}
.life-input-mode-tabs--segment .life-input-mode-btn {
  flex: 1;
  border: 0;
  background: transparent;
  backdrop-filter: none;
  border-radius: 999px;
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  box-shadow: none;
  text-align: center;
  white-space: nowrap;
}
.dark .life-input-mode-tabs--segment .life-input-mode-btn {
  background: transparent;
}
.life-input-mode-tabs--segment .life-input-mode-btn.is-active {
  background: rgba(65, 179, 163, 0.28);
  color: #0f766e;
  box-shadow: none;
}
.dark .life-input-mode-tabs--segment .life-input-mode-btn.is-active {
  background: rgba(65, 179, 163, 0.32);
  color: #99f6e4;
}
.life-input-mode-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(6px);
  border-radius: 0.75rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
  color: #4b5563;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.dark .life-input-mode-btn {
  background: rgba(30, 35, 42, 0.7);
  color: #d1d5db;
}
.life-input-mode-btn.is-active {
  background: rgba(65, 179, 163, 0.22);
  color: #0f766e;
  box-shadow: inset 0 0 0 1px rgba(65, 179, 163, 0.45);
}
.dark .life-input-mode-btn.is-active {
  background: rgba(65, 179, 163, 0.28);
  color: #99f6e4;
}
.life-freetext-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: #4b5563;
  cursor: pointer;
  user-select: none;
}
.dark .life-freetext-toggle {
  color: #d1d5db;
}
.life-freetext-toggle input {
  accent-color: var(--color-renyo, #41b3a3);
}
.life-freetext-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.life-live-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.55rem 0.15rem 0.15rem;
}
.life-live-wrap.hidden {
  display: none;
}
.life-live-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: #4b5563;
}
.dark .life-live-status {
  color: #d1d5db;
}
#life-live-timer {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #0f766e;
}
.dark #life-live-timer {
  color: #99f6e4;
}
.life-live-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  width: 100%;
  gap: 0.6rem;
}
.life-live-controls-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}
.life-live-controls-side--left {
  justify-content: flex-end;
}
.life-live-controls-side--right {
  justify-content: flex-start;
}
.life-live-controls > .life-live-mic-btn {
  justify-self: center;
}
.life-live-mic-btn {
  box-sizing: border-box;
  width: 3.25rem;
  height: 3.25rem;
  min-width: 3.25rem;
  min-height: 3.25rem;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 0;
  touch-action: none;
  user-select: none;
}
/* FA webfont glyphs sit on a text baseline; force the ink box into the flex center. */
.life-live-mic-btn > i {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  line-height: 1;
  font-size: 1em;
  flex: 0 0 auto;
}
.life-live-mic-btn > i::before {
  display: block;
  line-height: 1;
  width: 1em;
  text-align: center;
}
.life-live-mic-btn.is-active {
  background: rgba(65, 179, 163, 0.18);
  border-color: rgba(65, 179, 163, 0.45);
  color: #0f766e;
}
.dark .life-live-mic-btn.is-active {
  background: rgba(65, 179, 163, 0.24);
  color: #99f6e4;
}
.life-live-mic-btn.is-recording {
  background: rgba(225, 29, 72, 0.16);
  border-color: rgba(225, 29, 72, 0.45);
  color: #be123c;
  animation: life-voice-pulse 1.2s ease-in-out infinite;
}
.dark .life-live-mic-btn.is-recording {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
}
.life-voice-btn.is-listening {
  background: rgba(225, 29, 72, 0.16);
  border-color: rgba(225, 29, 72, 0.45);
  color: #be123c;
  animation: life-voice-pulse 1.2s ease-in-out infinite;
}
.dark .life-voice-btn.is-listening {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
}
@keyframes life-voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(225, 29, 72, 0); }
}
/* 問道堂語音問答 (sensei voice Q&A) — reuses .life-live-* control classes */
.sensei-voice-bar {
  display: block;
}
.sensei-voice-bar.hidden {
  display: none;
}
.sensei-voice-hint {
  line-height: 1.5;
}

.life-api-hint {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  text-align: right;
  pointer-events: none;
}
.life-api-hint:not(.hidden) {
  pointer-events: auto;
}
.life-hub-body--disabled {
  pointer-events: none;
  opacity: 0.45;
  filter: grayscale(0.35);
  user-select: none;
}

/* Free-mode stage chrome */
.life-free-stage-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.life-free-stage-actions.hidden {
  display: none;
}
#life-free-change-place-btn:disabled,
#life-free-end-btn:disabled,
.life-free-stage-actions.is-locked button {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

.life-free-place-picker {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.life-free-place-picker.hidden {
  display: none;
}
.life-free-place-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.life-free-place-picker-body {
  min-width: 0;
}
.life-free-place-picker-body .life-place-grid {
  max-height: min(42vh, 360px);
  overflow-y: auto;
  padding-bottom: 0.25rem;
}

#life-free-leave-modal[aria-hidden="false"] {
  display: flex;
}

.life-side-top {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
}
.life-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.life-side-head-main {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
}
.life-side-head-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}
.life-furi-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  color: #6b7280;
  cursor: pointer;
  user-select: none;
}
.dark .life-furi-toggle {
  color: #9ca3af;
}
.life-furi-toggle input {
  accent-color: var(--color-renyo, #41b3a3);
}
.life-scene-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.life-scene-tabs.hidden {
  display: none;
}
.life-scene-tab {
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.4);
  color: #4b5563;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.dark .life-scene-tab {
  background: rgba(0, 0, 0, 0.25);
  color: #d1d5db;
}
.life-scene-tab:hover {
  border-color: rgba(65, 179, 163, 0.45);
}
.life-scene-tab.is-active {
  background: rgba(201, 168, 124, 0.28);
  border-color: rgba(201, 168, 124, 0.7);
  color: #1f2937;
  font-weight: 600;
}
.dark .life-scene-tab.is-active {
  color: #f3f4f6;
}
/*
 * Life Corner furigana — plain spans only (no <ruby>/<rt>).
 * Chromium native ruby reserves annotation space and sinks the kanji
 * even when CSS tries to override; span + absolute rt avoids that.
 */
#view-life .life-ruby-unit,
#view-life-log .life-ruby-unit {
  display: inline-block;
  position: relative;
  vertical-align: baseline;
  line-height: 1;
  white-space: nowrap;
  text-align: center;
}
#view-life .life-furi-rb,
#view-life-log .life-furi-rb {
  display: inline;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}
#view-life .life-furi-rt,
#view-life-log .life-furi-rt {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  display: block;
  font-size: 0.5em;
  line-height: 1;
  text-align: center;
  color: inherit;
  opacity: 0.78;
  user-select: none;
  white-space: nowrap;
  letter-spacing: 0;
  pointer-events: none;
}
/* Chat bubbles: muted gray furigana (not green「建議」inherit) */
.life-log-text .life-furi-rt {
  color: #6b7280;
  opacity: 1;
}
.dark .life-log-text .life-furi-rt {
  color: #9ca3af;
}
.life-log-list.is-furi-hidden .life-furi-rt {
  display: none;
}
.life-next-scene-wrap {
  margin-top: 0.5rem;
}
.life-next-scene-wrap.is-compact {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.35rem;
}
.life-next-scene-wrap.hidden {
  display: none;
}
.life-next-scene-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.7rem 1rem;
  border-radius: 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #41b3a3, #2d8a7e);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 14px rgba(45, 138, 126, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, padding 0.15s ease, font-size 0.15s ease;
}
.life-next-scene-wrap.is-compact .life-next-scene-btn {
  width: auto;
  max-width: 100%;
  padding: 0.32rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(45, 138, 126, 0.28);
}
.life-next-scene-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(45, 138, 126, 0.45);
}
.life-next-scene-wrap.is-compact .life-next-scene-btn:hover {
  box-shadow: 0 3px 10px rgba(45, 138, 126, 0.38);
}
.life-coach-prompt {
  padding: 0.15rem 0;
}
.life-coach-prompt.hidden {
  display: none;
}
.life-coach-panel.is-empty #life-coach-body {
  opacity: 0.85;
}
.life-coach-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.life-coach-cards.hidden {
  display: none;
}
.life-coach-cards-label {
  width: 100%;
  font-size: 0.65rem;
  color: #6b7280;
  margin-bottom: 0.1rem;
}
.dark .life-coach-cards-label {
  color: #9ca3af;
}
.life-log-list {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.45rem 0.4rem;
  margin: 0 -0.15rem;
  border-radius: 0.75rem;
  background: rgba(148, 163, 184, 0.1);
  -webkit-overflow-scrolling: touch;
}
.dark .life-log-list {
  background: rgba(15, 23, 42, 0.28);
}
.life-log-empty {
  font-size: 0.75rem;
  color: #9ca3af;
  padding: 0.75rem 0.25rem;
}
.life-log-item {
  position: relative;
  text-align: left;
  width: 100%;
  flex-shrink: 0;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.dark .life-log-item {
  background: rgba(0, 0, 0, 0.22);
}
.life-log-item:hover {
  border-color: rgba(65, 179, 163, 0.35);
}
.life-log-item.is-active {
  border-color: rgba(201, 168, 124, 0.7);
  box-shadow: 0 0 0 1px rgba(201, 168, 124, 0.35);
  background: rgba(201, 168, 124, 0.18);
}
.life-log-item.is-highlight {
  animation: life-log-flash 0.9s ease;
}
.life-log-item.has-coach {
  border-left: 3px solid #0f766e;
  background: rgba(15, 118, 110, 0.08);
}
.dark .life-log-item.has-coach {
  border-left-color: #5eead4;
  background: rgba(45, 212, 191, 0.1);
}
.life-log-item.no-coach {
  border-left: 3px solid transparent;
}
@keyframes life-log-flash {
  0% { background: rgba(65, 179, 163, 0.45); }
  100% { background: inherit; }
}
.life-log-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.65rem;
  color: #6b7280;
  margin-bottom: 0.15rem;
}
.dark .life-log-meta {
  color: #9ca3af;
}
.life-log-role {
  font-weight: 700;
  color: var(--color-shushi, #c9a87c);
}
.life-log-clock {
  margin-left: auto;
  opacity: 0.85;
}
.life-log-emotion {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  padding: 0.08rem 0.4rem 0.08rem 0.2rem;
  border-radius: 999px;
  background: rgba(65, 179, 163, 0.16);
  color: #0f766e;
  font-size: 0.6rem;
  line-height: 1;
  max-width: 100%;
}
.dark .life-log-emotion {
  color: #5eead4;
  background: rgba(45, 212, 191, 0.12);
}
.life-log-emotion-label {
  white-space: nowrap;
}
.life-emo-svg {
  flex-shrink: 0;
  display: block;
}
.life-emo-blush {
  fill: #f9a8d4;
  opacity: 0.55;
}
.life-emo-blush--soft {
  opacity: 0.35;
}
.life-emo-blush--strong {
  opacity: 0.75;
}
.life-emo-sweat,
.life-emo-tear {
  fill: #38bdf8;
  opacity: 0.85;
}
.life-emo-anger,
.life-emo-focus,
.life-emo-sigh,
.life-emo-tease,
.life-emo-speed {
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
}
.life-emo-anger {
  stroke: #e11d48;
  stroke-width: 1.2;
}
.life-emo-spark,
.life-emo-glow {
  fill: #fbbf24;
  opacity: 0.9;
}
.life-emo-zz,
.life-emo-mark {
  opacity: 0.9;
}
.life-log-emotion[data-emotion="happy"] .life-emo-blush,
.life-log-emotion[data-emotion="friendly"] .life-emo-blush,
.life-log-emotion[data-emotion="shy"] .life-emo-blush,
.life-emotion-chip[data-emotion="happy"] .life-emo-blush,
.life-emotion-chip[data-emotion="friendly"] .life-emo-blush,
.life-emotion-chip[data-emotion="shy"] .life-emo-blush {
  animation: life-emo-blush-pulse 2.4s ease-in-out infinite;
}
.life-log-emotion[data-emotion="hurried"] .life-emo-speed,
.life-emotion-chip[data-emotion="hurried"] .life-emo-speed {
  animation: life-emo-speed-flicker 1.2s ease-in-out infinite;
}
.life-log-emotion[data-emotion="excited"] .life-emo-spark,
.life-emotion-chip[data-emotion="excited"] .life-emo-spark {
  animation: life-emo-spark-twinkle 1.4s ease-in-out infinite;
}
@keyframes life-emo-blush-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.7; }
}
@keyframes life-emo-speed-flicker {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}
@keyframes life-emo-spark-twinkle {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
/* emotion color buckets for log + chip */
.life-log-emotion[data-emotion="confused"],
.life-log-emotion[data-emotion="worried"],
.life-log-emotion[data-emotion="nervous"],
.life-log-emotion[data-emotion="surprised"],
.life-log-emotion[data-emotion="hurried"],
.life-log-emotion[data-emotion="determined"],
.life-emotion-chip[data-emotion="confused"],
.life-emotion-chip[data-emotion="worried"],
.life-emotion-chip[data-emotion="nervous"],
.life-emotion-chip[data-emotion="surprised"],
.life-emotion-chip[data-emotion="hurried"],
.life-emotion-chip[data-emotion="determined"] {
  background: rgba(232, 168, 124, 0.25);
  color: #b45309;
}
.life-log-emotion[data-emotion="annoyed"],
.life-log-emotion[data-emotion="angry"],
.life-log-emotion[data-emotion="sad"],
.life-log-emotion[data-emotion="apologetic"],
.life-emotion-chip[data-emotion="annoyed"],
.life-emotion-chip[data-emotion="angry"],
.life-emotion-chip[data-emotion="sad"],
.life-emotion-chip[data-emotion="apologetic"] {
  background: rgba(225, 29, 72, 0.16);
  color: #be123c;
}
.life-log-emotion[data-emotion="shy"],
.life-emotion-chip[data-emotion="shy"] {
  background: rgba(244, 114, 182, 0.18);
  color: #be185d;
}
.life-log-emotion[data-emotion="cold"],
.life-log-emotion[data-emotion="sleepy"],
.life-log-emotion[data-emotion="neutral"],
.life-log-emotion[data-emotion="polite"],
.life-log-emotion[data-emotion="curious"],
.life-emotion-chip[data-emotion="cold"],
.life-emotion-chip[data-emotion="sleepy"],
.life-emotion-chip[data-emotion="neutral"],
.life-emotion-chip[data-emotion="polite"],
.life-emotion-chip[data-emotion="curious"] {
  background: rgba(148, 163, 184, 0.22);
  color: #475569;
}
.dark .life-log-emotion[data-emotion="cold"],
.dark .life-log-emotion[data-emotion="sleepy"],
.dark .life-log-emotion[data-emotion="neutral"],
.dark .life-log-emotion[data-emotion="polite"],
.dark .life-log-emotion[data-emotion="curious"],
.dark .life-emotion-chip[data-emotion="cold"],
.dark .life-emotion-chip[data-emotion="sleepy"],
.dark .life-emotion-chip[data-emotion="neutral"],
.dark .life-emotion-chip[data-emotion="polite"],
.dark .life-emotion-chip[data-emotion="curious"] {
  color: #cbd5e1;
}
.life-dialogue[data-emotion="friendly"],
.life-dialogue[data-emotion="happy"],
.life-dialogue[data-emotion="excited"],
.life-dialogue[data-emotion="grateful"],
.life-dialogue[data-emotion="proud"],
.life-dialogue[data-emotion="relieved"],
.life-dialogue[data-emotion="teasing"] {
  border-left: 3px solid #41b3a3;
}
.life-dialogue[data-emotion="confused"],
.life-dialogue[data-emotion="worried"],
.life-dialogue[data-emotion="nervous"],
.life-dialogue[data-emotion="surprised"],
.life-dialogue[data-emotion="hurried"],
.life-dialogue[data-emotion="determined"] {
  border-left: 3px solid #e8a87c;
}
.life-dialogue[data-emotion="annoyed"],
.life-dialogue[data-emotion="angry"],
.life-dialogue[data-emotion="sad"],
.life-dialogue[data-emotion="apologetic"] {
  border-left: 3px solid #e11d48;
}
.life-dialogue[data-emotion="shy"] {
  border-left: 3px solid #ec4899;
}
.life-dialogue[data-emotion="cold"],
.life-dialogue[data-emotion="sleepy"],
.life-dialogue[data-emotion="curious"],
.life-dialogue[data-emotion="neutral"],
.life-dialogue[data-emotion="polite"] {
  border-left: 3px solid #94a3b8;
}
.life-log-text {
  font-size: 0.82rem;
  line-height: 1.85;
  color: #1f2937;
  word-break: break-word;
}
.dark .life-log-text {
  color: #e5e7eb;
}
.life-log-coach-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: 0;
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.58rem;
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.life-log-coach-badge.is-done {
  color: #0f766e;
  background: rgba(15, 118, 110, 0.14);
  border: 1px solid rgba(15, 118, 110, 0.28);
}
.dark .life-log-coach-badge.is-done {
  color: #99f6e4;
  background: rgba(45, 212, 191, 0.16);
  border-color: rgba(45, 212, 191, 0.35);
}
.life-log-coach-badge.is-none {
  color: #9ca3af;
  background: rgba(156, 163, 175, 0.12);
  border: 1px solid rgba(156, 163, 175, 0.28);
}
.dark .life-log-coach-badge.is-none {
  color: #9ca3af;
  background: rgba(75, 85, 99, 0.28);
  border-color: rgba(156, 163, 175, 0.22);
}
.life-coach-panel {
  flex: 1 1 auto;
  height: auto;
  min-height: 260px;
  max-height: none;
  margin-top: 0;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  background: transparent;
  box-shadow: none;
}
.dark .life-coach-panel {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}
.life-coach-panel-head {
  margin-bottom: 0.5rem;
  padding-bottom: 0;
  border-bottom: none;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.life-coach-scene-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  line-height: 1.2;
  padding: 0.28rem 0.55rem;
  border-radius: 0.55rem;
  border: 1px solid rgba(201, 168, 124, 0.45);
  background: rgba(201, 168, 124, 0.14);
  color: #8a6a3e;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.life-coach-scene-btn:hover:not(:disabled) {
  background: rgba(201, 168, 124, 0.28);
  border-color: rgba(201, 168, 124, 0.7);
}
.life-coach-scene-btn:disabled,
.life-coach-scene-btn.is-loading {
  opacity: 0.72;
  cursor: wait;
  pointer-events: none;
}
.dark .life-coach-scene-btn {
  color: #e8d5b5;
  background: rgba(201, 168, 124, 0.12);
  border-color: rgba(201, 168, 124, 0.35);
}
.life-coach-eval--loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
  padding: 1rem 0.75rem;
  white-space: normal;
}
.life-coach-loading-icon {
  font-size: 1.1rem;
  color: #8a6a3e;
  margin-bottom: 0.15rem;
}
.dark .life-coach-loading-icon {
  color: #e8d5b5;
}
.life-coach-loading-sub {
  font-size: 0.7rem;
  opacity: 0.75;
}
.life-coach-panel.is-coach-loading #life-coach-body {
  opacity: 1;
}
.life-coach-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #374151;
}
.dark .life-coach-list {
  color: #d1d5db;
}
.life-coach-list li + li {
  margin-top: 0.2rem;
}
.life-coach-phrases {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.life-coach-phrase {
  padding: 0.35rem 0.4rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.35);
}
.dark .life-coach-phrase {
  background: rgba(0, 0, 0, 0.18);
}
.life-coach-phrase-ja {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #1f2937;
}
.dark .life-coach-phrase-ja {
  color: #e5e7eb;
}
.life-coach-phrase-zh {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  color: #4b5563;
}
.dark .life-coach-phrase-zh {
  color: #9ca3af;
}
.life-coach-phrase-note {
  margin: 0.1rem 0 0;
  font-size: 0.68rem;
  color: #6b7280;
}
.dark .life-coach-phrase-note {
  color: #9ca3af;
}
.life-coach-compare-wrap.hidden {
  display: none !important;
}
.life-coach-compare {
  display: flex;
  align-items: stretch;
  gap: 0.55rem;
  width: 100%;
}
.life-coach-compare-col {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.4rem 0.45rem;
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.4);
}
/* Room for furigana above kanji in 原句／建議 */
.life-coach-compare-col > .font-jp {
  line-height: 1.9;
}
.dark .life-coach-compare-col {
  background: rgba(0, 0, 0, 0.2);
}
.life-coach-compare-col--suggest {
  background: rgba(201, 168, 124, 0.16);
}
.dark .life-coach-compare-col--suggest {
  background: rgba(201, 168, 124, 0.12);
}
.life-coach-compare-arrow {
  flex: 0 0 auto;
  align-self: center;
  font-size: 1rem;
  font-weight: 600;
  color: #8a6a3e;
  line-height: 1;
  padding: 0 0.1rem;
}
.dark .life-coach-compare-arrow {
  color: #e8d5b5;
}
.life-coach-line-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.life-coach-line-suggest-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.4rem 0.45rem;
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.35);
}
.dark .life-coach-line-suggest-row {
  background: rgba(0, 0, 0, 0.18);
}
.life-coach-line-suggest-row .life-coach-compare {
  gap: 0.4rem;
}
.life-coach-line-suggest-note {
  margin: 0;
  font-size: 0.68rem;
  color: #6b7280;
  line-height: 1.4;
}
.dark .life-coach-line-suggest-note {
  color: #9ca3af;
}
.life-log-edit-btn {
  flex-shrink: 0;
  margin-left: auto;
  padding: 0.12rem 0.4rem;
  font-size: 0.65rem;
  line-height: 1.2;
  border-radius: 0.4rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.45);
  color: #64748b;
  cursor: pointer;
}
.life-log-edit-btn:hover {
  background: rgba(255, 255, 255, 0.7);
  color: #334155;
}
.dark .life-log-edit-btn {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.18);
  color: #94a3b8;
}
.life-log-item.is-editing {
  cursor: default;
}
.life-log-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.25rem;
}
.life-log-edit-input {
  width: 100%;
  min-height: 2.4rem;
  padding: 0.4rem 0.5rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(255, 255, 255, 0.85);
  color: #1f2937;
  font-size: 0.9rem;
  line-height: 1.45;
  resize: vertical;
}
.dark .life-log-edit-input {
  background: rgba(15, 20, 28, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
  color: #e5e7eb;
}
.life-log-edit-actions {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
}
.life-log-edit-actions button {
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
}
.dark .life-log-edit-actions button {
  background: rgba(0, 0, 0, 0.28);
  border-color: rgba(255, 255, 255, 0.18);
  color: #e5e7eb;
}
.life-log-edit-actions .life-log-edit-save {
  border-color: rgba(201, 168, 124, 0.55);
  background: rgba(201, 168, 124, 0.22);
  color: #8a6a3e;
}
@media (max-width: 559px) {
  .life-coach-compare {
    flex-direction: column;
    gap: 0.3rem;
  }
  .life-coach-compare-arrow {
    align-self: center;
    transform: rotate(90deg);
    padding: 0.1rem 0;
  }
}
.life-coach-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.45rem 0.4rem;
  margin: 0 -0.15rem;
  border-radius: 0.75rem;
  background: rgba(148, 163, 184, 0.1);
  -webkit-overflow-scrolling: touch;
}
.dark .life-coach-panel-body {
  background: rgba(15, 23, 42, 0.28);
}
.life-coach-block {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.45);
  box-sizing: border-box;
}
.dark .life-coach-block {
  background: rgba(0, 0, 0, 0.22);
}
.life-coach-block.hidden {
  display: none;
}
.life-coach-block-label {
  font-size: 0.65rem;
  color: #6b7280;
  margin: 0 0 0.15rem;
}
.dark .life-coach-block-label {
  color: #9ca3af;
}
.life-coach-eval {
  font-size: 0.75rem;
  color: #6b7280;
  margin: 0;
  line-height: 1.5;
}
.dark .life-coach-eval {
  color: #9ca3af;
}
@media (max-width: 959px) {
  .life-side-top {
    min-height: 240px;
    max-height: min(48vh, 420px);
  }
  .life-coach-panel:not(.life-coach-popover-card) {
    min-height: 240px;
    max-height: min(50vh, 480px);
  }
}
@media (max-width: 768px) {
  .life-stage {
    aspect-ratio: 16 / 10;
    min-height: 200px;
    max-height: 42vh;
  }
  .life-dialogue {
    max-height: 6.5rem;
  }
  .life-side-top {
    min-height: 200px;
    max-height: min(40vh, 360px);
  }
  .life-coach-panel:not(.life-coach-popover-card) {
    min-height: 220px;
    max-height: min(45vh, 420px);
  }
}

/* ============================================================
   個人手帳（Notebook）
   ============================================================ */
.view-header-actions { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 清單畫面 */
.nb-home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.nb-page-card {
  padding: 16px;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease;
  display: flex;
  flex-direction: column;
  min-height: 120px;
}
.nb-page-card:hover { transform: translateY(-3px); box-shadow: var(--card-hover-shadow); }
.nb-page-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.nb-page-menu-btn {
  width: 30px; height: 30px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #94a3b8; transition: background .15s;
}
.nb-page-menu-btn:hover { background: rgba(148,163,184,.18); }
.nb-page-card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; line-height: 1.35; }
.nb-page-card-meta { font-size: .75rem; color: #94a3b8; margin-top: auto; }

/* 頂欄 */
.nb-page-topbar { align-items: center; }
.nb-page-topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nb-page-title { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-back-btn {
  width: 38px; height: 38px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nb-page-actions { display: inline-flex; align-items: center; gap: 8px; }
.nb-done-btn { background: linear-gradient(135deg, #6366F1, #8B5CF6); color: #fff; border: none; }
.nb-done-btn:hover { filter: brightness(1.08); }
.nb-col-switch { display: inline-flex; padding: 3px; gap: 2px; }
.nb-col-btn {
  width: 30px; height: 30px; border-radius: 8px; font-size: .85rem; font-weight: 600;
  color: #64748b; transition: all .15s;
}
.nb-col-btn.active { background: rgba(99,102,241,.16); color: #6366F1; }
.nb-edit-tip { font-size: .8rem; color: #94a3b8; }

/* Grid */
.nb-grid { display: grid; gap: 16px; align-items: start; }

/* 區塊 */
.nb-block {
  position: relative;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
}
.nb-block-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(148,163,184,.16);
  cursor: default;
}
.nb-block-head:not(.nb-block-head-edit) { cursor: pointer; }
.nb-block-icon { font-size: .95rem; flex-shrink: 0; }
.nb-block-title { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.nb-badge {
  font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: 999px;
  background: rgba(99,102,241,.14); color: #6366F1; flex-shrink: 0;
}
.nb-expand-btn { color: #94a3b8; width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0; }
.nb-expand-btn:hover { background: rgba(148,163,184,.16); }

.nb-body { padding: 12px 14px; overflow-y: auto; }
.nb-body.nb-clip { position: relative; }
.nb-empty-hint { color: #94a3b8; font-size: .82rem; text-align: center; padding: 8px; }
.nb-feed-empty { padding: 24px 8px; }

/* 編輯工具 */
.nb-handle {
  cursor: grab; touch-action: none;
  width: 28px; height: 28px; border-radius: 8px; color: #94a3b8; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.nb-handle:active { cursor: grabbing; }
.nb-block-tools { display: inline-flex; align-items: center; gap: 2px; flex-shrink: 0; }
.nb-block-tools button {
  width: 26px; height: 26px; border-radius: 7px; color: #64748b; font-size: .78rem;
  display: inline-flex; align-items: center; justify-content: center; transition: background .15s;
}
.nb-block-tools button:hover { background: rgba(148,163,184,.18); }
.nb-block-tools .nb-block-del:hover { background: rgba(225,29,72,.16); color: #E11D48; }
.nb-resize {
  position: absolute; right: 4px; bottom: 4px;
  width: 24px; height: 24px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: #94a3b8; cursor: nwse-resize; touch-action: none;
  background: rgba(148,163,184,.12);
}
.nb-resize:hover { color: #6366F1; background: rgba(99,102,241,.16); }

/* 編輯模式：jiggle + 格線 */
.nb-grid.nb-edit { background-image: radial-gradient(rgba(148,163,184,.18) 1px, transparent 1px); background-size: 22px 22px; border-radius: 16px; padding: 8px; }
.nb-grid.nb-edit .nb-block:not(.nb-libcard-block) { animation: nbJiggle 1.6s ease-in-out infinite; }
.nb-grid.nb-edit .nb-block:not(.nb-libcard-block):nth-child(even) { animation-delay: -.8s; }
.nb-block.nb-dragging { opacity: .45; animation: none !important; }
.nb-block.nb-resizing { animation: none !important; outline: 2px dashed rgba(99,102,241,.5); }
@keyframes nbJiggle {
  0%, 100% { transform: rotate(-.35deg); }
  50% { transform: rotate(.35deg); }
}
@media (prefers-reduced-motion: reduce) {
  .nb-grid.nb-edit .nb-block { animation: none; }
}

/* 文字 / 便箋 */
.nb-note { font-size: .9rem; line-height: 1.6; word-break: break-word; }
.nb-note h1, .nb-note h2, .nb-note h3 { font-family: 'Noto Serif JP', serif; margin: .4em 0 .3em; font-weight: 700; }
.nb-note h1 { font-size: 1.15rem; } .nb-note h2 { font-size: 1.05rem; } .nb-note h3 { font-size: .98rem; }
.nb-note ul, .nb-note ol { padding-left: 1.3em; margin: .3em 0; }
.nb-note code { background: rgba(148,163,184,.18); padding: 1px 5px; border-radius: 5px; font-size: .85em; }
.nb-note a { color: #6366F1; text-decoration: underline; }
.nb-note blockquote { border-left: 3px solid rgba(99,102,241,.4); padding-left: 10px; color: #64748b; margin: .4em 0; }
.nb-memo { display: flex; flex-direction: column; height: 100%; }
.nb-memo-text { font-size: 1rem; line-height: 1.55; font-weight: 500; }
.nb-text-edit-btn { align-self: flex-start; margin-top: 10px; font-size: .78rem; padding: 5px 10px; border-radius: 9px; }

/* 卡片列表 + 翻卡 */
.nb-card-list { display: flex; flex-direction: column; gap: 8px; }
.nb-card {
  perspective: 900px;
  cursor: pointer;
  min-height: 76px;
}
.nb-flip-inner {
  position: relative;
  width: 100%;
  min-height: 76px;
  transition: transform .5s;
  transform-style: preserve-3d;
}
.nb-card.flipped .nb-flip-inner { transform: rotateY(180deg); }
.nb-flip-front, .nb-flip-back {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,.5);
  border: 1px solid rgba(148,163,184,.2);
  display: flex; flex-direction: column; justify-content: center;
  overflow: auto;
}
.nb-flip-front { position: relative; }
.nb-flip-back { transform: rotateY(180deg); }
.dark .nb-flip-front, .dark .nb-flip-back { background: rgba(30,30,54,.55); border-color: rgba(0,245,255,.14); }
.nb-card-tag {
  position: absolute; top: 6px; right: 8px;
  font-size: .62rem; font-weight: 700; color: #6366F1;
  background: rgba(99,102,241,.14); padding: 0 6px; border-radius: 999px;
}
.nb-card-main { font-family: 'Noto Serif JP', serif; font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.nb-card-sub { font-size: .74rem; color: #94a3b8; margin-top: 3px; }
.nb-card-back-main { font-size: .86rem; line-height: 1.45; }
.nb-card-note { font-size: .74rem; color: #94a3b8; }

/* 釘選 */
.nb-pin-wrap { position: relative; }
.nb-pin-del {
  position: absolute; top: -4px; right: -4px; z-index: 3;
  width: 22px; height: 22px; border-radius: 999px;
  background: #E11D48; color: #fff; font-size: .7rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.nb-pin-note { font-size: .76rem; color: #64748b; margin-top: 4px; padding-left: 4px; }

/* 浮動選單 */
.nb-float-menu {
  position: fixed; z-index: 60; min-width: 150px;
  padding: 6px; border-radius: 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.nb-float-menu button {
  text-align: left; padding: 8px 10px; border-radius: 8px; font-size: .85rem; color: #334155;
}
.dark .nb-float-menu button { color: #cbd5e1; }
.nb-float-menu button:hover { background: rgba(99,102,241,.14); }
.nb-float-menu .nb-float-danger { color: #E11D48; }
.nb-float-menu .nb-float-danger:hover { background: rgba(225,29,72,.14); }

/* Modal 元件 */
.nb-modal-box { max-height: 88vh; display: flex; flex-direction: column; }
.nb-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.nb-modal-x { width: 32px; height: 32px; border-radius: 9px; color: #94a3b8; }
.nb-modal-x:hover { background: rgba(148,163,184,.18); }
.nb-modal-body { overflow-y: auto; flex: 1; }
.nb-modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.nb-modal-confirm { background: linear-gradient(135deg, #6366F1, #8B5CF6); color: #fff; border: none; }
.nb-modal-confirm:hover { filter: brightness(1.08); }
.nb-field-label { display: block; font-size: .78rem; font-weight: 600; color: #64748b; margin-bottom: 4px; }
.dark .nb-field-label { color: #94a3b8; }
.nb-input, .nb-textarea {
  width: 100%; padding: 8px 10px; border-radius: 10px;
  background: rgba(255,255,255,.6); border: 1px solid rgba(148,163,184,.3);
  font-size: .9rem; color: inherit;
}
.dark .nb-input, .dark .nb-textarea { background: rgba(30,30,54,.55); border-color: rgba(0,245,255,.16); }
.nb-textarea { resize: vertical; font-family: inherit; line-height: 1.5; }
.nb-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nb-check-row { display: flex; flex-wrap: wrap; gap: 12px; }
.nb-check { display: inline-flex; align-items: center; gap: 5px; font-size: .85rem; cursor: pointer; }
.nb-preview-count { margin-top: 14px; font-size: .8rem; color: #64748b; padding: 8px 10px; border-radius: 9px; background: rgba(99,102,241,.08); }
.nb-preview-count strong { color: #6366F1; }

/* 模板選擇 */
.nb-tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nb-tpl-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 12px; border-radius: 12px; text-align: left;
  background: rgba(255,255,255,.5); border: 1px solid rgba(148,163,184,.22);
  transition: all .15s;
}
.dark .nb-tpl-card { background: rgba(30,30,54,.5); border-color: rgba(0,245,255,.14); }
.nb-tpl-card:hover { border-color: #6366F1; transform: translateY(-2px); }
.nb-tpl-card > i { font-size: 1.15rem; color: #6366F1; }
.nb-tpl-label { font-weight: 700; font-size: .9rem; }
.nb-tpl-desc { font-size: .72rem; color: #94a3b8; }

/* icon / accent picker */
.nb-icon-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.nb-icon-pick {
  width: 40px; height: 40px; border-radius: 10px; font-size: 1rem; color: #64748b;
  background: rgba(148,163,184,.12); border: 2px solid transparent;
}
.nb-icon-pick.active { border-color: #6366F1; color: #6366F1; }
.nb-accent-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.nb-accent-pick { width: 30px; height: 30px; border-radius: 999px; border: 3px solid transparent; }
.nb-accent-pick.active { border-color: rgba(15,23,42,.55); box-shadow: 0 0 0 2px #fff inset; }
.dark .nb-accent-pick.active { border-color: #fff; }

/* segmented */
.nb-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: rgba(148,163,184,.14); }
.nb-seg-btn { padding: 5px 14px; border-radius: 8px; font-size: .82rem; color: #64748b; }
.nb-seg-btn.active { background: #fff; color: #6366F1; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.dark .nb-seg-btn.active { background: rgba(99,102,241,.3); color: #fff; }

/* pin 選頁 */
.nb-pin-page-list { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; }
.nb-pin-page-opt {
  width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; font-size: .9rem;
  background: rgba(255,255,255,.5); border: 1px solid rgba(148,163,184,.22); transition: all .15s;
}
.dark .nb-pin-page-opt { background: rgba(30,30,54,.5); border-color: rgba(0,245,255,.14); }
.nb-pin-page-opt:hover { border-color: #6366F1; }
.nb-pin-newpage { margin-top: 8px; }

.nb-libcard-block {
  position: relative;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  overflow: visible;
  /* 唔套 glass-card 外殼 */
}
.nb-libcard-block .nb-lib-flip {
  height: 100%;
  min-height: inherit;
  display: block;
}
.nb-libcard-block .nb-lib-flip .flip-card-inner {
  min-height: inherit;
  height: 100%;
}
/* 編輯時浮層控制，唔加外框線 */
.nb-libcard-chrome {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}
.nb-libcard-chrome > * { pointer-events: auto; }
.nb-libcard-chrome-spacer { flex: 1; }
.nb-libcard-chrome button {
  width: 28px; height: 28px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.55); color: #fff; font-size: .75rem;
  backdrop-filter: blur(6px);
}
.nb-libcard-chrome button:hover { background: rgba(99, 102, 241, 0.85); }
.nb-libcard-chrome .nb-block-del:hover { background: rgba(225, 29, 72, 0.9); }
.nb-libcard-block .nb-resize {
  z-index: 6;
  background: rgba(15, 23, 42, 0.55); color: #fff;
}
.nb-grid.nb-edit .nb-libcard-block {
  outline: none;
  animation: none; /* 翻轉卡唔 jiggle，避免同翻卡動畫衝突 */
}

/* 項目挑選器 */
.nb-pick-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.nb-pick-filter { flex: 1; min-width: 120px; }
.nb-pick-list {
  max-height: min(50vh, 360px); overflow-y: auto; margin-top: 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.nb-pick-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 10px; row-gap: 2px;
  align-items: center;
  padding: 8px 10px; border-radius: 10px;
  background: rgba(255,255,255,.45); border: 1px solid rgba(148,163,184,.18);
  cursor: pointer; font-size: .85rem;
}
.dark .nb-pick-row { background: rgba(30,30,54,.45); border-color: rgba(0,245,255,.12); }
.nb-pick-row:hover { border-color: rgba(99,102,241,.45); }
.nb-pick-row input { grid-row: 1 / span 2; }
.nb-pick-main { grid-column: 2; font-weight: 600; line-height: 1.3; }
.nb-pick-sub { grid-column: 2; font-size: .72rem; color: #94a3b8; }
.nb-pick-row .nb-card-tag { grid-column: 3; grid-row: 1 / span 2; }

/* 手機：單欄 */
@media (max-width: 640px) {
  .nb-grid { grid-template-columns: 1fr !important; }
  .nb-block { grid-column: span 1 !important; }
  .nb-two-col { grid-template-columns: 1fr; }
  .nb-tpl-grid { grid-template-columns: 1fr; }
}

/* 加入手帳按鈕（各模組共用） */
.nb-pin-trigger { color: #94a3b8; transition: color .15s; }
.nb-pin-trigger:hover { color: #8B5CF6; }
