/* TÜV 40 prototype：像素風樣式。
   主色取自 TÜV 台灣官網實測用色（#0071B9、#D20033、#E1E5E8），正式版以官方 CI 手冊為準。
   字型：俐方體 11 號（Cubic 11），SIL OFL 授權。像素字以 11 的整數倍字級最清晰。 */
@font-face {
  font-family: "Cubic 11";
  src: url("/assets/fonts/cubic11.woff2") format("woff2");
  font-display: swap;
}
:root {
  --blue: #0071B9;
  --blue-light: #4FA3DB;
  --blue-dark: #005287;
  --red: #D20033;
  --yellow: #FFC93C;
  --ink: #1B2A41;
  --gray: #E1E5E8;
  --sky: #DCE7F0;
  --grid: #CDDAE5;
  --paper: #FFFFFF;
  --cream: #FFF3DC;
  --g1: #3B4A5E;
  --px: 6px;
  --pixel-font: "Cubic 11", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--pixel-font);
  color: var(--ink);
  background: var(--sky);
  -webkit-font-smoothing: none;
  font-smooth: never;
}
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* 像素外框：用四向陰影做出缺角的方框，再加一層位移陰影當立體感。 */
.px-box {
  background: var(--paper);
  box-shadow:
    calc(var(--px) * -1) 0 0 0 var(--ink),
    var(--px) 0 0 0 var(--ink),
    0 calc(var(--px) * -1) 0 0 var(--ink),
    0 var(--px) 0 0 var(--ink),
    calc(var(--px) * 2) calc(var(--px) * 2) 0 0 rgba(27, 42, 65, .18);
}
.px-grid {
  background-color: var(--sky);
  background-image:
    linear-gradient(var(--grid) 2px, transparent 2px),
    linear-gradient(90deg, var(--grid) 2px, transparent 2px);
  background-size: 44px 44px;
}
.px-btn {
  border: 0;
  background: var(--blue);
  color: #fff;
  padding: 18px 22px;
  font-size: 22px;
  letter-spacing: .08em;
  box-shadow:
    calc(var(--px) * -1) 0 0 0 var(--ink),
    var(--px) 0 0 0 var(--ink),
    0 calc(var(--px) * -1) 0 0 var(--ink),
    0 var(--px) 0 0 var(--ink),
    inset 0 calc(var(--px) * -1) 0 0 var(--blue-dark),
    inset 0 var(--px) 0 0 var(--blue-light);
  transition: transform .05s steps(1);
}
.px-btn:active, .px-btn.pressed { transform: translateY(4px); }
.px-btn:disabled { opacity: .5; }
.wordmark { font-size: 22px; letter-spacing: .2em; color: var(--blue); }

