/* 法律天秤：象牙白與深海軍藍為底，金色點綴；人類用沉穩青綠，AI 用法院紅，傳達可信任與審慎 */
:root {
  --bg: #f4f2ec; --paper: #fbfaf6; --card: #ffffff; --ink: #14213d; --muted: #5b6475; --faint: #9aa1ad;
  --line: #e2ddd2; --line-strong: #cfc7b6; --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 10px 28px rgba(20, 33, 61, .07);
  --human: #2e6f6a; --human-soft: rgba(46, 111, 106, .13); --mid: #a67c2e; --mid-soft: rgba(166, 124, 46, .15);
  --ai: #9e2a2b; --ai-soft: rgba(158, 42, 43, .12); --accent: #1f3a5f; --accent-ink: #ffffff;
  --gold: #b08d57; --gold-soft: rgba(176, 141, 87, .16);
  --openai: #3f7d5c; --anthropic: #b06a4a; --google: #3f5f9e; --other: #7a6a9a;
  --radius: 14px; --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: "Noto Serif TC", "Songti TC", serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1626; --paper: #111c30; --card: #15223a; --ink: #e8ecf3; --muted: #9ba6b9; --faint: #64708a;
    --line: #23324d; --line-strong: #2f4163; --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .3);
    --human: #5bb5aa; --human-soft: rgba(91, 181, 170, .15); --mid: #d6ad5c; --mid-soft: rgba(214, 173, 92, .15);
    --ai: #e0716c; --ai-soft: rgba(224, 113, 108, .15); --accent: #c9a96b; --accent-ink: #0d1626;
    --gold: #d4b37a; --gold-soft: rgba(212, 179, 122, .14);
  }
}
:root[data-theme="dark"] {
  --bg: #0d1626; --paper: #111c30; --card: #15223a; --ink: #e8ecf3; --muted: #9ba6b9; --faint: #64708a;
  --line: #23324d; --line-strong: #2f4163; --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .3);
  --human: #5bb5aa; --human-soft: rgba(91, 181, 170, .15); --mid: #d6ad5c; --mid-soft: rgba(214, 173, 92, .15);
  --ai: #e0716c; --ai-soft: rgba(224, 113, 108, .15); --accent: #c9a96b; --accent-ink: #0d1626;
  --gold: #d4b37a; --gold-soft: rgba(212, 179, 122, .14);
}


* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Noto Sans TC", -apple-system, "PingFang TC", system-ui, sans-serif; background: var(--bg);
  color: var(--ink); line-height: 1.65; -webkit-font-smoothing: antialiased; min-height: 100vh; overflow-x: hidden;
}
button { font: inherit; color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.spacer { flex: 1; }

/* 法庭的木質色 */
:root { --wood-1: #e8dcc4; --wood-2: #dccbaa; --wood-3: #c8b08a; --trim: #8a6a3f; --floor-1: #cdb38b; --floor-2: #b99a6e; --veil: rgba(244, 242, 236, .55); }
:root[data-theme="dark"] { --wood-1: #1c2538; --wood-2: #182033; --wood-3: #2a3550; --trim: #b9955a; --floor-1: #222b40; --floor-2: #1a2236; --veil: rgba(13, 22, 38, .55); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --wood-1: #1c2538; --wood-2: #182033; --wood-3: #2a3550; --trim: #b9955a; --floor-1: #222b40; --floor-2: #1a2236; --veil: rgba(13, 22, 38, .55); } }

/* ---------- 頂列 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 18px; padding: 10px 24px; height: 62px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand .seal { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--gold); display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
:root[data-theme="dark"] .brand .seal { color: var(--accent-ink); }
.brand .seal svg { width: 22px; height: 22px; }
.brand .name { font: 700 17px/1.15 "Noto Serif TC", serif; letter-spacing: .04em; }
.brand small { display: block; font: 600 9.5px "IBM Plex Mono", monospace; letter-spacing: .22em; color: var(--muted); margin-top: 2px; }
.nav { display: flex; gap: 4px; margin-left: 6px; }
.nav a { padding: 6px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 14px; }
.nav a.on { color: var(--ink); background: var(--card); box-shadow: var(--shadow); }
.trust { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.trust i { width: 7px; height: 7px; border-radius: 50%; background: var(--human); box-shadow: 0 0 0 3px var(--human-soft); }
.trust { position: relative; cursor: help; outline: none; }
.trust:focus-visible { box-shadow: 0 0 0 3px var(--gold-soft); }
.trust-tip {
  position: absolute; right: 0; top: calc(100% + 10px); width: 320px; z-index: 60; padding: 14px 16px; border-radius: 12px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(20, 33, 61, .18);
  font-size: 13px; line-height: 1.7; text-align: left; opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .2s, transform .2s, visibility .2s; white-space: normal; cursor: default;
}
.trust-tip::before { content: ""; position: absolute; right: 26px; top: -6px; width: 10px; height: 10px; background: var(--card); border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: rotate(45deg); }
.trust:hover .trust-tip, .trust:focus-within .trust-tip { opacity: 1; visibility: visible; transform: none; }
.trust-tip b { display: block; font: 700 14px "Noto Serif TC", serif; margin-bottom: 6px; color: var(--accent); }
.trust-tip ul { margin: 0; padding-left: 18px; }
.trust-tip li { margin: 3px 0; color: var(--muted); }
.trust-tip li strong { color: var(--ink); font-weight: 600; }
.trust-tip .device { margin-top: 8px; font: 12px "IBM Plex Mono", monospace; color: var(--faint); }
.trust i.busy { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- 法庭場景 ---------- */
.courtroom {
  position: fixed; inset: 62px 0 0 0; z-index: 0; overflow: hidden; pointer-events: none;
  transition: opacity .8s ease, transform 1.1s cubic-bezier(.2, .8, .2, 1), filter .9s ease;
}
.wall {
  position: absolute; inset: 0 0 24% 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 118px, rgba(0,0,0,.05) 118px 120px, transparent 120px 124px, rgba(255,255,255,.18) 124px 125px),
    linear-gradient(180deg, var(--wood-1), var(--wood-2) 70%, var(--wood-3));
}
.wall::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 14px; background: var(--trim); box-shadow: 0 -3px 0 rgba(0,0,0,.08) inset; }
.emblem { position: absolute; top: 9%; width: clamp(70px, 7vw, 120px); opacity: .85; filter: drop-shadow(0 4px 6px rgba(0,0,0,.15)); }
.emblem.left { left: calc(50% - clamp(210px, 21vw, 340px)); }
.emblem.right { right: calc(50% - clamp(210px, 21vw, 340px)); }
.stand { position: absolute; left: 50%; bottom: 4%; width: clamp(110px, 10vw, 160px); translate: -50% 0; opacity: .95; transition: opacity .6s; }
.bench-glow { position: absolute; left: 50%; top: 4%; width: 46vw; height: 46vh; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(255, 236, 190, .55), transparent); opacity: .7; }
.floor { position: absolute; left: 0; right: 0; bottom: 0; height: 24%; background: repeating-linear-gradient(90deg, var(--floor-1) 0 160px, var(--floor-2) 160px 162px); }
.floor::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.12), transparent 40%); }
.actor { position: absolute; transition: transform 1s cubic-bezier(.2, .8, .2, 1), filter .6s ease, opacity .6s ease; }
.actor img { width: 100%; display: block; }
.judge { left: 50%; top: 9%; width: clamp(180px, 19vw, 300px); translate: -50% 0; }
.human { left: 3%; bottom: 3%; width: clamp(170px, 19vw, 300px); }
.ai { right: 4%; bottom: 3%; width: clamp(150px, 16vw, 260px); }
.plate {
  white-space: nowrap; position: absolute; left: 50%; bottom: -2px; transform: translateX(-50%); padding: 3px 16px; border-radius: 6px;
  background: var(--accent); color: var(--accent-ink); font: 700 14px "Noto Serif TC", serif; letter-spacing: .3em; box-shadow: 0 4px 10px rgba(0,0,0,.18);
  transition: box-shadow .4s, background .4s;
}
.idle-bob { animation: bob 4.6s ease-in-out infinite; }
.ai.idle-bob { animation-delay: -2.1s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 58%, var(--veil) 0 34%, transparent 70%); transition: opacity .8s; }

