@font-face {
  font-family: "Newsreader";
  src: url("vendor/newsreader.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

/* One weight is enough, and declaring a range stops browsers from faking bold. */
@font-face {
  font-family: "Shippori Mincho";
  src: url("vendor/shippori-mincho-500.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* One light look everywhere, whatever the device or Telegram's theme. */
:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --surface: #fffdf9;
  --text: #26221c;
  --muted: #736b5e;
  --accent: #a8432f;
  --on-accent: #ffffff;
  --line: color-mix(in srgb, var(--text) 11%, transparent);
  --wash: color-mix(in srgb, var(--text) 6%, transparent);
  --tint: color-mix(in srgb, var(--accent) 11%, transparent);
  --shadow: 0 1px 2px rgb(70 45 20 / 5%), 0 10px 24px -14px rgb(70 45 20 / 18%);
  --shadow-raised: 0 2px 4px rgb(70 45 20 / 7%), 0 16px 32px -14px rgb(70 45 20 / 28%);
  --new: #c77700;
  --due: #2f6fbf;
  --again: #c0392b;
  --hard: #c77700;
  --good: #5b6770;
  --easy: #2e8b57;
  /* Chart colours for each answer, checked for colour blindness as a set. */
  --answer-1: #c2452d;
  --answer-2: #c98500;
  --answer-3: #3b82d6;
  --answer-4: #199e70;
  --answer-5: #e87ba4;
  --radius: 14px;
  --ja: "Shippori Mincho", "Hiragino Mincho ProN", "Noto Serif CJK JP", "Yu Mincho", serif;
  --ui: system-ui, -apple-system, "Segoe UI", "Noto Sans", sans-serif;
  --display: "Newsreader", "Iowan Old Style", Georgia, serif;
}

* { box-sizing: border-box; }

:lang(ja) { font-family: var(--ja); font-synthesis-weight: none; }

html, body { margin: 0; background: var(--bg); color: var(--text); }

body {
  font: 16px/1.5 var(--ui);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

main {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px calc(112px + env(safe-area-inset-bottom));
}

h1, h2 { font-family: var(--display); font-weight: 500; letter-spacing: -0.01em; }
h1 { font-size: 2rem; line-height: 1.15; margin: 4px 0 18px; }
h1[lang="ja"] { font-family: var(--ja); font-size: 1.65rem; font-weight: 600; letter-spacing: 0; }
h1 .small { font-family: var(--ui); font-weight: 500; letter-spacing: 0; }
h2 { font-size: 1.3rem; line-height: 1.25; margin: 32px 0 12px; }
p { margin: 0 0 12px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
footer a { text-decoration: underline; text-underline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.error { color: var(--again); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }

.icon {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon.solid { fill: currentColor; stroke: none; }

button, .button {
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 8px 18px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}
button:not(.word):not(:disabled):active { transform: scale(0.97); }
button:where(:not(.word, .link, .quiet, .danger, .card, .icon-button, .speed)):hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 88%, var(--text));
}
button:disabled { opacity: 0.45; cursor: default; }
button.quiet {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  font-weight: 500;
}
button.quiet:hover:not(:disabled) { background: var(--wash); }
button.danger {
  background: transparent;
  color: var(--again);
  border: 1px solid color-mix(in srgb, var(--again) 40%, transparent);
  font-weight: 500;
}
button.danger:hover { background: color-mix(in srgb, var(--again) 9%, transparent); }
button.link {
  background: none; border: 0; padding: 8px 0; min-height: 0; color: var(--accent); font-weight: 500;
}
button.link:hover { text-decoration: underline; }
button.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  background: var(--wash);
  color: var(--text);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  min-height: 44px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus-visible, textarea:focus-visible {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--tint);
}
::placeholder { color: var(--muted); opacity: 0.8; }
textarea { display: block; resize: vertical; min-height: 108px; }
label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 8px; }

.card {
  background: var(--surface);
  border: 1px solid var(--wash);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
a.card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
a.card:hover { transform: translateY(-1px); box-shadow: var(--shadow-raised); border-color: var(--line); }
a.card:active { transform: none; }
a.card > .icon { color: var(--muted); opacity: 0.7; }
.card-title { font-family: var(--ja); font-size: 1.15rem; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }

.back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 0 0 8px -4px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}
.back:hover { color: var(--text); text-decoration: none; }

.chapter-number {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--tint);
  color: var(--accent);
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 500;
}
.chapter-state { display: inline-flex; align-items: center; gap: 4px; }
.chapter-state.finished { color: var(--easy); }

.new-tag {
  position: absolute;
  top: 9px;
  right: 11px;
  padding: 1px 8px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--easy) 12%, transparent);
  color: color-mix(in srgb, var(--easy) 72%, var(--text));
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
a.card.has-tag .grow { padding-right: 40px; }

.queue {
  margin: -2px 0 12px;
  border-radius: var(--radius);
  background: var(--wash);
  padding: 4px 14px;
}
.queue-item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 0; }
.queue-item + .queue-item { border-top: 1px solid var(--line); }
.queue-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.9375rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.queue-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--text) 22%, transparent); }
.queue-read { flex: none; font-size: 0.875rem; font-weight: 600; }
button.small-icon { flex: none; width: 30px; height: 30px; background: transparent; color: var(--muted); }
button.small-icon:hover:not(:disabled) { background: var(--wash); color: var(--text); }
.pulse {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.25; transform: scale(0.7); } }

