
  :root {
    --bg: #060608;
    --surface: #101014;
    --surface2: #17171d;
    --border: #2a2a33;
    --accent: #b8c6ff;
    --accent2: #9a7cff;
    --accent3: #6d78ff;
    --text: #f1f1f4;
    --muted: #8b8b98;
    --correct: #00ff9d;
    --wrong: #ff4757;
    --warn: #ffd32a;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  /* Japanese character rendering */
  .kana, .kanji-char, .jp-text { font-family: 'Noto Sans JP', 'Syne', sans-serif; }
  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Syne', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
  }

  /* GRID BG */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: 
      linear-gradient(rgba(180,190,255,0.025) 1px, transparent 1px),
      linear-gradient(90deg, rgba(180,190,255,0.025) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
  }

  /* #app overridden by sidebar layout below */ #app { position: relative; z-index: 1; }

  /* HEADER — overridden by sidebar breadcrumb header below */
  .header { display: flex; align-items: center; }
  .logo {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--accent);
    letter-spacing: 3px;
    text-transform: uppercase;
    padding: 6px 10px;
    border: 1px solid var(--accent);
    border-radius: 4px;
    white-space: nowrap;
  }
  .header h1 {
    font-size: clamp(18px, 4vw, 26px);
    font-weight: 800;
    letter-spacing: -0.5px;
  }
  .header h1 span { color: var(--accent); }
  .progress-bar-wrap { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
  .score-pill {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--accent);
    background: rgba(0,255,157,0.08);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(0,255,157,0.2);
  }

  /* NAV TABS */
  .tabs {
    display: flex; gap: 4px;
    flex-wrap: nowrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 24px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    flex: 1 1 0; min-width: 0; padding: 10px 8px;
    background: transparent;
    border: none; border-radius: 7px;
    color: var(--muted);
    font-family: 'Syne', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.3px;
    white-space: nowrap;
  }
  .tab:hover { color: var(--text); }
  .tab.active {
    background: var(--surface2);
    color: var(--accent);
    border: 1px solid var(--border);
  }

  /* UNIT FILTER */
  .unit-bar {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-bottom: 20px;
  }
  .unit-btn {
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
  }
  .unit-btn:hover { border-color: var(--accent3); color: var(--text); }
  .unit-btn.active { background: rgba(123,97,255,0.15); border-color: var(--accent3); color: var(--accent3); }

  /* CARD */
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px;
    margin-bottom: 16px;
    animation: slideIn 0.3s ease;
    position: relative;
    overflow: hidden;
  }
  .card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent3), var(--accent));
    opacity: 0;
    transition: opacity 0.3s;
  }
  .card.active-card::before { opacity: 1; }

  @keyframes slideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .q-meta {
    display: flex; gap: 8px; align-items: center;
    margin-bottom: 16px;
  }
  .unit-tag {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(123,97,255,0.15);
    color: var(--accent3);
    border: 1px solid rgba(123,97,255,0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
  }
  .diff-tag {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
  }
  .diff-tag.hard { background: rgba(255,71,87,0.12); color: var(--wrong); border: 1px solid rgba(255,71,87,0.25); }
  .diff-tag.medium { background: rgba(255,211,42,0.12); color: var(--warn); border: 1px solid rgba(255,211,42,0.25); }
  .diff-tag.easy { background: rgba(0,255,157,0.1); color: var(--correct); border: 1px solid rgba(0,255,157,0.2); }

  .question-text {
    font-size: clamp(15px, 3vw, 18px);
    font-weight: 600;
    line-height: 1.55;
    margin-bottom: 22px;
    color: var(--text);
  }

  /* MCQ WRAPPER - fixed min-height so reveal doesn't cause scroll jump */
  #mcqMode { display: flex; flex-direction: column; }
  #mcqCardWrap { flex: 1; }
  #mcqCardWrap .card {
    min-height: calc(100vh - 300px);
    display: flex;
    flex-direction: column;
  }
  #mcqCardWrap .options { flex: 1; }
  #mcqCardWrap .explanation {
    margin-top: auto;
    padding-top: 16px;
  }

  /* MCQ OPTIONS */
  .options { display: flex; flex-direction: column; gap: 8px; }
  .option {
    padding: 13px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    display: flex; gap: 12px; align-items: flex-start;
    text-align: left;
  }
  .option:hover:not(.locked) { border-color: var(--accent3); background: rgba(123,97,255,0.08); }
  .option .opt-letter {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--muted);
    min-width: 16px;
    margin-top: 1px;
  }
  .option.correct {
    border-color: var(--correct);
    background: rgba(0,200,100,0.18);
    color: #e8fff4;
  }
  .option.correct * {
    color: #e8fff4 !important;
  }
  .option.correct .opt-letter {
    color: #00ff9d !important;
  }
  .option.wrong {
    border-color: var(--wrong);
    background: rgba(255,71,87,0.18);
    color: #fff0f2;
  }
  .option.wrong * {
    color: #fff0f2 !important;
  }
  .option.wrong .opt-letter { color: #ff7080 !important; }
  .option.locked { cursor: default; }
  .option.dim { opacity: 0.4; }

  /* EXPLANATION */
  .explanation {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 8px;
    background: var(--surface2);
    border-left: 3px solid var(--accent);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    display: none;
  }
  .explanation.show { display: block; animation: fadeIn 0.3s ease; }
  .explanation strong { color: var(--accent); }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

  /* FLASHCARD */
  .flashcard-wrap { perspective: 1000px; cursor: pointer; }
  .flashcard {
    width: 100%;
    min-height: 200px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.4,0,0.2,1);
    border-radius: 14px;
  }
  .flashcard.flipped { transform: rotateY(180deg); }
  .fc-front, .fc-back {
    position: absolute; inset: 0;
    backface-visibility: hidden;
    border-radius: 14px;
    padding: 32px 28px;
    display: flex; flex-direction: column;
    justify-content: center;
    border: 1px solid var(--border);
  }
  .fc-front {
    background: var(--surface);
    border-color: var(--border);
  }
  .fc-back {
    background: linear-gradient(135deg, rgba(0,255,157,0.05), rgba(123,97,255,0.05));
    border-color: rgba(0,255,157,0.3);
    transform: rotateY(180deg);
  }
  .fc-hint {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 16px;
  }
  .fc-front .fc-hint { color: var(--accent3); }
  .fc-back .fc-hint { color: var(--accent); }
  .fc-text {
    font-size: clamp(15px, 3vw, 18px);
    font-weight: 600;
    line-height: 1.55;
  }
  .fc-back .fc-text { font-size: clamp(13px, 2.5vw, 15px); font-weight: 500; color: var(--text); line-height: 1.7; }

  /* SELF RATE */
  .self-rate {
    display: none; gap: 8px; margin-top: 16px;
  }
  .self-rate.show { display: flex; animation: fadeIn 0.3s ease; }
  .rate-btn {
    flex: 1; padding: 10px 8px;
    border-radius: 8px; border: 1px solid;
    font-family: 'Syne', sans-serif;
    font-size: 13px; font-weight: 700;
    cursor: pointer; transition: all 0.15s;
  }
  .rate-btn.got-it { border-color: var(--correct); color: var(--correct); background: rgba(0,255,157,0.08); }
  .rate-btn.got-it:hover { background: rgba(0,255,157,0.18); }
  .rate-btn.missed { border-color: var(--wrong); color: var(--wrong); background: rgba(255,71,87,0.08); }
  .rate-btn.missed:hover { background: rgba(255,71,87,0.18); }

  /* FRQ */
  .frq-prompt {
    font-size: 15px; font-weight: 600; line-height: 1.6;
    margin-bottom: 20px;
  }
  .frq-sub {
    font-size: 13px; color: var(--muted);
    margin-bottom: 16px;
    font-family: 'Space Mono', monospace;
  }
  .frq-part {
    margin-bottom: 20px;
    padding: 16px;
    border-radius: 8px;
    background: var(--surface2);
    border: 1px solid var(--border);
  }
  .frq-part-label {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--accent2);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
  }
  .frq-part-q { font-size: 14px; font-weight: 600; margin-bottom: 10px; line-height: 1.5; }
  .frq-part-points {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 10px;
  }
  textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: 'Syne', sans-serif;
    font-size: 13px;
    padding: 10px 12px;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s;
    line-height: 1.5;
  }
  textarea:focus { outline: none; border-color: var(--accent3); }
  .frq-model-answer {
    display: none;
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 6px;
    background: rgba(0,255,157,0.06);
    border: 1px solid rgba(0,255,157,0.2);
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
  }
  .frq-model-answer.show { display: block; animation: fadeIn 0.3s ease; }
  .frq-model-answer strong { color: var(--accent); display: block; margin-bottom: 6px; font-family: 'Space Mono', monospace; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }

  /* BUTTONS */
  .btn {
    padding: 11px 20px;
    border-radius: 8px;
    border: 1px solid;
    font-family: 'Syne', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.3px;
  }
  .btn-primary {
    background: rgba(0,255,157,0.1);
    border-color: var(--accent);
    color: var(--accent);
  }
  .btn-primary:hover { background: rgba(0,255,157,0.2); }
  .btn-secondary {
    background: var(--surface2);
    border-color: var(--border);
    color: var(--text);
  }
  .btn-secondary:hover { border-color: var(--muted); }
  .btn-orange {
    background: rgba(255,107,53,0.1);
    border-color: var(--accent2);
    color: var(--accent2);
  }
  .btn-orange:hover { background: rgba(255,107,53,0.2); }

  .btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

  /* STATS BAR */
  .stats-bar {
    display: flex; gap: 16px; flex-wrap: wrap;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 20px;
  }
  .stat { display: flex; flex-direction: column; gap: 2px; }
  .stat-val { font-family: 'Space Mono', monospace; font-size: 20px; font-weight: 700; }
  .stat-val.green { color: var(--correct); }
  .stat-val.red { color: var(--wrong); }
  .stat-val.purple { color: var(--accent3); }
  .stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

  /* HIDDEN */
  .hidden { display: none !important; }

  /* PROGRESS DOT ROW */
  .dot-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; }
  .dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--border);
    transition: background 0.2s;
  }
  .dot.current { background: var(--accent3); box-shadow: 0 0 6px var(--accent3); }
  .dot.correct { background: var(--correct); }
  .dot.wrong { background: var(--wrong); }

  /* SECTION LABEL */
  .section-label {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--muted);
    margin-bottom: 14px;
  }


  /* ──────────────────────────────────────────────────────────
     MASCOT SYSTEM - Moods, Aura, Blush, Zoom-in, Peek
  ────────────────────────────────────────────────────────── */

  /* Base mascot image */
  .mascot {
    position: fixed;
    right: 20px;
    bottom: 76px;
    width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 0 30px rgba(0,0,0,0.45);
    z-index: 99;
    cursor: pointer;
    pointer-events: all;
    opacity: 0.93;
  }

  /* ── Float animations ── */
  .mascot-float-gentle  { animation: mscFloat 4s ease-in-out infinite; }
  .mascot-float-bouncy  { animation: mscBounce 1.4s cubic-bezier(0.36,0.07,0.19,0.97) infinite; }
  .mascot-float-spin    { animation: mscSpin 8s linear infinite, mscFloat 4s ease-in-out infinite; }
  .mascot-float-none    { animation: none; }

  @keyframes mscFloat {
    0%,100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
  }
  @keyframes mscBounce {
    0%,100% { transform: translateY(0) scaleY(1); }
    40%     { transform: translateY(-14px) scaleY(1.04); }
    70%     { transform: translateY(-4px) scaleY(0.97); }
    85%     { transform: translateY(-8px) scaleY(1.02); }
  }
  @keyframes mscSpin {
    0%   { filter: hue-rotate(0deg) drop-shadow(0 0 18px rgba(120,130,255,0.3)); }
    100% { filter: hue-rotate(360deg) drop-shadow(0 0 18px rgba(120,130,255,0.3)); }
  }

  /* ── Mood reactions ── */
  .mascot-react-correct {
    animation: mscCorrect 0.55s cubic-bezier(0.34,1.56,0.64,1) forwards !important;
  }
  @keyframes mscCorrect {
    0%   { transform: scale(1) rotate(0deg); }
    30%  { transform: scale(1.18) rotate(-6deg); }
    60%  { transform: scale(1.14) rotate(5deg); }
    80%  { transform: scale(1.12) rotate(-3deg); }
    100% { transform: scale(1) rotate(0deg); }
  }
  .mascot-react-wrong {
    animation: mscWrong 0.5s ease forwards !important;
  }
  @keyframes mscWrong {
    0%,100% { transform: translateX(0) rotate(0); }
    15%  { transform: translateX(-5px) rotate(-3deg); }
    35%  { transform: translateX(5px) rotate(3deg); }
    55%  { transform: translateX(-4px) rotate(-2deg); }
    75%  { transform: translateX(4px) rotate(2deg); }
    90%  { transform: translateX(-2px) rotate(-1deg); }
  }
  .mascot-react-thinking {
    animation: mscThink 0.7s ease forwards !important;
  }
  @keyframes mscThink {
    0%   { transform: scale(1) rotate(0deg); }
    25%  { transform: scale(1.04) rotate(-4deg); }
    50%  { transform: scale(1.04) rotate(4deg); }
    75%  { transform: scale(1.03) rotate(-2deg); }
    100% { transform: scale(1) rotate(0deg); }
  }
  .mascot-react-embarrassed {
    animation: mscEmbarrassed 0.6s ease forwards !important;
  }
  @keyframes mscEmbarrassed {
    0%,100% { transform: scale(1) rotate(0); }
    20%  { transform: scale(0.93) rotate(-5deg); }
    50%  { transform: scale(0.96) rotate(3deg); }
    80%  { transform: scale(0.95) rotate(-2deg); }
  }
  .mascot-react-excited {
    animation: mscExcited 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards !important;
  }
  @keyframes mscExcited {
    0%   { transform: scale(1) translateY(0); }
    25%  { transform: scale(1.22) translateY(-12px) rotate(5deg); }
    50%  { transform: scale(1.18) translateY(-8px) rotate(-4deg); }
    75%  { transform: scale(1.2) translateY(-10px) rotate(3deg); }
    100% { transform: scale(1) translateY(0) rotate(0); }
  }
  .mascot-react-panic {
    animation: mscPanic 0.4s ease forwards !important;
  }
  @keyframes mscPanic {
    0%,100% { transform: translateX(0) scaleX(1); }
    10%  { transform: translateX(-6px) scaleX(0.95); }
    20%  { transform: translateX(6px) scaleX(0.95); }
    30%  { transform: translateX(-5px) scaleX(0.97); }
    40%  { transform: translateX(5px) scaleX(0.97); }
    50%  { transform: translateX(-4px); }
    60%  { transform: translateX(4px); }
    70%  { transform: translateX(-3px); }
    80%  { transform: translateX(3px); }
    90%  { transform: translateX(-1px); }
  }

  /* ── Aura glow layer (sits behind mascot) ── */
  #mascotAuraRing {
    position: fixed;
    pointer-events: none;
    z-index: 97;
    border-radius: inherit;
    transition:
      background 0.7s ease,
      box-shadow 0.7s ease,
      opacity 0.5s ease;
    opacity: 0;
    animation: auraBreath 3s ease-in-out infinite;
  }
  @keyframes auraBreath {
    0%,100% { opacity: 0.55; }
    50%     { opacity: 0.85; }
  }

  /* ── Blush overlay ── */
  #mascotBlushOverlay {
    position: fixed;
    pointer-events: none;
    z-index: 101;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: rgba(255,140,180,0.88);
    letter-spacing: 1px;
    text-align: center;
    text-shadow: 0 0 8px rgba(255,100,150,0.5);
    opacity: 0;
    transition: opacity 0.4s ease;
    line-height: 1;
  }
  #mascotBlushOverlay.show { opacity: 1; }

  /* ── Mood badge ── */
  #mascotMoodBadge {
    position: fixed;
    pointer-events: none;
    z-index: 102;
    font-size: 16px;
    filter: drop-shadow(0 1px 5px rgba(0,0,0,0.7));
    transition:
      left 0.55s cubic-bezier(0.22,1,0.36,1),
      right 0.55s cubic-bezier(0.22,1,0.36,1),
      top 0.55s cubic-bezier(0.22,1,0.36,1),
      bottom 0.55s cubic-bezier(0.22,1,0.36,1);
    animation: badgeBob 2.5s ease-in-out infinite;
  }
  @keyframes badgeBob {
    0%,100% { transform: scale(1) rotate(0deg); }
    50%     { transform: scale(1.1) rotate(8deg); }
  }

  /* ── ZOOM-IN cinematic overlay ── */
  #mascotZoomOverlay {
    position: fixed;
    inset: 0;
    z-index: 9500;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    opacity: 0;
    transition: opacity 0.35s ease;
    background: rgba(0,0,0,0);
  }
  #mascotZoomOverlay.active {
    opacity: 1;
    pointer-events: all;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(3px);
  }
  #mascotZoomImg {
    width: 260px;
    height: 260px;
    object-fit: cover;
    border-radius: 20px;
    border: 2px solid rgba(255,255,255,0.12);
    box-shadow: 0 0 80px rgba(120,130,255,0.4), 0 20px 60px rgba(0,0,0,0.6);
    transform: scale(0.5) translateY(60px);
    transition: transform 0.55s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.55s ease;
    cursor: pointer;
  }
  #mascotZoomOverlay.active #mascotZoomImg {
    transform: scale(1) translateY(0);
  }
  #mascotZoomBubble {
    max-width: 320px;
    padding: 14px 20px;
    background: rgba(10,10,16,0.96);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    text-align: center;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.4s 0.25s ease, opacity 0.4s 0.25s ease;
    font-style: italic;
  }
  #mascotZoomOverlay.active #mascotZoomBubble {
    transform: translateY(0);
    opacity: 1;
  }
  #mascotZoomMoodAura {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transition: background 0.5s ease;
    border-radius: 20px;
  }

  /* SLAYR MASCOT FREAK-OUT */
  @keyframes mscSlayrShake {
    0%   { transform: translateX(0) translateY(0) rotate(0deg) scale(1); }
    5%   { transform: translateX(-8px) translateY(-4px) rotate(-6deg) scale(1.05); }
    10%  { transform: translateX(8px) translateY(-6px) rotate(6deg) scale(1.08); }
    15%  { transform: translateX(-10px) translateY(-2px) rotate(-8deg) scale(1.1); }
    20%  { transform: translateX(10px) translateY(-8px) rotate(8deg) scale(1.12); }
    25%  { transform: translateX(-12px) translateY(-4px) rotate(-10deg) scale(1.15); }
    30%  { transform: translateX(12px) translateY(-10px) rotate(10deg) scale(1.15); }
    35%  { transform: translateX(-14px) translateY(-6px) rotate(-12deg) scale(1.18); }
    40%  { transform: translateX(14px) translateY(-12px) rotate(12deg) scale(1.2); }
    45%  { transform: translateX(-8px) translateY(-8px) rotate(-8deg) scale(1.2); }
    50%  { transform: translateX(8px) translateY(-4px) rotate(8deg) scale(1.18); }
    55%  { transform: translateX(-4px) translateY(-2px) rotate(-4deg) scale(1.1); }
    60%  { transform: translateX(4px) translateY(0px) rotate(4deg) scale(1.05); }
    65%  { transform: translateX(0) rotate(0deg) scale(1.02); }
    100% { transform: translateX(0) rotate(0deg) scale(1); }
  }
  @keyframes mscSlayrFall {
    0%   { transform: translateX(0) translateY(0) rotate(0deg) scale(1); opacity: 1; }
    20%  { transform: translateX(-6px) translateY(-10px) rotate(-15deg) scale(1.1); }
    40%  { transform: translateX(4px) translateY(-5px) rotate(10deg) scale(1.05); }
    55%  { transform: translateX(0) translateY(-2px) rotate(-5deg) scale(1.02); }
    65%  { transform: translateX(0) translateY(0) rotate(0deg) scale(1); }
    70%  { transform: translateX(0) translateY(0) rotate(0deg) scale(1); }
    75%  { transform: translateX(0) translateY(20px) rotate(25deg) scale(0.9); }
    82%  { transform: translateX(20px) translateY(60px) rotate(45deg) scale(0.75); opacity: 0.7; }
    90%  { transform: translateX(40px) translateY(120px) rotate(80deg) scale(0.5); opacity: 0.3; }
    100% { transform: translateX(60px) translateY(180px) rotate(110deg) scale(0.3); opacity: 0; }
  }
  @keyframes mscSlayrExplode {
    0%   { transform: scale(1) rotate(0deg); opacity: 1; filter: brightness(1); }
    10%  { transform: scale(1.2) rotate(-5deg); filter: brightness(1.5); }
    20%  { transform: scale(1.4) rotate(5deg); filter: brightness(2) saturate(2); }
    30%  { transform: scale(1.6) rotate(-8deg); filter: brightness(3) hue-rotate(30deg); }
    40%  { transform: scale(1.8) rotate(10deg); filter: brightness(4) hue-rotate(60deg) saturate(3); }
    50%  { transform: scale(2.2) rotate(-5deg); filter: brightness(5) hue-rotate(120deg) saturate(4); opacity: 0.9; }
    60%  { transform: scale(2.5) rotate(0deg); filter: brightness(6) hue-rotate(180deg); opacity: 0.7; }
    70%  { transform: scale(2.0) rotate(5deg); filter: brightness(4) hue-rotate(240deg); opacity: 0.5; }
    80%  { transform: scale(1.5) rotate(-5deg); filter: brightness(2); opacity: 0.3; }
    90%  { transform: scale(1.1) rotate(0deg); filter: brightness(1); opacity: 0.1; }
    100% { transform: scale(1) rotate(0deg); filter: brightness(1); opacity: 0; }
  }
  .mascot-slayr-shake  { animation: mscSlayrShake 1.6s ease forwards !important; }
  .mascot-slayr-fall   { animation: mscSlayrFall 1.8s cubic-bezier(0.4,0,1,1) forwards !important; }
  .mascot-slayr-explode { animation: mscSlayrExplode 1.4s ease-out forwards !important; }

  /* SLAYR freak-out speech bubble */
  #slayrFreakBubble {
    position: fixed;
    z-index: 10000;
    background: rgba(6,6,10,0.97);
    border: 1px solid rgba(255,100,100,0.5);
    border-radius: 14px;
    padding: 10px 16px;
    font-size: 13px;
    font-family: 'Space Mono', monospace;
    color: #fff;
    text-align: center;
    box-shadow: 0 0 20px rgba(255,60,60,0.4);
    pointer-events: none;
    opacity: 0;
    transform: scale(0.8) translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
    max-width: 220px;
    line-height: 1.5;
  }
  #slayrFreakBubble.show {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  .mascot-peeking {
    animation: mscPeek 2.2s cubic-bezier(0.34,1.56,0.64,1) forwards !important;
  }
  @keyframes mscPeek {
    0%   { transform: translateX(140px) rotate(15deg); }
    20%  { transform: translateX(-20px) rotate(-5deg); }
    40%  { transform: translateX(0px) rotate(2deg); }
    60%  { transform: translateX(0px) rotate(-2deg); }
    80%  { transform: translateX(10px) rotate(5deg); }
    100% { transform: translateX(160px) rotate(18deg); }
  }

  /* ── Mascot bubble enhancement ── */
  .mascot-bubble {
    position: fixed;
    max-width: 240px;
    padding: 11px 15px;
    background: rgba(10,10,16,0.97);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    font-size: 12px;
    line-height: 1.6;
    z-index: 120;
    box-shadow: 0 6px 24px rgba(0,0,0,0.45);
    opacity: 0;
    transform: translateY(8px) scale(0.97);
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.34,1.56,0.64,1);
    pointer-events: none;
  }
  .mascot-bubble.show {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  .mascot-bubble .bubble-mood-stripe {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 14px 14px 0 0;
    transition: background 0.4s ease;
  }

  /* ── mascot config buttons ── */
  .mcfg-btn {
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
  }
  .mcfg-btn:hover { border-color: var(--accent3); color: var(--text); }
  .mcfg-btn.active { background: rgba(123,97,255,0.18); border-color: var(--accent3); color: var(--accent3); }

  /* ── Border style variants ── */
  .mascot-border-rounded { border-radius: 14px !important; border: 1px solid var(--border) !important; }
  .mascot-border-circle  { border-radius: 50% !important;  border: 1px solid var(--border) !important; }
  .mascot-border-sharp   { border-radius: 4px !important;  border: 1px solid var(--border) !important; }
  .mascot-border-none    { border-radius: 14px !important; border: none !important; box-shadow: none !important; }

  /* ── BG style variants ── */
  .mascot-bg-dark  { background: rgba(8,8,12,0.88) !important; }
  .mascot-bg-frost { backdrop-filter: blur(16px) !important; background: rgba(16,16,24,0.6) !important; }
  .mascot-bg-bubble{ background: linear-gradient(135deg, rgba(30,20,50,0.85), rgba(10,10,20,0.92)) !important; }
  .mascot-bg-glow  { background: rgba(6,6,10,0.9) !important; }
  .mascot-bg-none  { background: transparent !important; }

  /* ── Upload button ── */
  .mascot-area {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 100;
  }
  .mascot-upload-btn { backdrop-filter: blur(8px); }

  /* Mascot transition properties */
  .mascot {
    transition:
      width  0.4s cubic-bezier(0.34,1.56,0.64,1),
      height 0.4s cubic-bezier(0.34,1.56,0.64,1),
      border-radius 0.3s ease,
      filter 0.4s ease,
      opacity 0.35s ease,
      left   0.55s cubic-bezier(0.22,1,0.36,1),
      right  0.55s cubic-bezier(0.22,1,0.36,1),
      top    0.55s cubic-bezier(0.22,1,0.36,1),
      bottom 0.55s cubic-bezier(0.22,1,0.36,1);
  }

  @media (max-width: 700px) {
    .mascot { width: 90px !important; height: 90px !important; right: 12px !important; bottom: 60px !important; }
    .mascot-area { right: 12px; bottom: 12px; }
    .mascot-bubble { max-width: 160px; font-size: 11px; }
    .mascot-upload-btn { display: none; }
    #mascotImg { width: 72px !important; height: 72px !important; right: 8px !important; bottom: 52px !important; left: auto !important; top: auto !important; opacity: 0.85; }
    #mascotBubble { max-width: 180px !important; font-size: 11px !important; right: 88px !important; left: auto !important; bottom: 16px !important; top: auto !important; }
    #mascotZoomImg { width: 180px; height: 180px; }
    #mascotZoomBubble { max-width: 280px; font-size: 12px; }
  }



  /* NOIR UX ENHANCEMENTS */
  .card {
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.35);
  }

  .question-text,
  .fc-front .fc-text,
  .frq-part-q {
    letter-spacing: 0.15px;
  }

  .option {
    line-height: 1.55;
  }

  .option:hover:not(.locked) {
    transform: translateX(2px);
  }

  textarea {
    line-height: 1.7;
  }

  .header h1 {
    text-shadow: 0 0 20px rgba(184,198,255,0.08);
  }



  /* GAMIFICATION */
  .player-meta {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }

  .player-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent);
    font-family: 'Space Mono', monospace;
    opacity: 0.9;
  }

  .currency-wrap {
    display: flex;
    gap: 8px;
  }

  .currency {
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    font-size: 12px;
    font-family: 'Space Mono', monospace;
  }

  .slot-machine {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 24px 0;
  }

  .slot-reel {
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    font-size: 38px;
    box-shadow: inset 0 0 18px rgba(0,0,0,0.35);
  }

  .reward-pop {
    position: fixed;
    left: 50%;
    top: 20%;
    transform: translateX(-50%);
    padding: 14px 18px;
    border-radius: 12px;
    background: rgba(10,10,15,0.95);
    border: 1px solid rgba(255,255,255,0.08);
    z-index: 999;
    animation: rewardPop 1.6s ease forwards;
    pointer-events: none;
    font-family: 'Space Mono', monospace;
  }

  @keyframes rewardPop {
    0% { opacity:0; transform:translateX(-50%) translateY(8px) scale(0.96); }
    15% { opacity:1; }
    100% { opacity:0; transform:translateX(-50%) translateY(-40px) scale(1.05); }
  }

  .shop-item {
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:12px;
    margin-bottom:10px;
    background: rgba(255,255,255,0.03);
    border:1px solid rgba(255,255,255,0.05);
    border-radius:10px;
  }

  .unlock-flash {
    animation: unlockFlash 0.7s ease;
  }

  @keyframes unlockFlash {
    0% { box-shadow:0 0 0 rgba(255,255,255,0); }
    50% { box-shadow:0 0 40px rgba(150,170,255,0.35); }
    100% { box-shadow:0 0 0 rgba(255,255,255,0); }
  }


  /* INVENTORY */
  .inv-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 140px;
    flex: 1;
    max-width: 200px;
    position: relative;
  }
  .inv-item.equipped {
    border-color: var(--accent3);
    background: rgba(123,97,255,0.1);
  }
  .inv-item-name { font-size: 13px; font-weight: 700; }
  .inv-item-type { font-family: 'Space Mono', monospace; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
  .inv-equip-btn {
    padding: 5px 10px; border-radius: 6px;
    background: rgba(123,97,255,0.15);
    border: 1px solid rgba(123,97,255,0.3);
    color: var(--accent3);
    font-family: 'Syne', sans-serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
  }
  .inv-equip-btn:hover { background: rgba(123,97,255,0.3); }
  .inv-equip-btn.equipped-btn {
    background: rgba(0,255,157,0.12);
    border-color: rgba(0,255,157,0.3);
    color: var(--correct);
  }

  /* QUESTION PACK */
  .qpack {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface2);
    margin-bottom: 12px;
    transition: border-color 0.2s;
  }
  .qpack:hover { border-color: var(--accent3); }
  .qpack-emoji { font-size: 32px; flex-shrink: 0; }
  .qpack-info { flex: 1; }
  .qpack-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
  .qpack-desc { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 10px; }
  .qpack-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
  .qpack-cost { font-family: 'Space Mono', monospace; font-size: 12px; color: var(--accent); }
  .qpack-owned { 
    font-family: 'Space Mono', monospace; font-size: 10px; padding: 3px 8px;
    border-radius: 4px; background: rgba(0,255,157,0.1); color: var(--correct);
    border: 1px solid rgba(0,255,157,0.2); text-transform: uppercase;
  }

  /* Visual effects */
  .effect-sakura .effect-particle {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    font-size: 16px;
    animation: sakuraFall linear forwards;
    top: -40px;
  }
  @keyframes sakuraFall {
    0% { transform: translateX(0) rotate(0deg); opacity: 1; }
    100% { transform: translateX(60px) rotate(720deg) translateY(110vh); opacity: 0; }
  }
  .effect-lightning body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, rgba(180,198,255,0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: lightningPulse 3s ease-in-out infinite;
  }
  @keyframes lightningPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
  }

  /* CASINO TABS */
  .casino-tabs {
    display: flex; gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 16px;
  }
  .casino-tab {
    flex: 1; padding: 9px 8px;
    background: transparent;
    border: none; border-radius: 7px;
    color: var(--muted);
    font-family: 'Syne', sans-serif;
    font-size: 13px; font-weight: 700;
    cursor: pointer; transition: all 0.2s;
  }
  .casino-tab:hover { color: var(--text); }
  .casino-tab.active { background: var(--surface2); color: var(--warn); border: 1px solid rgba(255,211,42,0.2); }
  .casino-panel { }
  .casino-panel.hidden { display: none !important; }

  /* ─── 3×5 SLOT MACHINE ───────────────────────────────────── */
  .slot-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 6px;
    margin: 0 auto 8px;
    max-width: 420px;
    padding: 12px;
    background: rgba(0,0,0,0.3);
    border-radius: 14px;
    border: 2px solid var(--border);
    position: relative;
  }

  .slot-cell {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    border-radius: 8px;
    background: var(--surface2);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: transform 0.1s ease;
    user-select: none;
  }

  .slot-cell.spinning {
    animation: cellSpin 0.07s steps(1) infinite;
  }
  @keyframes cellSpin {
    0%   { opacity: 1;   transform: scaleY(1);    }
    33%  { opacity: 0.4; transform: scaleY(0.85); }
    66%  { opacity: 0.7; transform: scaleY(1.05); }
    100% { opacity: 1;   transform: scaleY(1);    }
  }

  .slot-cell.win-cell {
    border-color: var(--warn);
    background: rgba(255,211,42,0.15);
    animation: winPulse 0.5s ease infinite alternate;
    box-shadow: 0 0 12px rgba(255,211,42,0.4);
  }
  @keyframes winPulse {
    from { box-shadow: 0 0 8px rgba(255,211,42,0.3); }
    to   { box-shadow: 0 0 22px rgba(255,211,42,0.8); }
  }

  .slot-bet-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
  }
  .slot-bet-btn:hover { border-color: var(--warn); color: var(--warn); }
  .slot-bet-btn.active { border-color: var(--warn); background: rgba(255,211,42,0.12); color: var(--warn); }

  /* Jackpot flash overlay */
  .jackpot-flash {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 9995;
    animation: jackpotFlash 0.8s ease-out forwards;
  }
  @keyframes jackpotFlash {
    0%   { background: rgba(255,211,42,0.35); }
    40%  { background: rgba(255,211,42,0.1); }
    60%  { background: rgba(255,211,42,0.25); }
    100% { background: transparent; }
  }

  /* Screen shake keyframe */
  @keyframes screenShake {
    0%,100% { transform: translate(0,0) rotate(0); }
    10% { transform: translate(-4px, -2px) rotate(-0.5deg); }
    20% { transform: translate(4px, 2px) rotate(0.5deg); }
    30% { transform: translate(-3px, 3px) rotate(-0.3deg); }
    40% { transform: translate(3px, -3px) rotate(0.3deg); }
    50% { transform: translate(-2px, 1px); }
    60% { transform: translate(2px, -1px); }
    70% { transform: translate(-1px, 2px); }
    80% { transform: translate(1px, -2px); }
    90% { transform: translate(-1px, 1px); }
  }

  /* Coin explosion particle */
  .coin-particle {
    position: fixed;
    pointer-events: none;
    z-index: 9996;
    font-size: 18px;
    animation: coinFly ease-out forwards;
  }
  @keyframes coinFly {
    0%   { transform: translate(0,0) scale(1) rotate(0deg); opacity: 1; }
    100% { transform: translate(var(--cx), var(--cy)) scale(0.3) rotate(var(--cr)); opacity: 0; }
  }

  /* Win message colours */
  .win-mega   { color: #ffd700; text-shadow: 0 0 20px rgba(255,215,0,0.8); }
  .win-big    { color: #cc88ff; }
  .win-mid    { color: var(--correct); }
  .win-small  { color: var(--accent); }
  .win-tiny   { color: var(--muted); }

  @media (max-width: 700px) {
    .slot-cell { font-size: 20px; }
    .slot-grid-5 { gap: 4px; padding: 8px; }
  }

  /* BLACKJACK */
  .bj-bet-row {
    display: flex; align-items: center; gap: 12px;
    flex-wrap: wrap; margin-bottom: 16px;
    padding: 12px 14px;
    background: var(--surface2);
    border-radius: 8px;
    border: 1px solid var(--border);
  }
  .bj-chip {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 2px solid var(--warn);
    background: rgba(255,211,42,0.1);
    color: var(--warn);
    font-family: 'Space Mono', monospace;
    font-size: 12px; font-weight: 700;
    cursor: pointer; transition: all 0.15s;
  }
  .bj-chip:hover { background: rgba(255,211,42,0.25); transform: scale(1.1); }
  .bj-chip.selected { background: rgba(255,211,42,0.35); box-shadow: 0 0 12px rgba(255,211,42,0.4); }
  .bj-table {
    background: rgba(0,60,20,0.25);
    border: 1px solid rgba(0,180,60,0.2);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 12px;
  }
  .bj-hand-label {
    font-family: 'Space Mono', monospace;
    font-size: 10px; text-transform: uppercase;
    letter-spacing: 2px; color: var(--muted);
    margin-bottom: 8px;
  }
  .bj-cards {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin-bottom: 6px;
  }
  .bj-card {
    width: 50px; height: 72px;
    border-radius: 7px;
    background: #fff;
    color: #111;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    font-size: 18px; font-weight: 800;
    font-family: 'Space Mono', monospace;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    animation: cardDeal 0.25s ease;
    position: relative;
    line-height: 1;
  }
  .bj-card.red { color: #cc2222; }
  .bj-card.hidden-card {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: transparent;
    font-size: 28px;
  }
  .bj-card.hidden-card::after {
    content: '🂠';
    font-size: 32px;
    color: var(--accent3);
    opacity: 0.8;
  }
  @keyframes cardDeal {
    from { transform: translateY(-20px) rotate(-5deg); opacity: 0; }
    to { transform: translateY(0) rotate(0); opacity: 1; }
  }
  .bj-card-suit { font-size: 11px; }
  .bj-val {
    font-family: 'Space Mono', monospace;
    font-size: 12px; color: var(--muted);
    margin-bottom: 4px;
  }
  .bj-divider {
    height: 1px; background: rgba(0,180,60,0.15);
    margin: 14px 0;
  }

  /* SHOP CATEGORY BTNS */
  .shop-cat-btn {
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
  }
  .shop-cat-btn:hover { color: var(--text); border-color: var(--accent3); }
  .shop-cat-btn.active { background: rgba(123,97,255,0.15); border-color: var(--accent3); color: var(--accent3); }

  /* MASCOT DERE ANIMATIONS */
  .mascot-tsundere-correct {
    animation: tsundereCorrect 0.5s ease !important;
  }
  @keyframes tsundereCorrect {
    0% { transform: scale(1); }
    30% { transform: scale(1.1) rotate(5deg); }
    60% { transform: scale(0.95) rotate(-3deg); }
    100% { transform: scale(1); }
  }
  .mascot-genki-correct {
    animation: genkiCorrect 0.6s ease !important;
  }
  @keyframes genkiCorrect {
    0% { transform: scale(1); }
    25% { transform: scale(1.2) translateY(-8px); }
    50% { transform: scale(1.15) translateY(-4px) rotate(5deg); }
    75% { transform: scale(1.1) translateY(-6px) rotate(-3deg); }
    100% { transform: scale(1); }
  }
  .mascot-kuudere-correct {
    animation: kuudereCorrect 0.8s ease !important;
  }
  @keyframes kuudereCorrect {
    0% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.02); filter: brightness(1.15) saturate(0.4); }
    100% { transform: scale(1); filter: brightness(1); }
  }
  .mascot-chuu-correct {
    animation: chuuCorrect 0.7s ease !important;
  }
  @keyframes chuuCorrect {
    0% { transform: scale(1) rotate(0); filter: hue-rotate(0); }
    30% { transform: scale(1.12) rotate(-8deg); filter: hue-rotate(60deg) brightness(1.3); }
    60% { transform: scale(1.08) rotate(5deg); filter: hue-rotate(180deg); }
    100% { transform: scale(1) rotate(0); filter: hue-rotate(0); }
  }
  .mascot-genki-wrong {
    animation: genkiWrong 0.5s ease !important;
  }
  @keyframes genkiWrong {
    0% { transform: scale(1); }
    20% { transform: scale(0.9) translateY(4px); }
    50% { transform: scale(0.95) rotate(-8deg); }
    80% { transform: scale(0.93) rotate(5deg); }
    100% { transform: scale(1); }
  }
  .mascot-chuu-wrong {
    animation: chuuWrong 0.6s ease !important;
  }
  @keyframes chuuWrong {
    0% { transform: scale(1); }
    25% { transform: scale(1.08) translateY(-4px); filter: brightness(0.6) saturate(2); }
    75% { transform: scale(0.95) translateY(2px); filter: brightness(1); }
    100% { transform: scale(1); }
  }

  /* INVENTORY upgraded */
  .inv-section-header {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--muted);
    margin: 16px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
  }

  /* STREAK DISPLAY */
  .streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255,107,53,0.12);
    border: 1px solid rgba(255,107,53,0.25);
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: #ff9f43;
  }

  /* Scrollbar */
  ::-webkit-scrollbar { width: 4px; }
  ::-webkit-scrollbar-track { background: var(--bg); }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

  /* LOOT BOX MODAL */
  #lootBoxOverlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
  }
  #lootBoxOverlay.active { opacity: 1; pointer-events: all; }

  #lootBoxCard {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 36px 32px;
    width: min(380px, 92vw);
    text-align: center;
    position: relative;
    transform: scale(0.8) translateY(40px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
  }
  #lootBoxOverlay.active #lootBoxCard { transform: scale(1) translateY(0); }

  .loot-particles {
    position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  }
  .loot-particle {
    position: absolute;
    width: 8px; height: 8px;
    border-radius: 50%;
    animation: lootParticleBurst 0.9s ease-out forwards;
    opacity: 0;
  }
  @keyframes lootParticleBurst {
    0%   { transform: translate(0,0) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
  }

  #lootBoxIcon {
    font-size: 64px;
    display: block;
    margin-bottom: 8px;
    animation: lootIconPop 0.5s 0.2s cubic-bezier(0.34,1.56,0.64,1) both;
  }
  @keyframes lootIconPop {
    from { transform: scale(0) rotate(-20deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg);  opacity: 1; }
  }

  #lootBoxRarityLabel {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 16px;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
    animation: lootFadeUp 0.4s 0.35s ease both;
  }
  @keyframes lootFadeUp {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  .loot-rarity-common  { background: rgba(165,113,70,0.2);  color: #cd7f32; border: 1px solid rgba(165,113,70,0.4); }
  .loot-rarity-rare    { background: rgba(80,130,255,0.2);  color: #6699ff; border: 1px solid rgba(80,130,255,0.4); }
  .loot-rarity-epic    { background: rgba(150,80,255,0.2);  color: #bb66ff; border: 1px solid rgba(150,80,255,0.4); }
  .loot-rarity-legendary { background: rgba(255,195,30,0.2); color: #ffd32a; border: 1px solid rgba(255,195,30,0.4); }

  #lootBoxRewards {
    display: flex; flex-direction: column; gap: 10px;
    margin: 20px 0 28px;
    animation: lootFadeUp 0.4s 0.5s ease both;
  }
  .loot-reward-row {
    display: flex; align-items: center; justify-content: center;
    gap: 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 15px; font-weight: 700;
  }
  .loot-reward-row span { color: var(--muted); font-size: 12px; font-weight: 400; }

  #lootClaimBtn {
    animation: lootFadeUp 0.4s 0.65s ease both;
  }

  /* Flip-open box effect container */
  #lootBoxFlip {
    perspective: 600px;
    display: inline-block;
    margin-bottom: 4px;
  }
  #lootBoxFlipInner {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    transform: rotateY(0deg);
  }
  #lootBoxFlipInner.flipped { transform: rotateY(180deg); }
  .loot-flip-front, .loot-flip-back {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: block;
    font-size: 64px;
    line-height: 1;
  }
  .loot-flip-back { transform: rotateY(180deg); position: absolute; top: 0; left: 0; right: 0; }

  @media (max-width: 700px) {
    .mascot-area {
      right: 8px;
      bottom: 8px;
      pointer-events: none;
    }
    .mascot {
      width: 72px !important;
      height: 72px !important;
      right: 8px !important;
      bottom: 52px !important;
      left: auto !important;
      top: auto !important;
      opacity: 0.85;
    }
    .mascot-upload-btn {
      display: none;
    }
    #mascotBubble {
      max-width: 180px !important;
      font-size: 11px !important;
      right: 88px !important;
      left: auto !important;
      bottom: 16px !important;
      top: auto !important;
    }
  }

  /* ─── CONSOLIDATED MOBILE POLISH ─────────────────────────── */
  @media (max-width: 700px) {
    /* Header: compress */
    .header {
      flex-wrap: wrap;
      gap: 10px;
      margin-bottom: 20px;
      padding-bottom: 14px;
    }
    .header h1 { font-size: 16px; }
    .logo { font-size: 10px; padding: 4px 8px; }

    /* Player meta: move below logo row */
    .player-meta {
      flex-direction: row;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      width: 100%;
      order: 3;
    }
    .player-title { font-size: 10px; letter-spacing: 1px; }
    .currency-wrap { gap: 6px; }
    .currency { font-size: 11px; padding: 3px 8px; }
    .score-pill { font-size: 11px; }
    .progress-bar-wrap { display: none; } /* hide score pill on mobile - clutters header */

    /* Tabs: horizontal scroll on mobile, no grid override */
    .tabs {
      display: flex;
      gap: 2px;
      padding: 3px;
      overflow-x: auto;
    }
    .tab { font-size: 10px; padding: 8px 6px; letter-spacing: 0; white-space: nowrap; flex: 0 0 auto; }

    /* Unit bar: horizontal scroll, no wrap */
    .unit-bar {
      flex-wrap: nowrap;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      padding-bottom: 4px;
      gap: 4px;
      scrollbar-width: none;
    }
    .unit-bar::-webkit-scrollbar { display: none; }
    .unit-btn { white-space: nowrap; flex-shrink: 0; font-size: 10px; padding: 4px 10px; }

    /* Cards: less padding */
    .card { padding: 18px 16px; }

    /* Stats bar: 2-col grid */
    .stats-bar {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
      padding: 12px 14px;
    }
    .stat-val { font-size: 18px; }
    .stat-label { font-size: 10px; }

    /* Button rows: wrap nicely */
    .btn-row { gap: 6px; flex-wrap: wrap; }
    .btn-row .btn { flex: 1 1 auto; min-width: 0; font-size: 12px; padding: 9px 10px; text-align: center; }

    /* Inv category tabs scroll */
    .inv-cat-tabs {
      flex-wrap: nowrap;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      padding-bottom: 4px;
      scrollbar-width: none;
    }
    .inv-cat-tabs::-webkit-scrollbar { display: none; }
    .inv-cat-btn { white-space: nowrap; flex-shrink: 0; }

    /* Options: tighter */
    .option { padding: 10px 12px; font-size: 13px; }

    /* FRQ textarea */
    textarea { font-size: 12px; min-height: 64px; }

    /* Slot machine */
    .slot-machine { gap: 8px; margin: 16px 0; }
    .slot-reel { width: 72px; height: 72px; font-size: 30px; }

    /* BJ chips */
    .bj-chip { width: 38px; height: 38px; font-size: 11px; }

    /* Casino tabs */
    .casino-tabs {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 3px;
    }
    .casino-tab { font-size: 12px; padding: 8px 4px; }

    /* Inventory items: full width on mobile */
    .inv-item { min-width: 0; max-width: 100%; width: 100%; flex-direction: row; align-items: center; justify-content: space-between; padding: 10px 12px; }
    .inv-item-name { font-size: 12px; }
    .inv-section-items { flex-direction: column; }

    /* Shop items */
    .shop-item { flex-direction: column; align-items: flex-start; gap: 8px; }

    /* Question packs: stack */
    .qpack { flex-direction: column; gap: 8px; }
    .qpack-emoji { font-size: 24px; }

    /* Mascot (already handled above, leave as-is) */
  }

  /* ─── INVENTORY SECTION STYLES ────────────────────────────── */
  .inv-section {
    margin-bottom: 24px;
  }
  .inv-section-header {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--muted);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .inv-section-count {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1px 8px;
    font-size: 10px;
    color: var(--muted);
  }
  .inv-section-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .inv-empty-section {
    color: var(--muted);
    font-size: 12px;
    font-family: 'Space Mono', monospace;
    padding: 8px 0;
    opacity: 0.6;
  }

  /* Equipped summary banner */
  .equipped-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 22px;
  }
  @media (max-width: 700px) {
    .equipped-summary { grid-template-columns: 1fr; }
  }
  .equipped-summary-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
  }
  .equipped-summary-label {
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--muted);
    margin-bottom: 5px;
  }
  .equipped-summary-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ─── RESET MODAL ─────────────────────────────────────────── */
  #resetModal {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
  }
  #resetModal.active { opacity: 1; pointer-events: all; }
  #resetModalCard {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px 28px;
    width: min(400px, 92vw);
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
  }
  #resetModal.active #resetModalCard { transform: scale(1); }
  .reset-modal-icon { font-size: 40px; margin-bottom: 12px; }
  .reset-modal-title { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
  .reset-modal-desc { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 24px; }
  .reset-modal-btn-row { display: flex; gap: 10px; justify-content: center; }
  .btn-danger {
    background: rgba(255,71,87,0.1);
    border-color: var(--wrong);
    color: var(--wrong);
  }
  .btn-danger:hover { background: rgba(255,71,87,0.22); }

  /* ── INV SECTION REORGANIZED ────────────────────────────── */
  .inv-cat-tabs {
    display: flex; gap: 4px; flex-wrap: wrap;
    margin-bottom: 16px;
  }
  .inv-cat-btn {
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
  }
  .inv-cat-btn:hover { color: var(--text); border-color: var(--accent3); }
  .inv-cat-btn.active { background: rgba(123,97,255,0.15); border-color: var(--accent3); color: var(--accent3); }

  /* Equipped summary compact row */
  .equipped-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 18px;
  }
  @media (max-width: 700px) {
    .equipped-summary { grid-template-columns: repeat(2, 1fr); }
  }

  /* Rain effect */
  body.theme-rain::after {
    content: '';
    position: fixed; inset: 0;
    background: repeating-linear-gradient(
      180deg,
      transparent 0px, transparent 40px,
      rgba(120,180,255,0.03) 40px, rgba(120,180,255,0.03) 41px
    );
    pointer-events: none; z-index: 0;
    animation: rainScroll 0.6s linear infinite;
  }
  @keyframes rainScroll {
    from { background-position: 0 0; }
    to { background-position: 0 41px; }
  }
  .rain-drop {
    position: fixed;
    width: 1px;
    top: -20px;
    pointer-events: none;
    z-index: 9990;
    animation: rainFall linear forwards;
    opacity: 0.5;
  }
  @keyframes rainFall {
    from { transform: translateY(0) translateX(0); }
    to { transform: translateY(110vh) translateX(var(--rx, 20px)); }
  }

  /* Stars effect */
  .star-particle {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9990;
    animation: starTwinkle ease-in-out infinite;
  }
  @keyframes starTwinkle {
    0%, 100% { opacity: 0.1; transform: scale(1); }
    50% { opacity: 0.9; transform: scale(1.4); }
  }

  /* ─── INTERACTION PARTICLES ───────────────────────────────── */
  .interaction-particle {
    position: fixed;
    pointer-events: none;
    z-index: 9998;
    border-radius: 50%;
    animation: interactBurst ease-out forwards;
  }
  @keyframes interactBurst {
    0% { transform: translate(0,0) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
  }

  .tab-switch-flash {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9997;
    animation: tabFlash 0.4s ease-out forwards;
  }
  @keyframes tabFlash {
    0% { background: rgba(184,198,255,0.06); }
    100% { background: transparent; }
  }

  .correct-burst-text {
    position: fixed;
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--correct);
    pointer-events: none;
    z-index: 9999;
    animation: burstText 1s ease-out forwards;
    text-shadow: 0 0 10px var(--correct);
  }
  @keyframes burstText {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-60px) scale(1.2); }
  }

  /* ─── TITLE VISUAL STYLES ─────────────────────────────────── */
  .player-title {
    position: relative;
    transition: all 0.3s ease;
  }

  /* Legendary/special titles */
  .player-title.title-legendary {
    background: linear-gradient(90deg, #ffd32a, #ff9f43, #ffd32a);
    background-size: 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: legendaryShimmer 2s linear infinite;
    font-style: italic;
    letter-spacing: 3px;
  }
  @keyframes legendaryShimmer {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
  }

  .player-title.title-cursed {
    font-family: 'Space Mono', monospace;
    color: #ff4757 !important;
    text-shadow: 0 0 8px rgba(255,71,87,0.6);
    animation: cursedPulse 1.5s ease-in-out infinite;
  }
  @keyframes cursedPulse {
    0%, 100% { text-shadow: 0 0 8px rgba(255,71,87,0.4); }
    50% { text-shadow: 0 0 16px rgba(255,71,87,0.9), 0 0 30px rgba(255,71,87,0.3); }
  }

  .player-title.title-void {
    font-family: 'Space Mono', monospace;
    color: transparent !important;
    text-shadow: 0 0 6px rgba(200,200,255,0.8);
    letter-spacing: 4px;
  }

  .player-title.title-neon {
    color: #00ff9d !important;
    text-shadow: 0 0 10px rgba(0,255,157,0.7), 0 0 20px rgba(0,255,157,0.3);
    animation: neonFlicker 3s ease-in-out infinite;
  }
  @keyframes neonFlicker {
    0%, 90%, 100% { opacity: 1; }
    92% { opacity: 0.7; }
    94% { opacity: 1; }
    96% { opacity: 0.8; }
  }

  .player-title.title-glitch {
    font-family: 'Space Mono', monospace;
    color: #9a7cff !important;
    position: relative;
  }
  .player-title.title-glitch::before {
    content: attr(data-text);
    position: absolute;
    left: 2px;
    color: #ff4757;
    clip-path: inset(0 0 0 0);
    animation: glitchClip 2.5s steps(1) infinite;
    opacity: 0.7;
  }
  @keyframes glitchClip {
    0%, 85% { clip-path: inset(100% 0 0 0); }
    87% { clip-path: inset(30% 0 60% 0); left: 1px; }
    89% { clip-path: inset(70% 0 10% 0); left: -2px; }
    91% { clip-path: inset(0 0 80% 0); left: 2px; }
    93%, 100% { clip-path: inset(100% 0 0 0); }
  }

  .player-title.title-rainbow {
    background: linear-gradient(90deg, #ff4757, #ff9f43, #ffd32a, #00ff9d, #6699ff, #bb66ff);
    background-size: 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbowSlide 3s linear infinite;
    font-weight: 800;
  }
  @keyframes rainbowSlide {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
  }

  /* ─── PASS SHARD UI ───────────────────────────────────────── */
  .shard-bar-wrap {
    margin: 8px 0;
  }
  .shard-bar-bg {
    height: 6px;
    background: var(--surface2);
    border-radius: 3px;
    border: 1px solid var(--border);
    overflow: hidden;
  }
  .shard-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
  }

  /* ─── MORE EFFECTS ────────────────────────────────────────── */
  .effect-void-particle {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9989;
    background: rgba(150,140,255,0.15);
    animation: voidDrift ease-in-out infinite;
  }
  @keyframes voidDrift {
    0% { transform: translate(0,0) scale(1); opacity: 0.1; }
    50% { transform: translate(var(--dx),var(--dy)) scale(1.3); opacity: 0.3; }
    100% { transform: translate(0,0) scale(1); opacity: 0.1; }
  }

  .effect-matrix-char {
    position: fixed;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    pointer-events: none;
    z-index: 9989;
    color: var(--correct);
    opacity: 0;
    animation: matrixFall linear forwards;
  }
  @keyframes matrixFall {
    0% { opacity: 0.8; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(40px); }
  }
  /* ─── CYCLES MODE ─────────────────────────────────────────── */
  .fill-sentence {
    font-size: clamp(15px, 3vw, 18px);
    font-weight: 600;
    line-height: 1.8;
    margin-bottom: 20px;
    color: var(--text);
  }
  .fill-blank {
    display: inline-block;
    min-width: 120px;
    border-bottom: 2px solid var(--accent3);
    padding: 2px 8px;
    margin: 0 4px;
    text-align: center;
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    color: var(--accent);
    transition: all 0.2s;
    cursor: default;
  }
  .fill-blank.filled {
    border-bottom-color: var(--accent);
    color: var(--text);
    background: rgba(109,120,255,0.08);
    border-radius: 4px;
  }
  .fill-blank.revealed {
    border-bottom-color: var(--correct);
    color: var(--correct);
    background: rgba(0,255,157,0.08);
    border-radius: 4px;
  }
  .fill-blank.wrong-reveal {
    border-bottom-color: var(--wrong);
    color: var(--wrong);
    background: rgba(255,71,87,0.08);
    border-radius: 4px;
  }
  .fill-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
  }
  .fill-chip {
    padding: 7px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
  }
  .fill-chip:hover:not(.used):not(.locked) {
    border-color: var(--accent3);
    color: var(--text);
    background: rgba(109,120,255,0.1);
  }
  .fill-chip.used { opacity: 0.3; cursor: default; }
  .fill-chip.locked { cursor: default; }
  .fill-chip.correct-chip { border-color: var(--correct); color: var(--correct); background: rgba(0,255,157,0.1); }
  .fill-chip.wrong-chip { border-color: var(--wrong); color: var(--wrong); background: rgba(255,71,87,0.1); }

  /* Sequence ordering */
  .seq-instructions {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
  }
  .seq-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
  }
  .seq-item {
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.15s;
    touch-action: none;
  }
  .seq-item:hover { border-color: var(--accent3); color: var(--text); }
  .seq-item.dragging { opacity: 0.5; border-color: var(--accent3); }
  .seq-item.drag-over { border-color: var(--accent); background: rgba(184,198,255,0.06); }
  .seq-item.correct-order, .seq-item.seq-correct { border-color: var(--correct); background: rgba(0,255,157,0.08); color: var(--correct); }
  .seq-item.wrong-order, .seq-item.seq-wrong { border-color: var(--wrong); background: rgba(255,71,87,0.08); color: var(--wrong); }
  .seq-handle {
    font-size: 16px;
    cursor: grab;
    color: var(--border);
    flex-shrink: 0;
  }
  .seq-num {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--muted);
    min-width: 20px;
    flex-shrink: 0;
  }
  .seq-check-btn {
    margin-top: 8px;
  }
  .cyc-topic-label {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(154,124,255,0.15);
    color: var(--accent2);
    border: 1px solid rgba(154,124,255,0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
    display: inline-block;
  }
  .cyc-progress {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--muted);
    margin-left: auto;
  }

  /* ─── STATS HEADER BUTTON ─────────────────────────────────── */
  .stats-header-btn {
    background: rgba(184,198,255,0.07);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
    padding: 3px 7px;
    line-height: 1;
    transition: all 0.15s;
    flex-shrink: 0;
  }
  .stats-header-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(184,198,255,0.12);
  }

  /* ─── STATS MODAL ─────────────────────────────────────────── */
  #statsModal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }
  #statsModal.active {
    opacity: 1;
    pointer-events: all;
  }
  #statsModalCard {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
    padding: 24px 20px 32px;
    width: min(620px, 100vw);
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.34,1,0.64,1);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }
  #statsModal.active #statsModalCard {
    transform: translateY(0);
  }
  /* drag handle visual */
  #statsModalCard::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 20px;
  }
  @media (min-width: 640px) {
    #statsModal { align-items: center; }
    #statsModalCard {
      border-radius: 16px;
      transform: translateY(20px) scale(0.97);
      max-height: 80vh;
    }
    #statsModal.active #statsModalCard {
      transform: translateY(0) scale(1);
    }
  }

  /* ═══════════════════════════════════════════════════════════
     WIDGET COLUMNS - 8-row grid flanking the app
     Empty slots are INVISIBLE on screen (only filled widgets show).
     The grid editor lives in the Bag tab.
  ═══════════════════════════════════════════════════════════ */
  :root {
    --wcell: 160px;
    --wgap:  8px;
    --wrows: 4;
    --wcols: 2;
  }

  .widget-column {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    grid-template-rows: repeat(var(--wrows), var(--wcell));
    grid-template-columns: repeat(var(--wcols), var(--wcell));
    gap: var(--wgap);
    z-index: 50;
    pointer-events: none;
  }
  .widget-column.left  { left: calc(50% - 430px - calc(var(--wcols) * (var(--wcell) + var(--wgap))) - 20px); }
  .widget-column.right { right: calc(50% - 430px - calc(var(--wcols) * (var(--wcell) + var(--wgap))) - 20px); }

  /* Filled widget slots - visible on screen */
  .widget-slot {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    pointer-events: all;
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s;
    background: transparent;
    border: none;
    box-shadow: none;
    min-width: 0;
    min-height: 0;
    /* fill the entire grid area */
    width: 100%;
    height: 100%;
    align-self: stretch;
    justify-self: stretch;
  }
  .widget-slot img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 0;
  }

  /* Remove button and name - hidden by default, only shown when .bag-editable is active (set by bag panel) */
  .widget-slot-remove {
    position: absolute;
    top: 6px; right: 6px;
    width: 22px; height: 22px;
    background: rgba(0,0,0,0.75);
    border: 1px solid rgba(255,71,87,0.4);
    border-radius: 50%;
    font-size: 11px;
    color: var(--wrong);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 10;
  }
  .widget-slot-name {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 5px 8px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    font-family: 'Space Mono', monospace;
    font-size: 8px;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Only show remove + name when bag editing mode is active */
  body.bag-editing .widget-slot-remove {
    opacity: 1;
    pointer-events: all;
  }
  body.bag-editing .widget-slot-name { opacity: 1; }

  /* Hide columns on narrow screens */
  @media (max-width: 1280px) {
    .widget-column { display: none; }
  }

  /* ═══════════════════════════════════════════════════════════
     SLAYR WIDGET
  ═══════════════════════════════════════════════════════════ */
  .slayr-widget {
    position: relative;
    width: 100%; height: 100%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    border-radius: 14px;
    background: transparent;
  }

  /* Grok choke vignette */
  .grok-choke-vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.75) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
  }
  .grok-choke-vignette.active {
    opacity: 1;
  }
  .slayr-img {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
    z-index: 2;
    transition: transform 0.08s ease-out;
  }
  .slayr-img.slayr-click {
    animation: slayrBounce 0.32s cubic-bezier(0.36,0.07,0.19,0.97);
  }
  @keyframes slayrRattle {
    0%,100% { transform: translate(0,0) rotate(0); }
    15% { transform: translate(-2px,-1px) rotate(-1deg); }
    30% { transform: translate(2px,1px) rotate(1deg); }
    45% { transform: translate(-1px,2px) rotate(-0.5deg); }
    60% { transform: translate(1px,-1px) rotate(0.5deg); }
    75% { transform: translate(-1px,1px) rotate(-0.3deg); }
  }
  .slayr-rattling .slayr-img {
    animation: slayrRattle 0.18s linear infinite !important;
  }
  /* ── SLAYR SHAKE PHASES ─────────────────────────────────── */

  /* Phase 1 (0-10s): intense chaos shake on #app */
  @keyframes uiShakeIntense {
    0%   { transform: translate(0,0) rotate(0); }
    5%   { transform: translate(-8px,-6px) rotate(-1.2deg); }
    10%  { transform: translate(9px,7px) rotate(1.4deg); }
    15%  { transform: translate(-7px,8px) rotate(-1.1deg); }
    20%  { transform: translate(10px,-7px) rotate(1.3deg); }
    25%  { transform: translate(-9px,5px) rotate(-1deg); }
    30%  { transform: translate(8px,-9px) rotate(1.2deg); }
    35%  { transform: translate(-6px,7px) rotate(-0.9deg); }
    40%  { transform: translate(9px,6px) rotate(1.1deg); }
    45%  { transform: translate(-10px,-5px) rotate(-1.3deg); }
    50%  { transform: translate(7px,8px) rotate(0.8deg); }
    55%  { transform: translate(-8px,-7px) rotate(-1deg); }
    60%  { transform: translate(10px,5px) rotate(1.2deg); }
    65%  { transform: translate(-9px,9px) rotate(-1.1deg); }
    70%  { transform: translate(6px,-8px) rotate(0.9deg); }
    75%  { transform: translate(-7px,6px) rotate(-1deg); }
    80%  { transform: translate(9px,-5px) rotate(1.1deg); }
    85%  { transform: translate(-8px,7px) rotate(-0.8deg); }
    90%  { transform: translate(7px,-9px) rotate(1deg); }
    95%  { transform: translate(-6px,5px) rotate(-0.7deg); }
    100% { transform: translate(0,0) rotate(0); }
  }

  /* Phase 3 (38s+): normal chill shake */
  @keyframes uiShake {
    0%,100% { transform: translate(0,0) rotate(0); }
    10% { transform: translate(-3px,-2px) rotate(-0.4deg); }
    20% { transform: translate(3px,2px) rotate(0.4deg); }
    30% { transform: translate(-2px,3px) rotate(-0.3deg); }
    40% { transform: translate(2px,-2px) rotate(0.3deg); }
    50% { transform: translate(-1px,1px); }
    60% { transform: translate(1px,-1px); }
    70% { transform: translate(-1px,2px); }
    80% { transform: translate(1px,-1px); }
    90% { transform: translate(0,1px); }
  }

  /* Phase 2 chaotic POV slam — rapid erratic pan through the zoomed page */
  @keyframes slayrFlail {
    0%   { transform: scale(var(--sl-zoom,2.0)) translate(0%,0%) rotate(0deg); }
    4%   { transform: scale(var(--sl-zoom,2.0)) translate(-5%,3%) rotate(-4deg); }
    8%   { transform: scale(var(--sl-zoom,2.0)) translate(7%,-4%) rotate(3.5deg); }
    12%  { transform: scale(var(--sl-zoom,2.0)) translate(-3%,-6%) rotate(-5deg); }
    16%  { transform: scale(var(--sl-zoom,2.0)) translate(8%,2%) rotate(4deg); }
    20%  { transform: scale(var(--sl-zoom,2.0)) translate(-6%,5%) rotate(-3deg); }
    24%  { transform: scale(var(--sl-zoom,2.0)) translate(4%,-7%) rotate(5.5deg); }
    28%  { transform: scale(var(--sl-zoom,2.0)) translate(-8%,1%) rotate(-4.5deg); }
    32%  { transform: scale(var(--sl-zoom,2.0)) translate(5%,6%) rotate(3deg); }
    36%  { transform: scale(var(--sl-zoom,2.0)) translate(-4%,-5%) rotate(-5deg); }
    40%  { transform: scale(var(--sl-zoom,2.0)) translate(9%,3%) rotate(4.5deg); }
    44%  { transform: scale(var(--sl-zoom,2.0)) translate(-7%,-2%) rotate(-3.5deg); }
    48%  { transform: scale(var(--sl-zoom,2.0)) translate(3%,7%) rotate(5deg); }
    52%  { transform: scale(var(--sl-zoom,2.0)) translate(-9%,4%) rotate(-4deg); }
    56%  { transform: scale(var(--sl-zoom,2.0)) translate(6%,-6%) rotate(3deg); }
    60%  { transform: scale(var(--sl-zoom,2.0)) translate(-2%,8%) rotate(-5.5deg); }
    64%  { transform: scale(var(--sl-zoom,2.0)) translate(8%,-3%) rotate(4deg); }
    68%  { transform: scale(var(--sl-zoom,2.0)) translate(-5%,-7%) rotate(-3deg); }
    72%  { transform: scale(var(--sl-zoom,2.0)) translate(4%,5%) rotate(5deg); }
    76%  { transform: scale(var(--sl-zoom,2.0)) translate(-8%,2%) rotate(-4.5deg); }
    80%  { transform: scale(var(--sl-zoom,2.0)) translate(7%,-5%) rotate(3.5deg); }
    84%  { transform: scale(var(--sl-zoom,2.0)) translate(-3%,6%) rotate(-5deg); }
    88%  { transform: scale(var(--sl-zoom,2.0)) translate(6%,4%) rotate(4deg); }
    92%  { transform: scale(var(--sl-zoom,2.0)) translate(-7%,-3%) rotate(-3.5deg); }
    96%  { transform: scale(var(--sl-zoom,2.0)) translate(3%,-6%) rotate(5deg); }
    100% { transform: scale(var(--sl-zoom,2.0)) translate(0%,0%) rotate(0deg); }
  }

  /* Red pulse vignette */
  #slayrVignette {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99998;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(180,0,0,0.45) 100%);
    animation: vignetteSubtle 1.8s ease-in-out infinite;
  }
  @keyframes vignetteSubtle {
    0%,100% { opacity: 0.4; }
    50%     { opacity: 0.75; }
  }
  #slayrVignette.active       { display: block; }
  #slayrVignette.vign-intense {
    background: radial-gradient(ellipse at center, transparent 25%, rgba(200,0,0,0.75) 100%);
    animation: vignetteIntense 0.6s ease-in-out infinite;
  }
  @keyframes vignetteIntense {
    0%,100% { opacity: 0.7; }
    50%     { opacity: 1; }
  }

  /* Scramble overlay for phase 2 */
  #slayrScramble {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    pointer-events: none;
    mix-blend-mode: screen;
    opacity: 0.18;
    background: repeating-linear-gradient(
      0deg,
      rgba(110,80,255,0.35) 0px,
      transparent 2px,
      transparent 6px
    );
    animation: scrambleShift 0.07s steps(1) infinite;
  }
  @keyframes scrambleShift {
    0%   { background-position: 0 0; opacity: 0.15; }
    33%  { background-position: 0 3px; opacity: 0.22; }
    66%  { background-position: 0 -2px; opacity: 0.12; }
    100% { background-position: 0 1px; opacity: 0.18; }
  }
  #slayrScramble.active { display: block; }

  /* App shake states driven by JS class on body */
  body.slayr-phase-intense #app {
    animation: uiShakeIntense 0.14s linear infinite;
  }
  html.slayr-phase-zoom {
    transform-origin: center center;
    animation: slayrFlail 0.28s linear infinite;
  }
  body.slayr-phase-normal #app {
    animation: uiShake 0.22s linear infinite;
  }
  .slayr-explosion {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    z-index: 3;
    opacity: 0.65;
    display: none;
    pointer-events: none;
    mix-blend-mode: screen;
  }

  /* ═══════════════════════════════════════════════════════════
     GROK WIDGET
  ═══════════════════════════════════════════════════════════ */
  .grok-widget {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    overflow: hidden;
    border-radius: 14px;
    background: #000;
    position: relative;
  }
  .grok-img-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
  }
  .grok-img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
  }
  .grok-blur-overlay {
    position: absolute; inset: 0;
    backdrop-filter: blur(18px) brightness(0.7);
    -webkit-backdrop-filter: blur(18px) brightness(0.7);
    background: rgba(6,6,8,0.35);
    transition: opacity 1.2s ease;
  }
  .grok-blur-overlay.grok-unblurred {
    opacity: 0;
    pointer-events: none;
  }
  .grok-input-row {
    display: flex;
    gap: 4px;
    padding: 5px 6px;
    background: rgba(10,10,14,0.92);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
  }
  .grok-input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    padding: 4px 7px;
    min-width: 0;
  }
  .grok-input:focus { outline: none; border-color: var(--accent3); }
  .grok-send-btn {
    background: rgba(123,97,255,0.2);
    border: 1px solid rgba(123,97,255,0.4);
    border-radius: 5px;
    color: var(--accent3);
    font-size: 12px; font-weight: 700;
    cursor: pointer; padding: 4px 8px;
    transition: background 0.15s;
  }
  .grok-send-btn:hover { background: rgba(123,97,255,0.4); }

  /* ═══════════════════════════════════════════════════════════
     NAZUNA CLICKER WIDGET
  ═══════════════════════════════════════════════════════════ */
  .nazuna-widget {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    overflow: hidden;
    border-radius: 14px;
    background: #0a0a0e;
    position: relative;
    font-size: 11px;
  }
  .naz-bg {
    position: absolute; inset: 0;
    background-size: cover;
    background-position: center;
    pointer-events: none;
    z-index: 0;
    border-radius: 14px;
    transition: opacity 0.6s ease;
  }
  .nazuna-widget > * { position: relative; z-index: 1; }
  .naz-header {
    display: flex; align-items: baseline; gap: 4px;
    padding: 5px 8px 3px;
    background: rgba(0,0,0,0.6);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  .naz-pts {
    font-family: 'Space Mono', monospace;
    font-size: 13px; font-weight: 700;
    color: var(--accent);
  }
  .naz-label { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
  .naz-pps { font-family: 'Space Mono', monospace; font-size: 9px; color: var(--correct); margin-left: auto; }
  .naz-click-area {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 6px;
    min-height: 0;
  }
  .naz-img {
    max-width: 100%; max-height: 100%;
    object-fit: contain;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.08s;
    user-select: none;
  }
  .naz-img.naz-pop {
    animation: nazPop 0.18s ease;
  }
  @keyframes nazPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(0.85); }
    80%  { transform: scale(1.12); }
    100% { transform: scale(1); }
  }
  .naz-tabs {
    display: flex;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: rgba(0,0,0,0.5);
  }
  .naz-tab {
    flex: 1; padding: 4px 0;
    background: transparent; border: none;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    font-size: 9px; text-transform: uppercase; letter-spacing: 1px;
    cursor: pointer; transition: all 0.15s;
  }
  .naz-tab.active { color: var(--accent); border-bottom: 2px solid var(--accent3); }
  .naz-panel {
    overflow-y: auto; overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    flex-shrink: 0;
    max-height: 90px;
    background: rgba(0,0,0,0.55);
    padding: 4px 6px;
  }
  .naz-hidden { display: none !important; }
  .naz-shop-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 3px 4px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 10px;
    transition: background 0.12s;
    gap: 4px;
  }
  .naz-shop-item:hover { background: rgba(255,255,255,0.07); }
  .naz-cost { font-family: 'Space Mono', monospace; font-size: 9px; color: var(--accent); white-space: nowrap; }
  .naz-owned { font-family: 'Space Mono', monospace; font-size: 8px; color: var(--muted); padding: 2px 0; line-height: 1.4; }
  .naz-bg-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 4px; padding: 2px;
  }
  .naz-bg-thumb {
    border-radius: 5px; overflow: hidden;
    cursor: pointer; position: relative;
    border: 1px solid var(--border);
    aspect-ratio: 16/9;
    transition: border-color 0.15s;
  }
  .naz-bg-thumb:hover { border-color: var(--accent3); }
  .naz-bg-thumb.naz-bg-active { border-color: var(--correct); }
  .naz-bg-thumb.naz-bg-unlocked { border-color: var(--warn); }
  .naz-bg-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .naz-bg-thumb span {
    position: absolute; bottom: 2px; right: 3px;
    font-family: 'Space Mono', monospace;
    font-size: 8px; color: #fff;
    background: rgba(0,0,0,0.7);
    padding: 1px 3px; border-radius: 3px;
  }
  .naz-bg-lock {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    padding: 8px 0;
  }

  /* ─── BAG WIDGET GRID EDITOR ────────────────────────────── */
  /* The 2-column grid shown inside the Bag > Widgets tab */
  .wgrid-editor {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
  }
  .wgrid-col {
    flex: 0 0 auto;
  }
  .wgrid-col-label {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
    text-align: center;
  }
  .wgrid-cells {
    display: grid;
    grid-template-rows: repeat(4, 44px);
    grid-template-columns: repeat(2, 120px);
    gap: 4px;
  }
  /* Individual cell in the grid editor */
  .wgcell {
    border-radius: 7px;
    border: 1px solid rgba(184,198,255,0.1);
    background: rgba(255,255,255,0.02);
    cursor: pointer;
    transition: all 0.12s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    color: rgba(184,198,255,0.25);
    user-select: none;
    overflow: hidden;
  }
  .wgcell:hover:not(.occupied) {
    border-color: rgba(184,198,255,0.35);
    background: rgba(184,198,255,0.05);
    color: rgba(184,198,255,0.5);
  }
  /* Cell is occupied by a placed widget */
  .wgcell.occupied {
    cursor: default;
    background: rgba(109,120,255,0.12);
    border-color: rgba(109,120,255,0.35);
    color: var(--accent3);
  }
  /* Cell is selected as a valid placement spot */
  .wgcell.selected-pending {
    background: rgba(255,71,87,0.18);
    border-color: rgba(255,71,87,0.6);
    color: var(--wrong);
  }
  /* Cell is selected as a valid placement spot */
  .wgcell.selected-valid {
    background: rgba(0,255,157,0.15);
    border-color: rgba(0,255,157,0.6);
    color: var(--correct);
    animation: wgPreviewPulse 0.7s ease-in-out infinite alternate;
  }
  @keyframes wgPreviewPulse {
    from { box-shadow: none; }
    to   { box-shadow: 0 0 8px rgba(0,255,157,0.3); }
  }
  /* Confirm bar shown below grid when a cell is selected */
  .wgrid-confirm-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin-top: 8px;
    background: rgba(0,255,157,0.07);
    border: 1px solid rgba(0,255,157,0.25);
    border-radius: 10px;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--correct);
  }
  /* The widget name tag inside an occupied cell (shown on first row of widget) */
  .wgcell-tag {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    padding: 2px 4px;
  }
  .wgcell-tag-name {
    font-size: 8px;
    color: var(--accent3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .wgcell-tag-size {
    font-size: 7px;
    color: var(--muted);
  }
  .wgcell-remove {
    position: absolute;
    top: 2px; right: 3px;
    font-size: 9px;
    color: rgba(255,71,87,0.6);
    cursor: pointer;
    line-height: 1;
    padding: 1px 2px;
    border-radius: 2px;
  }
  .wgcell-remove:hover { color: var(--wrong); background: rgba(255,71,87,0.15); }

  /* Widget picker list in bag */
  .wg-picker {
    flex: 1;
    min-width: 220px;
  }
  .wg-picker-label {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
  }
  .wg-picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface2);
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 8px;
  }
  .wg-picker-item:hover { border-color: var(--accent3); background: rgba(109,120,255,0.08); }
  .wg-picker-item.selected { border-color: var(--accent3); background: rgba(109,120,255,0.15); }
  .wg-picker-item.placed { border-color: rgba(0,255,157,0.3); background: rgba(0,255,157,0.05); cursor: default; }
  .wg-picker-thumb {
    width: 40px; height: 40px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
    background: rgba(0,0,0,0.3);
  }
  .wg-picker-thumb img { width: 100%; height: 100%; object-fit: contain; }
  .wg-picker-info { flex: 1; min-width: 0; }
  .wg-picker-name { font-size: 13px; font-weight: 700; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .wg-picker-meta { font-family: 'Space Mono', monospace; font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
  .wg-size-pill {
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(184,198,255,0.06);
    border: 1px solid rgba(184,198,255,0.12);
    color: var(--muted);
    cursor: pointer;
    transition: all 0.12s;
    display: inline-block;
  }
  .wg-size-pill.active { background: rgba(109,120,255,0.2); border-color: var(--accent3); color: var(--accent3); }
  .wg-picker-size-badge {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(184,198,255,0.08);
    border: 1px solid rgba(184,198,255,0.15);
    color: var(--accent);
    flex-shrink: 0;
  }

  /* Placement instruction banner */
  .wg-instruction {
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(109,120,255,0.08);
    border: 1px solid rgba(109,120,255,0.25);
    font-size: 12px;
    color: var(--accent);
    margin-bottom: 14px;
    font-family: 'Space Mono', monospace;
    display: none;
  }
  .wg-instruction.show { display: block; animation: fadeIn 0.2s ease; }
  .wg-confirm-btn {
    display: none;
    width: 100%;
    margin-top: 10px;
    padding: 11px;
    border-radius: 8px;
    background: rgba(0,255,157,0.1);
    border: 1px solid var(--correct);
    color: var(--correct);
    font-family: 'Syne', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
  }
  .wg-confirm-btn.show { display: block; animation: fadeIn 0.2s ease; }
  .wg-confirm-btn:hover { background: rgba(0,255,157,0.2); }

  /* ═══════════════════════════════════════════════════════════
     WIDGET CONFIRM MODAL (small confirm after grid selection)
  ═══════════════════════════════════════════════════════════ */
  #widgetPlaceModal {
    position: fixed; inset: 0; z-index: 10100;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(10px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
  }
  #widgetPlaceModal.active { opacity: 1; pointer-events: all; }
  #widgetPlaceCard {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px 22px;
    width: min(380px, 94vw);
    transform: scale(0.93) translateY(12px);
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
  }
  #widgetPlaceModal.active #widgetPlaceCard { transform: scale(1) translateY(0); }
  .wplace-title { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
  .wplace-sub { font-size: 12px; color: var(--muted); margin-bottom: 16px; font-family: 'Space Mono', monospace; }

  /* Drag ghost */
  .widget-drag-ghost {
    position: fixed;
    width: 70px; height: 70px;
    border-radius: 10px;
    overflow: hidden;
    pointer-events: none;
    z-index: 99999;
    opacity: 0.85;
    box-shadow: 0 12px 36px rgba(0,0,0,0.6);
    transform: rotate(-4deg) scale(1.05);
    border: 2px solid var(--accent3);
  }
  .widget-drag-ghost img { width: 100%; height: 100%; object-fit: contain; background: var(--surface2); }

  /* ═══════════════════════════════════════════════════════════
     POKEMON-STYLE WIDGET CARD
  ═══════════════════════════════════════════════════════════ */
  .widget-card {
    width: 200px;
    height: 280px;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s;
    transform-style: preserve-3d;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06);
  }
  .widget-card:hover {
    transform: translateY(-6px) scale(1.04);
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(184,198,255,0.12);
  }
  .widget-card.rarity-legendary {
    background: linear-gradient(135deg, #2d1f00, #4a3200, #2d1f00);
    border-color: rgba(255,211,42,0.35);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(255,211,42,0.15);
  }
  .widget-card.rarity-legendary:hover {
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 50px rgba(255,211,42,0.3);
  }
  .widget-card-holosheen {
    position: absolute; inset: 0;
    background: linear-gradient(125deg,
      transparent 40%,
      rgba(184,198,255,0.06) 50%,
      rgba(109,120,255,0.08) 55%,
      transparent 65%
    );
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.3s;
    opacity: 0;
    animation: holoShift 4s ease-in-out infinite;
  }
  .widget-card:hover .widget-card-holosheen { opacity: 1; }
  @keyframes holoShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
  }
  .widget-card-rarity-bar {
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    z-index: 5;
  }
  .rarity-common  .widget-card-rarity-bar { background: linear-gradient(90deg, #8a8a8a, #c0c0c0); }
  .rarity-rare    .widget-card-rarity-bar { background: linear-gradient(90deg, #4466ff, #88aaff); }
  .rarity-epic    .widget-card-rarity-bar { background: linear-gradient(90deg, #9933cc, #cc66ff); }
  .rarity-legendary .widget-card-rarity-bar { background: linear-gradient(90deg, #cc8800, #ffd32a, #ffec80, #ffd32a); }
  .widget-card-inner {
    padding: 10px 10px 12px;
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  .widget-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
  }
  .widget-card-name {
    font-size: 11px;
    font-weight: 800;
    color: rgba(255,255,255,0.9);
    letter-spacing: 0.3px;
    line-height: 1.3;
    max-width: 120px;
  }
  .widget-card-rarity-badge {
    font-family: 'Space Mono', monospace;
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 2px 6px;
    border-radius: 4px;
  }
  .rarity-common  .widget-card-rarity-badge { background: rgba(192,192,192,0.15); color: #c0c0c0; border: 1px solid rgba(192,192,192,0.25); }
  .rarity-rare    .widget-card-rarity-badge { background: rgba(68,102,255,0.2); color: #88aaff; border: 1px solid rgba(68,102,255,0.35); }
  .rarity-epic    .widget-card-rarity-badge { background: rgba(153,51,204,0.2); color: #cc66ff; border: 1px solid rgba(153,51,204,0.35); }
  .rarity-legendary .widget-card-rarity-badge { background: rgba(255,211,42,0.2); color: #ffd32a; border: 1px solid rgba(255,211,42,0.35); }
  .widget-card-art {
    flex: 1;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    margin-bottom: 8px;
    position: relative;
  }
  .widget-card-art img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
  }
  .widget-card-art-placeholder {
    font-size: 48px;
    opacity: 0.8;
  }
  .widget-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .widget-card-type {
    font-family: 'Space Mono', monospace;
    font-size: 8px;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 1px;
  }
  .widget-card-id {
    font-family: 'Space Mono', monospace;
    font-size: 8px;
    color: rgba(255,255,255,0.2);
  }

  /* ═══════════════════════════════════════════════════════════
     REVAMPED BAG / INVENTORY
  ═══════════════════════════════════════════════════════════ */
  .bag-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
  }
  .bag-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
  }
  .bag-title span { color: var(--accent); }
  .bag-equipped-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 20px;
  }
  .bag-eq-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 20px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    font-size: 11px;
  }
  .bag-eq-chip-label {
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
  }
  .bag-eq-chip-val {
    font-weight: 700;
    color: var(--accent);
    font-size: 11px;
  }
  .bag-tabs {
    display: flex;
    gap: 3px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 20px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .bag-tabs::-webkit-scrollbar { display: none; }
  .bag-tab {
    flex: 1 1 0; min-width: 0; padding: 8px 6px;
    background: transparent; border: none; border-radius: 7px;
    color: var(--muted); font-family: 'Syne', sans-serif;
    font-size: 12px; font-weight: 700; cursor: pointer;
    transition: all 0.2s; white-space: nowrap;
    letter-spacing: 0.2px;
  }
  .bag-tab:hover { color: var(--text); }
  .bag-tab.active {
    background: var(--surface2); color: var(--accent);
    border: 1px solid var(--border);
  }
  /* Widget grid in bag */
  .bag-widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 4px;
  }
  /* Regular items grid */
  .bag-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }
  .bag-inv-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: border-color 0.15s;
  }
  .bag-inv-item:hover { border-color: rgba(184,198,255,0.25); }
  .bag-inv-item.equipped {
    border-color: var(--accent3);
    background: rgba(109,120,255,0.08);
  }
  .bag-inv-item-info { flex: 1; min-width: 0; }
  .bag-inv-item-name {
    font-size: 12px; font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .bag-inv-item-type {
    font-family: 'Space Mono', monospace;
    font-size: 9px; color: var(--muted);
    text-transform: uppercase; letter-spacing: 1px;
    margin-top: 2px;
  }

  /* Mystery pack section in bag */
  .mystery-pack-section {
    margin-top: 0;
  }

  /* ═══════════════════════════════════════════════════════════
     PACK OPENING MODAL
  ═══════════════════════════════════════════════════════════ */
  #packOpenOverlay {
    position: fixed; inset: 0; z-index: 10200;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(16px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.35s ease;
    overflow: hidden;
  }
  #packOpenOverlay.active { opacity: 1; pointer-events: all; }

  #packOpenParticles {
    position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  }
  .pack-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: packParticleFly ease-out forwards;
  }
  @keyframes packParticleFly {
    0%   { transform: translate(0,0) scale(1) rotate(0deg); opacity: 1; }
    100% { transform: translate(var(--px), var(--py)) scale(0) rotate(var(--pr)); opacity: 0; }
  }
  .pack-star {
    position: absolute;
    pointer-events: none;
    font-size: 18px;
    animation: packStarFly ease-out forwards;
  }
  @keyframes packStarFly {
    0%   { transform: translate(0,0) scale(1) rotate(0deg); opacity: 1; }
    100% { transform: translate(var(--px), var(--py)) scale(0.2) rotate(var(--pr)); opacity: 0; }
  }

  #packOpenStage {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%;
  }

  /* ─── SEALED PACK CARD ───────────────────────────────────── */
  .pack-phase-hidden { display: none !important; }

  #packSealedWrap {
    display: flex; flex-direction: column; align-items: center; gap: 20px;
  }
  #packSealedHint {
    font-family: 'Space Mono', monospace;
    font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
    color: var(--muted);
    animation: packHintPulse 1.5s ease-in-out infinite;
  }
  @keyframes packHintPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
  }

  #packSealedCard {
    width: 200px; height: 320px;
    border-radius: 18px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    animation: packFloat 3s ease-in-out infinite;
    background: linear-gradient(160deg, #1a1040 0%, #0d0820 40%, #1a1040 100%);
    border: 1px solid rgba(184,198,255,0.2);
    box-shadow:
      0 0 0 1px rgba(184,198,255,0.06),
      0 20px 60px rgba(0,0,0,0.8),
      0 0 80px rgba(109,120,255,0.15);
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s;
    user-select: none;
  }
  #packSealedCard:hover {
    transform: translateY(-8px) scale(1.04) rotate(1deg);
    box-shadow:
      0 0 0 1px rgba(184,198,255,0.12),
      0 30px 80px rgba(0,0,0,0.9),
      0 0 120px rgba(109,120,255,0.3);
    animation: none;
  }
  #packSealedCard.cracking {
    animation: packCrack 0.5s ease forwards !important;
  }
  @keyframes packFloat {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50% { transform: translateY(-12px) rotate(1deg); }
  }
  @keyframes packCrack {
    0%  { transform: scale(1) rotate(0deg); filter: brightness(1); }
    20% { transform: scale(1.08) rotate(-3deg); filter: brightness(1.4) saturate(1.5); }
    40% { transform: scale(1.12) rotate(3deg); filter: brightness(2) saturate(2); }
    60% { transform: scale(1.15) rotate(-1deg); filter: brightness(3) saturate(0.5); }
    80% { transform: scale(1.1) rotate(0deg); filter: brightness(4) blur(2px); }
    100%{ transform: scale(1.3) rotate(0deg); filter: brightness(8) blur(6px); opacity: 0; }
  }

  #packSealedSheen {
    position: absolute; inset: 0;
    background: linear-gradient(
      115deg,
      transparent 20%,
      rgba(255,255,255,0.04) 35%,
      rgba(184,198,255,0.12) 45%,
      rgba(109,120,255,0.1) 55%,
      transparent 70%
    );
    background-size: 300% 300%;
    animation: packSheenMove 4s ease-in-out infinite;
    pointer-events: none; z-index: 5;
    border-radius: 18px;
  }
  @keyframes packSheenMove {
    0%   { background-position: 0% 0%; }
    50%  { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
  }

  #packSealedTop {
    position: absolute; top: 0; left: 0; right: 0;
    padding: 14px 14px 0;
    z-index: 6;
  }
  #packSealedRarityBar {
    height: 3px; border-radius: 2px; margin-bottom: 10px;
    background: linear-gradient(90deg, var(--accent3), var(--accent));
  }
  #packSealedLabel {
    font-family: 'Space Mono', monospace;
    font-size: 9px; letter-spacing: 3px; text-transform: uppercase;
    color: rgba(184,198,255,0.6); margin-bottom: 3px;
  }
  #packSealedTier {
    font-size: 13px; font-weight: 800; color: rgba(255,255,255,0.9);
  }

  #packSealedArt {
    position: absolute;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 80px;
    z-index: 4;
    filter: drop-shadow(0 0 30px rgba(109,120,255,0.5));
    animation: packArtPulse 2s ease-in-out infinite;
  }
  @keyframes packArtPulse {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(109,120,255,0.4)); transform: translate(-50%,-50%) scale(1); }
    50% { filter: drop-shadow(0 0 50px rgba(109,120,255,0.8)) drop-shadow(0 0 80px rgba(184,198,255,0.3)); transform: translate(-50%,-50%) scale(1.05); }
  }

  /* Diagonal lines pattern on pack */
  #packSealedCard::before {
    content: '';
    position: absolute; inset: 0;
    background: repeating-linear-gradient(
      -45deg,
      transparent, transparent 12px,
      rgba(184,198,255,0.025) 12px, rgba(184,198,255,0.025) 13px
    );
    border-radius: 18px;
    z-index: 2;
    pointer-events: none;
  }

  #packSealedBottom {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 0 14px 14px;
    z-index: 6;
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  }
  #packSealedCost {
    font-family: 'Space Mono', monospace;
    font-size: 12px; color: var(--warn); font-weight: 700;
  }
  #packSealedSubtitle {
    font-family: 'Space Mono', monospace;
    font-size: 8px; letter-spacing: 2px;
    color: rgba(255,255,255,0.3); text-transform: uppercase;
  }

  #packSealedCrackLines {
    position: absolute; inset: 0; z-index: 7; pointer-events: none;
    border-radius: 18px; overflow: hidden;
    opacity: 0; transition: opacity 0.1s;
  }
  #packSealedCard.cracking #packSealedCrackLines { opacity: 1; }
  #packSealedCrackLines::before, #packSealedCrackLines::after {
    content: '';
    position: absolute;
    background: rgba(255,255,255,0.9);
    top: 0; bottom: 0;
  }
  #packSealedCrackLines::before { width: 1px; left: 50%; transform: rotate(8deg) scaleX(0.5); }
  #packSealedCrackLines::after  { width: 1px; left: 52%; transform: rotate(-12deg) scaleX(0.5); }

  /* ─── REVEAL PHASE ───────────────────────────────────────── */
  #packRevealWrap {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    animation: packRevealIn 0.6s cubic-bezier(0.34,1.56,0.64,1) both;
  }
  @keyframes packRevealIn {
    from { opacity: 0; transform: scale(0.7) translateY(30px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
  }
  #packRevealLabel {
    font-family: 'Space Mono', monospace;
    font-size: 10px; letter-spacing: 4px; text-transform: uppercase;
    color: var(--muted);
  }
  #packRevealRarity {
    font-family: 'Space Mono', monospace;
    font-size: 13px; letter-spacing: 3px; text-transform: uppercase;
    font-weight: 700; padding: 4px 14px; border-radius: 20px;
  }
  #packRevealCardSlot { position: relative; }

  /* Glow behind revealed card based on rarity */
  #packRevealCardSlot::before {
    content: '';
    position: absolute;
    inset: -20px;
    border-radius: 30px;
    background: var(--pack-glow, rgba(109,120,255,0.2));
    filter: blur(30px);
    z-index: -1;
    animation: revealGlowPulse 2s ease-in-out infinite;
  }
  @keyframes revealGlowPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
  }
  #packRevealName {
    font-size: 18px; font-weight: 800;
    color: var(--text); text-align: center;
    text-shadow: 0 0 20px rgba(184,198,255,0.3);
  }
  .mystery-pack-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(150,80,255,0.1), rgba(255,195,30,0.06));
    border: 1px solid rgba(150,80,255,0.25);
    margin-bottom: 20px;
  }
  .mystery-pack-banner-icon { font-size: 36px; flex-shrink: 0; }
  .mystery-pack-banner-text h3 {
    font-size: 15px; font-weight: 800; margin-bottom: 3px; color: var(--accent);
  }
  .mystery-pack-banner-text p {
    font-size: 12px; color: var(--muted); line-height: 1.5;
  }
  .widget-cards-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 4px 0 8px;
  }
  /* Owned badge on widget card */
  .widget-card-owned-badge {
    position: absolute;
    bottom: 8px; right: 8px;
    background: rgba(0,255,157,0.15);
    border: 1px solid rgba(0,255,157,0.35);
    border-radius: 6px;
    padding: 2px 7px;
    font-family: 'Space Mono', monospace;
    font-size: 8px;
    color: var(--correct);
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 20;
  }
  .widget-card-equip-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 15px;
    z-index: 15;
  }
  .widget-card:hover .widget-card-equip-overlay { opacity: 1; }
  .widget-card-equip-btn {
    padding: 8px 18px;
    border-radius: 8px;
    background: rgba(109,120,255,0.9);
    border: 1px solid var(--accent3);
    color: #fff;
    font-family: 'Syne', sans-serif;
    font-size: 12px; font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.3px;
  }
  .widget-card-equip-btn:hover { background: var(--accent3); }

  /* Widget slot indicators in bag */
  .widget-slots-status {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
  }
  .wss-slot {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border-radius: 8px;
    background: var(--surface2);
    border: 1px solid var(--border);
    font-size: 12px;
  }
  .wss-slot.filled { border-color: rgba(109,120,255,0.4); background: rgba(109,120,255,0.06); }
  .wss-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--border); flex-shrink: 0;
  }
  .wss-slot.filled .wss-dot { background: var(--accent3); box-shadow: 0 0 6px var(--accent3); }
  .wss-name { font-size: 11px; color: var(--muted); font-family: 'Space Mono', monospace; }
  .wss-slot.filled .wss-name { color: var(--accent); }

  /* ── AUTH MODAL ─────────────────────────────────────────── */
  #authOverlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(6,6,8,0.97);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(6px);
  }
  #authOverlay.hidden { display: none; }
  #authCard {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px 32px 28px;
    width: min(420px, 94vw);
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
    animation: slideIn 0.3s ease;
    position: relative;
  }
  #authCard .auth-logo {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--accent);
    letter-spacing: 3px;
    text-transform: uppercase;
    padding: 4px 8px;
    border: 1px solid var(--accent);
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 18px;
  }
  #authCard h2 {
    font-size: 22px; font-weight: 800; margin-bottom: 6px;
    letter-spacing: -0.3px;
  }
  #authCard h2 span { color: var(--accent); }
  #authCard .auth-sub {
    font-size: 13px; color: var(--muted); margin-bottom: 24px; line-height: 1.5;
  }
  .auth-field {
    display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px;
  }
  .auth-field label {
    font-family: 'Space Mono', monospace; font-size: 10px;
    text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted);
  }
  .auth-field input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    font-family: 'Syne', sans-serif;
    font-size: 14px;
    padding: 10px 13px;
    transition: border-color 0.2s;
    width: 100%;
  }
  .auth-field input:focus { outline: none; border-color: var(--accent3); }
  .auth-field input::placeholder { color: var(--muted); opacity: 0.6; }
  #authSubmitBtn {
    width: 100%; padding: 13px;
    background: rgba(0,255,157,0.1);
    border: 1px solid var(--accent);
    border-radius: 8px;
    color: var(--accent);
    font-family: 'Syne', sans-serif;
    font-size: 15px; font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 4px;
    letter-spacing: 0.3px;
  }
  #authSubmitBtn:hover { background: rgba(0,255,157,0.2); }
  #authSubmitBtn:disabled { opacity: 0.5; cursor: default; }
  .auth-toggle {
    text-align: center; margin-top: 16px;
    font-size: 13px; color: var(--muted);
  }
  .auth-toggle a {
    color: var(--accent3); cursor: pointer; text-decoration: underline;
  }
  .auth-guest-btn {
    width: 100%; padding: 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    font-family: 'Syne', sans-serif;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 10px;
  }
  .auth-guest-btn:hover { border-color: var(--muted); color: var(--text); }
  #authError {
    background: rgba(255,71,87,0.1);
    border: 1px solid rgba(255,71,87,0.3);
    border-radius: 7px;
    color: var(--wrong);
    font-size: 12px;
    padding: 9px 12px;
    margin-top: 10px;
    display: none;
    line-height: 1.5;
  }
  #authError.show { display: block; }
  #authMsg {
    background: rgba(0,255,157,0.08);
    border: 1px solid rgba(0,255,157,0.2);
    border-radius: 7px;
    color: var(--correct);
    font-size: 12px;
    padding: 9px 12px;
    margin-top: 10px;
    display: none;
    line-height: 1.5;
  }
  #authMsg.show { display: block; }
  /* Auth indicator in header */
  #authStatusBtn {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    padding: 4px 9px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
  }
  #authStatusBtn:hover { border-color: var(--accent); color: var(--accent); }
  .auth-spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(0,255,157,0.3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ── AUCTION ─────────────────────────────────────────────── */
  @keyframes bidPulse {
    0%   { box-shadow: 0 0 0 0 rgba(255,211,42,0.5); }
    70%  { box-shadow: 0 0 0 12px rgba(255,211,42,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,211,42,0); }
  }
  .bid-flash { animation: bidPulse 0.6s ease; }

  @keyframes bidRowIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  .bid-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    animation: bidRowIn 0.3s ease;
  }
  .bid-row.mine {
    background: rgba(109,120,255,0.1);
    border-color: rgba(109,120,255,0.3);
  }
  .bid-row.top {
    background: rgba(255,211,42,0.08);
    border-color: rgba(255,211,42,0.3);
  }
  .bid-row-crown { font-size: 14px; }
  .bid-row-name { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bid-row-amount { font-family: 'Space Mono', monospace; font-size: 12px; color: var(--warn); white-space: nowrap; }
  .bid-row-time { font-family: 'Space Mono', monospace; font-size: 10px; color: var(--muted); white-space: nowrap; }
  .auction-quick-btn {
    padding: 5px 11px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
  }
  .auction-quick-btn:hover { border-color: var(--warn); color: var(--warn); }
  #auctionCountdown.urgent { color: var(--wrong) !important; animation: bidPulse 1s infinite; }

  /* ── DEEP STUDY ─────────────────────────────────────────── */
  .ds-unit-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.18s;
    position: relative;
    overflow: hidden;
  }
  .ds-unit-card:hover { border-color: var(--accent3); transform: translateY(-2px); }
  .ds-unit-card .ds-unit-num {
    font-family: 'Space Mono', monospace;
    font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
    color: var(--muted); margin-bottom: 4px;
  }
  .ds-unit-card .ds-unit-name { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
  .ds-unit-card .ds-unit-bar {
    height: 3px; background: var(--border); border-radius: 2px; overflow: hidden;
  }
  .ds-unit-card .ds-unit-bar-fill {
    height: 100%; border-radius: 2px; background: var(--accent);
    transition: width 0.4s ease;
  }
  .ds-unit-card .ds-unit-stats {
    font-family: 'Space Mono', monospace; font-size: 10px; color: var(--muted);
    margin-top: 6px; display: flex; gap: 10px;
  }
  .ds-unit-card .ds-mastery-badge {
    position: absolute; top: 10px; right: 10px;
    font-family: 'Space Mono', monospace; font-size: 10px;
    padding: 2px 7px; border-radius: 20px;
    background: rgba(0,255,157,0.1); color: var(--correct);
    border: 1px solid rgba(0,255,157,0.2);
  }
  @keyframes dsFlipIn {
    from { opacity: 0; transform: rotateX(-8deg) translateY(12px); }
    to   { opacity: 1; transform: rotateX(0) translateY(0); }
  }
  #dsCardFront, #dsCardBack { animation: dsFlipIn 0.25s ease; }
  .ds-keyword {
    font-weight: 800; color: var(--accent);
    background: rgba(0,255,157,0.08);
    border-radius: 3px; padding: 0 2px;
  }
  .ds-keyword-match {
    font-weight: 800; color: var(--correct);
    background: rgba(0,255,157,0.15);
    border-radius: 3px; padding: 0 2px;
    position: relative;
  }
  .ds-queue-dot {
    width: 10px; height: 10px; border-radius: 50%;
    flex-shrink: 0; transition: opacity 0.3s;
  }
  @keyframes dsGradeIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
  }
  #dsAnswerReveal { animation: dsGradeIn 0.2s ease; }
  .ds-user-answer-compared {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; padding: 10px 12px; margin-bottom: 12px;
    font-size: 13px; line-height: 1.6;
  }
  .ds-user-answer-compared .match { color: var(--correct); font-weight: 700; }
  .ds-user-answer-compared .miss  { color: var(--muted); text-decoration: line-through; }

  /* ─── ENHANCED FILL-IN-BLANK ─────────────────────────────── */
  .fill-card-enhanced .fill-blank {
    display: inline-flex;
    align-items: center;
    min-width: 110px;
    border-bottom: 2px solid var(--accent3);
    padding: 2px 10px;
    margin: 0 4px;
    text-align: center;
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    border-radius: 5px;
    transition: all 0.2s;
    cursor: pointer;
    user-select: none;
  }
  .fill-card-enhanced .fill-blank:not(.revealed):not(.wrong-reveal):hover {
    background: rgba(109,120,255,0.08);
  }
  .fill-card-enhanced .fill-blank.filled {
    background: rgba(109,120,255,0.12);
    border-bottom-color: var(--accent);
    color: var(--text);
    animation: fillSnap 0.22s cubic-bezier(0.34,1.56,0.64,1);
  }
  @keyframes fillSnap {
    0%   { transform: scale(0.88); }
    60%  { transform: scale(1.07); }
    100% { transform: scale(1); }
  }
  .fill-card-enhanced .fill-blank.revealed {
    background: rgba(0,255,157,0.1);
    border-bottom-color: var(--correct);
    color: var(--correct);
    animation: fillReveal 0.3s ease;
  }
  .fill-card-enhanced .fill-blank.wrong-reveal {
    background: rgba(255,71,87,0.1);
    border-bottom-color: var(--wrong);
    color: var(--wrong);
    animation: fillWrong 0.35s ease;
  }
  @keyframes fillReveal {
    0%   { transform: scale(0.9); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
  }
  @keyframes fillWrong {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-5px); }
    40%     { transform: translateX(5px); }
    60%     { transform: translateX(-4px); }
    80%     { transform: translateX(4px); }
  }

  /* Pip progress row */
  .fill-pip-row { display: flex; gap: 5px; align-items: center; }
  .fill-pip {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--border);
    border: 1px solid var(--border);
    transition: all 0.2s;
  }
  .fill-pip.active  { background: var(--accent3); border-color: var(--accent3); box-shadow: 0 0 6px var(--accent3); }
  .fill-pip.correct { background: var(--correct);  border-color: var(--correct);  animation: pipPop 0.3s cubic-bezier(0.34,1.56,0.64,1); }
  .fill-pip.wrong   { background: var(--wrong);    border-color: var(--wrong); }
  @keyframes pipPop { 0%{transform:scale(0.5)} 70%{transform:scale(1.3)} 100%{transform:scale(1)} }

  /* Chip enhancements */
  .fill-choices-enhanced { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
  .fill-choices-enhanced .fill-chip {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 600;
  }
  .fill-choices-enhanced .fill-chip:hover:not(.used):not(.locked) {
    border-color: var(--accent3);
    background: rgba(109,120,255,0.12);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(109,120,255,0.2);
  }
  .fill-choices-enhanced .fill-chip.used {
    opacity: 0.25;
    cursor: default;
    transform: scale(0.95);
  }
  .fill-choices-enhanced .fill-chip.locked { cursor: default; }

  /* Streak badge */
  .fill-streak {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(255,165,0,0.12);
    border: 1px solid rgba(255,165,0,0.3);
    color: #ffaa44;
    animation: streakPulse 1.2s ease-in-out infinite;
  }
  @keyframes streakPulse {
    0%,100% { box-shadow: 0 0 0 rgba(255,165,0,0); }
    50%     { box-shadow: 0 0 10px rgba(255,165,0,0.35); }
  }

  /* Explanation animation */
  .fill-exp-anim {
    animation: expSlideIn 0.35s ease;
  }
  @keyframes expSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* ─── ENHANCED SEQUENCE / TIMELINE ──────────────────────── */
  .seq-card-enhanced .seq-tl-hint {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 14px;
    opacity: 0.7;
  }
  .seq-timeline { display: flex; flex-direction: column; gap: 0; margin-bottom: 4px; }

  .seq-timeline-item {
    display: flex;
    gap: 12px;
    align-items: stretch;
    cursor: grab;
    transition: transform 0.15s, opacity 0.15s;
    animation: seqItemIn 0.25s ease both;
  }
  @keyframes seqItemIn {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  .seq-timeline-item:active { cursor: grabbing; }
  .seq-timeline-item.dragging { opacity: 0.45; transform: scale(0.97); }
  .seq-timeline-item.drag-over .seq-tl-body {
    border-color: var(--accent);
    background: rgba(184,198,255,0.07);
  }
  .seq-timeline-item.seq-correct { animation: seqCorrectPop 0.35s ease both; }
  .seq-timeline-item.seq-wrong   { animation: seqWrongShake 0.4s ease both; }
  @keyframes seqCorrectPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.03) translateX(4px); }
    100% { transform: scale(1); }
  }
  @keyframes seqWrongShake {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-6px); }
    40%     { transform: translateX(5px); }
    60%     { transform: translateX(-4px); }
    80%     { transform: translateX(3px); }
  }

  /* Left column: node + connector line */
  .seq-tl-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 28px;
    flex-shrink: 0;
    padding-top: 12px;
  }
  .seq-tl-node {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Space Mono', monospace;
    font-size: 11px; font-weight: 700;
    color: var(--muted);
    background: var(--surface2);
    flex-shrink: 0;
    transition: all 0.25s;
    z-index: 1;
  }
  .seq-tl-line {
    width: 2px;
    flex: 1;
    min-height: 10px;
    background: var(--border);
    margin: 3px 0;
    border-radius: 1px;
    transition: background 0.3s;
  }

  /* Right body */
  .seq-tl-body {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface2);
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    transition: all 0.2s;
    min-height: 46px;
  }
  .seq-tl-body:hover { border-color: rgba(184,198,255,0.2); }
  .seq-tl-handle {
    font-size: 16px;
    color: var(--border);
    flex-shrink: 0;
    transition: color 0.15s;
  }
  .seq-timeline-item:hover .seq-tl-handle { color: var(--accent3); }
  .seq-tl-text { flex: 1; }
  .seq-tl-correct-pos {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: var(--wrong);
    flex-shrink: 0;
    opacity: 0.8;
  }

  /* Result banner */
  .seq-result-banner {
    padding: 8px 14px;
    border-radius: 8px;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 12px;
    animation: expSlideIn 0.3s ease;
  }
  .seq-result-banner.correct {
    background: rgba(0,255,157,0.08);
    border: 1px solid rgba(0,255,157,0.25);
    color: var(--correct);
  }
  .seq-result-banner.wrong {
    background: rgba(255,71,87,0.08);
    border: 1px solid rgba(255,71,87,0.2);
    color: var(--wrong);
  }
  .seq-exp-anim { animation: expSlideIn 0.35s ease; }

  /* ── Mascot radial context menu ──────────────────────────── */
  #mascotCtxMenu {
    position: fixed;
    z-index: 10500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease;
  }
  #mascotCtxMenu.show {
    pointer-events: all;
    opacity: 1;
  }
  .mctx-ring {
    position: relative;
    width: 0; height: 0;
  }
  .mctx-btn {
    position: absolute;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(10,10,16,0.97);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transform: translate(-50%, -50%) scale(0.6);
    transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1),
                border-color 0.15s, background 0.15s, opacity 0.22s;
    opacity: 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    user-select: none;
  }
  #mascotCtxMenu.show .mctx-btn {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  .mctx-btn:nth-child(1) { transition-delay: 0.03s; }
  .mctx-btn:nth-child(2) { transition-delay: 0.06s; }
  .mctx-btn:nth-child(3) { transition-delay: 0.09s; }
  .mctx-btn:hover {
    transform: translate(-50%, -50%) scale(1.18) !important;
    border-color: var(--accent3);
    background: rgba(123,97,255,0.18);
  }
  .mctx-btn.active-state {
    border-color: var(--correct);
    background: rgba(0,255,157,0.12);
    color: var(--correct);
  }
  .mctx-btn.muted-state {
    border-color: var(--wrong);
    background: rgba(255,71,87,0.12);
    color: var(--wrong);
  }
  .mctx-label {
    position: absolute;
    left: 50%; top: 100%;
    transform: translateX(-50%);
    margin-top: 5px;
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s 0.1s;
  }
  #mascotCtxMenu.show .mctx-btn:hover .mctx-label { opacity: 1; }
  /* dismiss backdrop */
  #mascotCtxBackdrop {
    display: none;
    position: fixed; inset: 0;
    z-index: 10499;
  }
  #mascotCtxBackdrop.show { display: block; }

