
:root {
  --primary: #1E40AF;
  --primary-light: #DBEAFE;
  --success: #15803D;
  --warning: #B45309;
  --danger: #B91C1C;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --text: #0F172A;
  --text2: #475569;
  --border: #CBD5E1;
  --dis-fg: #94A3B8;
  --dis-bg: #E2E8F0;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0F172A; overflow: hidden; }
#canvas {
  width: 1080px; height: 1920px; position: relative; overflow: hidden;
  background: var(--bg); color: var(--text);
  font-family: 'Noto Sans TC', 'Microsoft JhengHei', 'PingFang TC', sans-serif;
  transform-origin: top left; user-select: none; cursor: default;
}
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.topbar { height: 120px; flex: none; display: flex; align-items: center; gap: 24px; padding: 0 48px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar.dark { background: #0F172A; color: #fff; border-bottom: none; }
.logo { width: 72px; height: 72px; border-radius: 16px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 900; flex: none; }
.station { font-size: 36px; font-weight: 700; }
.clock { margin-left: auto; font-size: 32px; color: var(--text2); font-variant-numeric: tabular-nums; }
.topbar.dark .clock { color: rgba(255,255,255,0.7); }
.title { font-size: 40px; font-weight: 500; }
.back { display: flex; align-items: center; gap: 12px; height: 80px; padding: 0 28px; border: 3px solid var(--border); border-radius: 16px; font-size: 32px; font-weight: 500; cursor: pointer; flex: none; }
.back:active { background: var(--primary-light); }
.addr-chip { margin-left: auto; height: 64px; padding: 0 28px; background: var(--primary-light); border-radius: 12px; display: flex; align-items: center; font-size: 28px; font-weight: 500; color: var(--primary); flex: none; }
.footer > span:first-child { max-width: 600px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.footer { height: 96px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 48px; background: var(--surface); border-top: 1px solid var(--border); font-size: 24px; color: var(--text2); position: relative; }
.hint2 { color: var(--dis-fg); }
.content { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.card { background: var(--surface); border: 2px solid var(--border); border-radius: 16px; box-shadow: 0 2px 8px rgba(15,23,42,0.08); }
.btn-pri { border-radius: 16px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 40px; font-weight: 700; cursor: pointer; }
.btn-pri:active { filter: brightness(0.88); }
.btn-sec { border-radius: 16px; background: var(--surface); border: 3px solid var(--border); color: var(--text); display: flex; align-items: center; justify-content: center; gap: 16px; font-size: 32px; font-weight: 500; cursor: pointer; }
.btn-sec:active { background: var(--primary-light); }
.btn-dis { border-radius: 16px; background: var(--dis-bg); color: var(--dis-fg); display: flex; align-items: center; justify-content: center; font-size: 40px; font-weight: 700; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.key { background: var(--surface); border: 2px solid var(--border); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 48px; font-weight: 500; cursor: pointer; }
.key:active { background: var(--primary-light); }
.slots { display: flex; justify-content: center; }
.slot { background: var(--surface); border: 2px solid var(--border); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.slot.cur { border: 4px solid var(--primary); }
.slot.err { border: 4px solid var(--danger); }
.slot.fixed { background: var(--dis-bg); }
.matrix { display: grid; grid-template-columns: repeat(var(--mx-cols), 1fr); gap: 12px; width: 100%; }
.cell { height: 88px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--surface); border: 2px solid var(--border); color: var(--dis-fg); }
.cell.hl { background: var(--primary); border: 3px solid var(--primary); color: #fff; cursor: pointer; }
.cell.occ { background: var(--primary); border: 2px solid var(--primary); color: #fff; }
.cell.fault { background: repeating-linear-gradient(45deg, #FEE2E2, #FEE2E2 8px, #FCA5A5 8px, #FCA5A5 16px); color: var(--danger); border: 2px solid var(--danger); }
.cell.restore { background: repeating-linear-gradient(45deg, #FEF3C7, #FEF3C7 8px, #FDE68A 8px, #FDE68A 16px); color: var(--warning); border: 2px solid var(--warning); }
.cell.sel { border: 4px solid #0F172A; }
.dialog-mask { position: absolute; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 50; }
.dialog { width: 880px; background: var(--surface); border-radius: 24px; padding: 64px; display: flex; flex-direction: column; align-items: center; gap: 32px; }
.warn-note { display: flex; align-items: center; gap: 24px; background: #FEF3C7; border: 2px solid var(--warning); border-radius: 16px; padding: 32px 40px; }
.pick-item { background: var(--surface); border: 3px solid var(--border); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 44px; font-weight: 500; cursor: pointer; }
.pick-item:active { background: var(--primary-light); border-color: var(--primary); }
.list-row { min-height: 104px; display: flex; align-items: center; gap: 24px; padding: 0 32px; background: var(--surface); border-radius: 16px; margin-bottom: 16px; border: 2px solid var(--border); cursor: pointer; }
.list-row:active { background: var(--primary-light); border-color: var(--primary); }
.choice { border-radius: 16px; background: var(--surface); border: 3px solid var(--border); display: flex; align-items: center; cursor: pointer; box-shadow: 0 2px 8px rgba(15,23,42,0.08); }
.choice:active { background: var(--primary-light); border-color: var(--primary); }
.scroll { overflow-y: auto; }
.scroll::-webkit-scrollbar { width: 24px; }
.scroll::-webkit-scrollbar-track { background: #E2E8F0; border-radius: 12px; }
.scroll::-webkit-scrollbar-thumb { background: #94A3B8; border-radius: 12px; }
@keyframes kspin { to { transform: rotate(360deg); } }
.spin { width: 96px; height: 96px; border: 8px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: kspin 0.8s linear infinite; }
.ad-slide { position: absolute; inset: 0; transition: opacity 0.8s; }
.ad-text { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 48px 0 48px 64px; color: #fff; pointer-events: none; }
.prelaunch-mask { position: absolute; inset: 0; z-index: 1000; background: rgba(15,23,42,0.72); display: flex; align-items: center; justify-content: center; text-align: center; touch-action: none; }
.prelaunch-mask[hidden] { display: none; }
.prelaunch-message { color: #fff; font-size: 64px; font-weight: 700; line-height: 1.5; letter-spacing: 0.04em; text-shadow: 0 4px 16px rgba(0,0,0,0.35); }
