:root {
  --ocean: #1f7fd0; --deep: #0f4f8a; --sand: #fff3dc; --sand2: #f6e2bd; --sunset: #ff8a3a; --ink: #1f2a3a; --muted: #6a7488;
  --card: #ffffff; --line: #e3d6bd; --good: #22a35a; --bad: #e0453a; --gold: #f2b21e;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: linear-gradient(180deg, #8fd3ff 0%, #c8ecff 40%, #fff1d6 100%); color: var(--ink); font-family: "Baloo 2", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 12px; padding: 8px 14px; background: #fff; color: var(--ink); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12); font-weight: 700; }
button:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--sunset); color: #fff; box-shadow: 0 3px 0 #c45a14; }
button.blue { background: var(--ocean); color: #fff; box-shadow: 0 3px 0 var(--deep); }
button.green { background: var(--good); color: #fff; box-shadow: 0 3px 0 #13703a; }
button.red { background: var(--bad); color: #fff; box-shadow: 0 3px 0 #9a2a22; }
button.big { font-size: 1.15em; padding: 11px 20px; }
.pill { padding: 6px 12px; border-radius: 99px; font-size: 0.9em; }
.top { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: rgba(15, 79, 138, 0.92); color: #fff; position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: baseline; gap: 8px; font-size: 1.25em; }
.brand small { font-size: 0.65em; opacity: 0.85; }
.grow { flex: 1; }
#main { display: grid; grid-template-columns: minmax(0, auto) minmax(300px, 400px); gap: 14px; padding: 12px; justify-content: center; align-items: start; }
#boardWrap { width: min(calc(100vh - 80px), calc(100vw - 440px)); min-width: 320px; }
#board { position: relative; aspect-ratio: 1; display: grid; grid-template-columns: 1.55fr repeat(9, 1fr) 1.55fr; grid-template-rows: 1.55fr repeat(9, 1fr) 1.55fr; gap: 0.25cqw; background: #2a6a4a; padding: 0.6cqw; border-radius: 1.4cqw; container-type: inline-size; box-shadow: 0 10px 30px rgba(0, 40, 80, 0.3); }
#boardWrap { container-type: inline-size; }
.tile { position: relative; background: var(--sand); border-radius: 0.6cqw; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; text-align: center; cursor: pointer; font-size: 1.12cqw; line-height: 1.12; padding: 0.3cqw; }
.tile:hover { outline: 0.35cqw solid var(--gold); z-index: 2; }
.tile .band { align-self: stretch; height: 1.9cqw; flex: none; border-radius: 0.3cqw; display: flex; justify-content: center; align-items: center; gap: 0.2cqw; margin-bottom: 0.2cqw; }
.tile .icon { font-size: 2.1cqw; line-height: 1.1; }
.tile .nm { font-weight: 700; word-break: keep-all; overflow-wrap: anywhere; }
.tile .pr { color: var(--muted); font-size: 1.02cqw; margin-top: auto; }
.tile.side { flex-direction: row-reverse; text-align: left; gap: 0.4cqw; }   /* left column: the color band faces the middle */
.tile.side .band { width: 1.9cqw; height: auto; align-self: stretch; flex-direction: column; margin: 0; }
.tile.side.right { flex-direction: row; text-align: left; }
.tile.side .txt { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.tile.side .pr { margin-top: 0.2cqw; }
.tile.trow .band { order: 9; margin: 0.2cqw 0 0; }
.tile.trow .pr { margin: 0; order: -1; }
.tile.corner { background: #fff8e6; font-size: 1.3cqw; justify-content: center; }
.tile.corner .icon { font-size: 4.6cqw; }
.tile .own { position: absolute; inset: 0; border: 0.45cqw solid var(--oc); border-radius: 0.6cqw; pointer-events: none; }
.tile .mort { position: absolute; inset: 0; background: repeating-linear-gradient(45deg, rgba(40, 40, 40, 0.18) 0 0.6cqw, transparent 0.6cqw 1.2cqw); display: flex; align-items: center; justify-content: center; font-weight: 800; color: #6a3a2a; font-size: 1cqw; }
.house { width: 1.1cqw; height: 1.1cqw; background: #2ec860; border: 0.12cqw solid #10502a; border-radius: 0.15cqw; }
.hotel { width: 2.4cqw; height: 1.2cqw; background: #e83a3a; border: 0.12cqw solid #6a1010; border-radius: 0.15cqw; }
.tile.flash { animation: flash 0.7s; }
@keyframes flash { 50% { background: #ffe680; } }
.center { grid-column: 2 / 11; grid-row: 2 / 11; position: relative; border-radius: 1cqw; overflow: hidden; background: linear-gradient(180deg, #7cd0ff 0%, #bfe9ff 45%, #ffe2b0 46%, #fff3dc 100%); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 3cqw; }
.center .art { position: absolute; inset: 0; width: 100%; height: 100%; }
.logo { position: relative; text-align: center; font-weight: 800; color: #fff; text-shadow: 0 0.35cqw 0 var(--deep), 0 0 1.5cqw rgba(0, 60, 120, 0.4); line-height: 1; }
.logo .en { font-size: 5.6cqw; letter-spacing: 0.2cqw; }
.logo .zh { font-size: 3.4cqw; color: #ffe066; margin-top: 0.6cqw; }
.dicebox { position: relative; display: flex; gap: 2cqw; margin-top: 3cqw; }
.die { width: 7.5cqw; height: 7.5cqw; background: #fff; border-radius: 1.4cqw; box-shadow: 0 0.6cqw 0 #c8b590, 0 0.8cqw 1.4cqw rgba(0, 0, 0, 0.25); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 0.9cqw; }
.die i { border-radius: 50%; margin: 0.35cqw; background: transparent; }
.die i.on { background: var(--ink); }
.die.roll { animation: roll 0.45s; }
@keyframes roll { 30% { transform: rotate(-25deg) translateY(-1.5cqw); } 60% { transform: rotate(20deg); } }
.status { position: relative; margin-top: 2cqw; background: rgba(255, 255, 255, 0.86); border-radius: 99px; padding: 0.7cqw 2cqw; font-size: 1.8cqw; font-weight: 700; max-width: 80%; text-align: center; }
.decks { position: absolute; bottom: 4cqw; display: flex; gap: 14cqw; }
.deck { width: 13cqw; height: 9cqw; border-radius: 1cqw; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 1.6cqw; box-shadow: 0.5cqw 0.5cqw 0 rgba(0, 0, 0, 0.15), 1cqw 1cqw 0 rgba(0, 0, 0, 0.08); transform: rotate(-6deg); }
.deck b { font-size: 3.6cqw; }
.deck.surf { background: linear-gradient(135deg, #2fa8e8, #1f6fd0); }
.deck.taco { background: linear-gradient(135deg, #ffb03a, #f06a2a); transform: rotate(6deg); }
.token { position: absolute; width: 4.3cqw; height: 4.3cqw; margin: -2.15cqw 0 0 -2.15cqw; border-radius: 50%; background: #fff; border: 0.5cqw solid var(--c); display: flex; align-items: center; justify-content: center; font-size: 2.6cqw; box-shadow: 0 0.5cqw 0.8cqw rgba(0, 0, 0, 0.35); transition: left 0.11s linear, top 0.11s linear, transform 0.2s; z-index: 4; pointer-events: none; }
.token.cur { transform: scale(1.18); z-index: 5; }
.token.hop { animation: hop 0.12s; }
@keyframes hop { 50% { margin-top: -3.4cqw; } }
.panel { background: rgba(255, 255, 255, 0.92); border-radius: 16px; padding: 12px 14px; box-shadow: 0 4px 16px rgba(0, 40, 80, 0.12); margin-bottom: 12px; }
.panel h3 { margin: 0 0 6px; font-size: 1em; color: var(--muted); }
#players { display: grid; gap: 8px; margin-bottom: 12px; }
.pl { background: #fff; border-radius: 14px; padding: 8px 12px; display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: center; border: 3px solid transparent; box-shadow: 0 2px 8px rgba(0, 40, 80, 0.1); cursor: pointer; position: relative; }
.pl.cur { border-color: var(--c); }
.pl.out { opacity: 0.45; }
.pl .tk { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--c); display: flex; align-items: center; justify-content: center; font-size: 22px; grid-row: span 2; }
.pl .nm { font-weight: 800; }
.pl .nm small { font-weight: 600; color: var(--muted); margin-left: 4px; }
.pl .money { font-weight: 800; font-size: 1.2em; color: var(--deep); text-align: right; }
.pl .chips { display: flex; gap: 3px; flex-wrap: wrap; grid-column: 2 / 4; }
.pl .chip { width: 13px; height: 13px; border-radius: 3px; }
.pl .chip.m { opacity: 0.35; }
.pl .chip.full { outline: 2px solid var(--ink); }
.pl .delta { position: absolute; right: 12px; top: -6px; font-weight: 800; animation: rise 1.4s forwards; }
.pl .delta.plus { color: var(--good); } .pl .delta.minus { color: var(--bad); }
@keyframes rise { to { transform: translateY(-18px); opacity: 0; } }
#actions .who { font-weight: 800; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
#actions .row { display: flex; flex-wrap: wrap; gap: 8px; }
#actions .hint { color: var(--muted); font-size: 0.9em; margin: 6px 0 0; }
.bid { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.bid input { width: 100px; font: inherit; padding: 6px 8px; border-radius: 10px; border: 2px solid var(--line); }
.logbox { max-height: 260px; overflow: auto; }
#log { margin: 0; padding: 0; list-style: none; font-size: 0.88em; }
#log li { padding: 3px 0; border-bottom: 1px dashed var(--line); }
#log li i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
#modal { position: fixed; inset: 0; background: rgba(10, 30, 60, 0.45); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 14px; }
#modal[hidden] { display: none; }
.sheet { background: #fff; border-radius: 18px; padding: 18px 20px; width: min(440px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); }
.sheet.wide { width: min(820px, 100%); }
.sheet h2 { margin: 0 0 8px; }
.deed .head { border-radius: 12px; padding: 10px; color: #fff; text-align: center; margin-bottom: 10px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.deed .head b { display: block; font-size: 1.4em; }
.deed table { width: 100%; border-collapse: collapse; }
.deed td { padding: 4px 6px; border-bottom: 1px solid #eee; }
.deed td:last-child { text-align: right; font-weight: 700; }
.deed tr.now td { background: #fff4c8; }
.deed .about { color: var(--muted); font-size: 0.92em; margin: 0 0 8px; }
.cardview { border-radius: 16px; padding: 22px 18px; color: #fff; text-align: center; }
.cardview.surf { background: linear-gradient(135deg, #2fa8e8, #1f6fd0); }
.cardview.taco { background: linear-gradient(135deg, #ffb03a, #f06a2a); }
.cardview .ic { font-size: 54px; }
.cardview h2 { color: #fff; }
.cardview p { font-size: 1.15em; font-weight: 700; }
.btns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
.setup .slot { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; margin: 8px 0; }
.setup input[type=text] { font: inherit; padding: 6px 10px; border-radius: 10px; border: 2px solid var(--line); min-width: 0; }
.setup .tok { font-size: 26px; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 3px solid var(--c); }
.setup .seg { display: inline-flex; background: #eef3f8; border-radius: 10px; padding: 3px; gap: 3px; }
.setup .seg button { box-shadow: none; background: transparent; padding: 5px 10px; }
.setup .seg button.on { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }
.setup .opt { margin: 10px 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.trade { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.trade .side h3 { margin: 0 0 6px; }
.trade label { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 0.95em; }
.trade label i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.trade input[type=number] { width: 110px; font: inherit; padding: 5px 8px; border-radius: 10px; border: 2px solid var(--line); }
.rank li { font-size: 1.1em; margin: 4px 0; }
.toast { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); background: var(--deep); color: #fff; padding: 10px 22px; border-radius: 99px; font-weight: 800; z-index: 30; animation: toast 1.6s forwards; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -10px); } 15%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
@media (max-width: 900px) {
  #main { grid-template-columns: 1fr; }
  #boardWrap { width: 100%; min-width: 0; }
  #side { display: flex; flex-direction: column; }
  #actions { order: -1; position: sticky; bottom: 0; z-index: 3; }
  .tile { font-size: 1.25cqw; }
}