/* ══════════════════════════════════════════════════════════
   SIDEBAR LAYOUT — Variant 2: Wide sidebar, player profile + nav
   Faithful to neuroverse_sidebar_explorations.html
══════════════════════════════════════════════════════════ */

/* ── Page shell ── */
#pageShell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Sidebar ── */
#sidebar {
  width: 140px;
  flex-shrink: 0;
  background: #07070a;
  border-right: 1px solid #111114;
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
  gap: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  transition: transform 0.28s cubic-bezier(0.22,1,0.36,1);
}
#sidebar::-webkit-scrollbar { display: none; }
#sidebar.collapsed { transform: translateX(-140px); }

/* ── Toggle arrow ── */
#sidebarToggle {
  position: fixed;
  top: 50%;
  left: 140px;
  transform: translateY(-50%);
  z-index: 300;
  width: 16px;
  height: 44px;
  background: #0d0d10;
  border: 1px solid #111114;
  border-left: none;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #252528;
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  transition: left 0.28s cubic-bezier(0.22,1,0.36,1), color 0.15s;
  user-select: none;
  padding: 0;
  line-height: 1;
}
#sidebarToggle:hover { color: #555560; }
#sidebarToggle.collapsed {
  left: 0;
  border-left: 1px solid #111114;
  border-right: none;
  border-radius: 6px 0 0 6px;
}

