:root{
  --bg:#F4F6FB; --card:#FFFFFF; --ink:#14213D; --ink2:#2A3347; --muted:#4A5366; --muted2:#5B6475;
  --line:#D5DBE8; --line2:#E4E8F2; --accent:#2F5BEA; --accent-ink:#1E3FB0; --accent-soft:#E6ECFD;
  --ok-bg:#DDF3E4; --ok-ink:#11502A; --ok:#1F8A4C;
  --warn-bg:#FFF1D6; --warn-ink:#6B4200; --warn:#D9901A; --weak:#FFE2A8; --weak-ink:#5A3700;
  --miss:#B4441F; --miss-ink:#8A2F12; --rec:#C2362B;
  --radius:16px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{background:var(--bg);color:var(--ink);font-family:Inter,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;font-size:16px;line-height:1.45;-webkit-text-size-adjust:100%;overflow-x:hidden}
.display{font-family:"Baloo 2",Inter,system-ui,sans-serif;font-weight:700}
a{color:var(--accent)} a:hover{color:var(--accent-ink)}
button{font:inherit;color:inherit}
.app{max-width:480px;margin:0 auto;min-height:100vh;min-height:100dvh;padding:16px 16px 24px;display:flex;flex-direction:column}
.screen{display:none;flex-direction:column;gap:12px;flex:1;min-width:0}
.screen.on{display:flex}
.row{display:flex;align-items:center;gap:10px;min-width:0}
.between{justify-content:space-between}
.wrap{flex-wrap:wrap}
.grow{flex:1;min-width:0}
.label{font-size:12px;font-weight:600;color:var(--muted2);letter-spacing:.06em;text-transform:uppercase}
.muted{color:var(--muted2);font-size:13px}
.card{background:var(--card);border:1.5px solid var(--line);border-radius:18px;padding:14px;min-width:0}
.pill{display:inline-flex;align-items:center;font-size:12px;font-weight:600;padding:5px 10px;border-radius:999px;background:var(--accent-soft);color:var(--accent-ink);white-space:nowrap}
.pill.warn{background:var(--warn-bg);color:var(--warn-ink)}
.chips{display:flex;flex-wrap:wrap;gap:6px}

/* header */
.brand{display:flex;align-items:center;gap:10px;min-width:0}
.logo{width:38px;height:38px;flex-shrink:0;border-radius:11px;background:var(--accent);display:flex;align-items:center;justify-content:center}
.brand-name{font-size:21px;line-height:1;white-space:nowrap}
.brand-sub{white-space:nowrap}
.brand-sub{font-size:12px;color:var(--muted2)}
h1{margin:4px 0 0;font-size:28px;line-height:1.1}
h2{margin:0;font-size:22px;line-height:1.15}

/* buttons */
.btn{display:flex;align-items:center;justify-content:center;gap:8px;min-height:52px;padding:0 16px;border-radius:var(--radius);border:1.5px solid var(--line);background:var(--card);color:var(--ink);font-weight:600;font-size:15px;cursor:pointer;text-decoration:none;text-align:center}
.btn.primary{background:var(--accent);border-color:var(--accent);color:#fff;font-weight:700;font-size:16px}
.btn.primary:disabled{opacity:.55;cursor:default}
.btn.link{border:0;background:transparent;color:var(--accent-ink);min-height:44px}
.btn-row{display:flex;gap:10px;flex-wrap:wrap}
.btn-row .btn{flex:1 1 130px}
.icon-btn{width:44px;height:44px;flex-shrink:0;border-radius:12px;background:var(--card);border:1.5px solid var(--line);display:flex;align-items:center;justify-content:center;cursor:pointer;padding:0}

/* selectors */
.seg{display:flex;gap:6px;padding:4px;background:#E4E8F2;border-radius:14px;flex-wrap:wrap}
.seg button{flex:1 1 90px;min-height:40px;border:0;border-radius:10px;background:transparent;color:var(--muted);font-weight:600;font-size:14px;cursor:pointer;padding:0 8px}
.seg button[aria-pressed="true"]{background:#fff;color:var(--ink)}
.choice-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:10px}
.choice{text-align:left;padding:12px 14px;border-radius:16px;border:1.5px solid var(--line);background:var(--card);cursor:pointer;display:flex;flex-direction:column;gap:4px;min-width:0}
.choice[aria-pressed="true"]{border-color:var(--accent);background:var(--accent-soft)}
.choice b{font-size:15px}
.choice span{font-size:12px;color:var(--muted);line-height:1.35}
.meter{height:6px;border-radius:999px;background:var(--line2);overflow:hidden}
.meter i{display:block;height:6px;border-radius:999px;background:var(--accent)}

/* question */
.progress{height:6px;border-radius:999px;background:#DDE2EE}
.progress i{display:block;height:6px;border-radius:999px;background:var(--accent);transition:width .3s}
.qtext{margin:0;font-size:21px;line-height:1.28;overflow-wrap:anywhere}
.answer-box{width:100%;min-height:110px;resize:vertical;border:1.5px dashed #B9C2D6;border-radius:16px;padding:12px;font:inherit;font-size:15px;line-height:1.5;color:var(--ink2);background:var(--card)}
.answer-box:focus{outline:2px solid var(--accent);outline-offset:1px;border-style:solid}
.interim{color:var(--muted2);font-style:italic;font-size:14px;min-height:20px;overflow-wrap:anywhere}
.mic-wrap{display:flex;flex-direction:column;align-items:center;gap:10px;padding:6px 0}
.wave{display:flex;align-items:center;gap:4px;height:36px}
.wave i{display:block;width:4px;height:6px;border-radius:4px;background:#B9C2D6;transition:height .15s}
.recording .wave i{background:var(--accent)}
.mic{width:84px;height:84px;border-radius:999px;border:0;background:var(--accent);box-shadow:0 0 0 10px #DCE4FB;display:flex;align-items:center;justify-content:center;cursor:pointer}
.recording .mic{background:var(--rec);box-shadow:0 0 0 10px #F7D9D6}
.mic-status{font-size:14px;font-weight:600;color:var(--ink2);text-align:center}
.notice{font-size:13px;line-height:1.45;padding:10px 12px;border-radius:12px;background:var(--warn-bg);color:var(--warn-ink)}
.notice.err{background:#FBE3E0;color:#7A1F14}

/* viva */
.bubble{max-width:88%;padding:12px 14px;display:flex;flex-direction:column;gap:4px;overflow-wrap:anywhere}
.bubble small{font-size:11px;font-weight:600}
.bubble.me{align-self:flex-end;background:var(--accent-soft);border-radius:18px 18px 4px 18px}
.bubble.me small{color:var(--accent-ink)}
.bubble.ex{background:var(--card);border:1.5px solid var(--line);border-radius:18px 18px 18px 4px}
.bubble.ex small{color:var(--muted2)}
.avatar{width:36px;height:36px;flex-shrink:0;border-radius:999px;background:var(--ink);display:flex;align-items:center;justify-content:center}

/* result */
.score{background:var(--ink);color:#fff;border-radius:22px;padding:18px;display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.score .big{font-size:52px;line-height:1}
.score .of{font-size:18px;color:#C9D2E6}
.score p{margin:0;font-size:13px;color:#C9D2E6;line-height:1.4}
.rub{display:flex;flex-direction:column;gap:12px}
.rub-item{display:flex;flex-direction:column;gap:6px}
.rub-item .meter i.full{background:var(--ok)}
.rub-item .meter i.part{background:var(--warn)}
.rub-fb{font-size:12px;color:var(--muted)}
.transcript{font-size:14px;line-height:1.85;overflow-wrap:anywhere}
.hl{border-radius:4px;padding:1px 3px}
.hl.correct{background:var(--ok-bg);color:var(--ok-ink)}
.hl.partial{background:var(--warn-bg);color:var(--warn-ink)}
.hl.wrong{background:#FBE3E0;color:#7A1F14;text-decoration:line-through}
.missed{border:1.5px dashed var(--miss);color:var(--miss-ink);border-radius:8px;padding:6px 8px;font-size:13px}
.legend{display:flex;gap:12px;flex-wrap:wrap;font-size:12px;color:var(--muted)}
.legend span{display:flex;align-items:center;gap:6px}
.sw{width:12px;height:12px;border-radius:3px;display:inline-block}
details.model summary{cursor:pointer;font-weight:600;color:var(--accent-ink);min-height:44px;display:flex;align-items:center}
details.model p{margin:4px 0 0;font-size:14px;line-height:1.6;color:var(--ink2)}

/* map */
.cchip{font-size:13px;font-weight:600;padding:7px 10px;border-radius:10px;border:1.5px solid}
.cchip.strong{background:var(--ink);color:#fff;border-color:var(--ink)}
.cchip.weak{background:var(--weak);color:var(--weak-ink);border-color:#E0B565}
.cchip.new{background:#fff;color:var(--muted);border-color:#8892A6;border-style:dashed}
.due-row{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 0;border-bottom:1px solid var(--line2)}
.due-row:last-child{border-bottom:0}

/* summary */
.sum-row{display:flex;justify-content:space-between;gap:10px;padding:10px 0;border-bottom:1px solid var(--line2);font-size:14px}
.sum-row:last-child{border-bottom:0}

/* loading */
.overlay{position:fixed;inset:0;background:rgba(20,33,61,.55);display:none;align-items:center;justify-content:center;padding:24px;z-index:10}
.overlay.on{display:flex}
.overlay .card{max-width:320px;text-align:center;display:flex;flex-direction:column;gap:10px;align-items:center}
.spinner{width:36px;height:36px;border-radius:999px;border:4px solid var(--accent-soft);border-top-color:var(--accent);animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.foot{margin-top:auto;padding-top:16px;text-align:center;font-size:12px;color:var(--muted2)}
.foot a{color:var(--muted)}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}

@media (max-width:340px){
  .app{padding:12px 12px 20px}
  h1{font-size:24px}
  .qtext{font-size:18px}
  .score .big{font-size:42px}
  .brand-name{font-size:19px}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
