:root {
    --blue: #1a73e8;
    --blue-dark: #1558b0;
    --blue-light: #e8f0fe;
    --green: #34a853;
    --green-light: #e6f4ea;
    --red: #ea4335;
    --red-light: #fce8e6;
    --orange: #fbbc04;
    --orange-light: #fef9e0;
    --grey: #f8f9fa;
    --grey2: #e8eaed;
    --grey3: #9aa0a6;
    --dark: #202124;
    --text: #3c4043;
    --white: #ffffff;
    --bg: #f0f4f8;
    --card-bg: #ffffff;
    --shadow: 0 2px 12px rgba(0,0,0,0.10);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
    --radius: 16px;
    --radius-sm: 10px;
  }

  [data-theme="dark"] {
    --blue: #4da6ff;
    --blue-dark: #3b8bdb;
    --blue-light: #1a2a3e;
    --green: #4caf50;
    --green-light: #1a2e1a;
    --red: #ff6b6b;
    --red-light: #2e1a1a;
    --orange: #ffca28;
    --orange-light: #2e2a1a;
    --grey: #2a2a2a;
    --grey2: #3a3a3a;
    --grey3: #888888;
    --dark: #f0f0f0;
    --text: #d0d0d0;
    --white: #1a1a1a;
    --bg: #121212;
    --card-bg: #1e1e1e;
    --shadow: 0 2px 12px rgba(0,0,0,0.30);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.40);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  *:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

  body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* ===== HEADER ===== */
  .header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--grey2);
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: color-mix(in srgb, var(--card-bg) 85%, transparent);
  }
  .header-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--blue); letter-spacing: -0.3px; }
  .header-logo svg { width: 34px; height: 34px; border-radius: 8px; }
  .header-level { font-size: 0.85rem; font-weight: 600; color: var(--grey3); }

  /* ===== MAIN CONTAINER ===== */
  .container { max-width: 720px; margin: 0 auto; padding: 24px 16px 48px; }

  /* ===== SCREEN VISIBILITY ===== */
  .screen { display: none; }
  .screen.active { display: block; }

  /* ===== HOME SCREEN ===== */
  .home-hero {
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 50%, #1565c0 100%);
    border-radius: var(--radius);
    padding: 36px 28px 32px;
    color: white;
    margin-bottom: 28px;
    text-align: center;
    position: relative;
    overflow: hidden;
  }
  .home-hero::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
  }
  .home-hero h1 { font-size: 1.7rem; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.5px; }
  .home-hero p { font-size: 0.95rem; opacity: 0.85; margin-bottom: 20px; }
  .hero-stats { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
  .hero-stat {
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    text-align: center;
    min-width: 80px;
    border: 1px solid rgba(255,255,255,0.12);
  }
  .hero-stat-value { font-size: 1.4rem; font-weight: 800; display: block; }
  .hero-stat-label { font-size: 0.72rem; opacity: 0.8; }

  /* Progress bar global */
  .global-progress {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 28px;
    box-shadow: var(--shadow);
  }
  .global-progress h3 { font-size: 0.9rem; font-weight: 700; margin-bottom: 12px; color: var(--dark); }
  .progress-bar-bg { background: var(--grey2); border-radius: 99px; height: 10px; overflow: hidden; }
  .progress-bar-fill { background: linear-gradient(90deg, var(--blue), var(--green)); height: 100%; border-radius: 99px; transition: width 0.5s ease; }
  .progress-label { font-size: 0.8rem; color: var(--grey3); margin-top: 6px; display: flex; justify-content: space-between; }

  /* Series grid */
  .section-title { font-size: 1rem; font-weight: 700; color: var(--dark); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
  .series-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 28px; }
  @media (max-width: 480px) { .series-grid { grid-template-columns: 1fr; } }

  .series-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px 16px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
  }
  .series-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--blue); }
  .series-card:active { transform: translateY(0); }
  .series-card.done { border-color: var(--green); }
  .series-card.done::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--green), #66bb6a);
  }
  .series-card .series-icon { font-size: 1.8rem; margin-bottom: 8px; }
  .series-card .series-name { font-size: 0.92rem; font-weight: 700; color: var(--dark); margin-bottom: 4px; }
  .series-card .series-meta { font-size: 0.75rem; color: var(--grey3); margin-bottom: 8px; }
  .series-card .series-score { font-size: 0.78rem; font-weight: 600; }
  .series-score.good { color: var(--green); }
  .series-score.avg { color: var(--orange); }
  .series-score.bad { color: var(--red); }
  .series-score.none { color: var(--grey3); }
  .series-difficulty { position: absolute; top: 12px; right: 12px; font-size: 0.7rem; color: var(--orange); }

  /* Mode carte */
  .mode-cards { display: flex; gap: 12px; margin-bottom: 28px; }
  .mode-card {
    flex: 1;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 14px;
    cursor: pointer;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid transparent;
  }
  .mode-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--blue); }
  .mode-card:active { transform: translateY(0); }
  .mode-card .mode-icon { font-size: 1.6rem; margin-bottom: 6px; }
  .mode-card .mode-title { font-size: 0.85rem; font-weight: 700; color: var(--dark); }
  .mode-card .mode-desc { font-size: 0.73rem; color: var(--grey3); margin-top: 3px; }

  /* ===== QUIZ SCREEN ===== */
  .quiz-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
  }
  .btn-back {
    background: var(--card-bg);
    border: none;
    border-radius: 50%;
    width: 44px; height: 44px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow);
    transition: background 0.15s;
    flex-shrink: 0;
  }
  .btn-back:hover { background: var(--grey2); }
  .quiz-info { flex: 1; }
  .quiz-series-name { font-size: 0.8rem; color: var(--grey3); font-weight: 600; }
  .quiz-question-count { font-size: 0.95rem; font-weight: 700; color: var(--dark); }
  .timer-badge {
    background: var(--blue);
    color: white;
    border-radius: 99px;
    padding: 6px 16px;
    font-size: 1.1rem;
    font-weight: 800;
    min-width: 56px;
    text-align: center;
    transition: background 0.3s, transform 0.2s;
  }
  .timer-badge.warning { background: var(--orange); color: #1a1a1a; }
  .timer-badge.danger { background: var(--red); transform: scale(1.1); box-shadow: 0 0 12px rgba(234,67,53,0.5); }

  .quiz-progress-bar { background: var(--grey2); border-radius: 99px; height: 6px; margin-bottom: 24px; overflow: hidden; }
  .quiz-progress-fill { background: var(--blue); height: 100%; border-radius: 99px; transition: width 0.4s ease; }

  /* Question card */
  .question-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px 22px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
  }
  @keyframes fadeIn { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: translateY(0); } }

  .question-difficulty { font-size: 0.75rem; margin-bottom: 8px; }
  .question-text { font-size: 1rem; font-weight: 600; color: var(--dark); line-height: 1.55; margin-bottom: 16px; }
  .question-multi-hint { font-size: 0.75rem; color: var(--blue); font-weight: 600; margin-bottom: 12px; padding: 5px 10px; background: var(--blue-light); border-radius: 6px; display: inline-block; }

  /* SVG schema */
  .question-schema {
    background: var(--grey);
    border: 1px solid var(--grey2);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
  }
  .question-schema svg { max-width: 100%; height: auto; }

  /* Answer choices */
  .answers { display: flex; flex-direction: column; gap: 10px; }
  .answer-btn {
    background: var(--grey);
    border: 2px solid var(--grey2);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
  }
  .answer-btn:hover:not(:disabled) { background: var(--blue-light); border-color: var(--blue); color: var(--blue); }
  .answer-btn.selected { background: var(--blue-light); border-color: var(--blue); color: var(--blue-dark); }
  .answer-btn.correct { background: var(--green-light); border-color: var(--green); color: var(--green); }
  .answer-btn.wrong { background: var(--red-light); border-color: var(--red); color: var(--red); }
  .answer-btn.reveal-correct { background: var(--green-light); border-color: var(--green); color: var(--green); }
  .answer-btn:disabled { cursor: default; }
  .answer-letter {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--grey2);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.15s;
  }
  .answer-btn.selected .answer-letter { background: var(--blue); color: white; }
  .answer-btn.correct .answer-letter { background: var(--green); color: white; }
  .answer-btn.wrong .answer-letter { background: var(--red); color: white; }
  .answer-btn.reveal-correct .answer-letter { background: var(--green); color: white; }
  .answer-icon { margin-left: auto; font-size: 1rem; }

  /* Validate button */
  .btn-validate {
    width: 100%;
    background: linear-gradient(135deg, var(--blue), var(--blue-dark));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 16px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 16px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(26,115,232,0.35);
  }
  .btn-validate:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(26,115,232,0.45); }
  .btn-validate:active { transform: translateY(0); }
  .btn-validate:disabled { background: var(--grey2); color: var(--grey3); box-shadow: none; cursor: default; transform: none; }

  /* Feedback */
  .feedback-card {
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-top: 14px;
    display: none;
    animation: fadeIn 0.3s ease;
  }
  .feedback-card.correct { background: var(--green-light); border: 1.5px solid var(--green); }
  .feedback-card.wrong { background: var(--red-light); border: 1.5px solid var(--red); }
  .feedback-header { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.95rem; margin-bottom: 8px; }
  .feedback-header.correct { color: var(--green); }
  .feedback-header.wrong { color: var(--red); }
  .feedback-text { font-size: 0.87rem; line-height: 1.55; color: var(--text); }

  /* Next button */
  .btn-next {
    width: 100%;
    background: var(--dark);
    color: var(--bg);
    border: none;
    border-radius: var(--radius-sm);
    padding: 15px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 12px;
    transition: background 0.15s;
    display: none;
  }
  .btn-next:hover { background: var(--grey3); color: var(--bg); }

  /* ===== RESULTS SCREEN ===== */
  .results-hero {
    border-radius: var(--radius);
    padding: 28px 24px;
    text-align: center;
    margin-bottom: 20px;
    color: white;
  }
  .results-hero.excellent { background: linear-gradient(135deg, #34a853, #1e7e34); }
  .results-hero.good { background: linear-gradient(135deg, #1a73e8, #1558b0); }
  .results-hero.average { background: linear-gradient(135deg, #fbbc04, #e8a000); color: #1a1a1a; }
  .results-hero.poor { background: linear-gradient(135deg, #ea4335, #b71c1c); }
  .results-score { font-size: 3.5rem; font-weight: 800; line-height: 1; }
  .results-label { font-size: 1rem; opacity: 0.9; margin-top: 4px; }
  .results-emoji { font-size: 2.5rem; margin-bottom: 8px; }

  .results-breakdown {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
  }
  .breakdown-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--grey2); }
  .breakdown-item:last-child { border-bottom: none; }
  .breakdown-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
  .breakdown-dot.correct { background: var(--green); }
  .breakdown-dot.wrong { background: var(--red); }
  .breakdown-text { font-size: 0.87rem; flex: 1; }
  .breakdown-badge { font-size: 0.78rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
  .breakdown-badge.correct { background: var(--green-light); color: var(--green); }
  .breakdown-badge.wrong { background: var(--red-light); color: var(--red); }

  .results-btns { display: flex; flex-direction: column; gap: 10px; }
  .btn-primary {
    background: linear-gradient(135deg, var(--blue), var(--blue-dark));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 15px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(26,115,232,0.25);
  }
  .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(26,115,232,0.4); }
  .btn-primary:active { transform: translateY(0); }
  .btn-secondary {
    background: var(--card-bg);
    color: var(--dark);
    border: 2px solid var(--grey2);
    border-radius: var(--radius-sm);
    padding: 13px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s;
  }
  .btn-secondary:hover { border-color: var(--blue); color: var(--blue); }

  /* ===== EXAM MODE ===== */
  .exam-banner {
    background: linear-gradient(135deg, #202124, #3c4043);
    color: white;
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
  }
  .exam-banner-icon { font-size: 2rem; }
  .exam-banner-title { font-size: 1rem; font-weight: 700; }
  .exam-banner-sub { font-size: 0.8rem; opacity: 0.75; margin-top: 2px; }

  /* Tag chip */
  .tag { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 0.72rem; font-weight: 600; margin-right: 4px; letter-spacing: 0.3px; }
  .tag-new { background: #e8f0fe; color: var(--blue); }
  .tag-2026 { background: linear-gradient(135deg, #fff3e0, #ffe0b2); color: #e65100; }
  [data-theme="dark"] .tag-2026 { background: linear-gradient(135deg, #3e2723, #4e342e); color: #ffab40; }

  /* Scroll to top */
  html { scroll-behavior: smooth; }

  /* Responsive tweaks */
  @media (max-width: 400px) {
    .home-hero h1 { font-size: 1.4rem; }
    .series-grid { grid-template-columns: 1fr; }
    .mode-cards { flex-direction: column; }
  }

  /* ===== DARK MODE TOGGLE ===== */
  .theme-toggle {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .theme-toggle:hover { background: var(--grey2); }
  .header-right { display: flex; align-items: center; gap: 10px; }

  /* ===== STATS CHART ===== */
  .stats-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 28px;
    box-shadow: var(--shadow);
  }
  .stats-card h3 { font-size: 0.9rem; font-weight: 700; margin-bottom: 14px; color: var(--dark); }
  .stats-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 100px;
    padding-top: 8px;
  }
  .stats-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
  }
  .stats-bar {
    width: 100%;
    max-width: 32px;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, var(--blue), var(--green));
    transition: height 0.4s ease;
    min-height: 2px;
  }
  .stats-bar-label {
    font-size: 0.6rem;
    color: var(--grey3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40px;
    text-align: center;
  }
  .stats-summary {
    display: flex;
    justify-content: space-around;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--grey2);
  }
  .stats-summary-item { text-align: center; }
  .stats-summary-value { font-size: 1.1rem; font-weight: 800; color: var(--dark); }
  .stats-summary-label { font-size: 0.7rem; color: var(--grey3); }

  /* ===== SPACED REP BADGE ===== */
  .sr-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.65rem;
    font-weight: 700;
    margin-left: 6px;
  }
  .sr-badge.hot { background: var(--red-light); color: var(--red); }
  .sr-badge.warm { background: var(--orange-light); color: var(--orange); }
  .sr-badge.cool { background: var(--green-light); color: var(--green); }

  /* ===== PLANNING INTERACTIF ===== */
  .planning-day {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
  }
  .planning-day.today { border-color: var(--blue); }
  .planning-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
  }
  .planning-day-title { font-size: 1rem; font-weight: 800; color: var(--dark); }
  .planning-day-progress { font-size: 0.75rem; color: var(--grey3); margin-top: 2px; }
  .planning-day-pct {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--blue);
  }
  .planning-progress-bar {
    background: var(--grey2);
    border-radius: 99px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 16px;
  }
  .planning-progress-fill {
    background: linear-gradient(90deg, var(--blue), var(--green));
    height: 100%;
    border-radius: 99px;
    transition: width 0.4s ease;
  }
  .planning-time-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--blue);
    letter-spacing: 0.5px;
    margin: 14px 0 6px;
    padding-left: 4px;
  }
  .planning-task {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    gap: 10px;
  }
  .planning-task:hover { background: var(--grey); }
  .planning-task.done { opacity: 0.55; }
  .planning-task.done .planning-task-label { text-decoration: line-through; }
  .planning-task-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
  .planning-task-label { font-size: 0.88rem; font-weight: 600; color: var(--dark); }
  .planning-task-duration { font-size: 0.72rem; color: var(--grey3); margin-top: 1px; }
  .planning-check {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--grey2);
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: white;
    flex-shrink: 0;
    transition: all 0.15s;
  }
  .planning-check:hover { border-color: var(--blue); }
  .planning-check.checked {
    background: var(--green);
    border-color: var(--green);
  }
  .planning-go {
    background: var(--blue);
    color: white;
    border: none;
    border-radius: 99px;
    padding: 6px 14px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
    white-space: nowrap;
  }
  .planning-go:hover { background: var(--blue-dark); transform: scale(1.05); }
  .planning-done-badge {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--green);
    background: var(--green-light);
    padding: 3px 10px;
    border-radius: 99px;
    flex-shrink: 0;
  }
  .planning-milestone-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--orange), #e65100);
    flex-shrink: 0;
    margin: 0 6px;
  }
  .planning-task.milestone .planning-task-label {
    font-weight: 800;
    color: var(--orange);
  }
  .planning-complete {
    text-align: center;
    padding: 20px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--green);
    background: var(--green-light);
    border-radius: var(--radius);
    margin-bottom: 16px;
  }

  /* ====== MEMO CARD ====== */
  .memo-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 16px;
    border: 1px solid var(--grey);
  }
  .memo-card h3 {
    margin: 0 0 16px;
    font-size: 1.1rem;
    color: var(--dark);
  }
  .memo-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
  }
  @media (min-width: 600px) {
    .memo-grid { grid-template-columns: 1fr 1fr; }
  }
  .memo-section {
    background: var(--bg);
    border-radius: 12px;
    padding: 14px;
    border: 1px solid var(--grey);
  }
  .memo-section h4 {
    margin: 0 0 10px;
    font-size: .9rem;
    color: var(--blue);
  }
  .memo-section ul {
    margin: 0;
    padding-left: 18px;
    font-size: .82rem;
    line-height: 1.7;
    color: var(--dark);
  }
  .memo-section li b {
    color: var(--blue);
  }
  .memo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
    color: var(--dark);
  }
  .memo-table th, .memo-table td {
    padding: 5px 8px;
    text-align: center;
    border-bottom: 1px solid var(--grey);
  }
  .memo-table th {
    font-weight: 700;
    color: var(--blue);
  }
  .memo-table td:first-child {
    text-align: left;
    font-weight: 600;
  }

