:root {
  color-scheme: light;
  --page: #f3f4f8;
  --paper: #fff;
  --ink: #181b2a;
  --soft: #565c73;
  --line: #dfe2ec;
  --blue: #3438c4;
  --blur: #eef0ff;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.55;
  color: var(--ink);
  background: var(--page);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--blue); }
p, h1, h2, h3 { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); letter-spacing: -.065em; line-height: 1.06; margin-bottom: .55rem; }
h2 { font-size: 1.3rem; line-height: 1.25; letter-spacing: -.035em; margin-bottom: .55rem; }
h3 { font-size: 1rem; }
.shell { display: grid; min-height: 100vh; grid-template-columns: 14rem minmax(0, 1fr); }
.rail { padding: 2rem 1.25rem; border-right: 1px solid var(--line); background: #fbfbfe; display: flex; flex-direction: column; gap: 2.8rem; }
.brand { display: flex; align-items: center; gap: .65rem; color: var(--ink); text-decoration: none; font-weight: 780; font-size: .9rem; line-height: 1.1; letter-spacing: -.035em; }
.brand small { display: block; font-size: .76rem; letter-spacing: .14em; color: var(--blue); margin-top: .3rem; }
.mark { width: 2.2rem; height: 2.2rem; display: flex; align-items: center; justify-content: center; gap: 3px; background: var(--blue); border-radius: .68rem; }
.mark i { height: .65rem; width: 3px; background: #fff; border-radius: 3px; }
.mark i:nth-child(2) { height: 1.12rem; }
.mark i:nth-child(3) { height: .85rem; }
.rail nav { display: grid; gap: .28rem; }
.rail nav a { border-radius: .62rem; padding: .65rem .8rem; color: var(--soft); text-decoration: none; font-weight: 640; font-size: .92rem; }
.rail nav a:hover, .rail nav a[aria-current] { color: var(--blue); background: var(--blur); }
.rail-note { margin-top: auto; color: var(--soft); font-size: .875rem; }
.main { width: min(100%, 88rem); margin-inline: auto; padding: clamp(1rem, 4vw, 4rem); }
.page-head { margin: 1rem 0 2rem; }
.page-head p, .soft { color: var(--soft); }
.workspace { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(16rem, 1fr); gap: 1rem; align-items: start; }
.stack { display: grid; gap: 1rem; align-content: start; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 1.1rem; padding: clamp(1rem, 2vw, 1.55rem); min-width: 0; }
.toolbar { display: flex; align-items: end; gap: .75rem; flex-wrap: wrap; }
.toolbar.compact > label { flex: 1 1 8.1rem; min-width: 0; }
label { display: inline-grid; gap: .25rem; color: var(--soft); font-size: .875rem; font-weight: 650; }
input, select, textarea, button { font: inherit; }
input:not([type=checkbox]), select, textarea { padding: .52rem .65rem; background: #fff; border: 1px solid #cbd0e1; border-radius: .55rem; color: var(--ink); width: 100%; }
#ownText { resize: vertical; }
select { appearance: none; padding-right: 1.85rem; background-image: linear-gradient(45deg,transparent 50%,var(--soft) 50%),linear-gradient(135deg,var(--soft) 50%,transparent 50%); background-position: calc(100% - .9rem) 52%,calc(100% - .65rem) 52%; background-size: .25rem .25rem; background-repeat: no-repeat; }
button { background: var(--blue); color: #fff; border: 1px solid var(--blue); border-radius: .6rem; padding: .63rem .95rem; cursor: pointer; font-weight: 680; min-height: 2.75rem; line-height: 1.25; }
button:hover:not(:disabled) { filter: brightness(.92); }
button.secondary, #finish { background: #fff; border-color: #cbd0e1; color: var(--ink); }
button:disabled { opacity: .53; cursor: default; }
:focus-visible { outline: 3px solid #676cff; outline-offset: 2px; }
.practice-tools { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.capture-state { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.6rem; padding: .45rem .7rem; border-radius: .6rem; background: #eeeff4; color: var(--soft); font-size: .85rem; font-weight: 720; }
.capture-state::before { content: ""; width: .6rem; height: .6rem; flex: 0 0 .6rem; border-radius: 50%; background: currentColor; }
.capture-state[data-state=preparing], .capture-state[data-state=replay] { color: #3335a0; background: #e9eafe; }
.capture-state[data-state=recording] { color: #a11c36; background: #ffe5e9; }
.capture-state[data-state=error] { color: #933816; background: #fbeee2; }
#captureTime { font-variant-numeric: tabular-nums; }
#captureState { margin-bottom: .5rem; }
.analysis-link { margin-left: auto; font-size: .85rem; padding: .5rem .65rem; }
#activeChannels { color: var(--blue); margin-left: .25rem; }
.passage { border-radius: .85rem; background: #edf0f8; padding: clamp(1rem, 3vw, 2rem); margin: .85rem 0 1.25rem; min-height: 10rem; display: grid; align-content: center; gap: .55rem; }
.passage-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .25rem .55rem; }
#readingCount { color: #255644; font-size: .8rem; font-weight: 690; }
.pronunciation-option { display: flex; align-items: center; gap: .7rem; margin-top: .85rem; cursor: pointer; }
.pronunciation-option input { flex: none; width: 1.2rem; height: 1.2rem; margin: 0; accent-color: var(--blue); }
.pronunciation-option small { display: block; color: var(--soft); font-weight: 450; }
#pronunciationCount { color: #7d1919; font-size: .8rem; font-weight: 690; }
.caption { color: var(--blue); font-size: .85rem; font-weight: 700; }
#passage { font-family: Georgia, serif; font-size: clamp(1.3rem, 3vw, 1.85rem); line-height: 1.43; overflow-wrap: anywhere; }
#passage[data-long-reading] { max-height: min(52vh, 25rem); overflow: auto; overscroll-behavior-y: contain; white-space: pre-line; }
.read-match { background: #bce6d0; color: #114a30; border-radius: .2em; text-decoration: underline; text-decoration-thickness: .11em; text-underline-offset: .13em; }
.read-pron-suspect { background: #ffe1e1; color: #7d1919; border-radius: .2em; text-decoration: underline dotted; text-underline-offset: .15em; }
.read-pron-observation { background: #ffebbc; color: #614000; border-radius: .2em; text-decoration: underline dotted; cursor: pointer; }
.read-pron-observation[data-pron-preliminary] { background: #fff3d7; text-decoration-style: dashed; }
#pronunciationCount[data-diagnostic] { color: #614000; }
#pronunciationDetail { font-size: .9rem; }
#nextRuPassage { font-size: .82rem; padding: .35rem .6rem; }
.read-next { background: #dce1ff; box-shadow: 0 0 0 2px #5b63d3; border-radius: .12em; }
.speech-preview { margin-top: .8rem; padding: .85rem 1rem; border-radius: .75rem; background: #edf0f8; }
#transcript { margin-top: .25rem; overflow-wrap: anywhere; }
.actions { margin-bottom: .65rem; }
.manager .soft { font-size: .89rem; margin-bottom: .6rem; }
#channels { display: grid; gap: .45rem; margin-bottom: .8rem; }
.channel { border: 1px solid var(--line); border-radius: .65rem; overflow: hidden; }
.channel[data-enabled=true] { border-color: #b8bdec; background: #f6f7ff; }
.channel-toggle { display: flex; justify-content: space-between; gap: .7rem; align-items: center; padding: .6rem .7rem; min-height: 3.15rem; cursor: pointer; }
.channel-name { display: grid; color: var(--ink); font-weight: 710; line-height: 1.35; }
.channel-name small { color: var(--soft); font-weight: 500; margin-top: .2rem; }
.channel-toggle input { appearance: none; width: 2.4rem; height: 1.4rem; flex: 0 0 2.4rem; margin: 0; border: 1px solid #7f859d; border-radius: 1rem; background: #e4e6ee radial-gradient(circle at .66rem 50%, #5e657e .37rem, transparent .4rem); cursor: pointer; }
.channel-toggle input:checked { border-color: var(--blue); background: var(--blue) radial-gradient(circle at 1.67rem 50%, white .38rem, transparent .41rem); }
.channel-toggle input:disabled { cursor: default; }
.channel-method { display: grid; padding: 0 .7rem .65rem; font-size: .8rem; }
.channel-method select { min-height: 2.65rem; }
.tick { display: flex; gap: .55rem; align-items: center; color: var(--ink); letter-spacing: -.01em; font-weight: 640; }
.tick input { width: 1.05rem; height: 1.05rem; accent-color: var(--blue); margin: 0; }
.manager button { margin-top: .85rem; width: 100%; }
.manager .analysis-back { display: none; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,9rem),1fr)); gap: .5rem; margin: .75rem 0; }
.metric { padding: .7rem; background: #f3f4fa; border-radius: .6rem; }
.metric strong { display: block; font-size: 1.16rem; overflow-wrap: anywhere; }
.metric small { display: block; color: var(--soft); font-size: .83rem; }
.notice { padding: .75rem 1rem; color: #202578; background: var(--blur); border-radius: .6rem; margin-bottom: .8rem; }
video { width: min(100%,19rem); margin-top: 1rem; border-radius: .75rem; transform: scaleX(-1); }
.game-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: .85rem; }
.game-mode { display: grid; align-content: start; gap: .35rem; min-height: 7rem; padding: 1rem; text-align: left; border-radius: .9rem; }
.game-mode strong { font-size: 1.12rem; }
.game-mode small { font-weight: 450; font-size: .87rem; color: var(--soft); line-height: 1.4; }
.game-stage { background: var(--blur); display: grid; align-content: center; justify-items: start; gap: .55rem; min-height: 15rem; }
.game-stage h2 { font-size: clamp(1.8rem, 5vw, 3rem); margin: 0; }
.game-stage progress { width: min(100%, 19rem); accent-color: var(--blue); }
#gameClock { font-variant-numeric: tabular-nums; font-weight: 750; }
#gameRoundScore { font-variant-numeric: tabular-nums; font-weight: 650; }
#gameOutcome { font-weight: 720; }
.game-preview .toolbar, #gameInvite button { margin-top: .6rem; }
#gameInvite label { display: grid; }
#gameChoicePreview { font-weight: 450; overflow-wrap: anywhere; }
.game-history { margin-bottom: 1rem; }
.history-list details { border-bottom: 1px solid var(--line); padding: .75rem 0; }
.history-list summary { cursor: pointer; font-weight: 650; }
.history-list + button { margin-top: .85rem; }
.trend { margin-top: 1rem; max-width: 29rem; }
.trend canvas { width: 100%; height: auto; background: #f3f4fa; border-radius: .65rem; }
.account { max-width: 31rem; }
.room-members { margin: 1rem 0; display: grid; gap: .45rem; }
.room-members p { margin: 0; }
.lab { width: min(58rem,100%); margin: auto; padding: 1.4rem; }
.lab h1,.lab h2,.lab .toolbar { margin: 1rem 0; }
.lab pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #fff; border: 1px solid var(--line); padding: .85rem; }
@media (max-width: 980px) {
  .shell { grid-template-columns: 11.5rem minmax(0, 1fr); }
  .workspace { gap: .7rem; grid-template-columns: minmax(0, 1.55fr) minmax(13.5rem, 1fr); }
}
@media (max-width: 720px) {
  .shell,.workspace { grid-template-columns: minmax(0,1fr); }
  .rail { padding: .75rem 1rem .28rem; gap: .55rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail nav { display: flex; flex-wrap: wrap; gap: .14rem; }
  .rail nav a { padding: .44rem .5rem; font-size: .875rem; }
  .rail-note { display: none; }
  .page-head { margin: .7rem 0 1.15rem; }
  .manager .analysis-back { display: block; }
  .analysis-link { margin-left: 0; }
}
