:root { --fs: 26px; --bg: #0b0b0f; --card: #17171d; --fg: #f5f5f7; --muted: #8e8e98; --accent: #0a84ff; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "WenQuanYi Zen Hei", sans-serif;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  -webkit-text-size-adjust: 100%;
}
header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid #222; }
.title { font-weight: 600; font-size: 17px; }
.title small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.status { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #555; }
.status.on::before { background: #30d158; animation: pulse 1.4s infinite; }
.status.err::before { background: #ff453a; }
@keyframes pulse { 50% { opacity: .3; } }

main { flex: 1; overflow-y: auto; padding: 12px 14px 8px; -webkit-overflow-scrolling: touch; }
.seg { background: var(--card); border-radius: 14px; padding: 10px 14px 12px; margin-bottom: 10px; }
.seg .en { color: var(--muted); font-size: calc(var(--fs) * .55); line-height: 1.35; margin-bottom: 4px; word-break: break-word; }
.seg .zh { font-size: var(--fs); line-height: 1.4; font-weight: 500; word-break: break-word; }
.seg .zh.pending { color: var(--muted); font-weight: 400; }
.seg .zh.fail { color: #ff9f0a; font-size: calc(var(--fs) * .6); }
.seg:last-child { outline: 1px solid #2c2c35; }

.live { min-height: 2.6em; padding: 6px 16px; color: #c7c7cc; font-size: calc(var(--fs) * .6); line-height: 1.35; border-top: 1px solid #222; }
.live:empty::before { content: "（实时英文识别会显示在这里）"; color: #48484f; }

footer { display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid #222; }
button { font: inherit; font-size: 17px; border: 0; border-radius: 12px; padding: 12px 14px; background: #2c2c35; color: var(--fg); }
button:active { opacity: .7; }
button.primary { background: var(--accent); flex: 1; font-weight: 600; }
button.primary.stop { background: #ff453a; }

.hint { color: #c7c7cc; font-size: 16px; line-height: 1.6; padding: 8px 4px; }
.hint p { margin: 0 0 6px; }
.muted { color: var(--muted); font-size: 14px; }

dialog { background: var(--card); color: var(--fg); border: 0; border-radius: 16px; padding: 20px; width: min(90vw, 360px); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog input { width: 100%; font-size: 17px; padding: 10px; border-radius: 10px; border: 1px solid #3a3a44; background: #0f0f14; color: var(--fg); margin-bottom: 8px; }
dialog button { width: 100%; }
.err { color: #ff453a; font-size: 14px; min-height: 1em; margin: 0 0 8px; }
