* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --red: #ed2b33; --green: #0aa64f; --yellow: #fdd835; --blue: #27aeff;
  --bg: #171a38; --panel: #212549; --panel2: #2a2f5e;
  --ink: #eef0ff; --muted: rgba(238,240,255,.6);
  --boardBg: #e8f4e0; --cellBg: #f5faf0;
}

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: radial-gradient(circle at 50% 20%, #232860, var(--bg) 70%);
  font-family: -apple-system, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}

.hidden { display: none !important; }
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; overflow-y: auto; z-index: 10; }
#game.screen { z-index: 5; }
.panel { text-align: center; padding: 26px; width: min(400px, 94vw); animation: pin .3s ease; }
@keyframes pin { from { transform: translateY(16px) scale(.97); opacity: 0; } }

.logoBiz { font-size: 52px; margin-bottom: 2px; filter: drop-shadow(0 6px 16px rgba(253,216,53,.4)); }
h1 { font-size: 40px; font-weight: 900; letter-spacing: 2px; line-height: .95; margin-bottom: 6px; }
h1 span {
  display: block; font-size: 20px; letter-spacing: 6px;
  background: linear-gradient(135deg, #ffe07a, #fdd835, #ff8a3d);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
h2 { font-size: 26px; font-weight: 900; letter-spacing: 3px; margin-bottom: 16px; }
.tag { color: var(--muted); font-weight: 600; margin-bottom: 14px; font-size: 13px; }

.coinBar {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, rgba(253,216,53,.16), rgba(255,138,61,.12));
  border: 1.5px solid rgba(253,216,53,.4);
  border-radius: 999px; padding: 7px 16px; margin-bottom: 16px;
  font-weight: 900; font-size: 16px; color: var(--yellow);
  font-variant-numeric: tabular-nums;
}
.coinBar .coinIco { font-size: 18px; }
.coinBar .coinLbl { font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: .5px; }
#homeCoins.bump { animation: coinBump .5s ease; }
@keyframes coinBump { 30% { transform: scale(1.35); color: #fff; } }

.dailyBurst { font-size: 64px; margin-bottom: 6px; animation: dailyPop .6s ease; filter: drop-shadow(0 6px 18px rgba(253,216,53,.5)); }
@keyframes dailyPop { from { transform: scale(0) rotate(-40deg); } 60% { transform: scale(1.2) rotate(8deg); } }
.dailyAmt {
  font-size: 46px; font-weight: 900; margin: 6px 0 4px;
  background: linear-gradient(135deg, #ffe07a, #fdd835, #ff8a3d);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}

input {
  width: 100%; padding: 13px 16px; margin: 10px 0 6px;
  border-radius: 14px; border: 2px solid var(--panel2);
  background: var(--panel); color: var(--ink);
  font-size: 16px; font-weight: 700; text-align: center; outline: none;
}
input:focus { border-color: var(--yellow); }

button { font-family: inherit; cursor: pointer; }
button.big {
  display: block; width: 100%; margin: 10px 0; padding: 14px 0;
  font-size: 17px; font-weight: 900; letter-spacing: 1.5px;
  color: #08331a; background: linear-gradient(135deg, #6dedb0, #22c76a);
  border: none; border-radius: 16px;
  box-shadow: 0 5px 0 #169148, 0 10px 24px rgba(0,0,0,.35);
  transition: transform .08s;
}
button.big:active { transform: translateY(3px); box-shadow: 0 2px 0 #169148; }
button.big.alt { color: #0b2d4a; background: linear-gradient(135deg, #74c0fc, #339af0); box-shadow: 0 5px 0 #1c7ed6, 0 10px 24px rgba(0,0,0,.35); }
button.big.alt2 { color: #4a2c00; background: linear-gradient(135deg, #ffe07a, #fcc419); box-shadow: 0 5px 0 #e0a800, 0 10px 24px rgba(0,0,0,.35); }
button.big:disabled { filter: grayscale(.8); opacity: .5; }
.ghost { display: inline-block; background: none; border: none; color: var(--muted); font-size: 14px; font-weight: 700; margin-top: 12px; text-decoration: none; padding: 8px; }
.mini { background: var(--panel2); color: var(--ink); border: none; padding: 9px 14px; border-radius: 12px; font-size: 13px; font-weight: 800; }
.err { color: #ff8787; font-weight: 700; font-size: 14px; min-height: 20px; margin-top: 8px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 600; }
.orSep { color: var(--muted); font-size: 13px; font-weight: 700; margin: 14px 0 6px; }
.joinRow { display: flex; gap: 8px; }
.joinRow input { flex: 1; margin: 0; text-transform: uppercase; letter-spacing: 4px; }
.joinRow button { padding: 0 22px; border: none; border-radius: 14px; font-weight: 900; background: var(--yellow); color: #4a2c00; font-size: 15px; }
.roomCode { font-size: 44px; font-weight: 900; letter-spacing: 10px; color: var(--yellow); margin: 4px 0 10px; text-shadow: 0 4px 18px rgba(253,216,53,.35); }
.lobbyPlayers { margin: 14px 0 8px; display: flex; flex-direction: column; gap: 8px; }
.lobbySeat { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 14px; padding: 8px 12px; font-weight: 800; font-size: 15px; }
.lobbySeat .seatAv { width: 38px; height: 38px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 21px; background: var(--panel2); border: 3px solid transparent; }
.lobbySeat .tag { margin-left: auto; font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: 1px; margin-bottom: 0; }
.lobbySeat.empty { opacity: .35; font-weight: 600; }
.lobbyBtns { display: flex; gap: 8px; justify-content: center; margin: 10px 0; }
.countRow { display: flex; gap: 10px; justify-content: center; margin-bottom: 8px; }
.countBtn { width: 54px; height: 54px; border-radius: 16px; border: 2px solid var(--panel2); background: var(--panel); color: var(--ink); font-size: 21px; font-weight: 900; }
.countBtn.sel { border-color: var(--yellow); background: var(--panel2); box-shadow: 0 0 18px rgba(253,216,53,.25); }
.rulesBox { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 12px; text-align: left; }
.ruleTgl { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 12px; padding: 10px 12px; font-weight: 800; font-size: 13px; cursor: pointer; }
.ruleTgl input { width: 18px; height: 18px; accent-color: var(--yellow); flex: none; }
.ruleTgl i { display: block; font-style: normal; font-weight: 600; font-size: 11px; color: var(--muted); }
.ruleTgl.locked { opacity: .55; pointer-events: none; }

/* ================= game ================= */
#gameWrap {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  padding: max(8px, env(safe-area-inset-top)) 0 max(10px, env(safe-area-inset-bottom));
}
#topBar { width: min(96vmin, 600px); display: flex; align-items: center; justify-content: space-between; padding: 0 4px 6px; }
#timerChip { background: rgba(0,0,0,.3); border-radius: 14px; padding: 5px 14px; font-weight: 900; font-size: 14px; color: var(--yellow); font-variant-numeric: tabular-nums; }
#timerChip.low { color: #ff8787; animation: blink 1s ease infinite; }
@keyframes blink { 50% { opacity: .5; } }
.quit { width: 36px; height: 36px; border-radius: 12px; border: none; background: rgba(255,255,255,.1); color: var(--ink); font-size: 19px; font-weight: 800; }

#board {
  position: relative;
  width: min(96vmin, 600px);
  aspect-ratio: 1;
  background: var(--boardBg);
  border-radius: 2.4%;
  border: 5px solid #57402f;
  outline: 3px solid #3a2b22;
  box-shadow: 0 20px 50px rgba(0,0,0,.55);
}
#board.shake { animation: boardShake .5s ease; }
@keyframes boardShake {
  10%, 90% { transform: translateX(-3px); }
  30%, 70% { transform: translateX(5px); }
  50% { transform: translateX(-5px); }
}
#boardCenter {
  position: absolute; inset: 11%;
  background: linear-gradient(150deg, #fdd835, #f5b301);
  border-radius: 6%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  box-shadow: inset 0 0 30px rgba(120,80,0,.25);
}
#boardCenter .bizTitle {
  font-size: 4.6vmin; font-weight: 900; letter-spacing: .6vmin;
  color: #5b3a00; text-shadow: 0 2px 0 rgba(255,255,255,.35);
  transform: rotate(-6deg);
}
#boardCenter .bizSub { font-size: 1.8vmin; font-weight: 800; color: rgba(91,58,0,.65); transform: rotate(-6deg); letter-spacing: .3vmin; }
#centerDice { display: flex; gap: 10px; margin-top: 1.4vmin; }
.die {
  width: 7vmin; height: 7vmin; max-width: 44px; max-height: 44px;
  background: #fff; border-radius: 18%;
  box-shadow: 0 3px 0 #c9a02c, 0 6px 14px rgba(0,0,0,.3);
  position: relative;
}
.die.rolling { animation: shake .45s ease; }
@keyframes shake { 25% { transform: rotate(14deg); } 55% { transform: rotate(-12deg); } 80% { transform: rotate(6deg); } }
.die .pips { position: absolute; inset: 14%; display: grid; grid-template: repeat(3,1fr)/repeat(3,1fr); }
.die .pip { width: 60%; height: 60%; background: #222; border-radius: 50%; align-self: center; justify-self: center; }
#centerMsg { font-size: 1.9vmin; font-weight: 800; color: #5b3a00; min-height: 2.4vmin; transform: rotate(0); max-width: 90%; text-align: center; }

.space {
  position: absolute;
  width: 10%; height: 10%;
  background: var(--cellBg);
  border: 1px solid #b9c4ae;
  overflow: hidden;
  cursor: pointer;
  display: flex; flex-direction: column;
}
.space .band { height: 22%; flex: none; }
.space .nm {
  flex: 1; display: flex; align-items: center; justify-content: center;
  font-size: 1.35vmin; font-weight: 800; color: #333;
  text-align: center; line-height: 1.05; padding: 0 2px;
  word-break: break-word;
}
.space .pr { font-size: 1.25vmin; font-weight: 800; color: #777; text-align: center; padding-bottom: 3%; }
.space.corner { background: #eef3e6; }
.space.corner .nm { font-size: 1.5vmin; }
.space .ic { font-size: 2.6vmin; text-align: center; }
.space.owned-red { box-shadow: inset 0 0 0 2.5px var(--red); }
.space.owned-green { box-shadow: inset 0 0 0 2.5px var(--green); }
.space.owned-yellow { box-shadow: inset 0 0 0 2.5px #dcae00; }
.space.owned-blue { box-shadow: inset 0 0 0 2.5px var(--blue); }
.space.mort { opacity: .55; }
.space .hrow { position: absolute; top: 24%; left: 2px; display: flex; gap: 1px; }
.space .hh { width: 1.5vmin; height: 1.5vmin; background: #2f9e44; border-radius: 2px; border: 1px solid #1e6b2e; }
.space .hh.hotel { background: #e03131; border-color: #9c1f1f; width: 2vmin; }

.ptoken {
  position: absolute; z-index: 6;
  width: 4.6vmin; height: 4.6vmin; max-width: 30px; max-height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.6vmin;
  background: #fff;
  border: 2.5px solid #000;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
  transition: left .3s ease, top .3s ease;
  pointer-events: none;
}
.ptoken.red { border-color: var(--red); } .ptoken.green { border-color: var(--green); }
.ptoken.yellow { border-color: #dcae00; } .ptoken.blue { border-color: var(--blue); }

#playersBar {
  width: min(96vmin, 600px);
  display: flex; gap: 8px; padding: 8px 2px 4px;
}
.pchip {
  flex: 1; background: var(--panel); border: 2px solid transparent;
  border-radius: 12px; padding: 6px 8px;
  font-weight: 800; font-size: 12px;
  display: flex; align-items: center; gap: 6px;
  opacity: .6; transition: all .25s; min-width: 0;
}
.pchip.active { opacity: 1; border-color: #fff; box-shadow: 0 0 16px rgba(255,255,255,.18); }
.pchip.dead { opacity: .25; filter: grayscale(1); }
.pchip .av { font-size: 17px; flex: none; }
.pchip .col { min-width: 0; }
.pchip .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pchip .cash { color: #ffd75e; font-variant-numeric: tabular-nums; font-size: 11px; }
.pchip .jl { font-size: 10px; color: #ff8787; }

#actionBar {
  width: min(96vmin, 600px);
  display: flex; gap: 8px; justify-content: center;
  padding: 4px 2px; min-height: 54px;
}
.act {
  border: none; border-radius: 14px; padding: 12px 20px;
  font-size: 15px; font-weight: 900; letter-spacing: 1px;
  color: #08331a; background: linear-gradient(135deg, #6dedb0, #22c76a);
  box-shadow: 0 4px 0 #169148;
}
.act:active { transform: translateY(2px); box-shadow: 0 2px 0 #169148; }
.act.main { animation: rollGlow 1s ease-in-out infinite; }
@keyframes rollGlow { 50% { box-shadow: 0 4px 0 #169148, 0 0 22px rgba(253,216,53,.7); } }
.act.buy { color: #4a2c00; background: linear-gradient(135deg, #ffe07a, #fcc419); box-shadow: 0 4px 0 #c77e0a; }
.act.skip, .act.end { color: var(--ink); background: var(--panel2); box-shadow: 0 4px 0 #1a1e42; }
.act.build { color: #0b2d4a; background: linear-gradient(135deg, #74c0fc, #339af0); box-shadow: 0 4px 0 #1c7ed6; }

#toast {
  position: fixed; top: 38%; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.7); color: #fff; font-weight: 800; font-size: 14px;
  padding: 8px 18px; border-radius: 18px; opacity: 0; transition: opacity .25s;
  pointer-events: none; white-space: nowrap; z-index: 30;
}
#toast.show { opacity: 1; }

/* property card */
#propCard {
  background: #fdfcf7; color: #222; border-radius: 16px;
  padding: 0 0 14px; overflow: hidden; text-align: center;
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
}
#propCard .head { padding: 14px; font-weight: 900; font-size: 20px; color: #fff; letter-spacing: 1px; }
#propCard .row { display: flex; justify-content: space-between; padding: 5px 18px; font-size: 13px; font-weight: 700; color: #444; }
#propCard .row b { color: #111; }
#propCard .ownerTag { margin-top: 8px; font-weight: 800; font-size: 13px; }
#propActions { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
#propActions button { border: none; border-radius: 12px; padding: 10px 18px; font-weight: 900; font-size: 13px; background: var(--panel2); color: var(--ink); }
#propActions button.gold { background: linear-gradient(135deg, #ffe07a, #fcc419); color: #4a2c00; }

.chanceCard {
  background: linear-gradient(150deg, #ff8a3d, #ff5e62);
  border-radius: 18px; padding: 28px 22px;
  box-shadow: 0 16px 44px rgba(255,94,98,.4);
  animation: chanceIn .4s ease;
}
@keyframes chanceIn { from { transform: rotateY(90deg); } }
.chanceTag { font-size: 13px; font-weight: 900; letter-spacing: 4px; color: rgba(255,255,255,.8); margin-bottom: 10px; }
#chanceText { font-size: 19px; font-weight: 900; color: #fff; line-height: 1.35; }

#buildList { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
#buildList button {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 2px solid var(--panel2); border-radius: 14px;
  color: var(--ink); padding: 12px 14px; font-weight: 800; font-size: 14px;
}
#buildList .sw { width: 16px; height: 16px; border-radius: 4px; flex: none; }
#buildList .cost { margin-left: auto; color: #ffd75e; }

#rankList { margin: 6px 0 14px; display: flex; flex-direction: column; gap: 8px; }
.rankRow { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 14px; padding: 10px 14px; font-weight: 800; font-size: 15px; }
.rankRow .medal { font-size: 20px; }
.rankRow .sc { margin-left: auto; color: var(--muted); font-size: 12px; }

#fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
#winTitle { margin-top: 4px; }
.winReward {
  font-size: 22px; font-weight: 900; color: var(--yellow);
  margin: 4px 0 10px; font-variant-numeric: tabular-nums;
  animation: coinBump .5s ease .2s both;
}