nav.tabs {
  position: fixed;
  inset: auto 0 0 0;
  display: flex;
  justify-content: center;
  gap: 4px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--wash);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  z-index: 5;
}
nav.tabs a {
  flex: 1 1 0;
  max-width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 4px;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.75rem;
  transition: color 0.15s ease, background-color 0.15s ease;
}
nav.tabs a:hover { color: var(--text); }
nav.tabs a.active { color: var(--accent); background: var(--tint); font-weight: 600; }
.tab-glyph { display: block; height: 22px; font-family: var(--ja); font-size: 1.15rem; font-weight: 600; line-height: 22px; }

/* Controls */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-height: 36px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.switch input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; opacity: 0; }
.track {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--text) 18%, transparent);
  transition: background-color 0.18s ease;
}
.track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 30%);
  transition: transform 0.18s ease;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.form-length { margin-top: 10px; }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 11px;
  background: var(--wash);
}
.segmented label {
  position: relative;
  margin: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.segmented input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; opacity: 0; }
.segmented span {
  display: block;
  min-width: 32px;
  padding: 4px 7px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 3px rgb(0 0 0 / 14%);
}
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.search { position: relative; }
.search .icon { position: absolute; left: 13px; top: 13px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 40px; }
.search input::-webkit-search-cancel-button { display: none; }

details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary .icon { color: var(--muted); transition: transform 0.18s ease; }
details[open] > summary .icon { transform: rotate(90deg); }

.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 72px;
  padding: 14px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  overflow-wrap: anywhere;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--accent); background: var(--tint); }
.dropzone.has-file { border-style: solid; border-color: var(--accent); background: var(--tint); color: var(--text); font-weight: 500; }
.dropzone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

/* Reader */
.toolbar {
  position: sticky;
  top: 8px;
  z-index: 3;
  margin: -8px -4px 22px;
  padding: 10px 12px 6px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--wash);
  border-radius: 18px;
  box-shadow: var(--shadow-raised);
}
.toolbar-note { display: flex; align-items: center; gap: 10px; min-height: 44px; }

