
/* ============================================================
   Layout concept: exam-slip aesthetic — a tall left "answer card"
   (score input, styled like a 准考證/成績單) beside a scrollable
   results roll on the right; a full-screen detail sheet slides up
   for a single major's 3-year history.
   ============================================================ */
/* Deliberately single light theme (user asked for pale tones only,
   no dark decoration) — background and every color are still set
   explicitly as tokens so the page reads correctly regardless of the
   viewer's own OS/app theme setting. */
:root{
  --bg:#faf8f2; --surface:#ffffff; --surface-2:#f3f1e8;
  --ink:#2b2a25; --ink-2:#6b6a5f; --muted:#96948a;
  --line:#e7e4d7; --accent:#4a7ba6; --accent-2:#c6742a;
  --good:#0ca30c; --good-bg:#e6f6e2;
  --warn:#a86a00; --warn-bg:#fdf1da;
  --bad:#b3261e; --bad-bg:#fbe6e4;
  --unknown:#8c8a80; --unknown-bg:#eeece4;
  --s1:#2a78d6; --s2:#eb6834; --s3:#eda100;
  --accent-soft:#e9f0f7; --accent-line:#d1e0ee; --accent-2-soft:#fbeedd; --accent-2-line:#efd8bb;
  color-scheme: light;
}

*{box-sizing:border-box;}
body{
  background:var(--bg); color:var(--ink);
  font-family:'Noto Sans TC', system-ui, -apple-system, "Segoe UI", sans-serif;
  margin:0; padding-inline:16px; padding-block:20px;
}
h1,h2,h3{font-family:'Noto Serif TC', 'Noto Sans TC', serif; font-weight:700; margin:0; text-wrap:balance;}
.wrap{max-width:1180px; margin:0 auto;}
.top{display:flex; flex-wrap:wrap; align-items:baseline; gap:10px 18px; margin-bottom:18px;}
.top h1{font-size:26px; color:var(--accent);}
.top .sub{color:var(--ink-2); font-size:13.5px;}
.badge-meta{display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--muted); background:var(--surface-2); border:1px solid var(--line); border-radius:99px; padding:3px 10px;}

.grid{display:grid; grid-template-columns:340px 1fr; gap:20px; align-items:start;}
@media (max-width:860px){ .grid{grid-template-columns:1fr;} }
/* On wide layouts, give the ticket and the results column their own independent
   scrollbars (each capped to the visible viewport height) instead of one long
   page scroll — so switching a filter never requires scrolling back up through
   a long result list first. --grid-h is measured and set by JS. */
@media (min-width:861px){
  .grid{ align-items:stretch; height:var(--grid-h, calc(100vh - 170px)); }
  .ticket{ position:static; height:100%; min-height:0; overflow-y:auto; }
  .results-col{ height:100%; min-height:0; display:flex; flex-direction:column; }
  .results-head, .major-search{ flex:none; }
  .list{ flex:1; min-height:0; overflow-y:auto; padding-right:4px; margin-right:-4px; }
}

