:root {
  --ink: #18343c;
  --muted: #62777c;
  --paper: #edf1ef;
  --card: #f9fbfa;
  --line: #cbd6d3;
  --teal: #1f7b75;
  --teal-dark: #185d5a;
  --signal: #e78942;
  --shadow: 0 18px 50px rgba(24, 52, 60, .09);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 85% 0%, rgba(58, 139, 128, .12), transparent 32rem), var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 70px; }
.masthead { display: flex; align-items: end; justify-content: space-between; gap: 40px; margin-bottom: 32px; }
.eyebrow { margin: 0 0 8px; font: 700 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .16em; color: var(--teal); }
h1 { margin: 0; font: 650 clamp(38px, 6vw, 72px)/.98 "Songti SC", "STSong", serif; letter-spacing: -.06em; }
.lede { max-width: 600px; margin: 20px 0 0; color: var(--muted); line-height: 1.75; }
.group-chooser { width: 290px; }
label { display: block; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.input-row { display: flex; border-bottom: 1px solid var(--ink); }
input { width: 100%; min-width: 0; border: 0; outline: 0; padding: 10px 2px; color: var(--ink); background: transparent; font: 650 15px ui-monospace, SFMono-Regular, Menlo, monospace; }
button { border: 0; border-radius: 999px; transition: transform .18s ease, background .18s ease, opacity .18s ease; }
button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, .language-option:focus-visible { outline: 3px solid rgba(31,123,117,.28); outline-offset: 3px; }
.quiet { flex: 0 0 auto; padding: 6px 10px; background: transparent; color: var(--teal); font-weight: 700; white-space: nowrap; }
.signal-panel { padding: 22px 26px 26px; color: #e8f0ed; background: var(--ink); border-radius: 22px 22px 6px 22px; box-shadow: var(--shadow); }
.signal-title { display: flex; gap: 10px; align-items: center; font-size: 13px; color: #bed0cb; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #8a9c99; box-shadow: 0 0 0 5px rgba(255,255,255,.05); }
.dot.live { background: #62d8a5; animation: pulse 2s infinite; }
.route-line { display: grid; grid-template-columns: auto 1fr auto 1fr auto 1fr auto; align-items: center; gap: 16px; margin-top: 24px; }
.route-line i { height: 1px; background: repeating-linear-gradient(90deg, #63817e 0 10px, transparent 10px 16px); }
.route-node { display: grid; grid-template-columns: 30px auto; gap: 3px 10px; align-items: baseline; }
.route-node span { grid-row: 1 / 3; color: var(--signal); font: 700 11px ui-monospace, monospace; }
.route-node strong { font-size: 15px; }
.route-node small { color: #89a6a1; font: 10px ui-monospace, monospace; }
.language-section, .device-card, .history-card { margin-top: 18px; padding: 30px; border: 1px solid rgba(113,139,135,.25); background: rgba(249,251,250,.86); backdrop-filter: blur(18px); border-radius: 6px 22px 22px 22px; box-shadow: var(--shadow); }
.section-heading { display: flex; justify-content: space-between; gap: 24px; align-items: center; }
h2 { margin: 0; font: 600 26px/1.2 "Songti SC", "STSong", serif; }
.current { display: grid; grid-template-columns: auto auto; gap: 2px 12px; align-items: baseline; text-align: right; }
.current span { color: var(--muted); font-size: 12px; }
.current strong { font: 700 18px ui-monospace, monospace; }
.current small { grid-column: 1 / 3; color: var(--teal); font: 10px ui-monospace, monospace; }
.language-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 26px; }
.language-option { position: relative; min-height: 96px; padding: 17px; text-align: left; border: 1px solid var(--line); border-radius: 14px 14px 4px 14px; color: var(--ink); background: transparent; }
.language-option:hover { border-color: var(--teal); }
.language-option.selected { color: white; background: var(--teal); border-color: var(--teal); }
.language-option strong, .language-option span { display: block; }
.language-option strong { margin-bottom: 15px; font-size: 17px; }
.language-option span { color: var(--muted); font-size: 12px; }
.language-option.selected span { color: #cce5e1; }
.language-option b { position: absolute; right: 14px; top: 13px; font: 10px ui-monospace, monospace; opacity: .7; }
.save-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.save-row p { margin: 0; color: var(--muted); font-size: 13px; }
.primary { padding: 13px 22px; color: white; background: var(--ink); font-weight: 700; }
.primary:hover { background: var(--teal-dark); }
.primary:disabled { cursor: not-allowed; opacity: .35; }
.lower-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 18px; }
.compact { margin-bottom: 20px; }
.device-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; border-top: 1px solid var(--line); }
.device-row:first-child { border-top: 0; }
.device-name { display: flex; align-items: center; gap: 10px; font: 650 14px ui-monospace, monospace; }
.status-pill { padding: 5px 9px; border-radius: 99px; color: #667b77; background: #e2e8e5; font-size: 11px; }
.status-pill.online { color: #17664c; background: #d7f1e4; }
.translation-item { display: grid; grid-template-columns: 55px 1fr; gap: 14px; padding: 16px 0; border-top: 1px solid var(--line); }
.translation-item:first-child { border-top: 0; }
.translation-item .seq { color: var(--signal); font: 700 11px ui-monospace, monospace; }
.translation-item p { margin: 0 0 5px; line-height: 1.55; }
.translation-item .source { color: var(--muted); font-size: 12px; }
.translation-item small { color: var(--teal); font: 10px ui-monospace, monospace; }
.empty { color: var(--muted); font-size: 13px; }
.icon-button { width: 38px; height: 38px; color: var(--teal); background: #e4ece9; font-size: 20px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 12px 18px; border-radius: 999px; color: white; background: var(--ink); opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(98,216,165,.05); } }
@media (max-width: 820px) {
  .shell { width: min(100% - 24px, 680px); padding-top: 28px; }
  .masthead { display: grid; }
  .group-chooser { width: 100%; }
  .route-line { grid-template-columns: 1fr 1fr; }
  .route-line i { display: none; }
  .language-grid { grid-template-columns: repeat(2, 1fr); }
  .lower-grid { grid-template-columns: 1fr; }
}
@media (max-width: 500px) {
  .signal-panel, .language-section, .device-card, .history-card { padding: 22px 18px; }
  .section-heading, .save-row { align-items: flex-start; flex-direction: column; }
  .current { text-align: left; }
  .language-grid { grid-template-columns: 1fr; }
  .primary { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
