:root {
  --bg: #fbfaf7; --fg: #1d1d1f; --muted: #5a5a60; --card: #ffffff; --line: #c9c6bd;
  --accent: #0b5cad; --accent-fg: #ffffff; --accent-soft: #dbe9f7; --ok: #17613a; --warn: #8a4b00;
  --focus: #b35c00; --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15161a; --fg: #ececee; --muted: #a6a6ad; --card: #1f2127; --line: #4a4d57;
    --accent: #7ab4ee; --accent-fg: #0c1a2a; --accent-soft: #23405f; --ok: #7bd6a2; --warn: #f0b36b; --focus: #ffb454;
  }
}
:root[data-theme="dark"] {
  --bg: #15161a; --fg: #ececee; --muted: #a6a6ad; --card: #1f2127; --line: #4a4d57;
  --accent: #7ab4ee; --accent-fg: #0c1a2a; --accent-soft: #23405f; --ok: #7bd6a2; --warn: #f0b36b; --focus: #ffb454;
}
* { box-sizing: border-box; }
html { font-size: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); line-height: 1.5;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px;
  border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 2;
}
.brand { font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang button { min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--fg); font: inherit; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
main { max-width: 42rem; margin: 0 auto; padding: 16px; outline: none; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 8px 0 16px; }
h2 { font-size: 1.15rem; margin: 20px 0 8px; }
p, li { max-width: 65ch; }
.muted { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
button, .btn { font: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; min-width: 48px;
  padding: 8px 20px; border-radius: 10px; border: 2px solid var(--accent); background: var(--accent);
  color: var(--accent-fg); font-weight: 600; cursor: pointer;
}
.btn.secondary { background: transparent; color: var(--accent); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; border-style: dashed; }
.btn.big { min-height: 64px; width: 100%; font-size: 1.2rem; }
button.link { background: none; border: 0; color: var(--accent); text-decoration: underline; min-height: 44px; padding: 0 4px; cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 16px 0; padding: 8px 16px 12px; background: var(--card); }
legend { font-weight: 600; padding: 0 6px; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 4px 0; cursor: pointer; }
.choice input { width: 24px; height: 24px; flex: none; accent-color: var(--accent); }
.consent-list li { margin: 6px 0; }
.consent-sub { font-size: 1.1rem; margin: 16px 0 4px; }
.consent-save { font-weight: 600; margin: 12px 0; }
.round-nav { max-width: 42rem; margin: 0 auto; padding: 8px 16px 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 16px; border-top: 1px solid var(--line); }
.round-nav[hidden] { display: none; }
.status { max-width: 42rem; margin: 0 auto; padding: 0 16px 24px; color: var(--muted); min-height: 1.5em; }
.status.error { color: var(--warn); font-weight: 600; }
progress { width: 100%; height: 16px; }
/* item screens */
.meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.95rem; }
.tag-row { border-top: 1px solid var(--line); padding: 12px 0; }
.tag-row:first-child { border-top: 0; }
.tag-row[data-current="true"] { background: var(--accent-soft); margin: 0 -8px; padding: 12px 8px; border-radius: 8px; }
.tag-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag-name { font-weight: 600; font-size: 1.1rem; }
.gloss-btn { min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--card); color: var(--fg); cursor: pointer; }
.gloss { margin: 4px 0 0; color: var(--muted); font-size: 0.95rem; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.seg button, .opt {
  min-height: 48px; padding: 6px 8px; border: 2px solid var(--line); border-radius: 10px; background: var(--card);
  color: var(--fg); font: inherit; cursor: pointer; text-align: center;
}
.seg button[aria-pressed="true"], .opt[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.seg button[aria-pressed="true"]::before, .opt[aria-pressed="true"]::before { content: "\2713\00a0"; }
.seg button[disabled], .opt[disabled] { opacity: 0.45; cursor: not-allowed; border-style: dashed; }
.locked-note { color: var(--warn); margin: 8px 0 0; }
.scale { display: grid; gap: 8px; margin: 12px 0; }
.scale .opt { text-align: left; padding: 8px 14px; }
.pair-play { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.pair-play .btn { min-height: 72px; font-size: 1.1rem; }
.opts-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.feedback { border-left: 6px solid var(--ok); padding: 8px 12px; background: var(--accent-soft); border-radius: 6px; margin: 12px 0; }
.mock { border: 2px dashed var(--line); border-radius: var(--radius); padding: 12px; margin: 12px 0; }
.mock .seg span { border: 2px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; }
.mock .seg span.sel { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.mock .seg span.sel::before { content: "\2713\00a0"; }
.mock .playbtn { display: inline-block; padding: 10px 20px; border-radius: 10px; background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.highlight { background: var(--accent-soft); outline: 3px solid var(--accent); border-radius: 6px; padding: 2px 6px; }
.counter { font-size: 1.25rem; font-weight: 600; }
.noscript { padding: 16px; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--fg); max-width: 28rem; }
@media (max-width: 340px) { .seg { grid-template-columns: 1fr; } .opts-3 { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .brand { font-size: 0.9rem; line-height: 1.2; } button.link { font-size: 0.85rem; line-height: 1.2; } .seg button, .opt { padding: 6px 4px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