/* ============================
   SIGN GALLERY
   ============================ */
.sign-gallery { margin-top: 16px; }
.sign-gallery h2 { margin: 0 0 4px; font-size: 1.3rem; }
.sign-gallery-sub { color: var(--grey3); margin: 0 0 16px; font-size: 0.85rem; }
.sign-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.sf-btn {
  padding: 6px 14px; border-radius: 20px; border: 1.5px solid var(--grey2);
  background: var(--card); color: var(--text); font-size: 0.82rem; cursor: pointer;
  transition: all 0.2s; font-weight: 500;
}
.sf-btn:hover { border-color: var(--blue); }
.sf-btn.active { background: var(--blue); color: white; border-color: var(--blue); }
.sign-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
  gap: 12px;
}
.sign-card {
  background: var(--card); border-radius: 12px; padding: 14px 8px 10px;
  text-align: center; border: 1px solid var(--grey1);
  transition: transform 0.2s, box-shadow 0.2s;
}
.sign-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.sign-card-img { width: 68px; height: 68px; object-fit: contain; margin-bottom: 8px; }
.sign-card-name { font-size: 0.76rem; font-weight: 600; color: var(--text); line-height: 1.25; }
.sign-card-code { font-size: 0.68rem; color: var(--grey3); margin-top: 3px; font-family: monospace; }
[data-theme="dark"] .sign-card { border-color: var(--grey2); }
[data-theme="dark"] .sign-card-img { filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5)); }

/* Sign badges in quiz questions */
.question-signs {
  display: flex; gap: 14px; justify-content: center; align-items: flex-start;
  margin-bottom: 14px; flex-wrap: wrap;
}
.sign-badge {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.sign-badge .sign-img {
  width: 88px; height: 88px; object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.18));
  transition: transform 0.2s;
  border-radius: 4px;
}
.sign-badge .sign-img:hover { transform: scale(1.12); }
.sign-badge-label {
  font-size: 0.7rem; color: var(--grey3); font-weight: 500; text-align: center;
  max-width: 100px; line-height: 1.2;
}
[data-theme="dark"] .sign-badge .sign-img {
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

@media (max-width: 480px) {
  .sign-grid { grid-template-columns: repeat(auto-fill, minmax(95px, 1fr)); gap: 8px; }
  .sign-card { padding: 10px 6px 8px; }
  .sign-card-img { width: 56px; height: 56px; }
  .sign-badge .sign-img { width: 72px; height: 72px; }
  .sf-btn { font-size: 0.75rem; padding: 5px 10px; }
}