:root {
  --bg: #0b1f17;
  --bg-glow: #14402b;
  --panel: #11271d;
  --panel2: #16302330;
  --card: #15302480;
  --line: #1f4a36;
  --green: #00a05a;
  --green-bright: #2bd47e;
  --accent-ink: #04130c;
  --yellow: #ffcf3f;
  --text: #e9f3ee;
  --dim: #8fae9f;
  --red: #ff6b6b;
  --pos: #2bd47e;
  --neg: #ff7a7a;
}

/* === 10 種網站配色（覆蓋強調色與背景） === */
[data-theme="ocean"]   { --bg:#0b1a2b; --bg-glow:#143a5e; --card:#16263a80; --line:#1f3a57; --green:#1e74d6; --green-bright:#43a6ff; --accent-ink:#04101f; }
[data-theme="purple"]  { --bg:#160f24; --bg-glow:#2e1d52; --card:#241a3a80; --line:#3a2b57; --green:#7c3aed; --green-bright:#a884ff; --accent-ink:#120420; }
[data-theme="crimson"] { --bg:#220f14; --bg-glow:#5e1a28; --card:#3a1a2280; --line:#572b36; --green:#d6314e; --green-bright:#ff6b81; --accent-ink:#1f0408; }
[data-theme="orange"]  { --bg:#221a0f; --bg-glow:#5e3e14; --card:#3a2e1a80; --line:#574a1d; --green:#e07b1a; --green-bright:#ffae4d; --accent-ink:#1f1004; }
[data-theme="pink"]    { --bg:#221024; --bg-glow:#5e1a4e; --card:#3a1a3480; --line:#572b4f; --green:#d63a9e; --green-bright:#ff7ad0; --accent-ink:#1f0418; }
[data-theme="teal"]    { --bg:#0b2422; --bg-glow:#14403b; --card:#15302d80; --line:#1f4a44; --green:#0d9488; --green-bright:#2bd4c4; --accent-ink:#04130f; }
[data-theme="gold"]    { --bg:#211f0f; --bg-glow:#4f4514; --card:#33301a80; --line:#4f4a1d; --green:#caa11a; --green-bright:#ffd84d; --accent-ink:#1a1604; }
[data-theme="slate"]   { --bg:#13171d; --bg-glow:#2a3340; --card:#1c232d80; --line:#2c3540; --green:#5b6b82; --green-bright:#9fb2cc; --accent-ink:#0a0e13; }
[data-theme="indigo"]  { --bg:#12132a; --bg-glow:#23264f; --card:#1b1d3a80; --line:#2c2f57; --green:#4f46e5; --green-bright:#8b86ff; --accent-ink:#070620; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 50% -200px, var(--bg-glow) 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #0a1a13ee;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand { font-weight: 800; font-size: 20px; color: var(--green-bright); letter-spacing: .5px; }
.zerosum-chip { margin-left: auto; font-size: 12px; font-weight: 700; }

/* 底部導覽列（手機 App 風格） */
.bottomnav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  background: #0a1a13f2;
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  background: transparent;
  color: var(--dim);
  border: none;
  cursor: pointer;
  padding: 8px 2px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
}
.tab .nav-ico { font-size: 20px; line-height: 1; filter: grayscale(0.4) opacity(0.7); }
.tab .nav-label { font-size: 11px; }
.tab.active { color: var(--green-bright); }
.tab.active .nav-ico { filter: none; }

main { max-width: 860px; margin: 0 auto; padding: 18px 14px; }
.view { display: none; }
.view.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.section-title { font-size: 16px; margin: 22px 0 12px; color: var(--text); border-left: 3px solid var(--green-bright); padding-left: 10px; }
.section-title .hint { font-weight: 400; }
.hint { color: var(--dim); font-size: 12px; }
.dim { color: var(--dim); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}
.form-card label, .form-card .field { display: block; margin-bottom: 12px; font-size: 13px; color: var(--dim); font-weight: 600; }
.form-card input, .form-card select, .form-card textarea {
  width: 100%; margin-top: 6px; padding: 11px 12px; border-radius: 9px;
  border: 1px solid var(--line); background: #0c1d15; color: var(--text); font-size: 15px;
}
.form-card textarea { font-family: inherit; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-bright); }

.btn { border: none; border-radius: 9px; padding: 11px 16px; font-size: 15px; font-weight: 700; cursor: pointer; }
.btn.primary { background: var(--green); color: var(--accent-ink); width: 100%; margin-top: 4px; }
.btn.primary:hover { background: var(--green-bright); }
.btn.ghost { background: transparent; color: var(--green-bright); border: 1px solid var(--line); }
.btn.small { padding: 7px 12px; font-size: 13px; width: auto; }
.btn.danger { background: #3a1818; color: var(--neg); border: 1px solid #532; }
.btn.warn { background: #2d2a14; color: var(--yellow); border: 1px solid #5a4f1d; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.msg { margin: 10px 0 0; font-size: 13px; min-height: 18px; }
.msg.ok { color: var(--green-bright); }
.msg.err { color: var(--red); }

/* 排行榜 */
table { width: 100%; border-collapse: collapse; }
.standings-table th, .standings-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
.standings-table th { color: var(--dim); font-weight: 600; font-size: 12px; }
.standings-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.zero { color: var(--dim); }
.row-house td { background: #0e261bcc; font-weight: 700; }
.standings-table tr.clickable { cursor: pointer; }
.standings-table tr.clickable:hover td { background: #16382688; }

/* 玩家明細 */
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.detail-name { font-size: 18px; font-weight: 800; }
.detail-net { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.detail-sub { color: var(--dim); font-size: 13px; margin: 6px 0 10px; }

/* 配色挑選 */
.theme-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.theme-swatch {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  background: #0c1d15; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
  color: var(--text); font-size: 14px; font-weight: 600;
}
.theme-swatch .sw { width: 18px; height: 18px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px #0006 inset; }
.theme-swatch.sel { border-color: var(--green-bright); box-shadow: 0 0 0 1px var(--green-bright) inset; }
.badge-house { background: var(--yellow); color: #2a2200; border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 800; margin-left: 6px; }

/* 盤口卡片 */
.event-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.event-title { font-size: 16px; font-weight: 700; }
.event-desc { color: var(--dim); font-size: 13px; margin: 4px 0 10px; }
.status { font-size: 11px; font-weight: 800; padding: 2px 9px; border-radius: 999px; }
.status.open { background: #0c3a26; color: var(--green-bright); }
.status.closed { background: #3a2e0c; color: var(--yellow); }
.status.settled { background: #2a2a33; color: #b9c2d0; }
.maxtag { font-size: 11px; color: var(--dim); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }

.outcomes { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 10px 0; }
.outcome {
  background: #0c1d15; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.outcome.winner { border-color: var(--green-bright); box-shadow: 0 0 0 1px var(--green-bright) inset; }
.outcome .o-label { font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.outcome .o-odds { color: var(--yellow); font-weight: 800; font-size: 16px; }
.outcome .o-meta { color: var(--dim); font-size: 11px; }
.win-mark { color: var(--green-bright); font-size: 11px; font-weight: 800; }

.bets-list { margin-top: 6px; }
.bet-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.bet-row .who { font-weight: 700; min-width: 70px; }
.bet-row .pick { color: var(--dim); flex: 1; }
.bet-row .amt { font-variant-numeric: tabular-nums; }
.bet-row .pl { font-weight: 700; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--dim); font-size: 13px; padding: 8px 0; }

/* 下注頁選項挑選 */
.outcome-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 6px 0 14px; }
.pick-btn {
  background: #0c1d15; border: 1px solid var(--line); border-radius: 10px; padding: 10px;
  cursor: pointer; text-align: left; color: var(--text);
}
.pick-btn .o-odds { color: var(--yellow); font-weight: 800; }
.pick-btn.sel { border-color: var(--green-bright); background: #0c3a2680; }

.stake-picker { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.stake-btn {
  flex: 1; min-width: 60px; background: #0c1d15; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 0; cursor: pointer; color: var(--text); font-weight: 700; font-size: 15px;
}
.stake-btn.sel { border-color: var(--green-bright); background: var(--green); color: var(--accent-ink); }
.stake-btn:disabled { opacity: .3; cursor: not-allowed; }

/* admin outcome editor */
.oc-row { display: flex; gap: 8px; margin-bottom: 8px; }
.oc-row input.oc-label { flex: 2; }
.oc-row input.oc-odds { flex: 1; }
.oc-row input { padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); background: #0c1d15; color: var(--text); }
.oc-row .oc-del { background: #3a1818; color: var(--neg); border: 1px solid #532; border-radius: 8px; padding: 0 12px; cursor: pointer; }
.outcomes-label { font-size: 13px; color: var(--dim); font-weight: 600; margin: 6px 0; }

.admin-event-card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.edit-box { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.oc-edit-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.oc-edit-label-input { flex: 1; min-width: 0; }
.oc-edit-label-input, .oc-edit-odds, .oc-add-label, .oc-add-odds {
  padding: 7px 9px; border-radius: 8px; border: 1px solid var(--line); background: #0c1d15; color: var(--text);
}
.oc-edit-odds { width: 78px; }
.oc-add-row { margin-top: 8px; }
.oc-add-label { flex: 1; min-width: 0; }
.oc-add-odds { width: 78px; }
.oc-del-btn { background: #3a1818; color: var(--neg); border: 1px solid #532; border-radius: 8px; padding: 5px 9px; cursor: pointer; }
.meta-edit .meta-title, .meta-edit .meta-desc, .meta-edit .meta-start {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: #0c1d15; color: var(--text);
}
.meta-edit .meta-title, .meta-edit .meta-desc { width: 100%; margin-bottom: 7px; }
.meta-edit .meta-start { flex: 1; min-width: 0; }
.settle-box { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.settle-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; margin: 8px 0; }
.settle-opt { display: flex; align-items: center; gap: 8px; background: #0c1d15; border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; cursor: pointer; font-size: 14px; }
.settle-opt input { width: 18px; height: 18px; accent-color: var(--green-bright); flex: none; }
.settle-opt .o-odds { color: var(--yellow); font-weight: 700; }
.del-bet { background: transparent; border: none; color: var(--neg); cursor: pointer; font-size: 12px; }

.hidden { display: none !important; }

#zero-sum.bad { color: var(--red); font-weight: 700; }
#zero-sum.good { color: var(--green-bright); }
