:root {
  color-scheme: light;
  --ink: #0d0d0d;
  --muted: #606060;
  --line: #d9d9d9;
  --surface: #fff;
  --soft: #f7f7f7;
  --button: #111;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Yu Gothic UI", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }
html { background: #fff; }
html[lang="en"] [data-lang="ja"], html[lang="ja"] [data-lang="en"] { display: none !important; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: #fff;
  font-size: 14px;
  line-height: 1.55;
}
button { font: inherit; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid #111; outline-offset: 2px; }
.app-shell { width: min(100%, 480px); min-height: 100vh; margin: 0 auto; background: #fff; border-inline: 1px solid var(--line); }
.screen { min-height: 100vh; }
.intro { padding: 34px 24px 48px; }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(26px, 6.4vw, 42px); line-height: 1.15; letter-spacing: -.025em; overflow-wrap: normal; word-break: keep-all; }
h2 { margin: 0; font-size: 20px; }
h3 { font-size: 15px; }
.lead { margin: 16px 0; color: var(--muted); line-height: 1.7; }
.notice { padding: 13px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--soft); }
.intro-panel, .panel { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.intro-panel h2, .panel > h3 {
  margin: -16px -16px 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: var(--soft);
}
.counter { color: var(--ink); font-weight: 700; }
.topic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 18px; }
.topic-choice { min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; color: #333; background: #fff; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.topic-choice:hover { border-color: #888; background: var(--soft); }
.topic-choice.selected { border-color: #111; color: #fff; background: #111; }
.primary, .secondary { width: 100%; padding: 11px 16px; border-radius: 6px; font-weight: 700; cursor: pointer; transition: background .15s; }
.primary { border: 1px solid #111; color: #fff; background: #111; }
.primary:hover { border-color: #444; background: #444; }
.primary:disabled { border-color: #bbb; background: #bbb; cursor: not-allowed; }
.secondary { border: 1px solid var(--line); color: #333; background: #fff; }
.secondary:hover { background: var(--soft); }
.secondary:disabled { color: #999; background: var(--soft); cursor: default; }
#lang-toggle {
  width: auto;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #333;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
#lang-toggle:hover { background: var(--soft); }
.intro-tools { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.topbar-tools { display: flex; gap: 10px; align-items: center; }
.topbar { position: sticky; z-index: 10; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 11px 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); }
.brand { display: flex; gap: 9px; align-items: center; font-size: 16px; font-weight: 800; }
.brand-mark { position: relative; display: block; width: 30px; height: 30px; border-radius: 7px; background: #111; }
.brand-mark::after { position: absolute; inset: 9px; border-radius: 50%; background: #fff; content: ""; }
.phase-label { color: var(--muted); font-size: 12px; }
.feed-stats { padding: 8px 16px; border-bottom: 1px solid var(--line); color: var(--muted); background: var(--soft); font-size: 12px; }
.replay-meter { color: var(--ink); font-weight: 700; }
.reveal-banner { position: sticky; z-index: 8; top: 54px; width: calc(100% - 20px); margin: 10px; padding: 12px; border: 1px solid #111; border-radius: 6px; color: #fff; background: #111; font-weight: 700; cursor: pointer; }
.reveal-banner:hover { border-color: #444; background: #444; }
.feed-list { padding: 10px; background: var(--soft); }
.post { margin-bottom: 10px; padding: 15px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.post-head { position: relative; display: flex; gap: 10px; align-items: center; }
.avatar { display: grid; flex: 0 0 38px; width: 38px; height: 38px; place-items: center; border-radius: 7px; color: #fff; background: #444; font-size: 16px; font-weight: 700; }
.post-identity { min-width: 0; }
.author-row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.author { font-weight: 700; }
.handle { color: var(--muted); font-size: 12px; }
.follow-button { padding: 2px 9px; border: 1px solid #111; border-radius: 999px; color: #111; background: #fff; font-size: 11px; font-weight: 700; cursor: pointer; }
.follow-button:hover { color: #fff; background: #111; }
.follow-button.done { color: #fff; background: #111; cursor: default; }
.post-menu-wrap { position: relative; align-self: flex-start; margin-left: auto; }
.menu-button { display: grid; width: 32px; height: 32px; padding: 0; place-items: center; border: 1px solid transparent; border-radius: 50%; color: #333; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; }
.menu-button:hover, .menu-button[aria-expanded="true"] { border-color: var(--line); background: var(--soft); }
.post-menu { position: absolute; z-index: 6; top: 35px; right: 0; width: max-content; min-width: 150px; padding: 4px; border: 1px solid var(--line); border-radius: 7px; background: #fff; box-shadow: 0 5px 18px rgba(0,0,0,.12); }
.post-menu[hidden] { display: none; }
.post-menu button { width: 100%; padding: 8px 10px; border: 0; border-radius: 4px; color: #222; text-align: left; background: transparent; cursor: pointer; }
.post-menu button:hover { background: var(--soft); }
.post-menu button:disabled { color: #888; cursor: default; }
.post-text { margin: 12px 0 8px; line-height: 1.65; }
.hashtags { color: #444; font-size: 13px; }
.actions { display: flex; gap: 8px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
.action { min-width: 76px; padding: 7px 10px; border: 1px solid transparent; border-radius: 6px; color: #333; background: transparent; font-size: 12px; cursor: pointer; }
.action:hover { border-color: var(--line); background: var(--soft); }
.action.done { border-color: #111; color: #fff; background: #111; font-weight: 700; }
.action:disabled { cursor: default; }
.icon-action { display: inline-flex; gap: 6px; align-items: center; justify-content: center; }
.icon-action svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-action.done svg { fill: currentColor; }
.reveal-overlay { position: fixed; z-index: 100; inset: 0; display: grid; padding: 20px; place-items: center; background: rgba(0,0,0,.55); }
.reveal-dialog { width: min(100%, 420px); padding: 24px; border: 1px solid #111; border-radius: 10px; background: #fff; box-shadow: 0 14px 40px rgba(0,0,0,.24); }
.reveal-dialog h2 { font-size: 22px; line-height: 1.45; }
.reveal-dialog-actions { display: grid; gap: 8px; margin-top: 22px; }
.load-area { padding: 0 10px 28px; background: var(--soft); }
.dashboard { padding: 16px 14px 40px; }
.dashboard-topbar { margin: -16px -14px 0; }
.dashboard-title { padding: 12px 4px 5px; }
.dashboard-title p { color: var(--muted); }
.panel-intro { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.weight-row { display: grid; grid-template-columns: 112px 1fr 34px; gap: 8px; align-items: center; margin: 9px 0; font-size: 12px; }
.weight-row > span { display: flex; align-items: center; gap: 6px; }
.topic-mark { display: inline-grid; width: 24px; height: 24px; place-items: center; border-radius: 4px; color: #fff; font-size: 10px; font-style: normal; font-weight: 700; }
.bar-track { height: 9px; overflow: hidden; border-radius: 5px; background: #e5e5e5; }
.bar-fill { height: 100%; border-radius: inherit; background: #444; }
.diversity-chart { display: flex; align-items: end; gap: 3px; height: 110px; padding-top: 10px; border-bottom: 1px solid #aaa; }
.diversity-bar { flex: 1; min-width: 3px; border-radius: 2px 2px 0 0; background: #666; }
.topic-strip { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 12px; }
.topic-tile { display: inline-grid; width: 25px; height: 25px; place-items: center; border-radius: 4px; color: #fff; font-size: 10px; font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 7px 12px; margin-top: 10px; color: var(--muted); font-size: 11px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { display: inline-grid; width: 21px; height: 21px; place-items: center; border-radius: 3px; color: #fff; font-size: 9px; font-style: normal; font-weight: 700; }
.mini-post { padding: 11px 0; border-bottom: 1px solid var(--line); }
.mini-post:last-child { border: 0; }
.mini-meta { display: flex; align-items: center; gap: 5px; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.mini-avatar { display: inline-grid; width: 24px; height: 24px; place-items: center; border-radius: 5px; color: #fff; background: #444; font-weight: 700; }
.low-badge { margin-left: auto; padding: 1px 6px; border: 1px solid #111; border-radius: 4px; color: #111; background: #fff; font-size: 11px; font-weight: 700; }
.signs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.sign { padding: 3px 7px; border: 1px solid #aaa; border-radius: 5px; color: #333; background: #fff; font-size: 11px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 14px; border: 1px solid var(--line); border-radius: 7px; text-align: center; background: var(--soft); }
.stat strong { display: block; color: #111; font-size: 26px; }
.lesson-screen { padding-bottom: 35px; }
.lesson-header { padding: 24px 18px; border-bottom: 1px solid var(--line); color: var(--ink); background: #fff; }
.lesson-header p { color: var(--muted); }
.lesson-list, .quiz-wrap { padding: 4px 14px; }
.lesson-card { margin: 12px 0; padding: 16px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.lesson-number { display: inline-block; padding: 3px 7px; border: 1px solid var(--line); border-radius: 4px; color: #333; background: var(--soft); font-size: 11px; font-weight: 700; }
.lesson-card h3 { margin: 12px 0 6px; }
.lesson-card p { margin-bottom: 0; color: var(--muted); line-height: 1.7; }
.tips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.tip { padding: 6px 9px; border: 1px solid var(--line); border-radius: 5px; color: #333; background: var(--soft); font-size: 12px; }
.quiz-wrap h2 { margin: 25px 4px 12px; }
.quiz-card { padding: 16px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.quiz-progress { color: var(--muted); font-size: 12px; }
.options { display: grid; gap: 8px; margin-top: 14px; }
.option { padding: 11px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); text-align: left; background: #fff; cursor: pointer; }
.option:hover { border-color: #888; background: var(--soft); }
.option.correct { border: 2px solid #111; background: var(--soft); }
.option.wrong { border-style: dashed; border-color: #777; background: #fff; }
.feedback { margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 6px; line-height: 1.55; background: var(--soft); }
.result { padding: 40px 18px 50px; text-align: center; }
.result-topbar { margin: -40px -18px 30px; text-align: left; }
.result-badge { display: inline-block; margin: 18px 0 8px; padding: 4px 10px; border: 1px solid #111; border-radius: 4px; color: #fff; background: #111; font-size: 12px; font-weight: 700; }
.result-score { margin: 12px 0; color: #111; font-size: 36px; font-weight: 800; }
.result .primary { margin-top: 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 520px) {
  .app-shell { border-inline: 0; }
  .weight-row { grid-template-columns: 96px 1fr 30px; }
}

@media (max-width: 360px) { .topic-grid { grid-template-columns: 1fr; } }
@media (max-width: 360px) { .phase-label { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
