/* 約書亞大富翁｜共用樣式（參考 2027 TopKidz 冬令營海報：木質立體標題、羊皮紙、金幣、彩色大富翁格子） */
:root {
  --paper: #f8eed6;
  --paper-2: #efdcb2;
  --card: #fffaee;
  --wood: #6b3a17;
  --wood-2: #8f5524;
  --wood-dark: #3f1f08;
  --ink: #3b2210;
  --muted: #8b6f52;
  --gold: #f2a81d;
  --gold-2: #ffd34d;
  --sky: #5fb7e8;
  --grass: #5aa83a;
  --green: #2f9a55;
  --red: #d63a2c;
  --blue: #2f7fc6;
  --line: #e4cc9a;
  --shadow: 0 3px 0 rgba(107, 58, 23, .22), 0 8px 20px rgba(107, 58, 23, .12);
  --radius: 18px;
  /* 新版設定稿用到的名稱（保留相容） */
  --teal: #6b3a17; --teal-2: #8f5524; --teal-dark: #3f1f08;
  --canaan: #2f9a55; --promise: #f2a81d; --sand: #d35400; --jordan: #5fb7e8; --parchment: #f8eed6;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: var(--paper);
  background-image:
    radial-gradient(circle at 15% -10%, #fff7e3 0, transparent 45%),
    radial-gradient(circle at 110% 110%, #ecd3a0 0, transparent 40%);
  color: var(--ink);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { margin: 0; line-height: 1.25; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--wood-2); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* ── 海報風立體木字標題 ── */
.wood-title {
  font-weight: 900; letter-spacing: 1px; color: var(--gold-2);
  -webkit-text-stroke: 2px var(--wood-dark); paint-order: stroke fill;
  text-shadow: 0 3px 0 var(--wood-dark), 0 6px 0 #2a1404, 0 8px 14px rgba(0,0,0,.35);
}
.wood-title.white { color: #fff; }
.plank {
  display: inline-block; background: linear-gradient(180deg, #a86a33, #7a461c);
  border: 3px solid var(--wood-dark); border-radius: 12px; padding: 4px 14px; color: #fff2cf; font-weight: 900;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.25), 0 4px 0 var(--wood-dark);
}
.tag { display: inline-block; background: var(--wood-2); color: #fff3d6; border-radius: 8px; padding: 2px 10px; font-weight: 800; font-size: 13px; }

/* ── 頂部：天空＋木框 ── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, #8a5226 0%, #6b3a17 100%);
  color: #fff4dc; padding: 10px 14px; display: flex; align-items: center; gap: 10px;
  border-bottom: 4px solid var(--wood-dark);
  box-shadow: 0 4px 0 rgba(63,31,8,.25);
}
.topbar .title { font-weight: 900; letter-spacing: .5px; font-size: 17px; }
.topbar .sub { font-size: 12px; opacity: .9; }
.topbar .spacer { flex: 1; }
.topbar button.link { background: rgba(255,255,255,.08); border: 2px solid rgba(255,244,220,.45); color: #fff4dc; border-radius: 10px; padding: 5px 10px; font-size: 13px; font-weight: 700; }
.topbar .shield { display: none; }

.wrap { max-width: 560px; margin: 0 auto; padding: 14px 16px 100px; }
.wrap.wide { max-width: 1320px; }

/* ── 羊皮紙卡片 ── */
.card {
  background: var(--card); border: 3px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; position: relative;
}
.card h2 { font-size: 18px; margin-bottom: 8px; }
.card h3 { font-size: 15px; margin-bottom: 6px; }
.card + .card { margin-top: 14px; }
.card.hero { background: linear-gradient(180deg, #fffaf0, #fbefd2); border-color: #d9b878; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--paper-2); color: var(--wood); white-space: nowrap; }
.chip.green { background: #dcf3e2; color: #1d6b3c; }
.chip.red { background: #fde0dc; color: #a12a1d; }
.chip.gold { background: #fff0bf; color: #8a5600; }
.chip.blue { background: #d9ecfa; color: #1b5a8f; }
.chip.gray { background: #ece5d7; color: #6f6250; }

/* ── 圓滾滾按鈕 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 3px solid #b06f06; border-radius: 16px; padding: 12px 18px; font-weight: 900; font-size: 18px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #4a2600;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.55), 0 5px 0 #a66604; transition: transform .05s, box-shadow .05s;
  min-height: 54px; text-shadow: 0 1px 0 rgba(255,255,255,.4);
}
.btn:active { transform: translateY(4px); box-shadow: inset 0 2px 0 rgba(255,255,255,.55), 0 1px 0 #a66604; }
.btn.block { width: 100%; }
.btn.green { background: linear-gradient(180deg, #4fc078, var(--green)); color: #fff; border-color: #1d6b3c; box-shadow: inset 0 2px 0 rgba(255,255,255,.35), 0 5px 0 #1d6b3c; text-shadow: none; }
.btn.red { background: linear-gradient(180deg, #ee5b4c, var(--red)); color: #fff; border-color: #8e2218; box-shadow: inset 0 2px 0 rgba(255,255,255,.3), 0 5px 0 #8e2218; text-shadow: none; }
.btn.blue { background: linear-gradient(180deg, #5aa6e6, var(--blue)); color: #fff; border-color: #1b5a8f; box-shadow: inset 0 2px 0 rgba(255,255,255,.3), 0 5px 0 #1b5a8f; text-shadow: none; }
.btn.ghost { background: var(--card); color: var(--wood); border-color: var(--line); box-shadow: 0 4px 0 var(--line); text-shadow: none; }
.btn.sm { padding: 6px 12px; font-size: 14px; min-height: 38px; border-radius: 12px; border-width: 2px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.busy { opacity: .7; pointer-events: none; }

/* ── 數字面板（金幣風） ── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: var(--card); border: 3px solid var(--line); border-radius: 16px; padding: 8px 4px 6px; text-align: center; }
.stat .v { font-size: 25px; font-weight: 900; color: var(--wood); line-height: 1.1; }
.stat .l { font-size: 11px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.stat .l .coin-ic { width: 15px; height: 15px; font-size: 8px; border-width: 1px; vertical-align: -2px; }
.stat.coin .v { color: #b36b00; }
.coin-ic { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff1a8, #f2a81d 60%, #b06f06); border: 2px solid #8a5200; font-size: 11px; font-weight: 900; color: #6b3a00; vertical-align: -4px; }

.progress { height: 14px; background: var(--paper-2); border-radius: 999px; overflow: hidden; border: 2px solid var(--line); }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); border-radius: 999px; transition: width .4s; }
.progress.stone > i { background: linear-gradient(90deg, #8d9a9b, #c6cfd0); }

.banner { border-radius: 14px; padding: 12px 14px; font-weight: 800; margin-bottom: 12px; }
.banner.warn { background: #fff0bf; color: #7a4f00; border: 3px solid #f1d27a; }
.banner.err { background: #fde0dc; color: #8c2216; border: 3px solid #f0b2a8; }
.banner.info { background: #d9ecfa; color: #174a7c; border: 3px solid #b4d3ea; }

/* ── 底部分頁 ── */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: linear-gradient(180deg, #8a5226, #6b3a17); border-top: 4px solid var(--wood-dark); display: flex; padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; background: none; border: none; padding: 8px 0 9px; font-size: 12px; color: #e8cfa5; display: flex; flex-direction: column; align-items: center; gap: 2px; font-weight: 700; }
.tabs button .ic { font-size: 22px; line-height: 1; }
.tabs button.on { color: var(--gold-2); }

/* ── 骰子 ── */
.dice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.dice-btn { aspect-ratio: 1; border-radius: 20px; border: 3px solid #d8c39b; background: linear-gradient(160deg, #fff, #f1ebe0); box-shadow: 0 5px 0 #c9b28a; padding: 14%; }
.dice-btn.on { border-color: var(--gold); background: linear-gradient(160deg, #fff8d8, #ffe48a); box-shadow: 0 5px 0 #b06f06; }
.pips { width: 100%; height: 100%; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); }
.pips i { width: 70%; height: 70%; margin: auto; border-radius: 50%; background: #2a1a0e; visibility: hidden; }
.pips i.on { visibility: visible; }
.pips.red-one i.on { background: #d63a2c; }
.big-die { width: 130px; height: 130px; margin: 10px auto; border-radius: 28px; background: linear-gradient(160deg, #fff, #ece6da); border: 4px solid #3f2a18; box-shadow: 0 7px 0 #3f2a18, 0 12px 24px rgba(0,0,0,.2); padding: 20px; }
.big-die.roll { animation: roll .14s linear infinite; }
@keyframes roll { 0% { transform: rotate(-14deg) scale(.94); } 50% { transform: rotate(14deg) scale(1.06); } 100% { transform: rotate(-14deg) scale(.94); } }
.die-stand { display: none; }

.steps { display: flex; gap: 4px; margin: 10px 0 4px; }
.steps i { flex: 1; height: 7px; border-radius: 4px; background: var(--paper-2); }
.steps i.on { background: var(--gold); }

/* ── 翻牌卡片 ── */
.flip { perspective: 800px; }
.flip .face { border-radius: 20px; padding: 22px 18px; text-align: center; color: #fff; animation: flipIn .6s ease; box-shadow: var(--shadow); border: 4px solid rgba(255,255,255,.5); }
.flip .face.chance { background: linear-gradient(160deg, #f6b73c, #d0700c); }
.flip .face.intel { background: linear-gradient(160deg, #4ea3df, #1f5e95); }
.flip .face.supply { background: linear-gradient(160deg, #5cc07a, #237a45); }
.flip .face.stone { background: linear-gradient(160deg, #9aa6a7, #59656a); }
.flip .face .t { font-size: 26px; font-weight: 900; margin: 6px 0; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
@keyframes flipIn { from { transform: rotateY(90deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── 大富翁棋盤（外圈路線） ── */
.board { display: grid; gap: 4px; }
.cell { position: relative; background: #fffdf6; border: 2px solid #d9c08e; border-radius: 10px; padding: 3px; font-size: 10px; line-height: 1.15; min-height: 62px; overflow: hidden; }
.cell .n { font-weight: 900; color: var(--muted); font-size: 10px; }
.cell .nm { font-weight: 900; font-size: 11px; color: var(--ink); word-break: break-all; }
.cell .ic { position: absolute; right: 3px; top: 2px; font-size: 12px; }
.cell.t-S { background: linear-gradient(160deg, #fff1b0, #ffd34d); }
.cell.t-C { background: linear-gradient(160deg, #ffe7c2, #ffc979); }
.cell.t-I { background: linear-gradient(160deg, #dff0fc, #a9d5f5); }
.cell.t-P { background: linear-gradient(160deg, #e2f5dd, #b3e2a6); }
.cell.t-T { background: linear-gradient(160deg, #eceeee, #c9d0d1); }
.cell.me { outline: 4px solid var(--red); outline-offset: 1px; z-index: 2; }
.cell .own { position: absolute; left: 0; right: 0; bottom: 0; height: 15px; color: #fff; font-size: 10px; font-weight: 900; text-align: center; line-height: 15px; }
.cell.lock { background: #ebe4d6; color: #a99b86; }
.cell.lock .nm { color: #a99b86; }
.cell .dots { position: absolute; right: 2px; bottom: 17px; display: flex; flex-wrap: wrap-reverse; justify-content: flex-end; gap: 1px; max-width: 34px; }
.cell .dots b { width: 10px; height: 10px; border-radius: 50%; color: #fff; font-size: 7px; display: grid; place-items: center; border: 1px solid #fff; }
.board-center { background: linear-gradient(160deg, #9fd6f3, #e6f5d8 70%); border: 3px solid #d9c08e; border-radius: 14px; display: grid; place-items: center; text-align: center; padding: 8px; }

/* ── 列表 ── */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 2px; border-bottom: 2px dashed var(--line); display: flex; gap: 10px; align-items: center; }
.list li:last-child { border-bottom: none; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.team-badge { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: #fff; font-weight: 900; flex: none; border: 2px solid rgba(0,0,0,.2); box-shadow: inset 0 2px 0 rgba(255,255,255,.3); }

/* ── 對話框／提示 ── */
.modal-back { position: fixed; inset: 0; background: rgba(40, 22, 8, .55); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--card); border-radius: 22px; padding: 20px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.35); border: 4px solid var(--wood-2); }
.modal h3 { font-size: 20px; margin-bottom: 10px; color: var(--wood); }
.modal .msg { white-space: pre-wrap; line-height: 1.65; }
.modal .row { margin-top: 16px; }
.modal .row .btn { flex: 1; }
.toast { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); background: var(--wood-dark); color: #fff4dc; padding: 12px 18px; border-radius: 14px; z-index: 200; font-weight: 800; max-width: 90vw; box-shadow: 0 8px 24px rgba(0,0,0,.3); border: 2px solid var(--gold); }
.toast.err { background: #9d2a1e; border-color: #ffb4a8; }

.field { display: block; margin-bottom: 10px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 800; }
.input { width: 100%; padding: 12px 14px; border-radius: 14px; border: 3px solid var(--line); background: #fff; font-size: 16px; }
.input:focus { outline: none; border-color: var(--gold); }

.net { position: fixed; top: 8px; right: 8px; z-index: 300; }

/* ── 後台表格 ── */
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; background: var(--paper-2); padding: 7px 8px; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
table.t td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:hover td { background: #fff4dc; }
table.t input, table.t select { width: 100%; min-width: 50px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 13px; }
table.t input.saved, table.t select.saved { background: #e3f5e8; }
.scroll { overflow: auto; max-height: 70vh; border: 3px solid var(--line); border-radius: 14px; background: #fff; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