/* 待審：法庭在後面，稍微失焦，輸入框在前 */
.state-idle .courtroom { filter: blur(1.5px) saturate(.85); transform: scale(1.02); }
.state-idle .stand { opacity: 0; }
.state-idle .courtroom .vignette { opacity: 1; }
.state-trial .courtroom { z-index: 30; filter: none; transform: scale(1); }
.state-trial .courtroom .vignette { opacity: 0; }
.state-result .courtroom { opacity: 0; transform: scale(1.08); filter: blur(6px); }

/* ---------- 待審：中央輸入 ---------- */
.hero { position: relative; z-index: 2; max-width: 760px; margin: 0 auto; padding: clamp(250px, 38vh, 420px) 20px 60px; transition: opacity .5s ease, transform .6s cubic-bezier(.2, .8, .2, 1); }
.state-trial .hero, .state-result .hero { opacity: 0; transform: translateY(24px); pointer-events: none; }
.state-result .hero { display: none; }
.hero-head { text-align: center; margin-bottom: 18px; }
.docket { display: inline-block; padding: 3px 14px; border: 1.5px solid var(--trim); border-radius: 4px; font: 700 12px "Noto Serif TC", serif; letter-spacing: .4em; color: var(--trim); background: color-mix(in srgb, var(--card) 70%, transparent); }
.hero h1 { margin: 12px 0 6px; font: 900 clamp(28px, 4vw, 44px)/1.2 "Noto Serif TC", serif; letter-spacing: .04em; color: var(--ink); text-shadow: 0 2px 18px var(--bg); }
.hero p { margin: 0 auto; max-width: 560px; color: var(--muted); font-size: 15px; text-shadow: 0 1px 12px var(--bg); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.editor { position: relative; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 2px 4px rgba(20,33,61,.06), 0 24px 60px rgba(20,33,61,.18); }
.editor::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--accent), var(--gold), var(--accent)); }
.editor-body { position: relative; flex: 1; display: flex; min-height: 0; }
textarea#text { flex: 1; width: 100%; min-height: 220px; border: 0; outline: 0; resize: vertical; padding: 24px 26px 12px; background: var(--card); color: var(--ink); font: inherit; font-size: 16px; line-height: 1.85; }
textarea#text::placeholder { color: var(--faint); }
.editor-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; background: var(--paper); }
.count { font: 13px "IBM Plex Mono", monospace; color: var(--muted); }
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong); background: var(--card); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--ink); }
.btn.ghost { background: transparent; }
.btn.pulse { border-color: var(--gold); color: var(--trim); background: var(--gold-soft); animation: callout 1.6s ease-in-out infinite; }
@keyframes callout { 0%, 100% { box-shadow: 0 0 0 0 var(--gold-soft); } 50% { box-shadow: 0 0 0 6px var(--gold-soft); } }
.btn-primary {
  position: relative; overflow: hidden; border: 0; background: var(--accent); color: var(--accent-ink); padding: 11px 22px; border-radius: 11px;
  cursor: pointer; font: 700 15px "Noto Sans TC", sans-serif; letter-spacing: .08em; display: inline-flex; align-items: center; gap: 10px;
  box-shadow: 0 6px 18px rgba(31, 58, 95, .28); transition: transform .15s, box-shadow .2s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(31, 58, 95, .32); }
.btn-primary:disabled { opacity: .6; cursor: default; transform: none; }
.kbd { font: 11px "IBM Plex Mono", monospace; padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, .2); letter-spacing: 0; }
.error { color: var(--ai); font-size: 14px; }
.hero-foot { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 16px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; font-size: 13px; color: var(--muted); }
.chip { border: 1px solid var(--line-strong); background: color-mix(in srgb, var(--card) 85%, transparent); padding: 5px 13px; border-radius: 999px; font-size: 13px; cursor: pointer; color: var(--ink); backdrop-filter: blur(6px); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.formats { font-size: 12px; color: var(--muted); background: color-mix(in srgb, var(--bg) 70%, transparent); padding: 2px 10px; border-radius: 999px; }
.file-pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--gold-soft); border: 1px solid var(--gold); font-size: 13px; }
.file-pill button { border: 0; background: var(--line); width: 20px; height: 20px; border-radius: 50%; cursor: pointer; line-height: 1; }
.dropzone { position: absolute; inset: 10px; border-radius: 12px; border: 2px dashed var(--gold); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: color-mix(in srgb, var(--card) 92%, transparent); z-index: 5; font: 700 17px "Noto Serif TC", serif; color: var(--trim); pointer-events: none; }
.dropzone img { width: 90px; }

