:root {
  --bg: #0b1220;
  --bg2: #111a2e;
  --fg: #e5e7eb;
  --fg2: #94a3b8;
  --accent: #3b82f6;
  --accent2: #fbbf24;
  --line: #1f2a44;
  --fs: 20px;
}
[data-theme="light"] {
  --bg: #f8fafc;
  --bg2: #ffffff;
  --fg: #0f172a;
  --fg2: #64748b;
  --accent: #2563eb;
  --accent2: #b45309;
  --line: #e2e8f0;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  overscroll-behavior: none;
}
header {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
}
.title-row { display: flex; align-items: center; gap: 10px; }
.titles { flex: 1; min-width: 0; }
h1 { font-size: 17px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { font-size: 12px; color: var(--fg2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #64748b; flex: none; }
.dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.dot.wait { background: #f59e0b; }
.dot.off { background: #ef4444; }
.icon-btn { background: none; border: 0; color: var(--fg); font-size: 22px; padding: 4px 6px; }
.bar { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.lbl { font-size: 13px; color: var(--fg2); }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: none; color: var(--fg2);
  font-size: 14px; padding: 6px 12px; border-radius: 8px; min-height: 32px;
}
.seg button.active { background: var(--accent); color: #fff; }
select {
  background: var(--bg); color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 8px; font-size: 14px; min-height: 34px;
}
.astate { font-size: 12px; color: var(--fg2); }
.hidden { display: none !important; }
main {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 10px 14px 70px;
}
.item { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.item .src, .item .tgt { font-size: var(--fs); line-height: 1.5; word-wrap: break-word; overflow-wrap: anywhere; }
.item .src { color: var(--fg); }
.item .tgt { color: var(--accent2); margin-top: 2px; }
.view-source .item .tgt, .view-target .item .src { display: none; }
.view-target .item .tgt { color: var(--fg); }
.view-both .item .src { color: var(--fg2); font-size: calc(var(--fs) * .85); }
.item.partial .src, .item.partial .tgt { opacity: .7; }
.item .meta { font-size: 11px; color: var(--fg2); margin-bottom: 2px; }
.empty { color: var(--fg2); text-align: center; margin-top: 30vh; font-size: 15px; line-height: 1.8; }
.to-latest {
  position: fixed; right: 14px; bottom: calc(env(safe-area-inset-bottom) + 44px);
  background: var(--accent); color: #fff; border: 0; border-radius: 18px;
  padding: 8px 14px; font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,.3); z-index: 6;
}
.banner {
  position: fixed; left: 12px; right: 12px; top: 40%;
  background: rgba(15,23,42,.95); color: #fff; padding: 14px; border-radius: 12px;
  text-align: center; font-size: 15px; z-index: 9;
}
footer {
  position: fixed; left: 0; right: 0; bottom: 0;
  font-size: 11px; color: var(--fg2); text-align: center;
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
  background: var(--bg2); border-top: 1px solid var(--line);
}
.panel { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 20; display: flex; align-items: flex-end; }
.panel-card { background: var(--bg2); width: 100%; border-radius: 16px 16px 0 0; padding: 16px 16px calc(env(safe-area-inset-bottom) + 16px); }
.panel-card h2 { font-size: 17px; margin: 0 0 8px; }
.row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.row input[type="checkbox"] { width: 22px; height: 22px; }
.stepper { display: inline-flex; align-items: center; gap: 10px; }
.stepper button { background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 4px 12px; font-size: 15px; }
.hint { font-size: 12px; color: var(--fg2); line-height: 1.6; }
.primary { width: 100%; margin-top: 10px; background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 12px; font-size: 16px; }
@media (min-width: 900px) {
  main { max-width: 860px; margin: 0 auto; width: 100%; }
  .panel { align-items: center; justify-content: center; }
  .panel-card { max-width: 420px; border-radius: 16px; }
}
