:root{color-scheme:dark;--bg:#0b121c;--fg:#f3f5f8;--size:36px;--line:1.5;--font:'Yu Mincho','Hiragino Mincho ProN',serif}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--fg);font-family:'Yu Gothic',system-ui,sans-serif}button,input,select{font:inherit}button{min-height:44px;min-width:44px;border:1px solid transparent;background:transparent;color:#adb8c6;border-radius:8px;padding:8px 14px;cursor:pointer}button:hover{background:#203044;color:#f3f5f8}button:disabled{opacity:.35;cursor:default}button:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #80b8ff;outline-offset:4px}#app{min-height:100svh;display:grid;grid-template-rows:auto 1fr auto}header{min-height:56px;display:flex;align-items:center;padding:0 24px;border-bottom:1px solid #293848;gap:20px}.title{flex:1;min-width:0}.title strong{font-size:15px;font-weight:500}.title small{font-size:11px;color:#adb8c6;margin-left:14px}nav{display:flex;gap:4px}nav button{font-size:13px}main{display:flex;align-items:center;justify-content:center;min-height:280px;padding:48px 32px;touch-action:pan-y}#passages{max-width:960px;width:100%;text-align:center}#sentence{font-family:var(--font);font-size:var(--size);line-height:var(--line);margin:24px 0;white-space:pre-wrap;overflow-wrap:anywhere}rt{font-size:.45em}.vertical #sentence{writing-mode:vertical-rl;max-height:52svh;max-width:100%;overflow:auto;margin:24px auto;text-align:start}footer{background:#14202e;border-top:1px solid #293848;padding:24px 24px max(26px,env(safe-area-inset-bottom));display:flex;flex-direction:column;align-items:center;gap:20px}.transport{display:flex;align-items:center;gap:28px}.transport button{width:48px;height:48px;font-size:18px}.transport #play{width:64px;height:64px;border-radius:50%;background:#398ff5;color:white;font-size:22px}.speed{display:flex;gap:18px;align-items:center;font-size:13px;color:#adb8c6}.speed label{white-space:nowrap}.speed output{color:#f3f5f8;margin:0 8px;font-variant-numeric:tabular-nums}.speed label span{font-size:11px}input[type=range]{accent-color:#398ff5;min-height:44px;width:240px}#state{font-size:12px;min-width:84px}#progress{width:min(640px,100%);font-size:12px;color:#adb8c6}progress{width:85%;height:4px;margin-right:16px;accent-color:#398ff5}.ui-hidden header,.ui-hidden footer{visibility:hidden;pointer-events:none}#error{position:fixed;bottom:0;margin:0;background:#612c36;color:white;width:100%;padding:12px;font-size:14px}dialog{background:#14202e;color:#f3f5f8;border:1px solid #293848;border-radius:12px;width:min(560px,calc(100% - 32px));max-height:85svh;padding:24px}dialog::backdrop{background:#0009}.dialogHead{display:flex;align-items:center;justify-content:space-between;gap:12px}h1{font-size:20px;margin:0}#dialogBody{padding:16px 0;line-height:1.8}#dialogBody label{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:12px 0}#dialogBody input[type=number],select{max-width:180px;min-height:44px;background:#0b121c;color:#f3f5f8;border:1px solid #46566b;border-radius:6px;padding:8px}input[type=checkbox]{width:22px;height:22px;accent-color:#398ff5}#dialogActions{display:flex;justify-content:flex-end;gap:12px}#dialogActions button{background:#398ff5;color:white}#dialogBody p{font-size:14px;color:#adb8c6}body.focus #header{visibility:hidden}body.focus.ui-hidden #controls{visibility:hidden}
@media(max-width:600px){:root{--size:26px;--line:1.55}header{min-height:52px;padding:4px 12px;gap:4px;flex-wrap:wrap}.title small{display:block;margin:0;font-size:10px}.desktop{display:none!important}nav{gap:0}nav button{font-size:11px;padding:8px 6px}#about{padding:8px;min-width:32px}main{padding:28px 20px}footer{padding:18px 20px max(20px,env(safe-area-inset-bottom));gap:12px}.transport #play{width:60px;height:60px}.transport{gap:32px}.speed{width:100%;display:grid;grid-template-columns:1fr auto;gap:0 12px}.speed input{grid-column:1/-1;grid-row:2;width:100%}.speed #state{text-align:right}dialog{padding:18px}#dialogBody label{flex-wrap:wrap}}
body.focus:not(.ui-hidden) #header{visibility:visible}
@media(max-width:600px){#about{min-width:44px}.vertical #sentence{max-height:max(120px,min(52svh,calc(100svh - 360px)))}}
@media(max-height:480px){main{min-height:160px;padding:16px 20px}footer{padding:8px;gap:0}.speed input{min-height:30px}#sentence{margin:8px 0}}

/* UI-01: framed transport, quiet icon header, generous speed controls. */
header{gap:16px;background:#101a27}
header button{display:inline-flex;align-items:center;justify-content:center;padding:10px;color:#d9e2ed}
svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.type-icon{font-size:23px;line-height:1}
nav{gap:12px;align-items:center}
#seek{gap:8px;font-size:13px}
.title small{color:#adb8c6}
main{padding:40px 32px}
#passages{max-width:860px}
footer{background:transparent;border-top:0;padding:24px 32px max(28px,env(safe-area-inset-bottom));gap:20px}
.transport{gap:48px}
.transport button{display:flex;align-items:center;justify-content:center;gap:22px;width:152px;height:56px;border:1px solid #536476;border-radius:12px;background:#14202e;color:#f3f5f8;font-size:16px;font-weight:600}
.transport button:disabled{opacity:.5}
.transport button:hover:not(:disabled){background:#203044;border-color:#80b8ff}
.transport #play{display:block;width:72px;height:72px;border:0;font-size:28px;box-shadow:0 0 24px #398ff526}
.speed{width:min(640px,100%);display:grid;grid-template-columns:1fr auto;gap:4px 16px;font-size:15px}
.speed label{grid-column:1;display:flex;align-items:baseline;gap:8px}
.speed output{font-size:22px;margin:0;font-weight:600}
.speed label span{font-size:14px}
.speed-adjust{grid-column:1/-1;grid-row:2;display:flex;align-items:center;gap:20px;width:100%}
.speed-adjust button{flex:0 0 44px;width:44px;height:44px;padding:0;border:1px solid #536476;border-radius:50%;background:#14202e;color:#f3f5f8;font-size:26px}
.speed-adjust input{flex:1;min-width:0;width:100%;margin:0;cursor:pointer}
#state{grid-column:2;grid-row:1;align-self:center;text-align:right;font-size:13px}
@media(max-width:600px){
  header{padding:4px 12px;gap:8px;flex-wrap:nowrap}
  header button{padding:8px}
  .title strong{font-size:14px}
  .title small{font-size:10px}
  nav{gap:2px}
  #seek{gap:4px;padding:8px 6px;font-size:11px}
  #seek svg{width:20px;height:20px}
  main{padding:28px 20px}
  footer{padding:16px 20px max(20px,env(safe-area-inset-bottom));gap:14px}
  .transport{width:100%;max-width:380px;gap:20px;justify-content:center}
  .transport button{width:auto;flex:1;max-width:124px;height:48px;font-size:14px;gap:12px;padding:8px 12px}
  .transport #play{flex:0 0 60px;width:60px;height:60px;font-size:24px}
  .speed{gap:4px 8px}
  .speed label{gap:6px}
  .speed label span{font-size:12px}
  .speed output{font-size:20px}
  .speed-adjust{gap:12px}
  #state{font-size:11px;min-width:0}
}
@media(max-width:360px){
  header{gap:4px}
  .title small{max-width:90px;line-height:1.3}
  .transport{gap:12px}
  .transport button{gap:8px;padding:8px}
}
@media(max-height:480px){
  main{min-height:120px;padding:16px 20px}
  footer{padding:8px 20px;gap:4px}
  .transport button{height:44px}
  .transport #play{width:52px;height:52px;flex-basis:52px;font-size:22px}
  .speed-adjust{grid-row:1;grid-column:2;gap:12px}
  .speed{grid-template-columns:auto minmax(120px,1fr) auto;max-width:800px;gap:12px}
  .speed label{gap:4px}
  #state{grid-column:3}
}

/* Body and ruby inherit the same reading-position color. */
#app{grid-template-columns:minmax(0,1fr)}
.speed label{min-width:0;flex-wrap:wrap;white-space:normal}
#sentence.previously-read { color: color-mix(in srgb, var(--fg) 78%, var(--bg)); }

/* Use the actual space between the header and controls for vertical columns. */
@media(max-width:600px){
  .vertical #app{height:100svh;height:100dvh;min-height:0;grid-template-rows:auto minmax(0,1fr) auto}
  .vertical #surface{min-height:0;min-width:0;padding:16px 20px;overflow:hidden}
  .vertical #passages{height:100%;min-height:0}
  .vertical #sentence{height:100%;max-height:100%;width:max-content;max-width:100%;margin:0 auto}
}
