/* Monopoly — monopoly.hemishthanki.com */
:root {
  --accent: #ed1b24;
  --board-bg: #cde6d0;
  --tile-bg: #f5f1e3;
  --ink: #1b1b1f;
  --paper: #faf7ee;
  --felt: #0f3d2e;
  --gold: #d4a017;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 800px at 50% -10%, #1d5c46, var(--felt) 60%, #082419);
  min-height: 100dvh;
}
button { font: inherit; cursor: pointer; }
input { font: inherit; }
.hidden { display: none !important; }
.muted { color: #666; font-size: 13px; }

/* ---------- shared ---------- */
.btn {
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 18px;
  font-weight: 600;
  box-shadow: 0 2px 0 var(--ink);
  transition: transform .06s, box-shadow .06s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 3px 0 var(--ink); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.5); color: #fff; box-shadow: none; }
.btn-mini { padding: 4px 10px; font-size: 12px; border-radius: 8px; box-shadow: 0 1px 0 var(--ink); }
.btn.big { font-size: 20px; padding: 14px 34px; border-radius: 14px; }

.logo-banner {
  font-family: 'Lilita One', cursive;
  color: #fff;
  background: var(--accent);
  display: inline-block;
  padding: 6px 26px 8px;
  border: 3px solid #fff;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
  letter-spacing: 2px;
  font-size: clamp(30px, 6vw, 54px);
  transform: rotate(-2deg);
}
.logo-banner.small { font-size: 26px; }

/* ---------- landing ---------- */
.screen { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.landing-inner { text-align: center; max-width: 860px; width: 100%; }
.mascot-hero { width: 130px; filter: drop-shadow(0 8px 18px rgba(0,0,0,.45)); animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
.landing-inner .sub { color: #cfe8d8; margin: 14px 0 26px; font-size: 15px; }
.landing-form { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.landing-form input {
  width: min(340px, 90%);
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid var(--ink);
  font-size: 17px;
  text-align: center;
  background: var(--paper);
}
#in-code { text-transform: uppercase; letter-spacing: 6px; font-weight: 700; width: 200px; }
.landing-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
#join-row { display: flex; gap: 10px; align-items: center; justify-content: center; }
.conn-status { margin-top: 18px; color: #9fc7b0; font-size: 13px; min-height: 18px; }

#theme-gallery { margin-top: 30px; }
#theme-gallery h2 { color: #fff; font-family: 'Oswald', sans-serif; font-weight: 500; margin-bottom: 14px; }
.theme-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.theme-card {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 14px 12px 12px;
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: transform .12s;
}
.theme-card:hover { transform: translateY(-3px) scale(1.02); }
.theme-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 8px;
  background: var(--tc, var(--accent));
}
.theme-card .tc-name { font-family: 'Oswald', sans-serif; font-weight: 600; font-size: 15px; margin-top: 4px; }
.theme-card .tc-tag { font-size: 11.5px; color: #555; margin: 4px 0 8px; min-height: 28px; }
.theme-card .tc-tokens { font-size: 16px; letter-spacing: 2px; }
.theme-card .tc-cur {
  position: absolute; top: 14px; right: 10px;
  font-family: 'Lilita One', cursive; font-size: 22px; color: var(--tc, var(--accent));
}

/* ---------- lobby ---------- */
.lobby-inner { text-align: center; max-width: 720px; width: 100%; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.room-code-box {
  background: var(--paper); border: 2px solid var(--ink); border-radius: 14px;
  padding: 10px 22px; display: flex; align-items: center; gap: 14px;
}
.room-code-box span { font-size: 13px; color: #666; }
.room-code-box strong { font-family: 'Oswald', sans-serif; font-size: 30px; letter-spacing: 8px; }
#lobby-theme { width: 100%; }
.lobby-theme-strip {
  display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px; scrollbar-width: thin;
}
.lobby-theme-chip {
  border: 2px solid rgba(255,255,255,.35); background: rgba(0,0,0,.25); color: #fff;
  border-radius: 999px; padding: 6px 14px; white-space: nowrap; font-size: 13px;
}
.lobby-theme-chip.active { background: var(--paper); color: var(--ink); border-color: var(--ink); font-weight: 700; }
.lobby-theme-chip:disabled { cursor: default; opacity: .8; }
.lobby-players { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.lobby-player {
  background: var(--paper); border: 2px solid var(--ink); border-radius: 12px;
  padding: 8px 14px; display: flex; align-items: center; gap: 8px; font-weight: 600;
  border-left-width: 8px;
}
.lobby-player .tok { font-size: 22px; }
.lobby-player .host-star { color: var(--gold); }
.lobby-player .kick { background: none; border: none; color: #b00; font-weight: 700; }
#lobby-tokens { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
#lobby-tokens button {
  font-size: 24px; width: 46px; height: 46px; border-radius: 12px;
  border: 2px solid rgba(255,255,255,.4); background: rgba(0,0,0,.25);
}
#lobby-tokens button.mine { border-color: #fff; background: var(--paper); }
#lobby-tokens button.taken { opacity: .35; cursor: not-allowed; }
#lobby-settings { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; color: #dfeee5; font-size: 14px; align-items: center; }
#lobby-settings label { display: flex; gap: 6px; align-items: center; }
#lobby-settings select { padding: 4px 8px; border-radius: 8px; }
.lobby-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* ---------- game layout ---------- */
#screen-game { align-items: stretch; padding: 10px; }
#game-layout {
  display: flex; gap: 12px; width: 100%; max-width: 1400px; margin: 0 auto;
  align-items: stretch; justify-content: center;
}
#board-wrap { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; min-width: 0; }
#board {
  --n: min(92vh - 20px, 100%);
  width: var(--n);
  aspect-ratio: 1;
  max-width: 100%;
  background: var(--board-bg);
  border: 3px solid var(--ink);
  border-radius: 6px;
  display: grid;
  grid-template-columns: 13.5fr repeat(9, 8.11fr) 13.5fr;
  grid-template-rows: 13.5fr repeat(9, 8.11fr) 13.5fr;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  position: relative;
  container-type: inline-size;
}

/* tiles */
.tile {
  background: var(--tile-bg);
  border: 1px solid var(--ink);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
  font-family: 'Oswald', sans-serif;
}
.tile:hover { filter: brightness(1.06); z-index: 5; }
.tile .bar { flex: 0 0 22%; border-bottom: 1px solid var(--ink); position: relative; }
.tile.corner { font-size: 1.5cqw; }
.tile .t-name {
  font-size: 1.02cqw; line-height: 1.12; text-align: center; font-weight: 500;
  padding: 2px 1px 0; text-transform: uppercase; letter-spacing: .1px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tile .t-price { font-size: .95cqw; text-align: center; margin-top: auto; padding-bottom: 2px; font-weight: 600; }
.tile .t-icon { font-size: 2.2cqw; text-align: center; margin-top: 4px; }
.tile.corner .t-icon { font-size: 3.4cqw; }
.tile.corner .t-name { font-size: 1.15cqw; font-weight: 600; }

/* side-specific: color bar orientation via flex order */
.tile.side-bottom { flex-direction: column; }
.tile.side-left { flex-direction: row; }
.tile.side-left .bar { flex: 0 0 22%; border-bottom: none; border-left: 1px solid var(--ink); order: 2; }
.tile.side-left .t-body { order: 1; }
.tile.side-top { flex-direction: column; }
.tile.side-top .bar { order: 2; border-bottom: none; border-top: 1px solid var(--ink); }
.tile.side-top .t-body { order: 1; }
.tile.side-right { flex-direction: row; }
.tile.side-right .bar { flex: 0 0 22%; border-bottom: none; border-right: 1px solid var(--ink); order: 1; }
.tile.side-right .t-body { order: 2; }
.t-body { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 1px; }

/* ownership + mortgage */
.tile .owner-stripe { position: absolute; inset: auto 0 0 0; height: 7%; opacity: .95; }
.tile.side-left .owner-stripe { inset: 0 auto 0 0; width: 7%; height: auto; }
.tile.side-right .owner-stripe { inset: 0 0 0 auto; width: 7%; height: auto; }
.tile.side-top .owner-stripe { inset: 0 0 auto 0; }
.tile.mortgaged .t-body { opacity: .45; }
.tile.mortgaged::after {
  content: 'MORTGAGED'; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%) rotate(-18deg);
  font-size: .9cqw; font-weight: 700; color: #b00020; border: 1px solid #b00020;
  padding: 1px 3px; background: rgba(255,255,255,.8); pointer-events: none;
}

/* houses */
.houses { position: absolute; display: flex; gap: 2%; justify-content: center; align-items: center; inset: 1% 0 auto 0; height: 20%; pointer-events: none; }
.tile.side-left .houses { flex-direction: column; inset: 0 1% 0 auto; width: 20%; height: auto; }
.tile.side-right .houses { flex-direction: column; inset: 0 auto 0 1%; width: 20%; height: auto; }
.tile.side-top .houses { inset: auto 0 1% 0; }
.house {
  width: 14%; aspect-ratio: 1; background: #1fb25a; border: 1px solid #0a5c2c; border-radius: 15%;
  box-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.tile.side-left .house, .tile.side-right .house { width: auto; height: 14%; }
.house.hotel { background: #d21f26; border-color: #7c1015; width: 22%; }
.tile.side-left .house.hotel, .tile.side-right .house.hotel { height: 22%; }

/* tokens on tiles */
.toks {
  position: absolute; inset: auto 2% 8% 2%; display: flex; flex-wrap: wrap; gap: 1px;
  justify-content: center; align-items: flex-end; pointer-events: none; z-index: 4;
}
.tok-chip {
  font-size: 1.7cqw; line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.5));
  background: radial-gradient(circle at 50% 40%, rgba(255,255,255,.95), rgba(255,255,255,.75));
  border-radius: 50%; padding: 8%; border: .15cqw solid var(--pc, #333);
  transition: all .35s ease;
}
.tok-chip.me { outline: .3cqw solid var(--pc,#333); outline-offset: 1px; }

/* center */
#center {
  grid-area: 2 / 2 / 11 / 11;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 2.5% 3%;
  position: relative;
  overflow: hidden;
}
#center .c-logo {
  font-family: 'Lilita One', cursive;
  background: var(--accent); color: #fff;
  padding: .5% 3% .8%;
  border: .35cqw solid #fff;
  outline: .18cqw solid var(--ink);
  border-radius: .8cqw;
  font-size: 3.4cqw;
  letter-spacing: .25cqw;
  transform: rotate(-2.5deg);
  box-shadow: 0 .5cqw 2cqw rgba(0,0,0,.25);
  white-space: nowrap; max-width: 96%; overflow: hidden; text-overflow: ellipsis;
  text-align: center;
}
#center .c-sub { font-family: 'Oswald', sans-serif; font-size: 1.25cqw; color: #333; margin-top: .6%; text-align: center; }
.c-mid { display: flex; align-items: center; justify-content: center; gap: 4%; width: 100%; flex: 1; min-height: 0; }
.c-mascot { height: 68%; max-height: 20cqw; filter: drop-shadow(0 .6cqw 1.2cqw rgba(0,0,0,.3)); }
.c-action { display: flex; flex-direction: column; align-items: center; gap: 1cqw; min-width: 40%; }
.c-turn { font-family: 'Oswald', sans-serif; font-size: 1.6cqw; font-weight: 600; text-align: center; }
.c-turn .who { padding: .2cqw 1cqw; border-radius: 99px; color: #fff; background: var(--pc, #333); }
.c-buttons { display: flex; gap: .8cqw; flex-wrap: wrap; justify-content: center; }
.c-buttons .btn { font-size: 1.5cqw; padding: .8cqw 2cqw; border-radius: 1cqw; }
.c-note { font-size: 1.2cqw; color: #444; text-align: center; max-width: 90%; }
.c-pot { font-size: 1.2cqw; color: #333; font-weight: 600; }

/* dice */
.dice { display: flex; gap: 1.2cqw; }
.die {
  width: 4.6cqw; height: 4.6cqw; background: #fff; border: .22cqw solid var(--ink);
  border-radius: .9cqw; display: grid; grid-template-columns: repeat(3,1fr); grid-template-rows: repeat(3,1fr);
  padding: .55cqw; box-shadow: 0 .3cqw .6cqw rgba(0,0,0,.25);
}
.die span { border-radius: 50%; }
.die span.on { background: var(--ink); }
.die.rolling { animation: diceroll .5s ease; }
@keyframes diceroll {
  0% { transform: rotate(0) translateY(0); }
  30% { transform: rotate(190deg) translateY(-2cqw) scale(1.15); }
  70% { transform: rotate(320deg) translateY(.4cqw); }
  100% { transform: rotate(360deg); }
}

/* deck spots */
.deck-spot {
  position: absolute; font-family: 'Oswald', sans-serif; text-align: center;
  border: .18cqw dashed rgba(0,0,0,.45); border-radius: .8cqw; padding: .8cqw 1.2cqw;
  color: rgba(0,0,0,.55); font-size: 1.1cqw; background: rgba(255,255,255,.25);
  pointer-events: none;
}
.deck-spot .q { font-size: 2.6cqw; font-weight: 700; font-family: 'Lilita One', cursive; }
.deck-chance { left: 6%; top: 10%; transform: rotate(-45deg); }
.deck-chest { right: 6%; bottom: 10%; transform: rotate(-45deg); }

/* ---------- side panel ---------- */
#side {
  flex: 0 0 320px; display: flex; flex-direction: column; gap: 10px;
  max-height: calc(100dvh - 20px); width: 320px;
}
#side-players { display: flex; flex-direction: column; gap: 6px; }
.sp {
  background: var(--paper); border: 2px solid var(--ink); border-left-width: 8px;
  border-radius: 10px; padding: 7px 10px; font-size: 13.5px;
}
.sp.turn-now { outline: 3px solid var(--gold); }
.sp.bankrupt { opacity: .45; }
.sp .sp-top { display: flex; align-items: center; gap: 7px; font-weight: 700; }
.sp .sp-top .tok { font-size: 18px; }
.sp .sp-money { margin-left: auto; font-family: 'Oswald', sans-serif; font-size: 16px; }
.sp .sp-sub { display: flex; gap: 6px; margin-top: 3px; flex-wrap: wrap; align-items: center; }
.sp .badge {
  font-size: 10.5px; background: #eee; border: 1px solid #999; border-radius: 6px; padding: 0 5px;
}
.sp .prop-dots { display: flex; gap: 2px; flex-wrap: wrap; margin-top: 4px; }
.sp .pd { width: 11px; height: 15px; border: 1px solid var(--ink); border-radius: 2px; cursor: pointer; }
.sp .pd.mort { opacity: .35; }
.sp .trade-btn { margin-left: auto; }
.sp .offline { color: #b00; font-size: 10px; font-weight: 700; }

#side-trades { display: flex; flex-direction: column; gap: 6px; }
.trade-box { background: #fff8dc; border: 2px solid var(--gold); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; }
.trade-box .tr-actions { display: flex; gap: 6px; margin-top: 6px; }

.side-tabs { display: flex; gap: 6px; }
.side-tabs .tab {
  flex: 1; background: rgba(0,0,0,.3); color: #cfe8d8; border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px 8px 0 0; padding: 6px; font-size: 13px;
}
.side-tabs .tab.active { background: var(--paper); color: var(--ink); font-weight: 700; }
.side-scroll {
  flex: 1; min-height: 120px; overflow-y: auto; background: rgba(255,255,255,.92);
  border-radius: 0 0 10px 10px; padding: 8px 10px; font-size: 12.5px; line-height: 1.5;
}
.side-scroll .log-line { border-bottom: 1px dotted #ddd; padding: 2px 0; }
.side-scroll .chat-line b { }
#chat-form { display: flex; gap: 6px; }
#chat-form input { flex: 1; padding: 7px 10px; border-radius: 8px; border: 2px solid var(--ink); }

/* ---------- modals ---------- */
#modal-root:not(:empty) {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: var(--paper); border: 3px solid var(--ink); border-radius: 16px;
  padding: 20px; max-width: 560px; width: 100%; max-height: 90dvh; overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,.5);
}
.modal h3 { font-family: 'Oswald', sans-serif; margin-bottom: 10px; }
.modal .m-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; justify-content: flex-end; }

/* deed card */
.deed { max-width: 340px; margin: 0 auto; border: 2px solid var(--ink); background: #fff; border-radius: 6px; overflow: hidden; font-family: 'Oswald', sans-serif; }
.deed .d-head { padding: 10px 12px; text-align: center; border-bottom: 2px solid var(--ink); }
.deed .d-head .d-group { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; opacity: .85; }
.deed .d-head .d-name { font-size: 19px; font-weight: 700; text-transform: uppercase; line-height: 1.1; }
.deed .d-body { padding: 10px 16px 14px; font-size: 13.5px; }
.deed table { width: 100%; border-collapse: collapse; }
.deed td { padding: 2.5px 0; }
.deed td:last-child { text-align: right; font-weight: 600; }
.deed .d-owner { text-align: center; margin-top: 8px; font-weight: 600; padding: 3px; border-radius: 6px; color: #fff; }
.deed-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }

/* drawn card overlay */
#card-overlay {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); cursor: pointer;
}
.big-card {
  width: min(440px, 92vw); background: var(--paper); border: 3px solid var(--ink); border-radius: 18px;
  padding: 26px 28px; text-align: center; transform-origin: center;
  animation: cardpop .45s cubic-bezier(.2,1.6,.4,1);
  box-shadow: 0 30px 90px rgba(0,0,0,.6);
}
@keyframes cardpop { 0% { transform: scale(.3) rotate(-14deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.big-card .bc-deck { font-family: 'Lilita One', cursive; font-size: 24px; color: var(--accent); letter-spacing: 1px; }
.big-card .bc-text { font-size: 17px; margin-top: 12px; line-height: 1.5; font-weight: 500; }
.big-card .bc-hint { margin-top: 14px; font-size: 11.5px; color: #888; }

/* auction */
.auction-bids { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 12px 0; }
.auction-status { text-align: center; font-size: 15px; }
.auction-status .cur { font-size: 26px; font-family: 'Oswald', sans-serif; font-weight: 700; }
.auction-timer { height: 6px; background: #ddd; border-radius: 3px; margin-top: 10px; overflow: hidden; }
.auction-timer > div { height: 100%; background: var(--accent); transition: width 1s linear; }

/* trade modal */
.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.trade-col { border: 2px solid #ccc; border-radius: 10px; padding: 10px; }
.trade-col h4 { font-size: 13px; margin-bottom: 8px; font-family: 'Oswald', sans-serif; }
.trade-col label { display: flex; gap: 6px; align-items: center; font-size: 12.5px; padding: 2px 0; }
.trade-col input[type=number] { width: 90px; padding: 4px 8px; border-radius: 6px; border: 1.5px solid var(--ink); }
.trade-col .prop-check { max-height: 180px; overflow-y: auto; margin-top: 6px; }
.gdot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; border: 1px solid var(--ink); }

/* toast */
#toast-root { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: #fff; border-radius: 10px; padding: 10px 18px; font-size: 14px;
  animation: toastin .25s ease; box-shadow: 0 8px 30px rgba(0,0,0,.4); max-width: 90vw;
}
.toast.err { background: #b00020; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }

/* winner banner */
.winner-banner { text-align: center; padding: 10px; }
.winner-banner .wb-cup { font-size: 64px; }
.winner-banner h2 { font-family: 'Lilita One', cursive; font-size: 30px; margin: 8px 0; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  #game-layout { flex-direction: column; align-items: center; }
  #board { --n: min(96vw, 96vh); }
  #side { width: 100%; max-width: 640px; flex: 0 0 auto; max-height: none; }
  .side-scroll { max-height: 200px; }
}
