/* [claude code] 2026-11-01 v0.1 球團物語:手機直式、像素 Q 版。顏色只在 :root,字級 11 / 13 / 15 / 20 / 28,圓角 8 / 14 / 999。 */
:root {
  --bg: #1f3b2a;
  --surface: #fdf7e8;
  --surface-2: #f3e7c9;
  --border: #c9b27a;
  --text: #2b2418;
  --mute: #7a6a4a;
  --accent: #e2583e;
  --accent-ink: #fff8ec;
  --ok: #2f8f4e;
  --warn: #d98a1c;
  --danger: #c43a2c;
  --gold: #e8b437;
  --field: #4caf50;
  --dirt: #c98b4f;
  --sky: #8fd3ff;
  --scrim: rgba(18, 26, 20, .6);
  --hud: #173022;
  --hud-text: #fdf7e8;
  --legend: #b5651d;
  --phone-width: min(100vw, 480px);
  color-scheme: light;
  --sec-bg: #fff7d6;
  --news-stop: #ffe4d8;
  --row-me: #fff3cf;
  --hit: #ffd27a;
  --neg-light: #ff9a8a;
  --white: #fff;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", "Noto Sans TC", sans-serif; }
body { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

button { font: inherit; font-size: 15px; color: var(--text); min-height: 44px; padding: 8px 12px; border: 2px solid var(--border); border-radius: 8px; background: var(--surface-2); cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
button.flat { background: transparent; border-color: transparent; }
button.small { min-height: 36px; font-size: 13px; padding: 4px 10px; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
input { font: inherit; font-size: 15px; min-height: 44px; padding: 8px 10px; border: 2px solid var(--border); border-radius: 8px; background: var(--white); color: var(--text); width: 100%; }
label { font-size: 13px; color: var(--mute); display: block; margin: 8px 0 4px; }

.app { width: var(--phone-width); height: 100%; margin: 0 auto; position: relative; display: flex; flex-direction: column; background: var(--surface); overflow: hidden; }

/* 登入 / 開局 */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; padding: 24px 16px; overflow-y: auto; background: var(--surface); }
.gate { align-items: stretch; justify-content: center; text-align: center; background: linear-gradient(var(--sky), var(--surface) 55%); }
.gate h1 { font-size: 28px; letter-spacing: 2px; }
.gate .logo { width: 128px; height: 128px; margin: 0 auto; image-rendering: pixelated; border-radius: 14px; }
.gate p { color: var(--mute); }
.pick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pick { text-align: left; padding: 10px; border-radius: 14px; background: var(--surface-2); }
.pick b { display: block; font-size: 15px; }
.pick small { color: var(--mute); font-size: 11px; display: block; }
.pick[aria-pressed="true"] { border-color: var(--accent); background: var(--white); box-shadow: 0 0 0 2px var(--accent); }
.logo-s { width: 20px; height: 20px; vertical-align: -5px; margin-right: 4px; image-rendering: pixelated; }
.team-dot { display: inline-block; width: 12px; height: 12px; border-radius: 999px; margin-right: 6px; vertical-align: -1px; border: 1px solid var(--text); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.check input { width: 22px; min-height: 22px; }
.msg { color: var(--danger); font-size: 13px; min-height: 20px; }

/* HUD */
.hud { display: flex; align-items: center; gap: 6px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--hud); color: var(--hud-text); font-size: 15px; font-weight: 700; }
.hud span { white-space: nowrap; }
.hud .grow { flex: 1; }
.hud small { font-size: 11px; font-weight: 400; opacity: .85; }
.hud button { min-height: 36px; color: var(--hud-text); border-color: transparent; background: transparent; padding: 4px 8px; }
.hud .neg { color: var(--neg-light); }

.main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 8px; }
.tab { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px; }

/* 球場 */
.stadium-wrap { margin: 0 -12px; position: relative; background: var(--sky); }
#stadium { display: block; width: 100%; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: manipulation; }
.phase-tag { position: absolute; left: 8px; top: 8px; background: var(--scrim); color: var(--hud-text); font-size: 11px; padding: 2px 8px; border-radius: 999px; }

.card { background: var(--white); border: 2px solid var(--border); border-radius: 14px; padding: 10px 12px; }
.card h3 { font-size: 13px; color: var(--mute); margin-bottom: 4px; font-weight: 700; }
.card .big { font-size: 20px; font-weight: 700; }
.row { display: flex; align-items: center; gap: 8px; }
.row .grow { flex: 1; min-width: 0; }
.mute { color: var(--mute); font-size: 13px; }
.tiny { font-size: 11px; color: var(--mute); }
.pos { color: var(--ok); }
.neg { color: var(--danger); }

.sec { display: flex; gap: 8px; align-items: flex-start; background: var(--sec-bg); border: 2px solid var(--gold); border-radius: 14px; padding: 10px; }
.sec .face { width: 40px; height: 40px; flex: none; image-rendering: pixelated; }
.sec p { font-size: 13px; }
.news { display: flex; flex-direction: column; gap: 6px; }
.news div { font-size: 13px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); }
.news .stop { background: var(--news-stop); }

.go-bar { position: sticky; bottom: 0; padding: 8px 12px; padding-bottom: max(8px, env(safe-area-inset-bottom)); background: var(--surface); border-top: 2px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.go-bar .main-btn { min-height: 56px; font-size: 20px; width: 100%; }
.speeds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.speeds button { min-height: 36px; font-size: 13px; }
.speeds button[aria-pressed="true"] { background: var(--hud); color: var(--hud-text); border-color: var(--hud); }

.results { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; font-size: 13px; }
.results .me { font-weight: 700; }
.stand { width: 100%; border-collapse: collapse; font-size: 13px; }
.stand td, .stand th { padding: 4px 2px; text-align: center; border-bottom: 1px solid var(--surface-2); }
.stand th { color: var(--mute); font-weight: 400; font-size: 11px; }
.stand td:first-child, .stand th:first-child { text-align: left; }
.stand tr.me td { font-weight: 700; background: var(--row-me); }

/* 球員 */
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--hud); color: var(--hud-text); border-color: var(--hud); }
.plist { display: flex; flex-direction: column; gap: 6px; }
.prow { display: flex; align-items: center; gap: 8px; text-align: left; width: 100%; background: var(--white); border-radius: 14px; padding: 8px 10px; }
.prow .ovr { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; background: var(--surface-2); flex: none; }
.prow .ovr.hi { background: var(--gold); }
.prow .info { flex: 1; min-width: 0; }
.prow .name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .sub { font-size: 11px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow.legend { border-color: var(--legend); }
.prow.out { opacity: .6; }
.badge { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--text); margin-left: 4px; font-weight: 400; vertical-align: 1px; }
.badge.legend { background: var(--legend); color: var(--accent-ink); }
.badge.inj { background: var(--danger); color: var(--accent-ink); }
.badge.rest { background: var(--mute); color: var(--accent-ink); }
.badge.focus { background: var(--ok); color: var(--accent-ink); }
.badge.start { background: var(--hud); color: var(--hud-text); }
.fat { width: 48px; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; flex: none; }
.fat i { display: block; height: 100%; background: var(--ok); }
.fat i.mid { background: var(--warn); }
.fat i.hi { background: var(--danger); }
.bars { display: grid; grid-template-columns: 48px minmax(0, 1fr) 32px; gap: 4px 8px; align-items: center; font-size: 13px; }
.bars .bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bars .bar i { display: block; height: 100%; background: var(--accent); }

