:root {
  color-scheme: dark;
  --bg: #0e1014;
  --panel: #161a21;
  --panel-2: #12161c;
  --ink: #eceef2;
  --muted: #9aa3af;
  --rule: #262d38;
  --accent: #d94032;
  --accent-soft: #ff6a58;
  --good: #7bc47f;
  --warn: #e8b04b;
  --radius: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 50% -180px, rgba(217, 64, 50, 0.18), transparent 70%),
    var(--bg);
  color: var(--ink);
  font: 16px/1.6 ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 100% 6px;
  z-index: -1;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 20;
}
.skip:focus { left: 1rem; top: 1rem; }

.top {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.1rem 1.2rem 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  background: none;
  border: 0;
  color: var(--ink);
  padding: 0.35rem 0;
  cursor: pointer;
}
.brand-kana {
  color: var(--accent);
  font-size: 1.05rem;
  letter-spacing: 0.14em;
}
.brand-latin {
  font-weight: 700;
  letter-spacing: 0.02em;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.2rem 1.2rem 5rem;
}

.voice-note {
  max-width: 760px;
  margin: 0.4rem auto 0;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(232, 176, 75, 0.35);
  background: rgba(232, 176, 75, 0.08);
  color: #f0d29b;
  border-radius: 10px;
  font-size: 0.88rem;
  width: calc(100% - 2.4rem);
}

.view { animation: rise 180ms ease-out; }
@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--accent-soft);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 0.9rem;
  font-size: clamp(1.65rem, 5vw, 2.35rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h2 { line-height: 1.2; }
h3 { margin: 0; font-size: 1.02rem; }

.lede {
  margin: 0 0 1.4rem;
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 58ch;
}

.section-title {
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  margin: 0 0 0.9rem;
}

.rule {
  height: 1px;
  background: var(--rule);
  margin: 2rem 0 1.4rem;
}

.muted { color: var(--muted); }
.small { font-size: 0.86rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 0.6rem;
  margin: 1.2rem 0 1.4rem;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.85rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-label {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--rule);
  background: #1e232c;
  color: var(--ink);
  min-height: 48px;
  padding: 0.6rem 0.95rem;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}
button:hover { border-color: #3b4655; }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 650;
}
.primary:hover { background: #e04c3d; border-color: #e04c3d; }
.secondary { background: #222a34; }
.ghost { background: transparent; }
.big { width: 100%; min-height: 54px; font-size: 1.02rem; }
.wide { width: 100%; margin-top: 0.9rem; }
.small { font-size: 0.86rem; }
.linkish {
  background: none;
  border: 0;
  color: var(--accent-soft);
  padding: 0;
  min-height: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.row {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.8rem;
}

.return-reason {
  margin: 0.9rem 0 0;
  padding: 0.75rem 0.9rem;
  border-left: 2px solid var(--accent);
  background: rgba(217, 64, 50, 0.07);
  color: #f1c9c4;
  border-radius: 0 8px 8px 0;
  font-size: 0.9rem;
}

/* lessons */
.lesson-list { display: grid; gap: 0.7rem; }
.lesson {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
}
.lesson-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}
.lesson-sub { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.84rem; }
.pill {
  white-space: nowrap;
  font-size: 0.74rem;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}
.bar {
  height: 5px;
  border-radius: 999px;
  background: #0c0f13;
  overflow: hidden;
  margin: 0.8rem 0 0.6rem;
}
.bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  border-radius: inherit;
  transition: width 240ms ease;
}
.lesson-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.lesson-meta { color: var(--muted); font-size: 0.82rem; }

.steps {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  display: grid;
  gap: 0.55rem;
}
.steps strong { color: var(--ink); font-weight: 600; }

/* session */
.session-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.session-progress { flex: 1; }
.session-bar { margin: 0.4rem 0 0; }

.card {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 1.3rem 1.25rem 1.15rem;
  box-shadow: var(--shadow);
  margin-top: 0.5rem;
}

.kana {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  font-size: 1.45rem;
  line-height: 1.5;
  margin: 0 0 0.2rem;
}
.big-kana { font-size: clamp(2rem, 7vw, 2.9rem); }
.romaji { color: var(--muted); margin: 0 0 0.9rem; letter-spacing: 0.01em; }
.meaning { margin: 0 0 0.7rem; font-size: 1.05rem; }
.tip {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.88rem;
  border-left: 2px solid var(--rule);
  padding-left: 0.7rem;
}

.prompt-card { border-color: #3a2a2a; }
.prompt {
  font-size: clamp(1.5rem, 5.5vw, 2rem);
  line-height: 1.25;
  margin: 0.1rem 0 1rem;
  text-wrap: balance;
}
.timer {
  font-variant-numeric: tabular-nums;
  color: var(--accent-soft);
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 0.4rem;
}

.feedback-time {
  font-size: 2rem;
  font-weight: 700;
  color: var(--good);
  margin: 0 0 0.4rem;
  font-variant-numeric: tabular-nums;
}

.chunk-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.9rem 0;
}
.chunk {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 1.1rem;
  background: #1b2028;
  border-color: #303947;
}

.summary-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  border-top: 1px solid var(--rule);
}
.summary-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}
.summary-kana {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}
.summary-meta { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }

/* progress */
.trend {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  color: var(--accent-soft);
  margin-bottom: 1.4rem;
}
.trend svg { display: block; width: 100%; height: auto; }
.trend .muted { color: var(--muted); margin: 0.2rem 0 0; }

.progress-lessons { display: grid; gap: 1.3rem; }
.progress-lesson {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.progress-lesson-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.4rem;
}
.phrase-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.3rem 0.8rem;
  padding: 0.55rem 0;
  border-top: 1px solid #1d232c;
}
.phrase-main { display: flex; flex-direction: column; min-width: 0; }
.phrase-kana {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 1.05rem;
}
.phrase-en { color: var(--muted); font-size: 0.8rem; overflow-wrap: anywhere; }
.phrase-meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.76rem;
}
.dots { display: flex; gap: 3px; align-items: center; padding-top: 0.35rem; }
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2c333e;
}
.dot.on { background: var(--accent); }

.foot {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.2rem 1.2rem 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.8rem;
}
.foot p { margin: 0; }

@media (max-width: 520px) {
  .top { padding-top: 0.9rem; }
  main { padding: 0.8rem 1rem 4rem; }
  .voice-note { width: calc(100% - 2rem); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .session-top { flex-wrap: wrap; }
  .session-progress { flex-basis: 100%; }
  .card { padding: 1.1rem 1rem 1rem; }
  .row > button { flex: 1 1 auto; }
  .primary.big { position: sticky; bottom: 0.7rem; z-index: 2; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
  .summary-list li { flex-direction: column; gap: 0.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