/* ---------- 審理動畫 ---------- */
.papers { position: absolute; left: 50%; top: 31%; width: 0; height: 0; z-index: 6; }
.paper {
  position: absolute; width: 150px; height: 104px; margin: -52px 0 0 -75px; border-radius: 4px; background: #fffdf7; border: 1px solid #e3dccb;
  box-shadow: 0 6px 16px rgba(0,0,0,.18); padding: 10px 12px; overflow: hidden; font: 9px/1.5 "Noto Sans TC", sans-serif; color: #6b6355;
}
.paper::before { content: ""; position: absolute; left: 12px; right: 12px; top: 8px; height: 3px; background: var(--gold); opacity: .6; }
.lens { position: absolute; left: 50%; top: 31%; width: 70px; height: 70px; margin: -35px 0 0 -35px; border-radius: 50%; border: 5px solid #6b4f2a; background: radial-gradient(circle at 35% 35%, rgba(255,255,255,.75), rgba(200,230,255,.25) 60%, rgba(255,255,255,.1)); box-shadow: 0 6px 14px rgba(0,0,0,.25); opacity: 0; z-index: 7; }
.lens::after { content: ""; position: absolute; width: 12px; height: 44px; background: #6b4f2a; border-radius: 6px; left: 52px; top: 50px; transform: rotate(-45deg); }
.lens.on { opacity: 1; animation: sweep 2.2s ease-in-out infinite; }
@keyframes sweep { 0% { transform: translate(-60px, -10px); } 50% { transform: translate(60px, 12px); } 100% { transform: translate(-60px, -10px); } }
.gavel-wrap { position: absolute; left: calc(50% + clamp(90px, 9vw, 150px)); top: 4%; width: clamp(70px, 6vw, 100px); z-index: 8; transform-origin: 50% 92%; opacity: 0; }
.gavel-wrap img { width: 100%; display: block; }
.gavel-wrap.raise { opacity: 1; animation: raise .45s cubic-bezier(.2, .8, .2, 1) both; }
.gavel-wrap.strike { opacity: 1; animation: strike .38s cubic-bezier(.6, 0, .9, .6) both; }
@keyframes raise { from { transform: translateY(-60px) rotate(-10deg); opacity: 0; } to { transform: translateY(0) rotate(35deg); opacity: 1; } }
@keyframes strike { from { transform: rotate(35deg); } 70% { transform: rotate(-58deg); } to { transform: rotate(-52deg); } }
.bang { position: absolute; left: calc(50% + clamp(60px, 7vw, 120px)); top: 24%; z-index: 9; font: 900 clamp(34px, 4vw, 60px) "Noto Serif TC", serif; color: var(--ai); -webkit-text-stroke: 2px #fff; paint-order: stroke; opacity: 0; transform: scale(.3) rotate(-12deg); }
.bang.on { animation: pop .7s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop { 0% { opacity: 0; transform: scale(.3) rotate(-12deg); } 40% { opacity: 1; transform: scale(1.15) rotate(-6deg); } 100% { opacity: 0; transform: scale(1) rotate(-6deg) translateY(-14px); } }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; z-index: 12; pointer-events: none; }
.flash.on { animation: flash .45s ease-out both; }
@keyframes flash { 0% { opacity: .75; } 100% { opacity: 0; } }
.courtroom.shake { animation: shake .42s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes shake { 10%, 90% { transform: translate(-1px, 1px); } 20%, 80% { transform: translate(3px, -2px); } 30%, 50%, 70% { transform: translate(-6px, 2px); } 40%, 60% { transform: translate(6px, -2px); } }
.spot { position: absolute; inset: 0; z-index: 4; opacity: 0; transition: opacity .7s ease; pointer-events: none; }
.spot.on { opacity: 1; }
.actor.lose { filter: grayscale(.9) brightness(.75); opacity: .55; transform: scale(.94); }
.actor.win { animation: hop .7s cubic-bezier(.3, 1.6, .5, 1) 2 both; }
.actor.win .plate { background: var(--gold); color: #1b1b1b; box-shadow: 0 0 0 4px var(--gold-soft), 0 6px 18px rgba(0,0,0,.25); }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-18px); } }
.human.focus, .ai.focus { transform: translateY(-6px) scale(1.03); }
.focus .plate { box-shadow: 0 0 0 4px var(--gold-soft), 0 6px 18px rgba(0,0,0,.25); }
.scroll { position: absolute; left: 50%; top: 36%; z-index: 10; width: min(380px, 70vw); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; opacity: 0; }
.scroll .rod { width: 108%; height: 14px; border-radius: 7px; background: linear-gradient(180deg, #a77d3f, #6e5126); box-shadow: 0 3px 8px rgba(0,0,0,.3); }
.scroll-paper { width: 100%; background: #fffdf6; border-left: 1px solid #eadfc6; border-right: 1px solid #eadfc6; text-align: center; overflow: hidden; max-height: 0; padding: 0 18px; transition: max-height .8s cubic-bezier(.2, .8, .2, 1), padding .8s; color: #2b2116; }
.scroll.open { opacity: 1; }
.scroll.open .scroll-paper { max-height: 260px; padding: 18px 18px 20px; }
.scroll-paper small { display: block; font: 700 13px "Noto Serif TC", serif; letter-spacing: .6em; color: #8a6a3f; }
.scroll-paper b { display: block; margin: 8px 0 4px; font: 900 clamp(26px, 3vw, 36px)/1.25 "Noto Serif TC", serif; }
.scroll-paper span { font: 600 15px "IBM Plex Mono", monospace; color: #6b6355; }
.scroll.ai b { color: #9e2a2b; } .scroll.human b { color: #2e6f6a; } .scroll.mid b { color: #8a6a1f; }
.caption { position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%); z-index: 11; padding: 8px 22px; border-radius: 999px; background: rgba(20, 33, 61, .82); color: #f1e6cc; font: 600 15px "Noto Serif TC", serif; letter-spacing: .2em; opacity: 0; transition: opacity .4s; white-space: nowrap; }
.caption.on { opacity: 1; }
.caption small { display: block; margin-top: 2px; font: 400 12px "Noto Sans TC", sans-serif; letter-spacing: .04em; opacity: .8; text-align: center; }
.caption:has(small) { border-radius: 14px; }
.caption .dots::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "．"; } 50% { content: "．．"; } 75% { content: "．．．"; } }
.skip { position: fixed; right: 22px; bottom: 22px; z-index: 35; border: 1px solid rgba(255,255,255,.4); background: rgba(20, 33, 61, .75); color: #fff; padding: 7px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; backdrop-filter: blur(6px); }

/* ---------- 宣判後 ---------- */
.verdict-view { position: relative; z-index: 3; max-width: 1360px; margin: 0 auto; padding: 18px 24px 40px; animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
.result-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.seg-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); }
.seg-switch button { border: 0; background: transparent; padding: 6px 16px; border-radius: 999px; cursor: pointer; font-size: 14px; color: var(--muted); }
.seg-switch button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.workspace { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(330px, 1fr); gap: 20px; }
.doc-card { min-height: 60vh; display: flex; overflow: hidden; position: sticky; top: 76px; height: calc(100vh - 160px); align-self: start; }
.doc-card .editor { flex: 1; border: 0; box-shadow: none; border-radius: 0; }
.doc-card .editor::before { display: none; }
.doc-card .editor-foot { display: none; }
.doc-card textarea#text { min-height: 0; resize: none; }
.doc-wrap { flex: 1; display: grid; grid-template-columns: 14px 1fr; grid-template-rows: minmax(0, 1fr); min-height: 0; background: var(--card); }
.heatstrip { position: relative; border-right: 1px solid var(--line); cursor: pointer; background: var(--paper); }
.heatstrip i { position: absolute; left: 3px; right: 3px; border-radius: 3px; display: block; }
.doc { padding: 24px 26px 40px; white-space: pre-wrap; font-size: 16px; line-height: 1.95; overflow-y: auto; min-height: 0; }
.seg { border-radius: 5px; padding: 2px 0; cursor: pointer; transition: box-shadow .15s; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.seg:hover, .seg.active { box-shadow: 0 0 0 2px var(--ink); }
.reveal-seg .seg { animation: segin .6s ease both; }
@keyframes segin { from { background-color: transparent; } }
.panel { display: flex; flex-direction: column; gap: 16px; }
.panel .card { padding: 18px 20px; }
.card h2 { font-size: 12.5px; letter-spacing: .14em; color: var(--muted); font-weight: 700; margin: 0 0 12px; }
.ruling { position: relative; overflow: hidden; }
.ruling::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--accent), var(--gold), var(--accent)); }
.ruling-head { display: flex; justify-content: space-between; align-items: baseline; }
.eyebrow { font: 700 13px "Noto Serif TC", serif; letter-spacing: .5em; color: var(--trim); }
.case { font: 12px "IBM Plex Mono", monospace; color: var(--faint); }
.ruling-main { display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: 6px; }
.scale-wrap svg { width: 100%; display: block; overflow: visible; }
.scale-wrap .string { stroke: var(--trim); stroke-width: 1.5; }
.scale-wrap .pan { fill: var(--gold-soft); stroke: var(--trim); stroke-width: 2; }
.scale-wrap .pan-label { font: 700 13px "Noto Serif TC", serif; fill: var(--muted); }
.scale-wrap .pan-label.on-h { fill: var(--human); } .scale-wrap .pan-label.on-a { fill: var(--ai); }
.readout { display: flex; flex-direction: column; gap: 10px; }
.readout div { display: flex; align-items: baseline; gap: 8px; }
.readout b { font: 600 34px/1 "IBM Plex Mono", monospace; }
.readout span { font-size: 13px; color: var(--muted); }
.readout .h b { color: var(--human); } .readout .a b { color: var(--ai); }
.stamp { display: inline-block; margin-top: 10px; padding: 7px 16px; border: 2.5px solid currentColor; border-radius: 8px; font: 900 17px "Noto Serif TC", serif; letter-spacing: .06em; transform: rotate(-2deg); }
.stamp.ai { color: var(--ai); background: var(--ai-soft); } .stamp.human { color: var(--human); background: var(--human-soft); } .stamp.mid { color: var(--mid); background: var(--mid-soft); }
.stamp.slam { animation: slam .55s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes slam { 0% { transform: scale(1.9) rotate(-8deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1) rotate(-2deg); opacity: 1; } }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.stat b { display: block; font: 600 20px "IBM Plex Mono", monospace; }
.stat span { font-size: 12px; color: var(--muted); }
.src-row { display: grid; grid-template-columns: 96px 1fr 46px; align-items: center; gap: 10px; margin: 9px 0; font-size: 14px; }
.src-bar { height: 10px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); overflow: hidden; }
.src-bar i { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .9s cubic-bezier(.2, .8, .2, 1); }
.src-val { font: 13px "IBM Plex Mono", monospace; text-align: right; }
.note { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }
.segmap { display: flex; flex-wrap: wrap; gap: 4px; }
.segmap button { width: 22px; height: 22px; border-radius: 6px; border: 0; cursor: pointer; }
.segmap button.active { outline: 2px solid var(--ink); outline-offset: 1px; }
.legend { display: flex; gap: 12px; font-size: 12.5px; color: var(--muted); margin-top: 10px; align-items: center; }
.legend i { display: inline-block; width: 64px; height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--human), var(--mid), var(--ai)); }
.history { display: flex; flex-direction: column; gap: 6px; }
.history button { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 7px 10px; cursor: pointer; font-size: 13px; }
.history button b { font-family: "IBM Plex Mono", monospace; }
.history button span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.logbox summary { cursor: pointer; font-size: 12.5px; letter-spacing: .14em; color: var(--muted); font-weight: 700; }
.log { font: 12.5px "IBM Plex Mono", monospace; max-height: 160px; overflow-y: auto; margin-top: 10px; }
.log div { padding: 2px 0; color: var(--muted); }
.log div b { color: var(--trim); font-weight: 500; margin-right: 8px; }
.log div.err b { color: var(--ai); }
.pop { position: fixed; z-index: 50; width: 280px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.18); padding: 14px 16px; font-size: 14px; }
.pop .p { font: 600 26px "IBM Plex Mono", monospace; }
.pop .mini .src-row { grid-template-columns: 84px 1fr 40px; margin: 5px 0; font-size: 13px; }
.credit { position: fixed; left: 10px; bottom: 6px; z-index: 36; margin: 0; font-size: 10.5px; color: var(--faint); }
.state-result .credit { position: static; text-align: center; padding-bottom: 18px; }

@media (max-width: 980px) {
  .topbar { padding: 8px 14px; gap: 10px; }
  .brand small { display: none; }
  .trust { font-size: 11.5px; padding: 4px 9px; }
  .trust-tip { width: min(300px, calc(100vw - 24px)); right: -48px; }
  .brand .name { font-size: 15px; white-space: nowrap; }
  .nav a { padding: 5px 9px; font-size: 13px; white-space: nowrap; }
  .emblem { display: none; }
  .plate { white-space: nowrap; font-size: 12px; padding: 2px 10px; letter-spacing: .15em; }
  .hero { padding-top: 34vh; }
  .judge { width: 42vw; top: 6%; }
  .human { width: 34vw; left: -2%; }
  .ai { width: 30vw; right: 0; }
  .workspace { grid-template-columns: 1fr; }
  .doc-card { position: static; height: auto; min-height: 50vh; }
  .ruling-main { grid-template-columns: 1fr; }
  .readout { flex-direction: row; justify-content: center; gap: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Chrome 擴充套件安裝說明（只有靜態網頁版有） ---------- */
.ext-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.ext-btn:hover { border-color: var(--gold); }
.ext-btn svg { width: 16px; height: 16px; color: var(--gold); }
.ext-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 26px 28px 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.ext-dialog::backdrop { background: rgba(13, 22, 38, .45); backdrop-filter: blur(3px); }
.ext-dialog[open] { animation: ext-in .25s ease both; }
@keyframes ext-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.ext-dialog h2 { margin: 0 0 6px; font: 900 21px var(--serif); letter-spacing: .04em; }
.ext-close { position: absolute; right: 14px; top: 12px; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 22px; cursor: pointer; }
.ext-close:hover { background: var(--paper); }
.ext-lead { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.ext-warn { padding: 10px 12px; border-radius: 10px; background: var(--ai-soft); color: var(--ai); font-size: 13.5px; }
.ext-steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 12px; }
.ext-steps li { counter-increment: s; position: relative; padding: 12px 14px 12px 50px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); display: grid; gap: 4px; font-size: 13.5px; }
.ext-steps li::before { content: counter(s); position: absolute; left: 14px; top: 12px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 700 13px var(--mono); }
.ext-steps b { font-size: 14.5px; }
.ext-steps span { color: var(--muted); }
.ext-dl { justify-self: start; margin-top: 4px; text-decoration: none; display: inline-flex; padding: 8px 16px; font-size: 13.5px; }
.ext-url { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.ext-url code { flex: 1; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font: 13px var(--mono); user-select: all; }
.ext-url .btn { padding: 6px 12px; font-size: 13px; white-space: nowrap; }
.ext-mock { display: inline-flex; align-items: center; gap: 8px; margin-top: 2px; font-size: 12.5px; color: var(--ink) !important; }
.ext-toggle { width: 30px; height: 16px; border-radius: 9px; background: #1a73e8; position: relative; }
.ext-toggle i { position: absolute; right: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; }
.ext-fakebtn { padding: 4px 12px; border: 1px solid #dadce0; border-radius: 6px; background: #fff; color: #1a73e8 !important; font-weight: 600; }
.ext-foot { margin: 14px 0 0; font-size: 12px; color: var(--faint); }
@media (max-width: 720px) { .ext-btn { display: none; } }