.player { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.player button { flex: none; display: grid; place-items: center; padding: 0; min-height: 0; border-radius: 50%; }
.player .play { width: 44px; height: 44px; box-shadow: 0 4px 10px -3px color-mix(in srgb, var(--accent) 65%, transparent); }
.player .rewind { width: 34px; height: 34px; background: transparent; color: var(--muted); }
.player .rewind:hover:not(:disabled) { background: var(--wash); color: var(--text); }
.wave { position: relative; flex: 1 1 0; min-width: 0; height: 40px; --played: 0%; }
.wave svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; fill: currentColor; }
.wave .rest { color: color-mix(in srgb, var(--text) 20%, transparent); }
.wave .done { color: var(--accent); clip-path: inset(0 calc(100% - var(--played)) 0 0); }
.seek {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}
.wave:has(.seek:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.time {
  flex: none;
  width: 32px;
  font-size: 0.75rem;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.toolbar-options { justify-content: space-between; column-gap: 10px; row-gap: 0; }
.toolbar-options .switches { display: flex; gap: 12px; }
button.speed {
  min-height: 30px;
  min-width: 44px;
  padding: 2px 10px;
  border-radius: 99px;
  background: var(--wash);
  color: var(--text);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.sentence { margin-bottom: 20px; }
.ja {
  font-family: var(--ja);
  font-size: 1.3rem;
  line-height: 2.3;
  overflow-wrap: anywhere;
}
.ja.plain { line-height: 1.8; }
rt { font-size: 0.55em; color: var(--muted); user-select: none; }
.word {
  all: unset;
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 0;
  border-bottom: 2px solid transparent;
  transition: background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.word:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.word:focus-visible { outline: 2px solid var(--accent); }
.word.selected { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.word.new { border-bottom-color: var(--new); }
.word.due { border-bottom-color: var(--due); }
.word.mark-1 { background: color-mix(in srgb, var(--again) 22%, transparent); }
.word.mark-2 { background: color-mix(in srgb, var(--hard) 22%, transparent); }
.word.mark-3 { background: color-mix(in srgb, var(--good) 22%, transparent); }
.word.mark-4 { background: color-mix(in srgb, var(--easy) 22%, transparent); }
.word.selected { box-shadow: 0 0 0 1.5px var(--accent); }

button.en-toggle { display: block; padding: 0; color: var(--muted); font-size: 0.8125rem; text-align: left; }
button.en-toggle:hover { color: var(--accent); text-decoration: none; }
.en {
  color: var(--muted);
  border-left: 2px solid var(--line);
  padding-left: 10px;
  margin-top: 2px;
  animation: fade 0.2s ease;
}
@keyframes fade { from { opacity: 0; } }

.legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 18px; font-size: 0.8125rem; }
.legend span { border-bottom: 2px solid; padding-bottom: 1px; }
.legend .new { border-color: var(--new); }
.legend .due { border-color: var(--due); }

.sheet {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  max-height: 72vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -12px 40px rgb(0 0 0 / 20%);
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  animation: rise 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes rise { from { transform: translateY(48px); } }
.sheet::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 99px;
  background: var(--line);
}
.sheet-inner { max-width: 648px; margin: 0 auto; }
.sheet-lemma { font-family: var(--ja); font-size: 1.85rem; line-height: 1.2; font-weight: 600; overflow-wrap: anywhere; }
.sheet ol { margin: 12px 0 14px; padding-left: 22px; }
.sheet li { margin-bottom: 4px; }
.sheet li::marker { color: var(--muted); font-size: 0.875em; }
.status {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 99px;
  --status: var(--good);
  color: color-mix(in srgb, var(--status) 82%, var(--text));
  background: color-mix(in srgb, var(--status) 15%, transparent);
}
.status.new { --status: var(--new); }
.status.due { --status: var(--due); }
.status.known { --status: var(--easy); }

.marks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.marks button {
  min-height: 42px;
  padding: 6px 2px;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.2;
  border-radius: 11px;
  background: color-mix(in srgb, var(--mark) 11%, transparent);
  color: color-mix(in srgb, var(--mark) 78%, var(--text));
}
.marks button:hover:not(:disabled) { background: color-mix(in srgb, var(--mark) 20%, transparent); }
.marks button.on, .marks button.on:hover:not(:disabled) { background: var(--mark); color: #fff; font-weight: 600; }
.mark-again { --mark: var(--again); }
.mark-hard { --mark: var(--hard); }
.mark-good { --mark: var(--good); }
.mark-easy { --mark: var(--easy); }

.finish { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.finish-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.sheet-choice { position: sticky; bottom: 0; padding-top: 6px; background: var(--surface); }
.review-progress { flex-wrap: nowrap; margin-bottom: 4px; }
.chapter-links { margin-top: 14px; font-weight: 500; }

.word-row .card-title { font-size: 1.2rem; }
.word-meaning { color: var(--muted); overflow-wrap: anywhere; margin-top: 2px; }
.word-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 10px; }
button.word-action, button.word-action:hover:not(:disabled) {
  --action: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 11px;
  background: transparent;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--action) 40%, transparent);
  color: color-mix(in srgb, var(--action) 78%, var(--text));
}
button.word-action:hover:not(:disabled) { background: color-mix(in srgb, var(--action) 11%, transparent); }
button.word-known, button.word-known:hover:not(:disabled) { --action: var(--easy); }
.word-remove { margin-left: auto; color: var(--muted) !important; font-size: 0.8125rem; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { margin: 0; padding: 14px; display: flex; flex-direction: column; min-width: 0; }
.tile-wide { grid-column: 1 / -1; }
.tile-label { font-size: 0.875rem; color: var(--muted); }
.tile-value { font-family: var(--ui); font-size: 2.25rem; line-height: 1.15; font-weight: 600; }
.tile-chart { display: block; width: 100%; height: auto; margin-top: auto; padding-top: 8px; }
.tile-axis { font-size: 0.6875rem; margin-top: 4px; flex-wrap: nowrap; white-space: nowrap; }
.tile-note { margin-top: 8px; line-height: 1.3; font-size: 0.75rem; }
.meter { height: 8px; margin-top: auto; border-radius: 99px; overflow: hidden; background: color-mix(in srgb, var(--answer-4) 16%, transparent); }
.meter-fill { height: 100%; border-radius: 99px; background: var(--answer-4); }
.chart-axis { stroke: var(--line); stroke-width: 1; }
.chart-grid { stroke: var(--wash); stroke-width: 1; }
.chart-past { fill: color-mix(in srgb, var(--text) 24%, transparent); }
.chart-current { fill: var(--accent); }
.chart-hit:hover .chart-past { fill: color-mix(in srgb, var(--text) 40%, transparent); }
.chart-text { font-family: var(--ui); font-size: 11px; fill: var(--muted); }
.chart-text.strong { fill: var(--text); font-weight: 600; }
.pie-row { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.pie { flex: 0 0 104px; width: 104px; height: 104px; }
.pie-slice { stroke: var(--surface); stroke-width: 2; stroke-linejoin: round; }
.pie-slice:hover { opacity: 0.85; }
.chart-legend { flex: 1; min-width: 0; list-style: none; margin: 0; padding: 0; font-size: 0.8125rem; }
.chart-legend li { display: flex; align-items: center; gap: 7px; padding: 2px 0; }
.legend-key { flex: none; width: 10px; height: 10px; }
.legend-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.legend-share { width: 2.6em; text-align: right; font-variant-numeric: tabular-nums; }

.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; margin: 14px 0 4px; }
.facts dt { font-size: 0.75rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; font-size: 0.9375rem; }
.stat-title { font-family: var(--ui); font-size: 0.875rem; font-weight: 600; margin: 16px 0 6px; }
.stat-chart { display: block; width: 100%; height: auto; }
.recall-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.recall-area { fill: color-mix(in srgb, var(--accent) 10%, transparent); }
.recall-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.timeline-dot { stroke: var(--surface); stroke-width: 2; }
.answer-bars { margin-bottom: 8px; }
.answer-bar { display: grid; grid-template-columns: 7.5em minmax(0, 1fr) 2em; align-items: center; gap: 8px; padding: 2px 0; }
.answer-bar svg { display: block; width: 100%; height: 10px; }
.answer-bar .legend-value { text-align: right; }
.answer-list { margin-top: 8px; }
.answer-list summary { cursor: pointer; color: var(--muted); }
.answer-list table { margin-top: 6px; border-collapse: collapse; }
.answer-list td { padding: 2px 16px 2px 0; }
.word-remove:hover { color: var(--again) !important; }

button.choice {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  margin-bottom: 10px;
  padding: 12px 16px;
  text-align: left;
  border: 1px solid var(--wash);
}
button.choice[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.choice .check {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--text) 25%, transparent);
  transition: border-color 0.15s ease, border-width 0.15s ease;
}
.choice[aria-pressed="true"] .check { border: 6px solid var(--accent); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  z-index: 20;
  background: var(--text);
  color: var(--bg);
  border-radius: 99px;
  box-shadow: var(--shadow-raised);
  padding: 10px 18px;
  font-size: 0.9rem;
  animation: toast 0.22s ease;
}
@keyframes toast { from { transform: translate(-50%, 8px); opacity: 0; } }

.center { text-align: center; padding-top: 56px; }
.center h1 { font-size: 2.5rem; margin-bottom: 8px; }
.hanko {
  display: inline-grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--ja);
  font-size: 2.1rem;
  font-weight: 600;
  line-height: 1;
  transform: rotate(-3deg);
  box-shadow: var(--shadow-raised);
}
footer { margin-top: 40px; font-size: 0.8125rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