/* ── App wrap ── */
#appWrap {
  margin-left: 140px;
  flex: 1;
  min-width: 0;
  transition: margin-left 0.28s cubic-bezier(0.22,1,0.36,1);
}
#appWrap.expanded { margin-left: 0; }

/* ── App container ── */
#app {
  position: relative;
  z-index: 1;
  max-width: none;
  margin: 0;
  padding: 16px 20px 24px;
}

/* ─── Sidebar atoms ─────────────────────────────────── */

/* Logo + title block */
.sb-top { margin-bottom: 16px; }
.sb-logo-badge {
  font-family: 'Space Mono', monospace;
  font-size: 8px;
  color: #09090b;
  background: #e0e0e8;
  padding: 3px 7px;
  border-radius: 2px;
  letter-spacing: 2px;
  display: inline-block;
  margin-bottom: 8px;
}
.sb-site-name {
  font-size: 9px;
  color: #252528;
  letter-spacing: 1px;
}

/* Player card */
.sb-player-card {
  background: #0f0f12;
  border: 1px solid #1a1a1a;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 14px;
}
.sb-player-name {
  font-size: 10px;
  font-weight: 700;
  color: #e0e0e8;
  margin-bottom: 3px;
  font-family: 'Syne', sans-serif;
}
.sb-player-sub {
  font-size: 8px;
  color: #333340;
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.sb-prog-track {
  height: 2px;
  background: #1a1a1a;
  border-radius: 1px;
  margin-bottom: 6px;
}
.sb-prog-fill {
  height: 2px;
  background: #e0e0e8;
  border-radius: 1px;
  transition: width 0.4s ease;
}
.sb-coins-row {
  display: flex;
  align-items: center;
}
.sb-coin-item {
  font-size: 8px;
  color: #444450;
  font-family: 'Space Mono', monospace;
}

/* Section labels */
.sb-section {
  font-size: 8px;
  letter-spacing: 2px;
  color: #252528;
  margin-bottom: 6px;
  padding: 0 2px;
  font-family: 'Space Mono', monospace;
}

/* Nav */
.sb-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 10px;
}
.sb-nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-radius: 5px;
  border: none;
  background: transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.12s;
}
.sb-nav-item:hover { background: #111114; }
.sb-nav-item.active { background: #1a1a1e; }

.sb-code {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.05em;
  color: #252528;
  flex-shrink: 0;
}
.sb-code-lit { color: #e0e0e8; }
.sb-label {
  font-size: 8px;
  color: #1a1a1e;
  margin-left: auto;
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.03em;
}
.sb-label-mid { color: #555560; }
.sb-active-dot {
  width: 4px;
  height: 4px;
  background: #e0e0e8;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Mascot footer */
.sb-mascot-foot {
  border-top: 1px solid #111114;
  padding-top: 8px;
  margin-top: 10px;
}
.sb-mascot-label {
  font-size: 8px;
  color: #1a1a1e;
  text-align: center;
  letter-spacing: 1px;
  font-family: 'Space Mono', monospace;
}

/* ─── Content pane header ──────────────────────────── */
.header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #111114;
}
.breadcrumb-head {
  display: flex;
  align-items: center;
  gap: 5px;
}
.bc-section {
  font-family: 'Space Mono', monospace;
  font-size: 8px;
  color: #252528;
  letter-spacing: 1px;
}
.bc-sep {
  font-size: 8px;
  color: #1c1c20;
  font-family: 'Space Mono', monospace;
}
.bc-active {
  font-family: 'Space Mono', monospace;
  font-size: 8px;
  color: #e0e0e8;
  letter-spacing: 1px;
}
.bc-pills {
  display: flex;
  gap: 5px;
  align-items: center;
  margin-left: auto;
}
.bc-pill {
  font-size: 8px;
  border: 1px solid #1a1a1a;
  padding: 2px 7px;
  border-radius: 20px;
  color: #333340;
  font-family: 'Space Mono', monospace;
}

/* Stats-header btn stays minimal */
.stats-header-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 13px;
  opacity: 0.35;
  transition: opacity 0.15s;
  padding: 0 2px;
  margin-left: 4px;
}
.stats-header-btn:hover { opacity: 0.7; }

/* Keep widget columns above sidebar */
.widget-column { z-index: 201; }

/* Tabs row hidden — replaced by sidebar */
.tabs { display: none !important; }
/* ═══════════════════════════════════════════════════════════════════════════
   NEUROVERSE — YOFUKASHI NO UTA AESTHETIC OVERHAUL
   Dark monochromatic · desaturated · terminal-sleek · cinematic B&W
   Applies to all content pages: flashcard, kana, mcq, review, shop, bag, casino
   Sidebar untouched.
═══════════════════════════════════════════════════════════════════════════ */

/* ── Override root palette to pure monochromatic ──────────────────────── */
:root {
  --bg:      #060608;
  --surface: #0d0d10;
  --surface2:#111114;
  --border:  #1e1e22;
  --accent:  #e0e0e8;      /* pure near-white — only accent now */
  --accent2: #b0b0b8;
  --accent3: #888890;
  --text:    #d8d8e0;
  --muted:   #42424a;
  --correct: #c8c8d0;      /* desaturated — no more bright green */
  --wrong:   #58585e;
  --warn:    #888890;
  /* keep color refs but neutralise them */
}

/* ── Grain texture overlay on body ───────────────────────────────────────*/
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9995;
  opacity: 1;
  mix-blend-mode: overlay;
}

/* ── Grid bg — keep but desaturate ───────────────────────────────────── */
body::before {
  background-image:
    linear-gradient(rgba(224,224,232,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(224,224,232,0.018) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* ── Page enter animation ─────────────────────────────────────────────── */
@keyframes pageReveal {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
#app {
  animation: pageReveal 0.5s cubic-bezier(0.22,1,0.36,1) both;
}


/* ══ HEADER breadcrumb ════════════════════════════════════════════════════ */
.header {
  border-bottom: 1px solid #111114;
  padding-bottom: 12px;
  margin-bottom: 18px;
}

/* ══ UNIT FILTER BAR ══════════════════════════════════════════════════════ */
.unit-bar {
  gap: 4px;
  margin-bottom: 18px;
}
.unit-btn {
  padding: 4px 10px;
  border-radius: 3px;
  border: 1px solid #1a1a1e;
  background: transparent;
  color: #2a2a32;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
}
.unit-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(224,224,232,0.04), transparent);
  opacity: 0;
  transition: opacity 0.15s;
}
.unit-btn:hover {
  border-color: #333340;
  color: #888890;
}
.unit-btn:hover::after { opacity: 1; }
.unit-btn.active {
  background: #111114;
  border-color: #e0e0e8;
  color: #e0e0e8;
  box-shadow: 0 0 0 1px #e0e0e8 inset;
}

/* ══ CARDS — refined mono ═════════════════════════════════════════════════ */
.card {
  background: #0d0d10;
  border: 1px solid #1a1a1e;
  border-radius: 6px;
  padding: 22px 20px;
  margin-bottom: 12px;
  animation: cardDrop 0.3s cubic-bezier(0.22,1,0.36,1) both;
  position: relative;
  overflow: hidden;
}
@keyframes cardDrop {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(224,224,232,0.15), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.card.active-card::before { opacity: 1; }
.card.active-card {
  border-color: #252528;
}

/* ══ FLASHCARD ════════════════════════════════════════════════════════════ */
.flashcard {
  transition: transform 0.55s cubic-bezier(0.4,0,0.2,1);
  border-radius: 6px;
}
.fc-front, .fc-back {
  border-radius: 6px;
  padding: 40px 28px;
  border: 1px solid #1a1a1e;
}
.fc-front {
  background: #0d0d10;
}
.fc-back {
  background: #111114;
  border-color: #252528;
  transform: rotateY(180deg);
}
.fc-hint {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  color: #2a2a32;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 20px;
}
.fc-front .fc-hint { color: #333340; }
.fc-back .fc-hint  { color: #555560; }

/* Large kanji on flashcard */
.fc-text {
  font-size: clamp(60px, 12vw, 96px);
  font-weight: 400;
  color: #d8d8e0;
  font-family: 'Noto Sans JP', sans-serif;
  line-height: 1;
}
.fc-back .fc-text {
  font-size: clamp(14px, 2.5vw, 16px);
  font-weight: 400;
  color: #888890;
  font-family: 'Space Mono', monospace;
  line-height: 1.9;
  letter-spacing: 0.02em;
}

/* ══ SELF RATE BUTTONS ════════════════════════════════════════════════════ */
.self-rate { margin-top: 14px; gap: 6px; }
.rate-btn {
  flex: 1;
  padding: 10px 8px;
  border-radius: 3px;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.rate-btn.got-it {
  border-color: #333340;
  color: #888890;
  background: transparent;
}
.rate-btn.got-it:hover {
  border-color: #e0e0e8;
  color: #e0e0e8;
  background: rgba(224,224,232,0.05);
}
.rate-btn.missed {
  border-color: #1a1a1e;
  color: #333340;
  background: transparent;
}
.rate-btn.missed:hover {
  border-color: #444450;
  color: #888890;
}

/* ══ BUTTONS — mono terminal ══════════════════════════════════════════════ */
.btn {
  padding: 10px 18px;
  border-radius: 3px;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(224,224,232,0.04);
  opacity: 0;
  transition: opacity 0.12s;
}
.btn:hover::after { opacity: 1; }

.btn-primary {
  background: transparent;
  border: 1px solid #e0e0e8;
  color: #e0e0e8;
}
.btn-primary:hover {
  background: rgba(224,224,232,0.07);
}
.btn-secondary {
  background: transparent;
  border: 1px solid #1e1e22;
  color: #888890;
}
.btn-secondary:hover {
  border-color: #333340;
  color: #b0b0b8;
}
.btn-orange {
  background: transparent;
  border-color: #333340;
  color: #555560;
}
.btn-orange:hover {
  border-color: #888890;
  color: #b0b0b8;
}
.btn-danger {
  background: transparent;
  border-color: #2a2a2e;
  color: #444450;
}
.btn-danger:hover {
  border-color: #888890;
  color: #e0e0e8;
}

/* ══ STATS BAR ════════════════════════════════════════════════════════════ */
.stats-bar {
  background: #0d0d10;
  border: 1px solid #1a1a1e;
  border-radius: 4px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.stat-val { font-size: 18px; color: #e0e0e8; }
.stat-val.green { color: #b0b0b8; }
.stat-val.red   { color: #555560; }
.stat-val.purple{ color: #888890; }
.stat-label {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  color: #2a2a32;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ══ PROGRESS DOTS ════════════════════════════════════════════════════════ */
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #1a1a1e;
  transition: background 0.2s, transform 0.2s;
}
.dot.current {
  background: #e0e0e8;
  box-shadow: 0 0 6px rgba(224,224,232,0.3);
  transform: scale(1.2);
}
.dot.correct { background: #555560; }
.dot.wrong   { background: #2a2a2e; }

/* ══ MCQ OPTIONS ══════════════════════════════════════════════════════════ */
.option {
  padding: 12px 16px;
  border-radius: 4px;
  border: 1px solid #1a1a1e;
  background: #0d0d10;
  color: #555560;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.18s ease;
  letter-spacing: 0.02em;
}
.option:hover:not(.locked) {
  border-color: #333340;
  background: #111114;
  color: #b0b0b8;
}
.option .opt-letter {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  color: #2a2a32;
  letter-spacing: 2px;
}
.option.correct {
  border-color: #e0e0e8;
  background: rgba(224,224,232,0.04);
  color: #d8d8e0;
}
.option.correct * { color: #d8d8e0 !important; }
.option.correct .opt-letter { color: #888890 !important; }
.option.wrong {
  border-color: #252528;
  background: transparent;
  color: #333340;
}
.option.wrong * { color: #444450 !important; }
.option.dim { opacity: 0.25; }

/* ══ EXPLANATION ══════════════════════════════════════════════════════════ */
.explanation {
  padding: 12px 14px;
  border-radius: 3px;
  background: #0d0d10;
  border-left: 2px solid #333340;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  line-height: 1.75;
  color: #888890;
}
.explanation strong { color: #b0b0b8; }

/* ══ SECTION LABEL ════════════════════════════════════════════════════════ */
.section-label {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #2a2a32;
  margin-bottom: 12px;
}

/* ══ FLASH SUB-NAV ════════════════════════════════════════════════════════ */
#flashSubNav .unit-btn {
  font-size: 9px;
  letter-spacing: 2px;
}

/* ══ KANA MODE ════════════════════════════════════════════════════════════ */
.kana-grid {
  display: grid;
  gap: 3px;
}
/* Override any bright kana cell colours */
.kana-cell, .kana-btn {
  background: #0d0d10 !important;
  border: 1px solid #1a1a1e !important;
  border-radius: 3px !important;
  color: #555560 !important;
  font-family: 'Noto Sans JP', sans-serif !important;
  transition: all 0.15s ease !important;
}
.kana-cell:hover, .kana-btn:hover {
  border-color: #333340 !important;
  color: #b0b0b8 !important;
}
.kana-cell.selected, .kana-btn.selected, .kana-cell.active, .kana-btn.active {
  border-color: #e0e0e8 !important;
  color: #e0e0e8 !important;
  background: rgba(224,224,232,0.04) !important;
}
.kana-cell.correct, .kana-btn.correct {
  border-color: #444450 !important;
  color: #888890 !important;
  background: rgba(224,224,232,0.03) !important;
}
.kana-cell.wrong, .kana-btn.wrong {
  border-color: #252528 !important;
  color: #2a2a32 !important;
}

/* ══ INVENTORY / BAG ══════════════════════════════════════════════════════ */
.bag-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #111114;
}
.bag-title {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 3px;
  color: #555560;
  text-transform: uppercase;
}
.bag-title span { color: #e0e0e8; }

/* Bag panel tabs */
.bag-tabs, .inv-cat-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.bag-tab, .inv-cat-btn {
  padding: 5px 10px;
  border-radius: 2px;
  border: 1px solid transparent;
  background: transparent;
  color: #2a2a32;
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
}
.bag-tab:hover, .inv-cat-btn:hover {
  color: #888890;
  border-color: #1a1a1e;
}
.bag-tab.active, .inv-cat-btn.active {
  color: #e0e0e8;
  border-color: #333340;
  background: #111114;
}

/* Inventory item grid */
.inv-item-card, .inv-card {
  background: #0d0d10 !important;
  border: 1px solid #1a1a1e !important;
  border-radius: 4px !important;
  transition: border-color 0.18s ease, transform 0.15s ease !important;
  position: relative;
  overflow: hidden;
}
.inv-item-card::before, .inv-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(224,224,232,0.1), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.inv-item-card:hover::before, .inv-card:hover::before { opacity: 1; }
.inv-item-card:hover, .inv-card:hover {
  border-color: #2a2a2e !important;
  transform: translateY(-1px);
}

/* Equip button */
.inv-equip-btn {
  background: transparent;
  border: 1px solid #1e1e22;
  border-radius: 2px;
  color: #555560;
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 4px 10px;
  transition: all 0.15s;
}
.inv-equip-btn:hover {
  border-color: #e0e0e8;
  color: #e0e0e8;
}
.inv-equip-btn.equipped {
  border-color: #888890;
  color: #b0b0b8;
  background: rgba(224,224,232,0.04);
}

/* Rarity badges — all desaturated */
.rarity-common    { color: #555560; border-color: #1e1e22; }
.rarity-rare      { color: #888890; border-color: #333340; }
.rarity-epic      { color: #b0b0b8; border-color: #555560; }
.rarity-legendary { color: #e0e0e8; border-color: #888890; }

/* ══ SHOP MODE ════════════════════════════════════════════════════════════ */
.shop-item-card {
  background: #0d0d10;
  border: 1px solid #1a1a1e;
  border-radius: 4px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.shop-item-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(224,224,232,0.02), transparent 60%);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.shop-item-card:hover {
  border-color: #252528;
  transform: translateY(-1px);
}
.shop-item-card:hover::after { opacity: 1; }

.shop-price {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: #888890;
}
.shop-buy-btn {
  background: transparent;
  border: 1px solid #333340;
  color: #888890;
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  border-radius: 2px;
  cursor: pointer;
  padding: 5px 12px;
  transition: all 0.18s;
}
.shop-buy-btn:hover {
  border-color: #e0e0e8;
  color: #e0e0e8;
  background: rgba(224,224,232,0.04);
}

/* ══ CASINO MODE — stripped terminals ═════════════════════════════════════ */
.casino-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 14px;
}
.casino-tab {
  padding: 6px 12px;
  border-radius: 2px;
  border: 1px solid transparent;
  background: transparent;
  color: #2a2a32;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
}
.casino-tab:hover { color: #888890; border-color: #1a1a1e; }
.casino-tab.active {
  border-color: #333340;
  color: #e0e0e8;
  background: #111114;
}

/* Slot grid */
.slot-grid-5 {
  gap: 3px;
}
.slot-cell {
  background: #0d0d10 !important;
  border: 1px solid #1a1a1e !important;
  border-radius: 3px !important;
  font-size: 18px;
  transition: all 0.1s;
  filter: grayscale(1);
}
.slot-cell.highlight {
  border-color: #e0e0e8 !important;
  box-shadow: 0 0 8px rgba(224,224,232,0.15);
  filter: grayscale(0.5);
}

/* Slot bet buttons */
.slot-bet-btn {
  background: transparent;
  border: 1px solid #1a1a1e;
  border-radius: 2px;
  color: #333340;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.slot-bet-btn:hover { border-color: #333340; color: #888890; }
.slot-bet-btn.active { border-color: #e0e0e8; color: #e0e0e8; }

/* BJ chips */
.bj-chip {
  background: transparent;
  border: 1px solid #1a1a1e;
  border-radius: 50%;
  width: 40px; height: 40px;
  color: #555560;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.bj-chip:hover {
  border-color: #e0e0e8;
  color: #e0e0e8;
}
.bj-chip.selected {
  border-color: #e0e0e8;
  color: #e0e0e8;
  background: rgba(224,224,232,0.05);
}

/* Cards in blackjack */
.bj-card {
  background: #111114 !important;
  border: 1px solid #252528 !important;
  border-radius: 4px !important;
  color: #e0e0e8 !important;
  font-family: 'Space Mono', monospace !important;
  box-shadow: none !important;
}
.bj-card .suit-red { color: #888890 !important; }

/* ══ REVIEW / LEARNED ═════════════════════════════════════════════════════ */
#reviewMode, #learnedMode {
  padding: 0;
}
.empty-state-icon {
  font-size: 32px;
  opacity: 0.15;
  margin-bottom: 14px;
}
/* Override colorful empty states */
#reviewMode > div, #learnedMode > div {
  background: transparent !important;
  border: none !important;
}
#reviewMode .card, #learnedMode .card {
  border: 1px dashed #1a1a1e;
  background: transparent;
}

/* ══ DEEP STUDY PANEL ════════════════════════════════════════════════════ */
#dsUnitGrid {
  gap: 8px;
}
/* Unit cards in deep study */
#dsUnitGrid > div {
  background: #0d0d10 !important;
  border: 1px solid #1a1a1e !important;
  border-radius: 4px !important;
  transition: border-color 0.15s, transform 0.15s !important;
}
#dsUnitGrid > div:hover {
  border-color: #e0e0e8 !important;
  transform: translateY(-1px) !important;
}
#dsProgressFill {
  background: #e0e0e8 !important;
}
#dsMascotBubble {
  background: #0d0d10 !important;
  border-color: #1a1a1e !important;
  border-radius: 4px !important;
}
#dsAnswerInput {
  background: #080808 !important;
  border-color: #1a1a1e !important;
  border-radius: 3px !important;
  color: #d8d8e0 !important;
  font-family: 'Space Mono', monospace !important;
  font-size: 12px !important;
}
#dsAnswerInput:focus { border-color: #555560 !important; }

/* ══ MYSTERY PACK / SHOP PACKS ═══════════════════════════════════════════ */
.mystery-pack-banner {
  background: #0d0d10;
  border: 1px solid #1a1a1e;
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 14px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.mystery-pack-banner-icon {
  font-size: 24px;
  filter: grayscale(1) opacity(0.4);
}
.mystery-pack-banner h3 {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: #888890;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.mystery-pack-banner p {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: #333340;
  line-height: 1.7;
}

/* Widget slot status */
.widget-slots-status {
  margin-bottom: 14px;
}
.widget-slot-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 3px;
  border: 1px solid #1a1a1e;
  margin-bottom: 4px;
  background: #0d0d10;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: #333340;
}

/* Question packs */
.qpack-card {
  background: #0d0d10 !important;
  border: 1px solid #1a1a1e !important;
  border-radius: 4px !important;
  transition: border-color 0.2s !important;
}
.qpack-card:hover { border-color: #333340 !important; }
.qpack-price {
  font-family: 'Space Mono', monospace;
  color: #888890;
}

/* ══ PASS / SHARD ════════════════════════════════════════════════════════ */
.shard-bar-bg {
  background: #111114;
  border: 1px solid #1a1a1e;
}
.shard-bar-fill {
  background: #e0e0e8 !important;
}

/* ══ MASCOT PANEL ════════════════════════════════════════════════════════ */
#mascotPreviewStrip {
  background: #0d0d10 !important;
  border-color: #1a1a1e !important;
  border-radius: 4px !important;
}
.mcfg-btn {
  background: transparent;
  border: 1px solid #1a1a1e;
  border-radius: 2px;
  color: #333340;
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 4px 10px;
  transition: all 0.15s;
}
.mcfg-btn:hover { border-color: #555560; color: #888890; }
.mcfg-btn.active { border-color: #e0e0e8; color: #e0e0e8; background: rgba(224,224,232,0.04); }

/* ══ MODALS ══════════════════════════════════════════════════════════════ */
#statsModal, #resetModal, #lootBoxOverlay, #authOverlay, #widgetPlaceModal {
  background: rgba(0,0,0,0.85) !important;
  backdrop-filter: blur(12px);
}
#statsModalCard, #resetModalCard, #lootBoxCard, #authCard, #widgetPlaceCard {
  background: #0d0d10 !important;
  border: 1px solid #1e1e22 !important;
  border-radius: 6px !important;
  padding: 24px 20px !important;
}
#statsModalCard::before {
  background: #1a1a1e !important;
}

/* Auth card */
#authCard .auth-logo {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 3px;
  color: #2a2a32;
  background: none;
  border: 1px solid #1a1a1e;
  padding: 4px 10px;
  border-radius: 2px;
  display: inline-block;
  margin-bottom: 16px;
}
#authCard h2 {
  font-family: 'Space Mono', monospace;
  font-size: 14px;
  font-weight: 400;
  color: #888890;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
#authCard h2 span { color: #e0e0e8; }
#authCard .auth-sub {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: #2a2a32;
  margin-bottom: 20px;
  line-height: 1.6;
}
.auth-field label {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: #333340;
  text-transform: uppercase;
  display: block;
  margin-bottom: 5px;
}
.auth-field input {
  width: 100%;
  background: #080808;
  border: 1px solid #1a1a1e;
  border-radius: 3px;
  color: #d8d8e0;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  padding: 8px 12px;
  margin-bottom: 14px;
  transition: border-color 0.2s;
  outline: none;
}
.auth-field input:focus { border-color: #555560; }
.auth-field input::placeholder { color: #1e1e22; }

/* ══ LOOT BOX ════════════════════════════════════════════════════════════ */
#lootBoxCard {
  text-align: center;
  position: relative;
  overflow: hidden;
}
#lootBoxCard .loot-rarity-common,
#lootBoxCard .loot-rarity-rare,
#lootBoxCard .loot-rarity-epic,
#lootBoxCard .loot-rarity-legendary {
  color: #888890 !important;
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin: 8px 0;
}

/* ══ ANIME STUDY MODE ════════════════════════════════════════════════════ */
.anime-scene-card {
  background: #0d0d10 !important;
  border: 1px solid #1a1a1e !important;
  border-radius: 4px !important;
}
.anime-dialogue {
  font-family: 'Space Mono', monospace;
  color: #888890 !important;
  border-color: #252528 !important;
}
.anime-char-name {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: #555560 !important;
  text-transform: uppercase;
}

/* ══ WIDGET PLACE MODAL ══════════════════════════════════════════════════ */
.wplace-title {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: #888890;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.wplace-sub {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: #333340;
  margin-bottom: 16px;
}

/* ══ TAGS + DIFF TAGS ════════════════════════════════════════════════════ */
.unit-tag {
  background: transparent !important;
  border: 1px solid #1a1a1e !important;
  color: #333340 !important;
}
.diff-tag.hard   { background: transparent !important; color: #555560 !important; border-color: #252528 !important; }
.diff-tag.medium { background: transparent !important; color: #444450 !important; border-color: #222226 !important; }
.diff-tag.easy   { background: transparent !important; color: #888890 !important; border-color: #333340 !important; }

/* ══ AUCTIONS ════════════════════════════════════════════════════════════ */
#auctionBidInput {
  background: #080808 !important;
  border-color: #1a1a1e !important;
  border-radius: 3px !important;
  color: #d8d8e0 !important;
  font-family: 'Space Mono', monospace !important;
  font-size: 12px !important;
}
#auctionBidInput:focus { border-color: #555560 !important; }
#auctionCurrentBid { color: #e0e0e8 !important; }
#auctionCountdown  { color: #888890 !important; }

/* ══ QUESTION TEXT ═══════════════════════════════════════════════════════ */
.question-text {
  font-family: 'Space Mono', monospace;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.75;
  color: #b0b0b8;
  letter-spacing: 0.02em;
}

/* ══ SCROLLBAR — minimal ═════════════════════════════════════════════════ */
* {
  scrollbar-width: thin;
  scrollbar-color: #1e1e22 transparent;
}
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1e1e22; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #333340; }

/* ══ INPUT GLOBAL ════════════════════════════════════════════════════════ */
input[type="range"] {
  accent-color: #e0e0e8 !important;
  cursor: pointer;
}
textarea {
  background: #080808 !important;
  border: 1px solid #1a1a1e !important;
  border-radius: 3px !important;
  color: #d8d8e0 !important;
  font-family: 'Space Mono', monospace !important;
  font-size: 12px !important;
}
textarea:focus { border-color: #555560 !important; }

/* ══ SMOOTH MODE TRANSITIONS — applied via JS on show ════════════════════ */
.mode-fade-in {
  animation: modeFadeIn 0.22s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes modeFadeIn {
  from { opacity: 0; transform: translateX(-3px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ══ KANJI BIG DISPLAY ═══════════════════════════════════════════════════ */
.kj, .kanji-char, [style*="Noto Sans JP"] {
  color: #d8d8e0;
}

/* ══ MISC OVERRIDES ══════════════════════════════════════════════════════ */
/* Remove any leftover color accents */
a { color: #888890; }
a:hover { color: #e0e0e8; }

/* Score pill in header */
.bc-pill { color: #333340; border-color: #1a1a1e; }

/* Stats header btn */
.stats-header-btn {
  background: transparent !important;
  border: 1px solid #1a1a1e !important;
  border-radius: 3px !important;
  color: #2a2a32 !important;
  font-size: 12px;
  filter: grayscale(1);
}
.stats-header-btn:hover { border-color: #333340 !important; color: #888890 !important; }

/* Emoji in buttons — desaturate them */
.btn, .unit-btn, .casino-tab, .bag-tab, .inv-cat-btn {
  filter: saturate(0.1) brightness(0.9);
}
.btn:hover, .unit-btn:hover, .casino-tab.active, .bag-tab.active, .inv-cat-btn.active {
  filter: saturate(0.2) brightness(1);
}
.btn-primary { filter: saturate(0); }
.btn-primary:hover { filter: saturate(0) brightness(1.05); }

/* Keep kanji readable */
.kj, .kanji-char { filter: none !important; }

/* ══ WIRE SCANLINE on app area ═══════════════════════════════════════════ */
#appWrap::before {
  content: '';
  position: fixed;
  inset: 0;
  left: 140px;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(224,224,232,0.007) 3px,
    rgba(224,224,232,0.007) 4px
  );
  pointer-events: none;
  z-index: 0;
}
#appWrap.expanded::before { left: 0; }

/* ══ WGRID EDITOR MONO ═══════════════════════════════════════════════════ */
.wgcell {
  border-color: rgba(224,224,232,0.06) !important;
  background: rgba(224,224,232,0.01) !important;
  color: rgba(224,224,232,0.15) !important;
  border-radius: 2px !important;
}
.wgcell:hover:not(.occupied) {
  border-color: rgba(224,224,232,0.2) !important;
  background: rgba(224,224,232,0.03) !important;
}
.wgcell.occupied {
  background: rgba(224,224,232,0.05) !important;
  border-color: rgba(224,224,232,0.2) !important;
  color: rgba(224,224,232,0.5) !important;
}
.wgcell.selected-valid {
  background: rgba(224,224,232,0.08) !important;
  border-color: #e0e0e8 !important;
  color: #e0e0e8 !important;
  animation: wgPulseMono 0.7s ease-in-out infinite alternate !important;
}
@keyframes wgPulseMono {
  from { box-shadow: none; }
  to   { box-shadow: 0 0 8px rgba(224,224,232,0.15); }
}

/* ══ FILL BLANK (cycles mode) ════════════════════════════════════════════ */
.fill-blank {
  border-bottom-color: #333340 !important;
  color: #888890 !important;
}
.fill-blank.filled { border-bottom-color: #888890 !important; background: rgba(224,224,232,0.04) !important; color: #e0e0e8 !important; border-radius: 2px !important; }
.fill-blank.revealed { border-bottom-color: #e0e0e8 !important; color: #e0e0e8 !important; background: rgba(224,224,232,0.04) !important; }
.fill-blank.wrong-reveal { border-bottom-color: #333340 !important; color: #555560 !important; }
.fill-chip {
  border-color: #1a1a1e !important;
  background: #0d0d10 !important;
  color: #555560 !important;
  border-radius: 2px !important;
  font-size: 11px !important;
}
.fill-chip:hover:not(.used):not(.locked) {
  border-color: #555560 !important;
  color: #b0b0b8 !important;
  background: rgba(224,224,232,0.04) !important;
}
.fill-chip.correct-chip { border-color: #888890 !important; color: #e0e0e8 !important; }
.fill-chip.wrong-chip   { border-color: #252528 !important; color: #333340 !important; }

/* ══ SEQUENCE ORDERING ═══════════════════════════════════════════════════ */
.seq-item {
  background: #0d0d10 !important;
  border-color: #1a1a1e !important;
  color: #555560 !important;
  border-radius: 3px !important;
  font-family: 'Space Mono', monospace !important;
  font-size: 12px !important;
}
.seq-item:hover { border-color: #333340 !important; color: #b0b0b8 !important; }
.seq-item.seq-correct { border-color: #888890 !important; color: #e0e0e8 !important; background: rgba(224,224,232,0.04) !important; }
.seq-item.seq-wrong   { border-color: #252528 !important; color: #333340 !important; }

/* ══ RESET MODAL ═════════════════════════════════════════════════════════ */
.reset-modal-icon { font-size: 24px; filter: grayscale(1) opacity(0.4); margin-bottom: 12px; }
.reset-modal-title {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  color: #888890;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.reset-modal-desc {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: #333340;
  line-height: 1.75;
  margin-bottom: 20px;
}
