/* 手機直式、深色 */
:root {
  --bg: #0b0d1a; --panel: #11142a; --ink: #e9e3cf; --muted: #8f8a7a;
  --gold: #e8c46a; --jade: #9fd3c7; --red: #e59a8a; --ok: #8fcf8f; --line: #2a2d44; --warn: #f0a35e;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: "PingFang TC", "Noto Sans TC", "Heiti TC", sans-serif; -webkit-text-size-adjust: 100%; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.wrap { max-width: 520px; margin: 0 auto; padding: 0 16px 40px; }
.hide { display: none !important; }
.center { text-align: center; }
.gold { color: var(--gold); font-weight: 600; }
.small { font-size: 13px; color: var(--muted); line-height: 1.7; }
.num { font-variant-numeric: tabular-nums; }

/* 頂列 */
.top { max-width: 520px; margin: 0 auto; padding: 16px 16px 6px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
h1 { font-size: 20px; font-weight: 600; letter-spacing: .3em; margin: 0; }
.tag { font-size: 12px; color: var(--muted); }
.netbad { border: 1px solid var(--red); color: var(--red); border-radius: 10px; padding: 10px 12px; font-size: 14px; line-height: 1.6; }

/* 卡片 */
.card { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 16px; background: var(--panel); margin-top: 12px; }
.card h2 { margin: 0; font-size: 17px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card .name { letter-spacing: .2em; }
.state { font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; text-align: right; }
.lamp { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex: none; background: var(--muted); }
.L-綠 { color: var(--ok); } .L-綠 .lamp { background: var(--ok); animation: breathe 2.6s ease-in-out infinite; }
.L-金 { color: var(--gold); } .L-金 .lamp { background: var(--gold); }
.L-橘 { color: var(--warn); } .L-橘 .lamp { background: var(--warn); animation: breathe 1.1s ease-in-out infinite; }
.L-紅 { color: var(--red); } .L-紅 .lamp { background: var(--red); }
.L-灰 { color: var(--muted); } .L-灰 .lamp { background: var(--muted); }
@keyframes breathe { 0%,100% { opacity: .45 } 50% { opacity: 1 } }
@media (prefers-reduced-motion: reduce) { .lamp { animation: none !important; } }
.note { font-size: 13px; color: var(--muted); margin: 6px 0 0; line-height: 1.6; min-height: 0; }
.note:empty, .phase:empty, .reply:empty { display: none; }
.phase { font-size: 14px; color: var(--jade); margin: 8px 0 0; }

.prog { margin-top: 12px; }
.pl { display: flex; justify-content: space-between; font-size: 14px; padding: 2px 0; }
.pl span, .row span { color: var(--muted); }
.pl b { font-size: 17px; font-weight: 600; }
.bar { height: 5px; background: var(--line); border-radius: 3px; margin: 4px 0 8px; overflow: hidden; }
.bar i { display: block; height: 5px; width: 0; background: var(--gold); border-radius: 3px; transition: width .8s; }
.rows { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 4px 0; }
.row b { font-weight: 500; text-align: right; }

/* 大按鈕 */
.btns { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.btns:empty { display: none; }
button { font-family: inherit; }
.big { width: 100%; min-height: 56px; border-radius: 14px; font-size: 19px; letter-spacing: .3em; font-weight: 600;
  border: 1px solid var(--gold); background: transparent; color: var(--gold); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.big.primary { background: var(--gold); color: #1a1406; }
.big.ghost { border-color: var(--line); color: var(--ink); }
.big:active { transform: scale(.985); }
.big:disabled { opacity: .45; }
.reply { margin: 10px 0 0; font-size: 14px; line-height: 1.6; padding: 8px 10px; border-radius: 8px; background: #0e1124; border: 1px solid var(--line); }
.reply.bad { border-color: var(--red); color: var(--red); }
.link { background: none; border: none; color: var(--muted); font-size: 14px; text-decoration: underline; padding: 12px; cursor: pointer; }

/* 確認 */
.sheet { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet-box { width: 100%; max-width: 520px; background: var(--panel); border: 1px solid var(--line); border-bottom: none;
  border-radius: 18px 18px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
.sheet-t { font-size: 20px; font-weight: 600; margin: 0 0 8px; text-align: center; }
.sheet-d { font-size: 14px; color: var(--muted); line-height: 1.7; margin: 0 0 16px; text-align: center; }
.sheet-btns { display: flex; gap: 10px; }

/* 登入 */
.login { padding-top: 12vh; }
.login h1 { text-align: center; font-size: 24px; }
.login .sub { text-align: center; color: var(--muted); letter-spacing: .2em; margin: 10px 0 28px; }
.lbl { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
#pw { width: 100%; font-size: 18px; padding: 14px; border-radius: 12px; background: #0e1124; color: var(--ink);
  border: 1px solid var(--line); font-family: ui-monospace, Menlo, monospace; }
#pw:focus { outline: none; border-color: var(--gold); }
.show { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin: 12px 0 18px; }
.show input { width: 20px; height: 20px; }
.msg { min-height: 1.6em; font-size: 15px; line-height: 1.6; margin: 14px 0; text-align: center; }
.msg.bad { color: var(--red); }
.offscreen { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