/* ---------- 手機頁 ---------- */
.play { min-height: 100%; display: flex; flex-direction: column; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.play-head { padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; background: var(--ink); color: #fff; }
.play-head .wordmark { color: #fff; }
.play-main { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 28px 24px; gap: 26px; }
.play h1 { font-size: 33px; font-weight: 400; line-height: 1.4; }
.play .sub { font-size: 22px; color: var(--g1); line-height: 1.5; }
.play .sub b { color: var(--ink); font-weight: 400; }
.error { color: var(--red); font-size: 22px; min-height: 22px; }
.my-taps { display: flex; align-items: baseline; justify-content: center; gap: 12px; padding: 18px; margin: 6px; font-size: 22px; color: var(--g1); }
.my-taps b { font-size: 66px; font-weight: 400; color: var(--blue); line-height: 1; font-variant-numeric: tabular-nums; }
.tap-zone { flex: 1; display: flex; flex-direction: column; gap: 22px; }
.tap-btn {
  flex: 1; min-height: 50vh; margin: 6px; font-size: 66px; letter-spacing: .1em; touch-action: manipulation;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
}
.tap-btn small { font-size: 22px; letter-spacing: .1em; color: #D8ECFA; }

/* ---------- 大螢幕 ---------- */
.screen { background: var(--ink); overflow: hidden; }
.stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; overflow: hidden; }
.clouds { position: absolute; inset: 0; pointer-events: none; }
.cloud { position: absolute; animation: drift 60s steps(120) infinite alternate; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(160px); } }
.s-head { position: absolute; left: 88px; right: 88px; top: 52px; display: flex; justify-content: space-between; align-items: flex-start; }
.s-title { font-size: 66px; letter-spacing: .06em; margin-top: 14px; }
.s-title b { font-weight: 400; color: var(--blue); }
.s-timer { font-size: 88px; padding: 10px 28px; min-width: 300px; text-align: right; font-variant-numeric: tabular-nums; margin: 6px; }
.s-left { position: absolute; left: 88px; top: 236px; width: 752px; bottom: 64px; display: flex; flex-direction: column; gap: 28px; }
.mosaic { width: 100%; height: auto; shape-rendering: crispEdges; }
.mosaic .cell { fill: #C3CFDA; }
.mosaic .cell.on { fill: var(--blue); }
.mosaic .cell.pop { animation: pop .6s steps(3); }
@keyframes pop { 0% { fill: var(--yellow); } 50% { fill: #fff; } 100% { fill: var(--blue); } }
.s-fill { display: flex; justify-content: space-between; align-items: baseline; font-size: 22px; color: var(--g1); }
.s-fill b { font-size: 55px; font-weight: 400; color: var(--ink); }
.s-join { display: flex; gap: 28px; align-items: center; padding: 18px 22px; margin: auto 6px 6px; }
.s-join img { width: 176px; height: 176px; image-rendering: pixelated; }
.s-join h3 { font-size: 44px; font-weight: 400; margin-bottom: 12px; }
.s-join p { font-size: 22px; color: var(--g1); word-break: break-all; line-height: 1.4; }
/* 加入提示放在右上角的雲層區：報到時這裡是空的，開始後計時器出現在這裡時提示已清空。 */
.s-speed { display: flex; align-items: baseline; justify-content: center; gap: 22px; padding: 26px 22px; margin: auto 6px 6px; font-size: 33px; color: var(--g1); }
.s-speed b { font-size: 110px; font-weight: 400; color: var(--blue); line-height: 1; font-variant-numeric: tabular-nums; min-width: 260px; text-align: center; }
.toasts { position: absolute; right: 88px; top: 64px; width: 752px; display: flex; flex-direction: column; gap: 16px; pointer-events: none; }
.toast { align-self: flex-end; background: var(--ink); color: #fff; font-size: 33px; padding: 12px 22px; box-shadow: 6px 6px 0 0 var(--blue); animation: toast 3.2s steps(8) forwards; }
@keyframes toast { 0% { opacity: 0; transform: translateX(24px); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.s-right { position: absolute; left: 900px; right: 88px; top: 190px; bottom: 64px; }
.cake { width: 100%; height: 826px; shape-rendering: crispEdges; }
.deco-pop { animation: deco-pop .5s steps(5) both; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes deco-pop { 0% { transform: scale(0); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }
.spark { animation: spark .8s steps(8) forwards; }
@keyframes spark { 0% { transform: translate(0, 0); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
.tier-face.flash { animation: flash 1.2s steps(6); }
@keyframes flash { 0%, 66% { fill: #FFE8A3; } 100% { fill: var(--cream); } }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.countdown-num { font-size: 330px; color: var(--yellow); text-shadow: 14px 14px 0 var(--ink); -webkit-text-stroke: 6px var(--ink); }
.finish-card { position: absolute; left: 94px; width: 740px; top: 242px; bottom: 70px; padding: 30px 44px; display: flex; flex-direction: column; justify-content: center; gap: 44px; }
.finish-card .eyebrow { align-self: flex-start; background: var(--red); color: #fff; font-size: 22px; letter-spacing: .3em; padding: 6px 14px; }
.finish-card .time { font-size: 154px; color: var(--ink); line-height: 1; font-variant-numeric: tabular-nums; }
.finish-card .time small { font-size: 44px; margin-left: 12px; }
.finish-card .together { font-size: 44px; letter-spacing: .12em; color: var(--blue); }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -30px; width: 18px; height: 18px; animation-name: fall; animation-timing-function: steps(40); animation-fill-mode: forwards; }
@keyframes fall { to { transform: translateY(1140px); } }

/* ---------- 主控台 ---------- */
.host { padding: 28px 20px; }
.host-wrap { max-width: 1100px; margin: 0 auto; display: grid; gap: 30px; }
.panel { padding: 22px; margin: 6px; }
.panel h2 { font-size: 22px; font-weight: 400; color: var(--g1); margin-bottom: 18px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.stat { border-left: 6px solid var(--blue); padding: 4px 12px; }
.stat span { display: block; font-size: 11px; color: var(--g1); letter-spacing: .1em; }
.stat b { font-size: 33px; font-weight: 400; font-variant-numeric: tabular-nums; }
.phase-badge { background: var(--blue); color: #fff; padding: 4px 12px; letter-spacing: .1em; }
.actions { display: flex; flex-wrap: wrap; gap: 22px; padding: 6px; }
.actions button { font-size: 22px; padding: 14px 18px; }
.actions button.secondary { background: var(--paper); color: var(--blue); box-shadow: -6px 0 0 0 var(--ink), 6px 0 0 0 var(--ink), 0 -6px 0 0 var(--ink), 0 6px 0 0 var(--ink); }
.actions button.danger { background: var(--paper); color: var(--red); box-shadow: -6px 0 0 0 var(--red), 6px 0 0 0 var(--red), 0 -6px 0 0 var(--red), 0 6px 0 0 var(--red); }
.actions button.danger.armed { background: var(--red); color: #fff; }
.msg { font-size: 22px; min-height: 22px; color: var(--g1); margin-top: 12px; }
.msg.bad { color: var(--red); }
.config { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.config label { display: grid; gap: 6px; font-size: 11px; letter-spacing: .1em; color: var(--g1); }
.config input[type=number] { font: 22px var(--pixel-font); padding: 8px 10px; border: 4px solid var(--ink); background: var(--paper); }
.config .check { display: flex; align-items: center; gap: 8px; font-size: 22px; }
.pl-note { font-size: 11px; letter-spacing: .1em; color: var(--g1); margin: 8px 0 12px; }
.players { width: 100%; border-collapse: collapse; font-size: 22px; }
.players th, .players td { text-align: left; padding: 8px 10px; border-bottom: 2px dashed var(--grid); }
.players th { color: var(--g1); font-weight: 400; font-size: 11px; letter-spacing: .1em; }
.players td.off { color: #8A97A8; }
/* 控制頁給現場人員閱讀，文字改用一般字體，不用像素字。 */
.cp { --pixel-font: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif; -webkit-font-smoothing: auto; font-smooth: auto; }
.cp .config label, .cp .pl-note { font-size: 15px; letter-spacing: .02em; }
.cp-actions { grid-column: 1 / -1; }
.cp-steps { padding-left: 1.6em; display: grid; gap: 12px; font-size: 22px; line-height: 1.5; }
.pl-note a { color: var(--blue); }
.login { max-width: 460px; margin: 12vh auto; padding: 28px; display: grid; gap: 18px; }
.login label { font-size: 22px; }
.login input { font: 22px var(--pixel-font); padding: 12px 14px; border: 4px solid var(--ink); }
.login .field { display: grid; gap: 14px; }
