/* MULLAK — Dubai at dusk (DESIGN D4): night-navy, glass teal, sand, gold money.
   Motion is furniture-quality; everything degrades gracefully under reduced-motion. */

:root {
  --navy-0: #070B1A;
  --navy-1: #0D1430;
  --navy-2: #151F45;
  --navy-3: #1C2A5C;
  --glass:  rgba(28, 40, 86, .55);
  --glass-2: rgba(38, 54, 112, .45);
  --line:   rgba(150, 180, 255, .16);
  --line-2: rgba(150, 180, 255, .28);
  --ink:    #EAF0FF;
  --muted:  #8FA3C8;
  --teal:   #3BC4BB;
  --sand:   #E8D5B5;
  --gold:   #E8B94B;
  --gold-2: #F6D87C;
  --rose:   #E2635E;
  --r: 16px;
}

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

html, body { height: 100%; }
body {
  font-family: "Cairo", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 50% -10%, #3A2A55 0%, transparent 60%),
    radial-gradient(900px 400px at 85% 0%, rgba(232, 185, 75, .14) 0%, transparent 55%),
    radial-gradient(700px 300px at 10% 100%, rgba(59, 196, 187, .07) 0%, transparent 60%),
    linear-gradient(180deg, var(--navy-1) 0%, var(--navy-0) 70%);
  background-attachment: fixed;
  min-height: 100%;
}
main { min-height: 100vh; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; }

/* ---------- shared ---------- */