/* ---- input card ---- */
.card{background:var(--surface); border:1px solid var(--line); border-radius:14px;}
.ticket{padding:18px 18px 14px; position:sticky; top:calc(env(safe-area-inset-top,0px) + 12px);}
@media (max-width:860px){ .ticket{position:static;} }
.ticket h2{font-size:16px; color:var(--accent); border-bottom:2px dashed var(--line); padding-bottom:10px; margin-bottom:12px;}
.field-row{display:grid; grid-template-columns:1fr 1fr; gap:8px 10px; margin-bottom:8px;}
.field{display:flex; flex-direction:column; gap:3px;}
.field label{font-size:11.5px; color:var(--ink-2); letter-spacing:.02em;}
.field input[type=number], .field select{
  font:inherit; font-size:14px; padding:7px 8px; border-radius:8px;
  border:1px solid var(--line); background:var(--bg); color:var(--ink);
  width:100%;
}
.field input:focus, .field select:focus{outline:2px solid var(--accent); outline-offset:1px;}
.section-label{font-size:12px; font-weight:600; color:var(--accent-2); margin:14px 0 6px; display:flex; align-items:center; gap:6px;}
.section-label .line{flex:1; height:1px; background:var(--line);}
.hint{font-size:11.5px; color:var(--muted); margin:2px 0 8px; line-height:1.5;}
details.opt{border:1px solid var(--line); border-radius:10px; padding:8px 10px; margin-bottom:8px; background:var(--surface-2);}
details.opt summary{cursor:pointer; font-size:13px; font-weight:600; color:var(--ink);}
details.opt[open] summary{margin-bottom:8px;}
.chipset{display:flex; flex-wrap:wrap; gap:6px; margin-top:4px;}
.chip{
  font-size:12px; padding:5px 10px; border-radius:99px; border:1px solid var(--line);
  background:var(--bg); color:var(--ink-2); cursor:pointer; user-select:none;
}
.chip.on{background:var(--accent); border-color:var(--accent); color:#fff;}
.chip.school-hidden{display:none;}
.ticket-tabbar{display:flex; gap:8px; margin-bottom:14px;}
.ticket-tabbar .tab{flex:1; text-align:center; padding:7px 4px;}
.ticket-tabbar .tab span{font-size:11px; opacity:.85; margin-left:2px;}
.ticket-panel{display:none;}
.ticket-panel.active{display:block;}
.school-search{
  width:100%; box-sizing:border-box; padding:8px 10px; border:1px solid var(--line); border-radius:8px;
  background:var(--bg); color:var(--ink); font:inherit; font-size:13px; margin-bottom:8px;
}
.school-search:focus{outline:2px solid var(--accent); outline-offset:1px;}
.tier-quick{display:flex; flex-wrap:wrap; gap:6px; margin-bottom:10px;}
.tier-btn{font:inherit; font-size:12px; font-weight:600; padding:5px 11px; border-radius:99px; border:1px solid var(--accent); background:var(--bg); color:var(--accent); cursor:pointer;}
.tier-btn.on{background:var(--accent); color:#fff;}
.tier-btn:focus-visible{outline:2px solid var(--accent); outline-offset:2px;}
.school-quick-actions{display:flex; gap:14px; font-size:11.5px; color:var(--accent); margin-bottom:10px;}
.school-quick-actions span{cursor:pointer; text-decoration:underline;}
.school-group-title{font-size:12px; font-weight:600; color:var(--accent-2); margin:12px 0 6px;}
.school-group-title:first-child{margin-top:0;}
.school-group-empty{font-size:11.5px; color:var(--muted); padding:4px 0;}
.run-btn{
  width:100%; margin-top:14px; padding:11px; border-radius:10px; border:none;
  background:var(--accent); color:#fff; font:inherit; font-size:15px; font-weight:700;
  cursor:pointer; letter-spacing:.03em;
}
.run-btn:active{transform:translateY(1px);}
.reset-link{display:block; text-align:center; margin-top:8px; font-size:12px; color:var(--muted); cursor:pointer; background:none; border:none; text-decoration:underline; width:100%;}

/* ---- results ---- */
.results-head{display:flex; flex-wrap:wrap; justify-content:space-between; align-items:baseline; gap:8px; margin-bottom:10px;}
.results-head h2{font-size:18px;}
.count-tabs{display:flex; gap:6px; flex-wrap:wrap;}
.major-search{margin:0 0 12px;}
.major-search-box{position:relative;}
.major-search input{
  width:100%; font:inherit; font-size:14px; padding:9px 34px 9px 12px; border:1px solid var(--line); border-radius:10px;
  background:var(--surface); color:var(--ink); -webkit-appearance:none; appearance:none;
}
.major-search input:focus{outline:2px solid var(--accent); outline-offset:1px;}
.major-search input::-webkit-search-cancel-button{display:none;}
.major-search-clear{position:absolute; right:6px; top:50%; transform:translateY(-50%); width:26px; height:26px; border:none; border-radius:50%; background:var(--surface-2); color:var(--ink-2); cursor:pointer; font-size:13px; line-height:1;}
.major-search-note{margin-top:6px; font-size:12px; color:var(--ink-2); line-height:1.6; overflow-wrap:anywhere;}
.major-search-note b{color:var(--ink);}
.tab{font-size:12.5px; padding:5px 11px; border-radius:8px; border:1px solid var(--line); background:var(--surface); color:var(--ink-2); cursor:pointer;}
.tab.on{background:var(--ink); color:var(--bg); border-color:var(--ink);}
.list{display:flex; flex-direction:column; gap:8px;}
.row{
  background:var(--surface); border:1px solid var(--line); border-radius:12px;
  padding:12px 14px; display:flex; align-items:center; gap:12px; cursor:pointer;
}
.row:hover{border-color:var(--accent);}
.row .tier-stripe{width:4px; align-self:stretch; border-radius:4px; flex:none;}
.row .main{flex:1; min-width:0;}
.row .school{font-size:12px; color:var(--ink-2);}
.row .major{font-size:15px; font-weight:600; margin-top:1px; overflow-wrap:anywhere;}
.row .tags{display:flex; gap:6px; margin-top:5px; flex-wrap:wrap;}
.tag{font-size:11px; padding:2px 8px; border-radius:99px; background:var(--surface-2); color:var(--ink-2); border:1px solid var(--line);}
.row .quota{font-size:11.5px; color:var(--muted); white-space:nowrap;}
.pill{font-size:12px; font-weight:700; padding:4px 10px; border-radius:99px; white-space:nowrap; flex:none;}
.pill.good{background:var(--good-bg); color:var(--good);}
.pill.warn{background:var(--warn-bg); color:var(--warn);}
.pill.bad{background:var(--bad-bg); color:var(--bad);}
.pill.unknown{background:var(--unknown-bg); color:var(--unknown);}
.empty{padding:40px 20px; text-align:center; color:var(--muted); border:1px dashed var(--line); border-radius:12px;}

/* ---- detail sheet ---- */
.overlay{position:fixed; inset:0; background:rgba(0,0,0,.45); display:flex; justify-content:center; align-items:flex-end; z-index:50;}
@media (min-width:720px){ .overlay{align-items:center;} }
.sheet{
  background:var(--surface); width:100%; max-width:720px; max-height:88vh; overflow-y:auto;
  border-radius:16px 16px 0 0; padding:20px 20px calc(24px + env(safe-area-inset-bottom,0px));
}
@media (min-width:720px){ .sheet{border-radius:16px; max-height:82vh;} }
.sheet-top{display:flex; justify-content:space-between; align-items:flex-start; gap:10px; margin-bottom:4px;}
.sheet-top h3{font-size:20px; color:var(--accent);}
.close-btn{background:var(--surface-2); border:1px solid var(--line); border-radius:99px; width:32px; height:32px; font-size:16px; cursor:pointer; color:var(--ink); flex:none;}
.sheet .school-line{font-size:13px; color:var(--ink-2); margin-bottom:10px;}
.detail-pill{display:inline-block; margin:2px 0 14px;}
.block-title{font-size:13px; font-weight:700; color:var(--accent-2); margin:18px 0 8px;}
.subject-detail{font-size:12.5px; color:var(--ink-2); line-height:1.7; background:var(--surface-2); border-radius:10px; padding:10px 12px; margin-bottom:4px;}
.subject-detail b{color:var(--ink);}
.bar-chart{display:flex; align-items:flex-end; gap:18px; height:120px; padding:8px 4px 0;}
.bar-col{flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:6px; height:100%;}
.bar{width:100%; max-width:56px; border-radius:6px 6px 2px 2px; background:var(--s1); position:relative; min-height:2px;}
.bar-val{font-size:12px; font-weight:700; font-variant-numeric:tabular-nums;}
.bar-label{font-size:11px; color:var(--muted);}
.miss-line{font-size:11.5px; color:var(--warn); margin-top:2px;}
.miss-box{font-size:12.5px; color:var(--ink); background:var(--surface-2); border:1px solid var(--line); border-left:3px solid var(--warn); border-radius:8px; padding:8px 10px; margin-bottom:8px; line-height:1.6;}
.bar-missing{font-size:10.5px; color:var(--muted);}
table.hist{width:100%; border-collapse:collapse; font-size:12.5px; margin-top:4px; margin-bottom:14px;}
table.hist th, table.hist td{border-bottom:1px solid var(--line); padding:6px 6px; text-align:center;}
table.hist th:first-child, table.hist td:first-child{text-align:left; color:var(--ink-2);}
.trend-chart{margin-bottom:6px;}
.trend-chart svg{width:100%; height:auto; display:block;}
.trend-legend{display:flex; flex-wrap:wrap; gap:8px 14px; font-size:11.5px; color:var(--ink-2); margin:8px 0 16px;}
.trend-legend span{display:inline-flex; align-items:center; gap:5px;}
.trend-legend i{width:9px; height:9px; border-radius:50%; display:inline-block; flex:none;}
.sel-chart-grid{display:flex; flex-wrap:wrap; gap:10px; margin-bottom:8px;}
.sel-chart-card{flex:1 1 170px; max-width:220px; background:var(--surface-2); border:1px solid var(--line); border-radius:10px; padding:8px 6px 4px;}
.sel-chart-title{font-size:11px; color:var(--ink-2); text-align:center; margin-bottom:2px; overflow-wrap:anywhere;}
.sel-chart-card svg{width:100%; height:auto; display:block;}
.sel-chart-sub{font-size:10px; color:var(--muted); text-align:center; margin-bottom:2px; overflow-wrap:anywhere;}
.conv-box{margin:2px 0 12px;}
.conv-box table{width:100%; border-collapse:collapse; font-size:12.5px; font-variant-numeric:tabular-nums;}
.conv-box th,.conv-box td{padding:5px 6px; text-align:center; border-bottom:1px solid var(--line);}
.conv-box th{font-weight:600; color:var(--muted); font-size:11.5px;}
.conv-box td:first-child,.conv-box th:first-child{text-align:left;}
.conv-box .sel{background:var(--surface-2); font-weight:700;}
.conv-box .cv-empty{font-size:12px; color:var(--muted); padding:6px 0;}
.conv-box .cv-th{display:block; font-size:10.5px; color:var(--muted); font-weight:400; margin-top:1px;}
.opt-check{display:flex; gap:8px; align-items:flex-start; font-size:12.5px; line-height:1.5; margin:4px 0 10px; cursor:pointer;}
.opt-check input{margin-top:3px; flex:none;}
.info-tag.warn-tag{background:var(--warn-bg); color:var(--warn);}
.info-tag{font-size:11px; padding:2px 8px; border-radius:99px; background:var(--surface-2); color:var(--accent-2); border:1px solid var(--line);}
.formula-list{font-size:12.5px; color:var(--ink-2); line-height:1.8;}
.formula-list .yr{color:var(--ink); font-weight:600;}
.footnote{margin-top:34px; padding-top:14px; border-top:1px solid var(--line); font-size:11.5px; color:var(--muted); line-height:1.7;}
.footnote strong{color:var(--ink-2);}
[hidden]{display:none!important;}

/* ---- AI 模擬面試 ---- */
.ai-btn{margin-left:auto; display:inline-flex; align-items:center; gap:6px; font:inherit; font-size:13px; font-weight:600; color:#fff; background:var(--accent-2); border:none; border-radius:99px; padding:7px 14px; cursor:pointer;}
.ai-btn:hover{filter:brightness(.94);}
.ai-btn:focus-visible, .btn:focus-visible, .ai-link-btn:focus-visible{outline:2px solid var(--accent); outline-offset:2px;}
.ai-link-btn{display:inline-flex; align-items:center; gap:6px; font:inherit; font-size:12.5px; font-weight:600; color:var(--accent-2); background:var(--accent-2-soft); border:1px solid var(--accent-2-line); border-radius:99px; padding:5px 12px; cursor:pointer; margin:0 0 6px 8px; vertical-align:middle;}
.sheet.ai-sheet{padding:0; display:flex; flex-direction:column; overflow:hidden; height:min(90vh,880px); max-height:none; max-width:760px;}
@media (max-width:719px){ .sheet.ai-sheet{height:92vh; border-radius:16px 16px 0 0;} }
.ai-head{flex:none; display:flex; justify-content:space-between; align-items:flex-start; gap:10px; padding:16px 20px 12px; border-bottom:1px solid var(--line);}
.ai-head h3{font-size:19px; color:var(--accent);}
.ai-head .ai-sub{font-size:12px; color:var(--ink-2); margin-top:3px; overflow-wrap:anywhere;}
.ai-body{flex:1 1 0; min-height:min(190px,34vh); overflow-y:auto; padding:16px 20px;}
.ai-foot{flex:0 1 auto; min-height:0; overflow-y:auto; border-top:1px solid var(--line); padding:12px 20px calc(14px + env(safe-area-inset-bottom,0px)); background:var(--surface);}
.ai-foot:empty{display:none;}
.ai-lead{font-size:13.5px; color:var(--ink-2); line-height:1.75; margin:0 0 14px;}
.ai-field{display:flex; flex-direction:column; gap:4px; margin-bottom:12px; min-width:0;}
.ai-field label{font-size:12px; color:var(--ink-2);}
.ai-field input[type=text], .ai-field select{font:inherit; font-size:14px; padding:8px 10px; border:1px solid var(--line); border-radius:8px; background:var(--bg); color:var(--ink); width:100%;}
.ai-ta{width:100%; font:inherit; font-size:14px; line-height:1.7; padding:10px 12px; border:1px solid var(--line); border-radius:10px; background:var(--bg); color:var(--ink); resize:vertical; min-height:150px;}
.ai-field input:focus, .ai-field select:focus, .ai-ta:focus{outline:2px solid var(--accent); outline-offset:1px;}
.ai-count{font-size:11.5px; color:var(--muted); text-align:right; font-variant-numeric:tabular-nums;}
.ai-prog{display:flex; align-items:center; gap:10px; font-size:12.5px; color:var(--ink-2); margin-bottom:14px;}
.ai-prog b{color:var(--ink); font-variant-numeric:tabular-nums; white-space:nowrap;}
.ai-bar{flex:1; height:6px; background:var(--surface-2); border-radius:99px; overflow:hidden; border:1px solid var(--line);}
.ai-bar i{display:block; height:100%; background:var(--accent); border-radius:99px;}
.ai-msgs{display:flex; flex-direction:column; gap:12px;}
.msg{max-width:90%; padding:10px 14px; border-radius:14px; font-size:14px; line-height:1.75; overflow-wrap:anywhere; white-space:pre-wrap;}
.msg .who{display:block; font-size:11px; font-weight:700; margin-bottom:2px; letter-spacing:.05em;}
.msg.q{align-self:flex-start; background:var(--accent-soft); border:1px solid var(--accent-line); border-top-left-radius:4px;}
.msg.q .who{color:var(--accent);}
.msg.a{align-self:flex-end; background:var(--accent-2-soft); border:1px solid var(--accent-2-line); border-top-right-radius:4px;}
.msg.a .who{color:var(--accent-2);}
.msg.wait{color:var(--muted);}
.ai-composer{display:flex; flex-direction:column; gap:6px;}
.ai-composer .ai-ta{min-height:76px; resize:none;}
.ai-actions{display:flex; flex-wrap:wrap; gap:8px; align-items:center;}
.ai-actions .grow{flex:1; min-width:0;}
.btn{font:inherit; font-size:13.5px; font-weight:600; padding:8px 14px; border-radius:10px; border:1px solid var(--line); background:var(--surface); color:var(--ink); cursor:pointer;}
.btn.primary{background:var(--accent); border-color:var(--accent); color:#fff;}
.btn.danger{color:var(--bad); border-color:var(--bad);}
.btn.ghost{background:none; border-color:transparent; color:var(--ink-2); text-decoration:underline; padding-inline:6px;}
.btn:disabled{opacity:.5; cursor:not-allowed;}
.ai-note{font-size:12.5px; border-radius:10px; padding:9px 12px; margin-bottom:10px; line-height:1.65;}
.ai-note.err{background:var(--bad-bg); color:var(--bad);}
.ai-note.warn{background:var(--warn-bg); color:var(--warn);}
.ai-note.info{background:var(--surface-2); color:var(--ink-2);}
.ai-note .ai-actions{margin-top:8px;}
.ai-wait{display:flex; align-items:center; gap:12px; font-size:14px; color:var(--ink-2); padding:30px 4px;}
.spinner{width:20px; height:20px; border:2px solid var(--line); border-top-color:var(--accent); border-radius:50%; animation:aispin .9s linear infinite; flex:none;}
@keyframes aispin{to{transform:rotate(360deg);}}
@media (prefers-reduced-motion:reduce){ .spinner{animation:none;} }
.rp-overall{font-size:14px; line-height:1.85; color:var(--ink); margin:0 0 4px;}
.rp-disclaimer{font-size:11.5px; color:var(--muted); line-height:1.6; margin:0 0 4px;}
.ai-score-row{display:grid; grid-template-columns:5.2em 1fr 2.2em; align-items:center; gap:10px; font-size:13px; margin-bottom:7px;}
.ai-score-row .num{font-weight:700; font-variant-numeric:tabular-nums; text-align:right;}
.pips{display:flex; gap:4px;}
.pips i{flex:1; height:9px; border-radius:3px; background:var(--surface-2); border:1px solid var(--line);}
.pips i.on{background:var(--accent); border-color:var(--accent);}
.ai-list{margin:0; padding-left:1.25em; font-size:13.5px; line-height:1.8; color:var(--ink-2);}
.ai-list li{margin-bottom:3px; overflow-wrap:anywhere;}
.ai-qcard{background:var(--surface-2); border-radius:10px; padding:10px 12px; margin-bottom:8px; font-size:13px; line-height:1.75; overflow-wrap:anywhere;}
.ai-qcard .qt{font-weight:600; color:var(--ink); margin-bottom:4px;}
.ai-qcard .at{color:var(--ink-2); white-space:pre-wrap; margin-bottom:4px;}
.ai-qcard .tip{color:var(--accent);}
details.ai-tr{margin-top:6px;}
details.ai-tr summary{cursor:pointer; font-size:13px; font-weight:600; color:var(--accent-2);}
.hist-item{display:flex; align-items:center; gap:10px; width:100%; text-align:left; font:inherit; background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:11px 14px; margin-bottom:8px; cursor:pointer; color:var(--ink);}
.hist-item:hover{border-color:var(--accent);}
.hist-item .hm{flex:1; min-width:0;}
.hist-item .ht{font-size:14px; font-weight:600; overflow-wrap:anywhere;}
.hist-item .hd{font-size:12px; color:var(--muted); margin-top:2px;}
.hist-score{font-size:12px; font-weight:700; padding:4px 10px; border-radius:99px; background:var(--accent-soft); color:var(--accent); white-space:nowrap; font-variant-numeric:tabular-nums;}

.ai-check{display:flex; align-items:flex-start; gap:10px; font-size:13.5px; margin-bottom:12px; cursor:pointer; line-height:1.6;}
.ai-check input{margin-top:4px; width:16px; height:16px; accent-color:var(--accent); flex:none;}
.speak-btn{margin-left:8px; font:inherit; font-size:11px; font-weight:600; color:var(--accent); background:var(--surface); border:1px solid var(--accent-line); border-radius:99px; padding:1px 9px; cursor:pointer; letter-spacing:0;}
.speak-btn:hover{background:var(--accent-soft);}
.speak-btn:focus-visible{outline:2px solid var(--accent); outline-offset:2px;}
.btn.rec{border-color:var(--bad); color:var(--bad); background:var(--bad-bg);}

/* ---- 語音面試面板 ---- */
.vpanel{background:var(--accent-soft); border:1px solid var(--accent-line); border-radius:14px; padding:12px 14px; margin-bottom:10px;}
.vhead{display:flex; align-items:center; gap:18px; margin-bottom:10px; padding-left:6px;}
.vtext{display:flex; flex-direction:column; gap:2px; min-width:0;}
.vtext b{font-size:14.5px; color:var(--ink);}
.vtext .hint{margin:0;}
.vorb{width:34px; height:34px; border-radius:50%; background:var(--accent); flex:none; position:relative;}
.vpanel[data-phase=speaking] .vorb::after, .vpanel[data-phase=listening] .vorb::after{content:""; position:absolute; inset:-6px; border-radius:50%; border:2px solid var(--accent); opacity:.5; animation:aipulse 1.2s ease-out infinite;}
.vpanel[data-phase=listening] .vorb{background:var(--bad);}
.vpanel[data-phase=listening] .vorb::after{border-color:var(--bad);}
.vpanel[data-phase=thinking] .vorb{background:var(--muted);}
.vpanel[data-phase=tap] .vorb{background:var(--accent-2);}
@keyframes aipulse{from{transform:scale(.85); opacity:.6;} to{transform:scale(1.35); opacity:0;}}
@media (prefers-reduced-motion:reduce){ .vorb::after{animation:none!important;} }
.ai-check.vauto{margin:8px 0 0; font-size:12.5px; color:var(--ink-2);}

/* ---- 表情與視線回饋 ---- */
.ai-facebar{flex:none; display:flex; align-items:center; gap:12px; padding:8px 20px; border-bottom:1px solid var(--line); background:var(--surface-2);}
.ai-facebar[hidden]{display:none;}
.fb-vid{flex:none; width:112px; height:84px; border-radius:8px; overflow:hidden; background:#000; border:3px solid var(--line); transition:border-color .15s;}
.fb-vid.on{border-color:var(--good);} .fb-vid.off{border-color:var(--warn);} .fb-vid.none{border-color:var(--muted);}
.fb-vid video{width:100%; height:100%; object-fit:cover; display:block;}
.fb-vid.mirror video{transform:scaleX(-1);}
.fb-txt{flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; font-size:13px;}
.fb-txt .hint{margin:0; font-size:11.5px;}
.fb-txt .ai-bar{margin-top:4px;}
.fc-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(110px,1fr)); gap:8px; margin:8px 0 10px;}
.fc-stat{background:var(--surface-2); border-radius:10px; padding:8px 10px; display:flex; flex-direction:column; gap:2px;}
.fc-stat b{font-size:20px; font-variant-numeric:tabular-nums; color:var(--ink); line-height:1.2;}
.fc-stat span{font-size:11.5px; color:var(--ink-2);}
.fc-scroll{overflow-x:auto; margin:6px 0 8px;}
.fc-tbl{width:100%; border-collapse:collapse; font-size:12.5px; font-variant-numeric:tabular-nums;}
.fc-tbl th,.fc-tbl td{padding:5px 8px; border-bottom:1px solid var(--line); text-align:right; white-space:nowrap;}
.fc-tbl th:first-child,.fc-tbl td:first-child{text-align:left;}
.fc-tbl th{color:var(--ink-2); font-weight:600;}
.fc-sub{font-size:12px; font-weight:700; color:var(--ink-2); margin:10px 0 4px;}
.fc-align{font-size:12px; color:var(--ink-2); line-height:1.7; margin-top:10px;}

.ai-upl{margin:0 0 8px;}
.ai-actions .ai-file-note{flex:1 1 220px; min-width:min(220px,100%);}
.ai-file-note{display:flex; flex-direction:column; gap:2px; font-size:11.5px; min-width:0; overflow-wrap:anywhere;}
.ai-file-note .hint{margin:0;}
.ai-file-ok{color:var(--muted);}
.ai-file-err{color:var(--bad, #b3261e);}
.ai-ta.ai-drop{outline:2px dashed var(--accent); outline-offset:2px;}

.ai-voicebox{display:grid; grid-template-columns:1fr 8em auto; gap:8px 10px; align-items:end; margin:-4px 0 12px 26px; padding:10px 12px; border:1px solid var(--line); border-radius:10px; background:var(--surface-2,var(--bg));}
.ai-voicebox .ai-field{margin:0;}
.ai-voicebox .hint{grid-column:1/-1;}
@media (max-width:560px){.ai-voicebox{grid-template-columns:1fr 1fr; margin-left:0;} .ai-voicebox .ai-field:first-child{grid-column:1/-1;} .ai-voicebox .ai-actions{grid-column:1/-1;}}

/* ---- 矮螢幕／手機：開鏡頭＋語音面試時，下半部不要把題目擠掉（題目區至少保留約 190px，作答區改成可捲動並壓縮） ---- */
@media (max-height:860px){
  .ai-head{padding:10px 20px 8px;}
  .ai-facebar{padding:4px 20px; gap:10px;}
  .fb-vid{width:56px; height:42px; border-width:2px;}
  .fb-txt .hint{display:none;}
  .fb-txt .ai-bar{margin-top:2px;}
  .ai-foot{padding-top:8px; padding-bottom:calc(8px + env(safe-area-inset-bottom,0px));}
  .vpanel{padding:8px 12px; margin-bottom:6px;}
  .vhead{margin-bottom:6px; gap:14px;}
  .ai-composer .ai-ta{min-height:52px;}
  .ai-check.vauto{margin-top:4px;}
}
@media (max-height:640px){
  .vtext .hint{display:none;}
  .ai-composer .ai-ta{min-height:44px;}
}

/* ---- 寬螢幕：鏡頭畫面移到面試視窗右邊的空白處，放大顯示（視窗置中、寬 760px；兩側空間不夠時維持在上方的橫條） ---- */
@media (min-width:1200px){
  .ai-facebar .fb-vid{position:fixed; z-index:40; top:96px; left:calc(50% + 380px + 20px); width:min(360px, calc(50vw - 380px - 36px)); height:auto; aspect-ratio:4/3; border-width:4px; border-radius:14px; box-shadow:0 4px 18px rgba(60,50,20,.18);}
  .ai-facebar{padding-top:6px; padding-bottom:6px;}
  .fb-txt .hint{display:block;}
}


/* ---- 網站外殼與工具頁的銜接 ---- */
body.app{padding:0;}
body.app main{padding-inline:16px; padding-block:18px 8px;}
body.app .wrap{max-width:1180px;}
.ai-btn{text-decoration:none;}
.ai-link-btn{text-decoration:none;}
/* AI 面試頁：把原本的浮層改成頁面內的版面 */
body.ai-body-page main{padding-inline:12px;}
.overlay.ai-page{position:static; inset:auto; background:none; display:block; z-index:auto;}
.overlay.ai-page .sheet.ai-sheet{margin:0 auto; height:min(calc(100vh - 150px),900px); min-height:520px; max-height:none; border:1px solid var(--line); border-radius:16px; box-shadow:0 2px 14px rgba(60,50,20,.07);}
@media (max-width:719px){ .overlay.ai-page .sheet.ai-sheet{border-radius:14px; height:calc(100vh - 130px);} }
.ai-unavail{padding-block:40px;}
