  @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;700;900&family=Space+Mono:wght@400;700&family=Dancing+Script:wght@400;700&display=swap');

  :root {
    --bg: #0a0a0f;
    --surface: #13131a;
    --surface2: #1c1c26;
    --border: #2a2a3a;
    --accent: #4f9eff;
    --accent2: #7c3aed;
    --green: #22c55e;
    --blue: #3b82f6;
    --orange: #f59e0b;
    --text: #f0f0f8;
    --text-muted: #666680;
    --text-dim: #9999bb;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

  body {
    font-family: 'Noto Sans JP', sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100dvh;
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* TOP BAR */
  .topbar {
    padding: 12px 20px 10px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .topbar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
  }

  .level-badge {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: var(--accent);
    letter-spacing: 2px;
  }

  .point-display {
    font-family: 'Space Mono', monospace;
    font-size: 24px;
    font-weight: 700;
  }

  .daily-info { text-align: right; }
  .daily-info div { font-family: 'Space Mono', monospace; font-size: 10px; color: var(--text-muted); }

  .level-bar-wrap { background: var(--border); border-radius: 2px; height: 3px; overflow: hidden; }
  .level-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent2), var(--accent));
    border-radius: 2px;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
  }

  /* MAIN */
  .main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

  /* SCREENS */
  .screen { display: none; flex: 1; flex-direction: column; overflow: hidden; position: relative; }
  .screen.active { display: flex; }



  .map-tool-goal { border-color: var(--orange) !important; color: var(--orange) !important; background: rgba(245,158,11,0.06) !important; }
  .goal-bar {
    flex-shrink: 0; padding: 5px 12px;
    background: transparent;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 6px;
  }
  .goal-label {
    font-size: 9px; color: var(--orange); letter-spacing: 1px;
    font-family: 'Space Mono', monospace; white-space: nowrap; flex-shrink: 0;
  }
  .goal-textarea {
    flex: 1; min-height: unset; height: 22px; max-height: 22px;
    background: transparent; border: none;
    color: var(--text-dim); font-size: 11px;
    font-family: 'Noto Sans JP', sans-serif; line-height: 1.4;
    padding: 0 4px; resize: none; box-sizing: border-box;
    outline: none; overflow: hidden;
  }
  .goal-textarea:focus { color: var(--text); }
  .goal-preview { display: none; }
  .map-toolbar {
    display: flex; gap: 6px; padding: 8px 12px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  .map-tool-btn {
    padding: 6px 14px; font-size: 10px; letter-spacing: 1.5px;
    background: transparent; border: 1px solid var(--border);
    border-radius: 20px; color: var(--text-muted);
    font-family: 'Space Mono', monospace; cursor: pointer;
    transition: all 0.18s;
  }
  .map-tool-btn:active { transform: scale(0.95); }
  .map-tool-collapse { border-color: #3a3a55; }
  .map-tool-collapse:hover { border-color: var(--text-muted); color: var(--text); }
  .map-tool-today {
    border-color: var(--accent); color: var(--accent);
    background: rgba(79,158,255,0.06);
  }
  .map-tool-today:hover { background: rgba(79,158,255,0.15); }

  /* ===== MINDMAP ===== */
  .mindmap-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--bg);
    cursor: grab;
  }
  .mindmap-container:active { cursor: grabbing; }

  #mindmapSvg {
    position: absolute;
    top: 0; left: 0;
    overflow: visible;
  }

  .map-hint {
    position: absolute;
    bottom: 16px; left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-muted);
    background: rgba(10,10,15,0.8);
    padding: 6px 14px;
    border-radius: 20px;
    pointer-events: none;
    white-space: nowrap;
  }

  /* SVG node styles */
  .node-center rect { fill: #1c1c3a; stroke: var(--accent); stroke-width: 2; rx: 12; }
  .node-center text { fill: var(--text); font-size: 13px; font-weight: 700; }

  /* ロードマップ フェーズヘッダー */
  .phase-connector {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    z-index: 2;
  }
  .phase-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--border);
    margin: 2px 0;
  }
  .phase-dot.active { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
  .phase-dot.done { background: var(--green); }

  /* ===== TODO ===== */
  .todo-wrap { padding: 16px; flex: 1; overflow-y: auto; }

  .todo-summary {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .todo-net {
    font-family: 'Space Mono', monospace;
    font-size: 20px;
    font-weight: 700;
  }
  .todo-net.pos { color: var(--green); }
  .todo-net.neg { color: var(--orange); }

  .section-btn {
    width: 100%;
    padding: 14px 16px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text);
    font-family: 'Noto Sans JP', sans-serif;
    transition: all 0.15s;
    text-align: left;
  }
  .section-btn:hover { border-color: var(--accent); }
  .section-btn.active-section { border-color: var(--accent); background: rgba(79,158,255,0.08); }

  .section-btn-left { flex: 1; }
  .section-btn-name { font-size: 14px; font-weight: 700; }
  .section-btn-meta { font-size: 10px; color: var(--text-muted); margin-top: 3px; font-family: 'Space Mono', monospace; }
  .section-btn-arrow { color: var(--accent); font-size: 18px; margin-left: 12px; }

  /* ===== PRACTICE ===== */
  .practice-wrap {
    flex: 1; display: flex; flex-direction: column; overflow: hidden;
  }

  /* ===== 倍率タイムライン ===== */
  .bonus-timeline {
    flex-shrink: 0;
    padding: 6px 16px 5px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    transition: opacity 0.3s;
  }
  .bt-header {
    display: flex; justify-content: space-between;
    font-size: 9px; font-family: 'Space Mono', monospace;
    margin-bottom: 4px;
  }
  .bt-mult { color: var(--text-muted); }
  .bt-mult.on { color: var(--accent); font-weight: 700; }
  .bt-mult.big { color: var(--orange); font-weight: 700; }
  .bt-timer { color: var(--text-muted); }
  .bt-bar-wrap {
    position: relative; height: 6px;
    background: var(--surface); border-radius: 3px; overflow: visible;
    margin-bottom: 2px;
  }
  .bt-track {
    position: absolute; inset: 0; border-radius: 3px; overflow: hidden;
  }
  .bt-zone {
    position: absolute; top: 0; height: 100%;
  }
  .bt-zone-bonus { background: rgba(79,158,255,0.35); }
  .bt-zone-big   { background: rgba(255,140,0,0.45); }
  .bt-zone-normal { background: transparent; }
  .bt-cursor {
    position: absolute; top: 50%; transform: translate(-50%, -50%);
    font-size: 10px; transition: left 1s linear; z-index: 2;
  }
  .bt-tick-row {
    position: relative; height: 12px;
  }
  .bt-tick {
    position: absolute; font-size: 8px; color: var(--text-muted);
    font-family: 'Space Mono', monospace;
    transform: translateX(-50%);
  }

  /* 上半分：日本語エリア — 高さ固定でテキスト量によるズレを防ぐ */
  .ja-half {
    height: 232px;
    flex-shrink: 0;
    display: flex; flex-direction: column;
    justify-content: flex-start;
    padding: 12px 20px 10px;
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
  }

  .practice-meta {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px;
  }

  .section-label {
    font-size: 10px; letter-spacing: 2px; color: var(--accent);
    text-transform: uppercase; font-family: 'Space Mono', monospace;
  }

  .progress-badge {
    font-family: 'Space Mono', monospace; font-size: 11px;
    color: var(--text-muted); background: var(--surface2);
    padding: 2px 10px; border-radius: 20px;
  }

  .section-title { font-size: 13px; color: var(--text-dim); margin-bottom: 8px; }

  .progress-bar-wrap { background: var(--border); border-radius: 2px; height: 2px; margin-bottom: 12px; overflow: hidden; }
  .progress-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.4s ease; }

  .card-num { font-family: 'Space Mono', monospace; font-size: 10px; color: var(--text-muted); margin-bottom: 8px; }

  .ja-text {
    font-size: 18px; font-weight: 700; line-height: 1.6; color: var(--text);
    overflow: hidden; transition: font-size 0.1s;
  }
  .ja-text .conv-line { display: block; line-height: 1.7; }
  .ja-text .conv-reply { display: block; color: var(--text-dim); line-height: 1.7; margin-top: 2px; }

  /* 解説ボタン — ヘッダー右に「💡」アイコンだけ */
  .exp-icon-btn {
    background: none; border: 1px solid var(--border);
    border-radius: 50%; width: 28px; height: 28px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; cursor: pointer; transition: all 0.2s;
    color: var(--text-muted); margin-left: 8px;
  }
  .exp-icon-btn:hover { border-color: var(--accent); color: var(--accent); }

  /* 解説オーバーレイ */
  .exp-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.75);
    display: none; align-items: center; justify-content: center;
    padding: 20px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s;
  }
  .exp-overlay.visible { display: flex; opacity: 1; pointer-events: all; }

  .exp-sheet {
    background: var(--surface2);
    border: 1px solid var(--accent2);
    border-radius: 20px;
    padding: 24px 20px 28px;
    width: 100%; max-width: 440px;
    max-height: 75vh; overflow-y: auto;
    transform: scale(0.92);
    transition: transform 0.25s cubic-bezier(0.34,1.36,0.64,1);
  }
  .exp-overlay.visible .exp-sheet { transform: scale(1); }

  .exp-sheet-title {
    font-size: 12px; font-weight: 700; color: var(--accent);
    margin-bottom: 12px; letter-spacing: 1px;
  }
  .exp-sheet-body { font-size: 13px; line-height: 1.9; color: var(--text-dim); }

  .exp-close {
    position: absolute; top: 16px; right: 16px;
    background: none; border: none; color: var(--text-muted);
    font-size: 20px; cursor: pointer; padding: 4px;
  }

  /* 下半分：回答エリア */
  .answer-half {
    flex: 1; display: flex; flex-direction: column;
    padding: 14px 20px 16px; gap: 10px; overflow: hidden;
  }

  .en-row {
    min-height: 60px; display: flex; align-items: flex-start; padding-top: 4px;
  }

  .en-text {
    font-family: 'Space Mono', monospace;
    font-size: 15px; font-weight: 700; color: var(--accent); line-height: 1.6;
    transition: font-size 0.1s;
  }
  .en-text .conv-line { display: block; line-height: 1.7; }
  .en-text .conv-reply { display: block; color: #6699cc; line-height: 1.7; margin-top: 2px; }

  .en-placeholder {
    font-size: 13px; color: var(--border);
    font-style: italic;
  }

  .note-row { min-height: 28px; }

  .inline-note-toggle {
    font-size: 11px; color: var(--text-muted); cursor: pointer;
    padding: 4px 10px; border: 1px solid var(--border);
    border-radius: 20px; display: none; transition: all 0.2s;
    font-family: 'Noto Sans JP', sans-serif; background: none;
  }
  .inline-note-toggle.visible { display: inline-block; }
  .inline-note-toggle:hover { color: var(--accent); border-color: var(--accent); }

  .inline-note {
    color: var(--text-dim); line-height: 1.7;
    background: rgba(79,158,255,0.05); border-radius: 8px;
    padding: 8px 12px; display: none; margin-top: 6px;
    max-height: 90px; overflow-y: auto;
    animation: fadeIn 0.2s ease;
  }
  .inline-note.visible { display: block; }

  .audio-row { display: flex; gap: 8px; min-height: 30px; }
  .ja-audio-row { margin-top: 8px; display: flex; align-items: center; gap: 6px; }
  .ja-audio-row .audio-btn { display: inline-flex; } /* 日本語音声は最初から表示 */

  .audio-en-btns { display: flex; gap: 4px; }
  .audio-btn {
    display: none; align-items: center; gap: 5px;
    padding: 5px 10px; border: 1px solid var(--border);
    border-radius: 20px; background: none; color: var(--text-muted);
    font-size: 11px; cursor: pointer; font-family: 'Noto Sans JP', sans-serif;
    transition: all 0.2s;
  }
  .audio-btn.visible { display: inline-flex; }
  .audio-en-btns .audio-btn.visible { display: inline-flex; }
  .audio-btn:hover { color: var(--accent); border-color: var(--accent); }
  .audio-slow:hover { color: #f59e0b; border-color: #f59e0b; }

  /* ボタンエリア: 常に画面下部に固定。reveal-btnとjudge-rowを同じ高さに */
  .action-area { margin-top: auto; }
  .action-area .reveal-btn { height: 52px; }
  .btn-judge { height: 52px; }

  .reveal-btn {
    width: 100%; padding: 15px;
    background: none; border: 1px dashed var(--accent);
    color: var(--accent); border-radius: 12px; cursor: pointer;
    font-size: 14px; font-weight: 700;
    font-family: 'Noto Sans JP', sans-serif; transition: all 0.2s;
  }
  .reveal-btn:active { transform: scale(0.98); background: rgba(79,158,255,0.08); }

  .judge-row {
    display: none; grid-template-columns: 1fr 1fr; gap: 10px;
  }
  .judge-row.visible { display: grid; }

  .btn-judge {
    padding: 8px 10px 8px; border-radius: 12px; border: none;
    cursor: pointer; font-family: 'Noto Sans JP', sans-serif;
    font-size: 13px; font-weight: 700;
    transition: all 0.15s; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
  }
  .btn-judge:active { transform: scale(0.96); }
  .btn-perfect { background: linear-gradient(135deg, #166534, #22c55e); color: white; }
  .btn-still { background: linear-gradient(135deg, #1e3a5f, #3b82f6); color: white; }
  .btn-pt { font-family: 'Space Mono', monospace; font-size: 10px; opacity: 0.75; line-height: 1; }


  .start-overlay {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 20px; background: var(--bg);
  }
  .start-card {
    background: var(--surface2);
    border: 1px solid var(--accent);
    border-radius: 20px; padding: 28px 22px; width: 100%; max-width: 360px;
    text-align: center; animation: fadeIn 0.35s ease;
    position: relative; overflow: hidden;
  }
  /* 背景グロー */
  .start-card::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(79,158,255,0.08) 0%, transparent 70%);
    pointer-events: none;
  }
  .start-eyebrow {
    font-family: 'Space Mono', monospace; font-size: 9px;
    letter-spacing: 3px; text-transform: uppercase;
    color: var(--accent); margin-bottom: 10px;
  }
  .start-section-title {
    font-family: 'Space Mono', monospace;
    font-size: 20px; font-weight: 700; color: var(--text);
    line-height: 1.3; margin-bottom: 14px;
  }
  .start-divider {
    height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent);
    margin: 0 20px 16px;
  }
  .start-point-row {
    font-family: 'Space Mono', monospace; font-size: 11px;
    color: var(--text-muted); margin-bottom: 14px;
    display: flex; justify-content: center; gap: 16px;
  }
  .start-exp-toggle {
    width: 100%; padding: 9px 16px; margin-bottom: 16px;
    background: transparent;
    border: 1px solid rgba(79,158,255,0.35);
    border-radius: 8px; color: rgba(79,158,255,0.8);
    font-family: 'Space Mono', monospace; font-size: 10px;
    letter-spacing: 2px; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
  }
  .start-exp-toggle:hover { border-color: var(--accent); color: var(--accent); background: rgba(79,158,255,0.06); }
  .start-exp-toggle.open { border-color: var(--accent); color: var(--accent); }
  .start-explanation {
    font-size: 12px; line-height: 1.8; color: var(--text-dim);
    background: rgba(79,158,255,0.04); border: 1px solid rgba(79,158,255,0.15);
    border-radius: 10px; padding: 12px 14px;
    text-align: left; margin-bottom: 22px;
    max-height: 100px; overflow-y: auto;
  }
  .start-btn {
    width: 100%; padding: 16px; margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    border: none; color: white; border-radius: 12px;
    font-size: 18px; font-weight: 700; letter-spacing: 4px;
    font-family: 'Space Mono', monospace;
    cursor: pointer; transition: all 0.2s;
  }
  .shuffle-toggle-btn {
    width: 100%; padding: 8px; margin-bottom: 10px;
    background: none; border: 1px dashed var(--border);
    color: var(--text-muted); border-radius: 8px;
    font-size: 11px; font-family: 'Space Mono', monospace;
    cursor: pointer; transition: all 0.2s; letter-spacing: 1px;
  }
  .shuffle-toggle-btn.active {
    border-color: var(--accent); color: var(--accent);
    background: rgba(79,158,255,0.08);
  }
  .start-btn:active { transform: scale(0.97); opacity: 0.9; }
  .start-back-btn {
    width: 100%; padding: 10px;
    background: none; border: 1px solid var(--border);
    color: var(--text-muted); border-radius: 10px;
    font-size: 12px; font-family: 'Space Mono', monospace; cursor: pointer;
    letter-spacing: 1px;
  }


  /* ABOUT OVERLAY - モーダルカード */
  .about-overlay {
    position: absolute; inset: 0; z-index: 80;
    background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    padding: 20px; animation: fadeIn 0.2s ease;
    backdrop-filter: blur(4px);
  }
  .about-inner {
    background: var(--surface2);
    border: 1px solid var(--accent);
    border-radius: 18px;
    width: 100%; max-width: 360px;
    max-height: 70vh;
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(79,158,255,0.15);
  }
  .about-header {
    padding: 14px 18px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  .about-title {
    font-family: 'Space Mono', monospace; font-size: 9px;
    letter-spacing: 3px; color: var(--accent); text-transform: uppercase;
  }
  .about-body {
    flex: 1; overflow-y: auto; padding: 14px 18px;
    font-size: 12px; line-height: 1.9; color: var(--text-dim);
    white-space: pre-wrap; word-break: break-word;
  }
  .about-close-btn {
    flex-shrink: 0; width: 100%; padding: 14px;
    background: none; border: none;
    border-top: 1px solid var(--border);
    color: var(--text-muted); font-family: 'Space Mono', monospace;
    font-size: 11px; letter-spacing: 3px; cursor: pointer;
    transition: all 0.15s; border-radius: 0 0 18px 18px;
  }
  .about-close-btn:active { background: rgba(255,255,255,0.04); color: var(--text); }

  /* COMPLETE SCREEN */
  .complete-screen {
    justify-content: flex-start; padding-top: 20px;
    flex: 1; display: none; flex-direction: column;
    padding: 20px 16px 16px; overflow-y: auto;
    animation: fadeIn 0.4s ease;
  }
  .complete-screen.visible { display: flex; }

  .complete-header { text-align: center; margin-bottom: 12px; padding-top: 0; }
  .complete-icon { font-size: 48px; margin-bottom: 10px; }
  .complete-streak {
    font-size: 11px; color: var(--orange);
    font-family: 'Space Mono', monospace; letter-spacing: 1px;
    margin-top: 6px; min-height: 18px;
  }
  .complete-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
  .complete-section-name {
    font-size: 16px; font-weight: 700; color: var(--accent);
    margin-bottom: 8px;
  }
  .complete-pts {
    font-family: 'Space Mono', monospace;
    font-size: 32px; font-weight: 700; color: var(--green);
  }
  .complete-pts span { font-size: 13px; color: var(--text-muted); }

  /* 完了画面ToDoリスト */
  .complete-todo-section {
    font-size: 9px; letter-spacing: 2px; color: var(--text-muted);
    font-family: 'Space Mono', monospace; margin: 14px 0 8px;
    text-transform: uppercase;
  }

  .complete-section-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-radius: 10px; margin-bottom: 6px;
    border: 1px solid var(--border); background: var(--surface2);
    cursor: pointer; transition: all 0.18s;
    font-size: 13px;
  }
  .complete-section-item:active { transform: scale(0.98); }
  .complete-section-item.done-now {
    border-color: var(--green);
    background: rgba(34,197,94,0.06);
  }
  .complete-section-item.done-now .csi-name { color: var(--green); }
  .complete-section-item .csi-name { font-weight: 700; color: var(--text); }
  .complete-section-item .csi-meta { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
  .complete-section-item .csi-status { font-size: 14px; flex-shrink: 0; margin-left: 8px; }

  .btn-next-section {
    width: 100%; padding: 14px;
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    border: none; color: white;
    border-radius: 12px; cursor: pointer;
    font-size: 14px; font-weight: 700;
    font-family: 'Noto Sans JP', sans-serif;
    margin-top: 12px;
    transition: all 0.2s;
  }
  .btn-next-section:active { transform: scale(0.98); }

  .btn-back-todo {
    width: 100%; padding: 12px;
    background: none; border: 1px solid var(--border);
    color: var(--text-dim); border-radius: 12px;
    cursor: pointer; font-size: 13px;
    font-family: 'Noto Sans JP', sans-serif;
    margin-top: 8px;
    transition: all 0.2s;
  }

  /* STATS */
  .stats-wrap { padding: 16px; flex: 1; overflow-y: auto; }
  .stat-card {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 12px; padding: 14px; margin-bottom: 10px;
  }
  .stat-card-title {
    font-size: 9px; letter-spacing: 2px; text-transform: uppercase;
    color: var(--text-muted); font-family: 'Space Mono', monospace; margin-bottom: 8px;
  }
  .stat-big { font-family: 'Space Mono', monospace; font-size: 30px; font-weight: 700; }

  /* 累計+今日横並び */
  .stat-top-row { display: flex; gap: 10px; margin-bottom: 10px; }
  .stat-top-row .stat-card { flex: 1; margin-bottom: 0; }

  /* グラフ期間ボタン */
  .chart-period-btns {
    display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap;
  }
  .period-btn {
    flex: 1; min-width: 0;
    padding: 5px 2px; font-size: 10px; text-align: center;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 6px; cursor: pointer; color: var(--text-muted);
    font-family: 'Space Mono', monospace; transition: all 0.15s;
    white-space: nowrap;
  }
  .period-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

  /* CHART */
  .chart-wrap { width: 100%; height: 120px; position: relative; margin-top: 4px; }
  .chart-svg { width: 100%; height: 100%; overflow: visible; }

  /* 累積グラフ */
  .accum-wrap { width: 100%; height: 130px; margin-top: 4px; }

  /* milestone */
  .milestone {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12px;
  }
  .milestone:last-child { border-bottom: none; }
  .milestone-icon { font-size: 16px; width: 22px; text-align: center; }
  .milestone-label { flex: 1; color: var(--text-dim); }
  .milestone-pts { font-family: 'Space Mono', monospace; font-size: 10px; color: var(--text-muted); }
  .milestone.reached .milestone-label { color: var(--text); }
  .milestone.reached .milestone-pts { color: var(--green); }


  .card-num-row { display: flex; align-items: center; justify-content: space-between; }
  .back-card-btn {
    font-size: 10px; color: var(--text-muted); background: none;
    border: 1px solid var(--border); border-radius: 8px;
    padding: 3px 8px; cursor: pointer; font-family: 'Space Mono', monospace;
    transition: all 0.15s;
  }
  .back-card-btn:active { color: var(--accent); border-color: var(--accent); }
  /* 練習画面：解説+音声を横並びに */
  .note-audio-row {
    display: flex; align-items: center; gap: 8px; min-height: 32px; flex-wrap: wrap;
  }

  .inline-note-toggle {
    font-size: 11px; color: var(--text-muted); cursor: pointer;
    padding: 5px 10px; border: 1px solid var(--border);
    border-radius: 20px; display: none; transition: all 0.2s;
    font-family: 'Noto Sans JP', sans-serif; background: none; white-space: nowrap;
  }
  .inline-note-toggle.visible { display: inline-block; }

  .audio-btn {
    display: none; align-items: center; gap: 4px;
    padding: 5px 10px; border: 1px solid var(--border);
    border-radius: 20px; background: none; color: var(--text-muted);
    font-size: 11px; cursor: pointer; font-family: 'Noto Sans JP', sans-serif;
    transition: all 0.2s; white-space: nowrap;
  }
  .audio-btn.visible { display: inline-flex; }


  .font-sel-btn {
    flex: 1; padding: 7px 4px; font-size: 11px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text-muted);
    font-family: 'Noto Sans JP', sans-serif; cursor: pointer;
    transition: all 0.15s;
  }
  .font-sel-btn.active { background: var(--accent); border-color: var(--accent); color: white; }


  .setting-section-title {
    font-size: 10px; letter-spacing: 2px; color: var(--text-muted);
    font-family: 'Space Mono', monospace; padding: 14px 0 8px;
    text-transform: uppercase;
  }

  /* ポイントアップの仕組み */
  .pts-guide {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 4px;
    display: flex; flex-direction: column; gap: 8px;
  }
  .pts-guide-row {
    display: flex; gap: 10px; align-items: flex-start;
  }
  .pts-guide-label {
    font-size: 10px; font-family: 'Space Mono', monospace;
    color: var(--accent); white-space: nowrap; flex-shrink: 0;
    padding-top: 1px; min-width: 70px;
  }
  .pts-guide-desc {
    font-size: 11px; color: var(--text-dim); line-height: 1.6;
  }
  .pts-guide-pt {
    font-family: 'Space Mono', monospace; color: var(--green);
    font-weight: 700;
  }

  .font-grid {
    display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px;
  }
  .font-grid .font-sel-btn { flex: 1; min-width: 60px; }
  .font-options-row {
    display: flex; gap: 8px; margin-bottom: 10px;
  }
  .font-opt-btn {
    flex: 1; padding: 7px 10px; font-size: 11px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text-muted);
    font-family: 'Space Mono', monospace; cursor: pointer; transition: all 0.15s;
  }
  .font-opt-btn.active { background: rgba(79,158,255,0.2); border-color: var(--accent); color: var(--accent); }
  .font-preview-box {
    font-size: 15px; padding: 10px 14px; border-radius: 10px;
    background: var(--surface2); border: 1px solid var(--border);
    margin-bottom: 4px; min-height: 40px;
  }

  .size-control-row {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 0 8px;
  }
  .size-ctrl-label {
    font-size: 11px; color: var(--text-muted);
    font-family: 'Space Mono', monospace;
    min-width: 70px;
  }
  .size-disp {
    font-family: 'Space Mono', monospace; font-size: 12px;
    color: var(--text-muted); min-width: 38px; text-align: center;
  }
  .note-size-btn {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--surface2); border: 1px solid var(--border);
    color: var(--text); font-size: 18px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Space Mono', monospace; transition: all 0.15s;
  }
  .note-size-btn:active { background: var(--accent); border-color: var(--accent); }
  /* SETTINGS */
  .settings-wrap { padding: 16px; flex: 1; overflow-y: auto; }
  .setting-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 0; border-bottom: 1px solid var(--border); font-size: 13px;
  }
  .setting-label { color: var(--text-dim); }
  .toggle {
    width: 42px; height: 22px; background: var(--border);
    border-radius: 11px; position: relative; cursor: pointer; transition: background 0.2s; flex-shrink: 0;
  }
  .toggle.on { background: var(--accent); }
  .toggle::after {
    content: ''; position: absolute; width: 16px; height: 16px;
    background: white; border-radius: 50%; top: 3px; left: 3px; transition: transform 0.2s;
  }
  .toggle.on::after { transform: translateX(20px); }

  .speed-btn {
    padding: 5px 10px; font-size: 11px; font-family: 'Space Mono', monospace;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-muted); cursor: pointer; transition: all 0.15s;
  }
  .speed-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(79,158,255,0.08); }

  /* BOTTOM NAV */
  .bottom-nav {
    display: flex; background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
    flex-shrink: 0;
  }
  .nav-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; gap: 2px; padding: 4px 0;
    cursor: pointer; transition: all 0.2s; color: var(--text-muted);
    font-size: 9px;
  }
  .nav-item.active { color: var(--accent); }
  .nav-item-icon { font-size: 17px; }

  /* POINT POPUP */
  .point-popup {
    position: fixed; top: 90px; left: 50%;
    transform: translateX(-50%);
    background: var(--green); color: white;
    font-family: 'Space Mono', monospace; font-size: 22px; font-weight: 700;
    padding: 8px 22px; border-radius: 40px;
    pointer-events: none; z-index: 1000;
    animation: pointAnim 1.2s forwards;
  }
  .point-popup.blue { background: var(--blue); }
  .point-popup.gold {
    background: linear-gradient(135deg, #92400e, #f59e0b, #fcd34d);
    color: #1a0a00; text-shadow: 0 1px 2px rgba(255,200,0,0.5);
    box-shadow: 0 0 18px rgba(251,191,36,0.7), 0 0 40px rgba(251,191,36,0.3);
    animation: pointAnimGold 1.3s forwards;
  }
  .point-popup.silver {
    background: linear-gradient(135deg, #475569, #94a3b8, #e2e8f0);
    color: #1e293b;
    box-shadow: 0 0 14px rgba(148,163,184,0.6);
    animation: pointAnim 1.2s forwards;
  }
  .point-popup.bronze {
    background: linear-gradient(135deg, #78350f, #b45309, #d97706);
    color: #fff8f0;
    box-shadow: 0 0 12px rgba(180,83,9,0.5);
    animation: pointAnim 1.2s forwards;
  }
  @keyframes pointAnim {
    0% { opacity: 0; transform: translateX(-50%) scale(0.8) translateY(8px); }
    20% { opacity: 1; transform: translateX(-50%) scale(1.1) translateY(0); }
    60% { opacity: 1; transform: translateX(-50%) scale(1) translateY(-20px); }
    100% { opacity: 0; transform: translateX(-50%) scale(0.9) translateY(-50px); }
  }
  @keyframes pointAnimGold {
    0% { opacity: 0; transform: translateX(-50%) scale(0.7) translateY(10px); }
    15% { opacity: 1; transform: translateX(-50%) scale(1.25) translateY(-4px); }
    40% { opacity: 1; transform: translateX(-50%) scale(1.1) translateY(-15px); }
    70% { opacity: 1; transform: translateX(-50%) scale(1.05) translateY(-30px); }
    100% { opacity: 0; transform: translateX(-50%) scale(0.9) translateY(-60px); }
  }
  /* ボーナスタイミング中のボタン枠 */
  .btn-judge.bonus-gold { box-shadow: 0 0 0 2.5px #f59e0b, 0 0 14px rgba(251,191,36,0.5) !important; }
  .btn-judge.bonus-silver { box-shadow: 0 0 0 2.5px #94a3b8, 0 0 10px rgba(148,163,184,0.4) !important; }
  .btn-judge.bonus-bronze { box-shadow: 0 0 0 2.5px #b45309, 0 0 10px rgba(180,83,9,0.4) !important; }

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

  /* ===== CALENDAR ===== */
  .cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
  .cal-title { font-family: 'Space Mono', monospace; font-size: 13px; color: var(--text); letter-spacing: 1px; }
  .cal-nav { background: none; border: 1px solid var(--border); color: var(--text-muted); border-radius: 6px; padding: 4px 10px; font-size: 11px; cursor: pointer; }
  .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px 0; }
  .cal-day-label { text-align: center; font-size: 9px; color: var(--text-muted); font-family: 'Space Mono', monospace; padding: 4px 0; }
  .cal-cell {
    position: relative; text-align: center; padding: 3px 0;
    min-height: 58px; border-radius: 4px;
    display: flex; flex-direction: column; align-items: center;
    overflow: visible; /* 帯が隣セルにはみ出せるように */
  }
  .cal-cell.empty { background: none; }
  .cal-cell.today { background: rgba(79,158,255,0.15); outline: 1px solid rgba(79,158,255,0.4); border-radius: 4px; }
  .cal-date { font-size: 11px; color: var(--text); font-family: 'Space Mono', monospace; line-height: 1.2; height: 16px; display: flex; align-items: center; justify-content: center; }

  /* ── Block帯 ── */
  .cal-band-row { width: 100%; height: 16px; overflow: visible; }
  .cal-band {
    height: 16px; width: 100%; position: relative;
    background-color: var(--band-color, transparent);
    display: flex; align-items: center;
  }
  .cal-band.band-start {
    margin-right: -1px;
    border-radius: 4px 0 0 4px;
    padding-left: 4px;
  }
  .cal-band.band-mid {
    margin-left: -1px; margin-right: -1px;
    border-radius: 0;
  }
  .cal-band.band-end {
    margin-left: -1px;
    border-radius: 0 4px 4px 0;
  }
  .cal-band.band-solo {
    margin: 0 3px;
    border-radius: 4px;
    padding: 0 4px;
  }
  .cal-band-label {
    font-size: 8px; font-weight: bold; color: #fff;
    white-space: nowrap; overflow: hidden; letter-spacing: 0;
    font-family: 'Space Mono', monospace;
    text-shadow: 1px 1px 0 rgba(0,0,0,1), -1px -1px 0 rgba(0,0,0,1),
                 1px -1px 0 rgba(0,0,0,1), -1px 1px 0 rgba(0,0,0,1),
                 0 0 6px rgba(0,0,0,1), 0 0 12px rgba(0,0,0,0.9);
    padding: 0 2px;
  }

  /* ── 🔥 / スコア ── */
  .cal-norm-row { height: 14px; font-size: 10px; line-height: 14px; }
  .cal-pts-row  { height: 12px; font-size: 9px; color: var(--text-muted); line-height: 12px; font-family: 'Space Mono', monospace; }
  .cal-streak { text-align: center; margin-top: 10px; font-size: 12px; color: #f59e0b; font-family: 'Space Mono', monospace; }

  /* ===== CELEBRATION ===== */
  .celeb-overlay {
    position: absolute; inset: 0; z-index: 500;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    animation: celeb-bg-in 0.3s ease;
  }
  @keyframes celeb-bg-in { from { opacity: 0; } to { opacity: 1; } }
  .celeb-card {
    position: relative; z-index: 2;
    background: linear-gradient(160deg, #0e1a2e 0%, #1a0e2e 100%);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px; padding: 32px 28px 24px;
    text-align: center; min-width: 240px;
    animation: celeb-card-in 0.4s cubic-bezier(0.34,1.56,0.64,1);
    box-shadow: 0 0 40px rgba(255,200,0,0.3);
  }
  @keyframes celeb-card-in {
    from { transform: scale(0.6) translateY(20px); opacity: 0; }
    to   { transform: scale(1) translateY(0);     opacity: 1; }
  }
  .celeb-emoji   { font-size: 48px; line-height: 1; margin-bottom: 8px; }
  .celeb-title   { font-size: 22px; font-weight: 800; color: #fff; letter-spacing: 1px; margin-bottom: 4px; font-family: 'Space Mono', monospace; }
  .celeb-sub     { font-size: 13px; color: rgba(255,255,255,0.75); margin-bottom: 8px; }
  .celeb-pts     { font-size: 18px; font-weight: 700; color: #f59e0b; margin-bottom: 12px; font-family: 'Space Mono', monospace; }
  .celeb-hint    { font-size: 10px; color: rgba(255,255,255,0.3); font-family: 'Space Mono', monospace; }
  .confetti-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 1; }

  /* ===== ADMIN PANEL ===== */
  .admin-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 3000; display: none; overflow-y: auto; }
  .admin-overlay.visible { display: block; }
  .admin-panel { max-width: 480px; margin: 0 auto; padding: 20px 16px 40px; }
  .admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; font-size: 16px; color: var(--text); font-weight: 700; }
  .admin-close { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; }
  .admin-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
  .admin-tab { flex: 1; padding: 8px 0; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text-muted); font-size: 11px; font-family: 'Space Mono', monospace; cursor: pointer; }
  .admin-tab.active { background: var(--accent); color: white; border-color: var(--accent); }
  .admin-section { display: none; }
  .admin-section.active { display: block; }
  .admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
  .admin-stat { background: var(--surface2); border-radius: 8px; padding: 10px; }
  .admin-stat label { display: block; font-size: 9px; color: var(--text-muted); margin-bottom: 4px; }
  .admin-stat span { font-family: 'Space Mono', monospace; font-size: 14px; color: var(--text); }
  .admin-section h3 { font-size: 12px; color: var(--text); margin: 16px 0 8px; }
  .admin-form { margin-bottom: 10px; }
  .admin-form label { display: block; font-size: 10px; color: var(--text-muted); margin-bottom: 4px; }
  .admin-form input, .admin-form select { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-family: 'Space Mono', monospace; font-size: 13px; padding: 8px; }
  .admin-form.inline { display: flex; gap: 8px; align-items: center; }
  .admin-form.inline input { width: 80px; }
  .admin-form.inline button { padding: 8px 16px; background: var(--accent); border: none; border-radius: 6px; color: white; font-size: 11px; cursor: pointer; }
  .admin-info { font-size: 10px; color: var(--text-muted); line-height: 1.8; }
  .admin-memo { width: 100%; min-height: 120px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 12px; padding: 10px; resize: vertical; margin-bottom: 8px; }
  .admin-section-list { max-height: 300px; overflow-y: auto; }
  .admin-sec-item { display: grid; grid-template-columns: 24px 50px 1fr 80px; gap: 4px; align-items: center; padding: 4px 0; font-size: 10px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
  .admin-review-item { display: grid; grid-template-columns: 70px 1fr 1fr 60px; gap: 4px; padding: 6px 0; font-size: 10px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
  .admin-review-item.due { color: var(--orange); }

/* ===== コンテンツビュー（セミナー/音読パッセージ） ===== */
.content-view-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 600;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
}
.content-view-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.content-view-back {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 11px;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.content-view-phase {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'Space Mono', monospace;
}
.content-view-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  padding: 12px 16px 6px;
  border-bottom: 1px solid var(--border);
}
.content-view-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.8;
}
.content-view-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.content-view-done {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.05em;
}