/* 經營 */
.money { width: 100%; font-size: 13px; border-collapse: collapse; }
.money td { padding: 3px 0; border-bottom: 1px dashed var(--surface-2); }
.money td:last-child { text-align: right; }
.fac { display: flex; align-items: center; gap: 8px; }
.fac .grow b { font-size: 15px; }

/* 選秀 / 圖鑑 */
.dex { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.dex div { font-size: 13px; text-align: center; padding: 6px 2px; border-radius: 8px; background: var(--surface-2); }
.dex div.got { background: var(--white); border: 2px solid var(--legend); }
.grade { font-weight: 700; font-size: 20px; width: 36px; text-align: center; flex: none; }
.grade.S { color: var(--danger); } .grade.A { color: var(--accent); } .grade.B { color: var(--warn); } .grade.C { color: var(--ok); } .grade.D { color: var(--mute); }

/* 底部導覽 */
.nav { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--hud); padding-bottom: env(safe-area-inset-bottom); }
.nav button { background: transparent; border: 0; color: var(--hud-text); opacity: .7; border-radius: 0; font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 0; min-height: 52px; }
.nav button b { font-size: 20px; line-height: 1.2; font-weight: 400; }
.nav button[aria-current="true"] { opacity: 1; box-shadow: inset 0 3px 0 var(--gold); }

/* 面板 / 對話框 */
.backdrop { position: absolute; inset: 0; background: var(--scrim); z-index: 20; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88%; overflow-y: auto; background: var(--surface); border-radius: 14px 14px 0 0; z-index: 21; padding: 12px 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.sheet h2 { font-size: 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opts .def { box-shadow: 0 0 0 2px var(--gold); }

/* 每場看 */
.watch { position: absolute; inset: 0; z-index: 30; background: var(--hud); color: var(--hud-text); display: flex; flex-direction: column; }
.watch canvas { width: 100%; image-rendering: pixelated; display: block; }
.score-board { display: flex; justify-content: center; gap: 16px; font-size: 20px; font-weight: 700; padding: 6px; }
.score-board small { font-size: 13px; font-weight: 400; opacity: .8; }
.pbp { flex: 1; overflow-y: auto; padding: 8px 16px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.pbp .half { color: var(--gold); margin-top: 6px; font-weight: 700; }
.pbp .hit { color: var(--hit); }
.pbp .run { color: var(--neg-light); font-weight: 700; }
.watch .bar-btns { display: flex; gap: 8px; padding: 8px 16px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.watch .bar-btns button { flex: 1; }

/* 結算 */
.end-lines { width: 100%; border-collapse: collapse; font-size: 15px; }
.end-lines td { padding: 4px 0; border-bottom: 1px dashed var(--border); }
.end-lines td:last-child { text-align: right; font-weight: 700; }
.end-total { font-size: 28px; font-weight: 700; text-align: center; color: var(--accent); }

.toast { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); background: var(--hud); color: var(--hud-text); padding: 8px 14px; border-radius: 999px; font-size: 13px; z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90%; text-align: center; }
.toast.show { opacity: 1; }