.bigBtn {
  display: block; width: 100%;
  margin: 10px 0; padding: 14px 18px;
  font-weight: 800; font-size: 17px;
  color: var(--ink);
  background: linear-gradient(170deg, var(--glass-2), var(--glass));
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.bigBtn:hover { border-color: rgba(232, 185, 75, .45); }
.bigBtn:active { transform: scale(.97); }
.bigBtn:disabled { opacity: .4; cursor: default; }
.bigBtn.gold {
  color: #241A05;
  background: linear-gradient(135deg, var(--gold-2), var(--gold) 60%, #D9A63C);
  border-color: transparent;
  box-shadow: 0 6px 28px rgba(232, 185, 75, .3), inset 0 1px 0 rgba(255, 255, 255, .5);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .3);
}
.bigBtn.slim { padding: 10px 14px; font-size: 15px; margin: 6px 0; width: auto; display: inline-block; }

.rowBtns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rowBtns .bigBtn { flex: 1 1 auto; }

.chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35), inset 0 -2px 4px rgba(0, 0, 0, .18);
  vertical-align: middle; flex: none;
}
.chip.big { width: 44px; height: 44px; }
.chip.tiny { width: 24px; height: 24px; }
.chip .ic { width: 62%; height: 62%; color: #10152E; }

/* the icon system — one hand-drawn family, never system emoji */
.ic { width: 1.15em; height: 1.15em; display: inline-block; vertical-align: -0.22em; flex: none; }
.bigBtn .ic { margin-inline-end: 4px; }
.secTitle .ic, .hintLine .ic, .cashLabel .ic { width: 1em; height: 1em; }
.rmeta .ic { width: 14px; height: 14px; vertical-align: -2px; }
.logIc { display: inline-block; width: 18px; margin-inline-end: 7px; color: var(--gold); text-align: center; }
.logIc .ic { width: 14px; height: 14px; }
.logIc.dotIc { color: var(--muted); }
.yourTurn { color: var(--gold); }

/* die faces (SVG pips) */
.dieF { width: 1.5em; height: 1.5em; vertical-align: -0.4em; display: inline-block; }
.bigBtn .dieF { margin-inline-end: 4px; }

/* medals */
.medal {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 900; color: #241A05;
  background: linear-gradient(135deg, #B9C3D6, #8FA3C8);
}
.medal.m0 { background: linear-gradient(135deg, var(--gold-2), var(--gold)); }
.medal.m1 { background: linear-gradient(135deg, #E6EBF5, #AEBBD2); }
.medal.m2 { background: linear-gradient(135deg, #E0A878, #B57B4C); }
.lobbyRow { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-weight: 700; }

.cardBox {
  background: linear-gradient(170deg, var(--glass-2), var(--glass));
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px; margin: 10px 0;
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
}
.hintLine { color: var(--muted); font-size: 14px; margin: 8px 0; }
.hintLine.center { text-align: center; }
.secTitle { font-weight: 800; font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--sand); margin: 14px 0 6px; }
.muted { color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: #2A1A1A; color: #FFD9D6; border: 1px solid #5c2f2c;
  padding: 10px 18px; border-radius: 12px; font-weight: 700; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: 90vw; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* countdown ring (host + phone) */
.ringWrap { position: relative; width: 92px; height: 92px; margin: 8px auto; }
.ringWrap.small { width: 72px; height: 72px; }
.ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--gold) 360deg, transparent 0);
  -webkit-mask: radial-gradient(closest-side, transparent 64%, #000 66%);
          mask: radial-gradient(closest-side, transparent 64%, #000 66%);
  filter: drop-shadow(0 0 8px rgba(232, 185, 75, .45));
}
.ringNum {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 900; color: var(--gold);
}
.ringWrap.small .ringNum { font-size: 26px; }

/* ---------- landing ---------- */

.landWrap {
  max-width: 460px; margin: 0 auto;
  padding: 9vh 22px 60px;
  text-align: center;
}
.brandAr { font-size: 74px; font-weight: 900; line-height: 1; color: var(--gold); text-shadow: 0 0 44px rgba(232, 185, 75, .4); }
.brandAr.small { font-size: 26px; vertical-align: middle; margin-inline-end: 8px; }
.brandEn {
  font-size: 26px; font-weight: 900; letter-spacing: 10px; margin-top: 8px;
  background: linear-gradient(90deg, var(--sand), var(--gold-2), var(--sand));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brandTag { color: var(--muted); margin-top: 10px; font-size: 15px; }
.skyline { width: 100%; margin: 26px 0 10px; fill: #223059; }
.landBtns { margin-top: 10px; }
.joinForm input {
  display: block; width: 100%; margin: 10px 0; padding: 14px 16px;
  font-size: 18px; font-weight: 800; text-align: center;
  color: var(--ink); background: var(--navy-2);
  border: 1px solid var(--line-2); border-radius: var(--r);
  letter-spacing: 2px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.joinForm input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 185, 75, .15); }
#inCode { text-transform: uppercase; letter-spacing: 10px; }

/* ---------- host (TV) ---------- */

.hostWrap { display: flex; gap: 18px; padding: 18px; height: 100vh; }

#board {
  position: relative;
  aspect-ratio: 1; height: calc(100vh - 36px); max-width: calc(100vw - 360px);
  display: grid;
  grid-template-rows: 1.45fr repeat(5, 1fr) 1.45fr;
  grid-template-columns: 1.45fr repeat(5, 1fr) 1.45fr;
  gap: 5px;
  flex: none;
}

#center {
  grid-area: 2 / 2 / 7 / 7;
  position: relative;
  border: 1px solid var(--line); border-radius: 20px;
  background:
    radial-gradient(420px 220px at 50% 0%, rgba(59, 196, 187, .09), transparent 70%),
    radial-gradient(500px 260px at 50% 110%, rgba(232, 185, 75, .08), transparent 70%),
    linear-gradient(180deg, var(--navy-1), #0A1024);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 20px; text-align: center; overflow: hidden;
}
.centerSky {
  position: absolute; left: 0; right: 0; bottom: -2px; width: 100%; height: 34%;
  fill: #1A2550; opacity: .85; pointer-events: none;
}
#center > *:not(.centerSky) { position: relative; z-index: 1; }
.centerBrand { font-weight: 900; font-size: 22px; letter-spacing: 6px; color: var(--sand); opacity: .9; }

/* tiles */
.tile {
  position: relative;
  border: 1px solid var(--line); border-radius: 11px;
  background: linear-gradient(165deg, var(--navy-3) 0%, var(--navy-2) 55%, #121B3D 100%);
  padding: 6px 7px 5px; overflow: hidden;
  display: flex; flex-direction: column;
  font-size: 12px; line-height: 1.25;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 3px 10px rgba(0, 0, 0, .25);
  transition: box-shadow .3s ease, border-color .3s ease;
}
.tile .band {
  height: 8px; border-radius: 5px; margin-bottom: 5px; flex: none;
  background: linear-gradient(90deg, var(--dc), color-mix(in srgb, var(--dc) 55%, #fff 20%));
  box-shadow: 0 0 10px color-mix(in srgb, var(--dc) 55%, transparent);
}
.tile .tname { font-weight: 800; font-size: 11.5px; letter-spacing: .1px; }
.tile .tname.corner { font-size: 12.5px; margin-top: auto; }
.tile .tfoot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 4px; }
.tile .tprice {
  color: #241A05; font-weight: 900; font-size: 10.5px;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  border-radius: 7px; padding: 0 6px; line-height: 16px;
}
.tile .tdev { font-size: 13px; min-height: 16px; }
.tile.owned { border-color: color-mix(in srgb, var(--oc) 70%, transparent); }
.tile.owned::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 5px;
  background: var(--oc); box-shadow: 0 0 12px var(--oc);
}
.tile.here {
  border-color: var(--gold);
  box-shadow: 0 0 0 1.5px var(--gold), 0 0 22px rgba(232, 185, 75, .45),
              inset 0 1px 0 rgba(255, 255, 255, .05);
}

/* metro + utility tiles */
.tile.kind-metro { background: linear-gradient(165deg, #113A42 0%, #0E2A38 60%, #0B1F30 100%); border-color: rgba(59, 196, 187, .35); }
.mSign .ic { width: 17px; height: 17px; color: var(--teal); }
.mLine { color: var(--teal); font-weight: 900; font-size: 8.5px; letter-spacing: 2.5px; }
.tile.kind-util { background: linear-gradient(165deg, #3A2E13 0%, #2B2210 60%, #1D1810 100%); border-color: rgba(232, 185, 75, .3); }
.uSign .ic { width: 17px; height: 17px; color: var(--gold); }
.tdev .ic { width: 15px; height: 15px; color: var(--sand); }

/* corner tiles */
.tile.corner { align-items: center; justify-content: center; text-align: center; }
.cornerArt { margin-top: 4px; }
.cornerArt .ic { width: 30px; height: 30px; color: var(--sand); filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5)); }
.tile.kind-akhbar .cornerArt .ic, .cornerArt { opacity: .95; }
.tile:not(.corner) .cornerArt .ic { width: 22px; height: 22px; color: var(--muted); }
.tile.corner-marhaba { background: linear-gradient(160deg, #2E2550 0%, #413060 45%, #8A5A33 130%); border-color: rgba(232, 185, 75, .4); }
.tile.corner-souq { background: linear-gradient(160deg, #1D3A33 0%, #14293A 100%); }
.tile.corner-jam { background: linear-gradient(160deg, #3A1E2A 0%, #241530 100%); }
.tile.corner-majlis { background: linear-gradient(160deg, #33301C 0%, #1E1D2E 100%); }

/* tokens — they walk */
#tokenLayer { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
#fxLayer { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.tokenFloat {
  position: absolute; left: -15px; top: -15px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--tc);
  border: 2px solid rgba(255, 255, 255, .9);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .55), inset 0 -3px 6px rgba(0, 0, 0, .2);
  display: flex; align-items: center; justify-content: center;
  transition: transform .3s ease;
}
.tokenFloat .tokIn { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.tokenFloat .tokIn .ic { width: 17px; height: 17px; color: #10152E; vertical-align: 0; }
.tokenFloat.step { transition: transform .15s linear; }
.tokenFloat.hop { transition: transform .65s cubic-bezier(.35, -.25, .25, 1.25); }
.tokenFloat.active { animation: tokPulse 1.6s ease-in-out infinite; }
.tokenFloat.ghost { opacity: .6; filter: saturate(.5); }
.tokenFloat.hopArc .tokIn { animation: arcUp .7s ease; }
@keyframes tokPulse {
  0%, 100% { box-shadow: 0 3px 10px rgba(0,0,0,.55), 0 0 0 0 color-mix(in srgb, var(--tc) 70%, transparent); }
  50%      { box-shadow: 0 3px 10px rgba(0,0,0,.55), 0 0 0 9px transparent; }
}
@keyframes arcUp { 0%,100% { transform: scale(1); } 50% { transform: scale(1.7) translateY(-4px); } }

/* confetti */
.cf {
  position: absolute; width: 8px; height: 8px; border-radius: 2px;
  animation: cfFly .9s ease-out forwards;
}
@keyframes cfFly {
  0%   { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 70px)) rotate(var(--rz)); opacity: 0; }
}

/* lobby */
#lobbyCard { width: min(460px, 92%); }
.lobbyGrid { display: flex; gap: 20px; align-items: center; justify-content: center; }
.qrBox {
  background: #FDF7EA; padding: 10px; border-radius: 14px; flex: none;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .4), 0 0 0 1px rgba(232, 185, 75, .3);
}
.qrBox img, .qrBox canvas { display: block; }
.lobbyRight { text-align: center; }
.codeLabel { color: var(--muted); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; margin-top: 10px; }
.joinUrl { font-weight: 800; font-size: 17px; color: var(--teal); word-break: break-all; }
.roomCode {
  font-size: 58px; font-weight: 900; letter-spacing: 16px; padding-left: 16px;
  color: var(--gold); text-shadow: 0 0 36px rgba(232, 185, 75, .45);
  animation: codeGlow 3s ease-in-out infinite;
}
@keyframes codeGlow {
  0%, 100% { text-shadow: 0 0 28px rgba(232, 185, 75, .35); }
  50%      { text-shadow: 0 0 48px rgba(232, 185, 75, .6); }
}

/* play HUD */
.roundPill {
  background: var(--glass); border: 1px solid var(--line-2);
  padding: 6px 18px; border-radius: 99px; font-weight: 800; color: var(--sand);
}
.turnBanner { font-size: 22px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.turnBanner .stageTxt { color: var(--muted); font-size: 17px; }
.diceBox { display: flex; gap: 14px; align-items: center; justify-content: center; min-height: 60px; color: var(--gold-2); }
.diceBox .dieF { width: 52px; height: 52px; }
.die { display: inline-block; filter: drop-shadow(0 4px 10px rgba(232, 185, 75, .35)); }
.die.tumble { animation: diceTumble .45s ease; }
.die.tumble.d2 { animation-delay: .06s; }
@keyframes diceTumble {
  0%   { transform: translateY(-34px) rotate(-160deg); opacity: 0; }
  60%  { transform: translateY(5px) rotate(15deg); opacity: 1; }
  100% { transform: translateY(0) rotate(0); }
}

.auctionBox {
  background: rgba(232, 185, 75, .1);
  border: 1px solid rgba(232, 185, 75, .45);
  border-radius: var(--r); padding: 14px 24px;
  font-weight: 800; font-size: 18px;
  box-shadow: 0 0 40px rgba(232, 185, 75, .12);
  animation: aucIn .3s ease;
}
@keyframes aucIn { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.overBox { width: min(440px, 92%); animation: aucIn .4s ease; }
.overTitle { font-size: 24px; font-weight: 900; color: var(--gold); margin-bottom: 10px; }
.overRow {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  background: var(--glass); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 14px; margin: 6px 0; font-size: 17px;
}
.overRow.winner {
  border-color: var(--gold); font-size: 19px; padding: 12px 14px;
  background: linear-gradient(170deg, rgba(232, 185, 75, .16), var(--glass));
  box-shadow: 0 0 26px rgba(232, 185, 75, .25);
}
.overRow .crown { position: absolute; top: -14px; left: 8px; font-size: 20px; transform: rotate(-18deg); }
.overRow .wealth { margin-inline-start: auto; color: var(--gold); font-weight: 900; }
.medal { font-size: 20px; width: 34px; }

#hostSide { flex: 1; display: flex; flex-direction: column; gap: 14px; min-width: 280px; }
.sideCard {
  background: linear-gradient(170deg, var(--glass-2), var(--glass));
  border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px 16px;
}
.sideCard.grow { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rosterRow {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 10px; margin: 3px 0; font-weight: 700;
  transition: background .3s, outline-color .3s;
}
.rosterRow.isTurn { background: rgba(232, 185, 75, .12); outline: 1px solid rgba(232, 185, 75, .4); }
.rosterRow .rmeta { margin-inline-start: auto; color: var(--muted); font-size: 13px; }
.rosterEmpty { color: var(--muted); }
.gameLog {
  overflow-y: auto; flex: 1; font-size: 14px; color: var(--sand);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 18px);
          mask-image: linear-gradient(180deg, transparent 0, #000 18px);
}
.gameLog div { padding: 4px 0; border-bottom: 1px dashed rgba(150, 180, 255, .08); animation: logIn .3s ease; }
@keyframes logIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- player (phone) ---------- */

.phoneWrap { max-width: 460px; margin: 0 auto; padding: 16px 16px 60px; }
.meHead {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(170deg, var(--glass-2), var(--glass));
  border: 1px solid var(--line-2);
  border-radius: var(--r); padding: 12px 16px;
  position: sticky; top: 10px; z-index: 5; backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.meCol { min-width: 0; }
.meName { font-weight: 900; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meBadges { font-size: 12px; color: var(--muted); }
.cashCol { margin-inline-start: auto; text-align: end; position: relative; }
.cashLabel { font-size: 11px; color: var(--muted); letter-spacing: 1px; }
.meCash {
  font-size: 28px; font-weight: 900; line-height: 1.1;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.meCash.debt { background: none; color: var(--rose); }
.meCash.pulse { animation: cashPulse .6s ease; }
@keyframes cashPulse { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }
.cashFloat {
  position: absolute; right: 0; top: -6px;
  font-weight: 900; font-size: 18px; pointer-events: none;
  animation: floatUp 1.3s ease-out forwards;
}
.cashFloat.up { color: #6FE3A5; }
.cashFloat.down { color: var(--rose); }
@keyframes floatUp {
  0%   { opacity: 0; transform: translateY(6px); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-30px); }
}

.playerStatus { font-weight: 800; font-size: 17px; margin: 16px 2px 6px; }
.tileBig { font-size: 17px; }
.tileBig .muted { font-size: 14px; }
.propRow { display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-size: 15px; }
.dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }

.newsCard {
  text-align: left; font-weight: 700; line-height: 1.45;
  border-left: 4px solid var(--gold);
  background: linear-gradient(170deg, rgba(232, 185, 75, .1), var(--glass));
}
.newsTag { display: block; font-size: 10.5px; font-weight: 900; letter-spacing: 2px; color: var(--gold); margin-bottom: 4px; }

.trade select { background: var(--navy-2); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.trade input {
  width: 100%; margin: 6px 0; padding: 10px 12px;
  background: var(--navy-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; outline: none;
}
.ck { display: block; padding: 6px 2px; font-size: 15px; }
#bidAmt {
  flex: 2; text-align: center; font-size: 22px; font-weight: 900;
  background: var(--navy-2); color: var(--gold);
  border: 1px solid var(--line-2); border-radius: 12px; padding: 10px; outline: none;
}
#bidAmt:focus { border-color: var(--gold); }

/* ---------- motion & small screens ---------- */

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
@media (max-width: 900px) {
  .hostWrap { flex-direction: column; height: auto; }
  #board { height: auto; width: 100%; max-width: 100vw; }
  #hostSide { min-width: 0; }
  .lobbyGrid { flex-direction: column; }
}
