/* ================= Vyapaar! — The Great Indian Property Card Game ================= */

:root {
  --bg1: #14213d;
  --bg2: #1d3557;
  --felt: #17603f;
  --gold: #f2c230;
  --saffron: #ff9933;
  --ink: #22223b;
  --paper: #fdf6e3;
  --paper2: #f5ead0;
  --danger: #d93b3b;
  --ok: #2e9e5b;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --card-r: 10px;
  font-size: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: 'Karla', system-ui, sans-serif;
  color: var(--paper);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255, 153, 51, 0.18), transparent 60%),
    radial-gradient(1000px 700px at 10% 110%, rgba(46, 158, 91, 0.20), transparent 60%),
    radial-gradient(2px 2px at 25% 35%, rgba(255,255,255,.08) 40%, transparent 41%),
    radial-gradient(2px 2px at 65% 75%, rgba(255,255,255,.06) 40%, transparent 41%),
    linear-gradient(160deg, var(--bg1), var(--bg2) 55%, #10192e);
  min-height: 100dvh;
  overflow-x: hidden;
}

h1, h2, h3, .logo-mini, .btn, .lobby-code, .turn-banner {
  font-family: 'Rozha One', Georgia, serif;
}

.hidden { display: none !important; }

.screen { min-height: 100dvh; display: flex; flex-direction: column; }

/* ============================== buttons ============================== */

.btn {
  border: none; cursor: pointer; border-radius: 12px;
  font-weight: 700; font-size: 1rem; padding: 0.7rem 1.4rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #ffd45e, var(--gold));
  color: #5c3a00; box-shadow: 0 4px 0 #b8860b, 0 8px 18px rgba(0,0,0,0.35);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-secondary {
  background: linear-gradient(180deg, #4c6ef5, #3b5bdb);
  color: #fff; box-shadow: 0 4px 0 #2b46b8, 0 8px 18px rgba(0,0,0,0.35);
}
.btn-ghost { background: rgba(255,255,255,0.1); color: var(--paper); }
.btn-ghost:hover { background: rgba(255,255,255,0.2); }
.btn-danger { background: linear-gradient(180deg,#ff6b6b,var(--danger)); color:#fff; box-shadow: 0 4px 0 #9c1f1f; }
.btn-small { padding: 0.35rem 0.8rem; font-size: 0.85rem; border-radius: 9px; }

/* ============================== home / lobby ============================== */

#screen-home, #screen-lobby { align-items: center; justify-content: center; padding: 1rem; }

.home-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(14px);
  border-radius: 24px; padding: 2.2rem 2.4rem; width: min(420px, 94vw);
  box-shadow: var(--shadow); text-align: center;
  display: flex; flex-direction: column; gap: 1rem;
}

.logo-coin { font-size: 3.2rem; display: block; filter: drop-shadow(0 6px 12px rgba(242,194,48,.5)); }
.logo h1 {
  font-size: 3rem; font-weight: 800; letter-spacing: 0.5px;
  background: linear-gradient(180deg, #ffe9a3, var(--gold) 60%, #d99a00);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 4px 24px rgba(242, 194, 48, 0.25);
}
.tagline { color: #ffd7a1; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; font-size: 0.75rem; }

.home-form { display: flex; flex-direction: column; gap: 0.8rem; text-align: left; }
.home-form label { font-weight: 700; font-size: 0.85rem; color: #cdd7f0; }
.home-form input, .join-row input {
  width: 100%; padding: 0.75rem 1rem; border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.18); background: rgba(0,0,0,0.25);
  color: var(--paper); font-size: 1.05rem; font-weight: 700; outline: none;
  font-family: inherit;
}
.home-form input:focus { border-color: var(--gold); }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 0.6rem; }
#code-input { text-transform: uppercase; letter-spacing: 8px; text-align: center; font-family: 'Rozha One', Georgia, serif; }
.home-hint { color: #9fb0d6; font-size: 0.82rem; }

.lobby-label { color: #cdd7f0; font-weight: 700; }
.lobby-code {
  font-size: 3.4rem; font-weight: 800; letter-spacing: 14px; padding-left: 14px;
  color: var(--gold); text-shadow: 0 0 30px rgba(242,194,48,.4);
  user-select: all; cursor: pointer;
}
.lobby-players { display: flex; flex-direction: column; gap: 0.5rem; }
.lobby-player {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 1rem;
  background: rgba(255,255,255,0.08); border-radius: 12px; font-weight: 700;
}
.lobby-player .avatar { font-size: 1.4rem; }
.lobby-player .host-tag { margin-left: auto; font-size: 0.7rem; color: var(--gold); border: 1px solid var(--gold); padding: 2px 8px; border-radius: 99px; }

/* ============================== game layout ============================== */

#screen-game { padding: 0.5rem 0.8rem 0.8rem; gap: 0.5rem; max-width: 1280px; margin: 0 auto; width: 100%; }

.topbar { display: flex; align-items: center; gap: 1rem; }
.logo-mini { font-weight: 800; color: var(--gold); font-size: 1.1rem; }
.room-tag { font-size: 0.75rem; background: rgba(255,255,255,.1); padding: 2px 10px; border-radius: 99px; letter-spacing: 2px; }
.turn-banner {
  flex: 1; text-align: center; font-weight: 800; font-size: 1.05rem;
  padding: 0.35rem 1rem; border-radius: 12px;
  background: rgba(255,255,255,0.06);
}
.turn-banner.mine { background: linear-gradient(90deg, rgba(242,194,48,.25), rgba(255,153,51,.25)); color: #ffe9a3; box-shadow: inset 0 0 0 1px rgba(242,194,48,.5); }

/* opponents */
.opponents { display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; }
.opp {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px; padding: 0.55rem 0.8rem; min-width: 240px; flex: 1; max-width: 400px;
}
.opp.turn { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(242,194,48,.35), 0 0 24px rgba(242,194,48,.15); }
.opp-head { display: flex; align-items: center; gap: 0.5rem; font-weight: 800; }
.opp-head .avatar { font-size: 1.2rem; }
.opp-stats { margin-left: auto; display: flex; gap: 0.6rem; font-size: 0.78rem; color: #cdd7f0; font-weight: 700; }
.opp-sets { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; min-height: 44px; }

/* mini property pile */
.mini-pile {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 3px 4px; border-radius: 8px; background: rgba(0,0,0,0.25);
  cursor: default; position: relative;
}
.mini-pile.full { outline: 2px solid var(--gold); }
.mini-pile.full::after { content: '★'; position: absolute; top: -8px; right: -6px; color: var(--gold); font-size: 0.7rem; }
.mini-pile .chips { display: flex; gap: 2px; }
.mini-chip { width: 13px; height: 19px; border-radius: 3px; border: 1px solid rgba(0,0,0,.35); }
.mini-chip.bldg { display: flex; align-items: center; justify-content: center; font-size: 9px; background: #fff; }
.mini-pile .mini-label { font-size: 0.58rem; font-weight: 800; color: #cdd7f0; max-width: 64px; text-align: center; }

/* center table */
.table-center {
  display: flex; align-items: center; justify-content: center; gap: 2rem;
  padding: 0.6rem;
  background:
    radial-gradient(ellipse at center, rgba(255,255,255,0.05), transparent 70%),
    linear-gradient(180deg, rgba(23,96,63,.55), rgba(23,96,63,.35));
  border: 1px solid rgba(255,255,255,0.1); border-radius: 20px;
  min-height: 132px;
}
.deck-area { display: flex; gap: 1rem; align-items: center; }
.center-status { font-weight: 700; font-size: 0.95rem; color: #e9f0ff; max-width: 420px; text-align: center; }

/* ============================== cards ============================== */

.card {
  width: 92px; height: 132px; border-radius: var(--card-r);
  background: var(--paper); color: var(--ink); position: relative;
  box-shadow: 0 3px 8px rgba(0,0,0,0.4);
  display: flex; flex-direction: column; overflow: hidden;
  border: 3px solid #fff; flex-shrink: 0;
  user-select: none;
}
.card.clickable { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
@media (hover: hover) {
  .card.clickable:hover { transform: translateY(-10px) scale(1.05); box-shadow: 0 14px 28px rgba(0,0,0,.5); z-index: 5; }
}
.card.clickable:active { transform: translateY(-4px) scale(1.03); }
.card.selected { outline: 4px solid var(--gold); transform: translateY(-10px); }

/* interactive game elements are real <button>s — neutralize UA styles */
button.card, button.card-back, button.pile, button.color-swatch, button.target-row {
  font: inherit; padding: 0;
}
button.pile, button.target-row { color: inherit; text-align: inherit; }
button.card-back { cursor: default; }
button.pile { background: none; border: none; }
button.mini-pile { border: none; cursor: pointer; font: inherit; color: inherit; }
button.mini-pile:hover { background: rgba(0,0,0,0.45); }
button.color-swatch { padding: 0.55rem 1rem; }
button.target-row { padding: 0.7rem 1rem; border: none; width: 100%; }
.card-back {
  background:
    radial-gradient(circle at 50% 42%, #ffd45e 0 14px, transparent 15px),
    repeating-linear-gradient(45deg, #b02a2a 0 8px, #9c1f1f 8px 16px);
  border-color: #7a1616; align-items: center; justify-content: center; display: flex;
}
.card-back::after { content: '₹'; position: absolute; top: 34%; left: 50%; transform: translate(-50%,-50%); font-weight: 900; color: #7a1616; font-size: 1.3rem; font-family: 'Karla', system-ui, sans-serif; }
.card-back span {
  margin-top: 66px; background: rgba(0,0,0,0.55); color: #ffe9a3;
  padding: 1px 10px; border-radius: 99px; font-size: 0.72rem; font-weight: 800;
}

.discard-slot {
  width: 92px; height: 132px; border-radius: var(--card-r);
  border: 2px dashed rgba(255,255,255,0.35);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.4); font-size: 0.7rem; font-weight: 700;
}
.discard-slot .card { border-style: solid; }

/* value badge (top-left corner) */
.v-badge {
  position: absolute; top: 3px; left: 3px; z-index: 2;
  background: #fff; border: 1.5px solid var(--ink); border-radius: 99px;
  min-width: 24px; height: 24px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 900; font-family: 'Karla', system-ui, sans-serif;
}

/* property card */
.card-prop .prop-head {
  padding: 8px 6px 4px 28px; text-align: center; font-weight: 800; font-size: 0.64rem;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.6); line-height: 1.1;
  min-height: 42px; display: flex; align-items: center; justify-content: center;
}
.card-prop .prop-name { padding: 4px 4px 2px; text-align: center; font-weight: 800; font-size: 0.72rem; line-height: 1.05; }
.card-prop .rent-table { margin-top: auto; padding: 0 8px 6px; font-size: 0.58rem; font-weight: 700; color: #5a5a6e; }
.card-prop .rent-table div { display: flex; justify-content: space-between; border-top: 1px dotted #c9bfa3; padding-top: 1px; }

/* wild card */
.wild-split { height: 52px; display: flex; }
.wild-split > div { flex: 1; }
.card-wild .prop-name { padding: 6px 4px; text-align: center; font-weight: 800; font-size: 0.68rem; }
.rainbow {
  background: conic-gradient(#d93b3b, #f2803b, #f2c230, #2e9e5b, #4c6ef5, #8b5cf6, #e56aa5, #d93b3b);
}

/* money card */
.card-money { align-items: center; justify-content: center; }
.money-oval {
  margin: auto; width: 68px; height: 92px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: 'Karla', system-ui, sans-serif; font-weight: 800; border: 4px double;
}
.money-oval .amt { font-size: 1.35rem; line-height: 1; }
.money-oval .m { font-size: 0.6rem; letter-spacing: 1px; }

/* action / kiraya cards */
.card-action .act-icon { font-size: 1.9rem; text-align: center; margin-top: 22px; }
.card-action .act-name { text-align: center; font-weight: 800; font-size: 0.72rem; padding: 2px 6px; font-family: 'Karla', system-ui, sans-serif; }
.card-action .act-desc { font-size: 0.55rem; text-align: center; color: #5a5a6e; padding: 0 7px; line-height: 1.15; }
.card-action { background: linear-gradient(180deg, #fdf6e3, #f2e6c9); }

.card-rent { background: linear-gradient(180deg, #fdf6e3, #f0e0c0); }
.card-rent .rent-circles { display: flex; justify-content: center; gap: 6px; margin-top: 26px; }
.card-rent .rent-circle { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.card-rent .act-name { text-align: center; font-weight: 800; font-size: 0.78rem; margin-top: 6px; font-family: 'Karla', system-ui, sans-serif; }
.card-rent .act-desc { font-size: 0.55rem; text-align: center; color: #5a5a6e; padding: 0 6px; margin-top: 2px; }

/* ============================== my area ============================== */

.my-area {
  display: flex; flex-direction: column; gap: 0.5rem;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px; padding: 0.7rem;
}
.my-table { display: flex; gap: 1rem; align-items: flex-start; min-height: 120px; }
.my-props { flex: 1; display: flex; gap: 0.6rem; flex-wrap: wrap; }

.pile { position: relative; cursor: pointer; }
.pile .pile-cards { display: flex; flex-direction: column; }
.pile .pcard {
  width: 78px; height: 26px; border-radius: 6px; border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,.35); margin-top: -8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.58rem; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.55);
  overflow: hidden; white-space: nowrap; padding: 0 4px;
}
.pile .pcard:first-child { margin-top: 0; height: 34px; }
.pile .pcard.bldg { background: #fff !important; color: var(--ink); text-shadow: none; }
.pile.full .pcard:first-child { box-shadow: 0 0 0 2px var(--gold), 0 2px 6px rgba(0,0,0,.4); }
.pile .pile-tag { text-align: center; font-size: 0.6rem; font-weight: 800; color: #cdd7f0; margin-top: 3px; }
.pile.full .pile-tag { color: var(--gold); }

.my-bank {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-end; min-width: 120px;
}
.bank-total { font-weight: 800; color: #ffe9a3; font-size: 0.85rem; }
.bank-chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; max-width: 220px; }
.bank-chip {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Karla', system-ui, sans-serif; font-weight: 800; font-size: 0.72rem;
  border: 2px dashed rgba(255,255,255,0.7); color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.5); box-shadow: 0 2px 5px rgba(0,0,0,.4);
}

/* hand */
.hand-bar { display: flex; flex-direction: column; gap: 0.4rem; }
.action-bar { display: flex; gap: 0.6rem; align-items: center; justify-content: center; flex-wrap: wrap; min-height: 40px; }
.plays-dots { display: flex; gap: 5px; }
.play-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px rgba(242,194,48,.6); }
.play-dot.used { background: rgba(255,255,255,0.18); box-shadow: none; }
.my-hand {
  display: flex; justify-content: center; gap: -10px; padding: 6px 4px 2px;
  flex-wrap: wrap; row-gap: 12px;
}
.my-hand .card { margin: 0 -8px; }
@media (hover: hover) { .my-hand .card:hover { margin: 0 6px; } }

/* ============================== modals ============================== */

.modal-root {
  position: fixed; inset: 0; background: rgba(10, 14, 28, 0.75);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  backdrop-filter: blur(4px); padding: 1rem;
}
.modal {
  background: linear-gradient(180deg, #223055, #1a2542);
  border: 1px solid rgba(255,255,255,0.18); border-radius: 20px;
  padding: 1.4rem; max-width: 640px; width: 100%; max-height: 86dvh; overflow-y: auto;
  box-shadow: var(--shadow); text-align: center;
  display: flex; flex-direction: column; gap: 0.9rem;
}
.modal h3 { font-size: 1.25rem; color: #ffe9a3; }
.modal .modal-sub { color: #cdd7f0; font-size: 0.9rem; }
.modal-cards { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; }
.modal-btns { display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; }
.color-grid { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
.color-swatch {
  padding: 0.55rem 1rem; border-radius: 10px; border: 2px solid #fff;
  font-weight: 800; color: #fff; cursor: pointer; text-shadow: 0 1px 3px rgba(0,0,0,.6);
  font-size: 0.85rem; transition: transform .1s;
}
.color-swatch:hover { transform: scale(1.07); }
.target-row {
  display: flex; align-items: center; gap: 0.8rem; padding: 0.7rem 1rem;
  background: rgba(255,255,255,0.07); border-radius: 12px; cursor: pointer;
  font-weight: 800; transition: background .1s;
}
.target-row:hover { background: rgba(255,255,255,0.16); }
.pay-total { font-size: 1.1rem; font-weight: 800; color: var(--gold); }

/* winner overlay */
.winner-overlay { text-align: center; }
.winner-overlay .trophy { font-size: 4.5rem; animation: bounce 1.2s infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-14px);} }
.confetti { position: fixed; top: -12px; font-size: 1.3rem; animation: fall linear forwards; z-index: 60; pointer-events: none; }
@keyframes fall { to { transform: translateY(110dvh) rotate(720deg); } }

/* toast */
.toast {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(180deg,#ff6b6b,var(--danger)); color: #fff; font-weight: 800;
  padding: 0.6rem 1.3rem; border-radius: 99px; z-index: 80;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); font-size: 0.9rem; max-width: 92vw; text-align: center;
}
.toast.info { background: linear-gradient(180deg,#4c6ef5,#3b5bdb); }

/* log */
.log-panel {
  position: fixed; right: 12px; top: 56px; width: min(320px, 92vw); max-height: 60dvh;
  background: rgba(15, 22, 44, 0.96); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 14px; z-index: 40; display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.log-head { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0.9rem; font-weight: 800; color: var(--gold); }
.log-body { overflow-y: auto; padding: 0 0.9rem 0.9rem; display: flex; flex-direction: column; gap: 5px; font-size: 0.8rem; color: #dce4f5; }

/* pulsing attention */
@keyframes pulse-gold { 0%,100% { box-shadow: 0 0 0 0 rgba(242,194,48,.6);} 50% { box-shadow: 0 0 0 10px rgba(242,194,48,0);} }
.attention { animation: pulse-gold 1.4s infinite; }

/* ============================== animations ============================== */

@keyframes flip-in {
  0% { transform: rotateY(92deg) translateY(8px) scale(.92); opacity: 0; }
  60% { transform: rotateY(-8deg) scale(1.02); opacity: 1; }
  100% { transform: none; opacity: 1; }
}
.flip-in { animation: flip-in .5s cubic-bezier(.2,.7,.3,1) backwards; transform-style: preserve-3d; }

@keyframes pop-in {
  0% { transform: scale(.4); opacity: 0; }
  70% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}
.pop-in { animation: pop-in .35s ease-out; }

@keyframes pulse-grow { 0% { transform: scale(1);} 45% { transform: scale(1.08);} 100% { transform: scale(1);} }
.pulse-grow { animation: pulse-grow .45s ease-out; }

@keyframes banner-slide { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
.banner-slide { animation: banner-slide .3s ease-out; }

@keyframes float-up {
  from { transform: translateY(0) scale(.7) rotate(-8deg); opacity: 1; }
  to { transform: translateY(-140px) scale(1.5) rotate(10deg); opacity: 0; }
}
.float-emoji {
  position: fixed; z-index: 70; font-size: 2rem; pointer-events: none;
  animation: float-up 1.4s ease-out forwards;
}

@keyframes modal-in { from { transform: scale(.92) translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal { animation: modal-in .22s ease-out; }

@keyframes shake { 0%,100% { transform: translateX(0);} 20% { transform: translateX(-7px);} 40% { transform: translateX(7px);} 60% { transform: translateX(-4px);} 80% { transform: translateX(4px);} }
.shake { animation: shake .4s ease-in-out; }

@media (prefers-reduced-motion: reduce) {
  .flip-in, .pop-in, .pulse-grow, .banner-slide, .float-emoji, .modal, .shake, .attention, .coach-pop,
  .winner-overlay .trophy, .confetti { animation: none !important; }
}

/* ============================== responsive ============================== */

@media (max-width: 720px) {
  :root { font-size: 14px; }
  #screen-game { padding: 0.3rem 0.45rem 0.6rem; gap: 0.4rem; }

  /* compact top bar: no logo, icon-only buttons, one-line banner */
  .topbar { gap: 0.35rem; }
  .logo-mini { display: none; }
  .btn-txt { display: none; }
  .room-tag { font-size: 0.66rem; padding: 2px 7px; letter-spacing: 1px; }
  .turn-banner {
    font-size: 0.8rem; padding: 0.28rem 0.5rem; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .topbar .btn-small { padding: 0.28rem 0.45rem; font-size: 0.85rem; }

  .card { width: 76px; height: 110px; }
  .discard-slot { width: 76px; height: 110px; }
  .card-action .act-icon { margin-top: 14px; font-size: 1.5rem; }
  .card-action .act-desc { display: none; }
  .card-prop .rent-table { display: none; }
  .opp { min-width: 46%; padding: 0.4rem 0.55rem; }
  .opp-sets { min-height: 36px; margin-top: 4px; }
  .table-center { gap: 0.8rem; min-height: 96px; padding: 0.45rem; }
  .center-status { font-size: 0.8rem; }
  .my-area { padding: 0.5rem; }
  .my-table { min-height: 92px; }
  .my-hand .card { margin: 0 -14px; }
}

/* ============================================================================
   VYAPAAR GAME SKIN — matches Taash Adda: ink indigo / vermillion / marigold /
   brass, painted bazaar scene, carved panel, chunky beveled controls.
   Deliberately overrides the flat gradient styling above.
   ========================================================================== */
:root {
  --bg1: #16223D; --bg2: #1B2A4A; --felt: #1E4D3A;
  --gold: #E8A33D; --marigold: #E8A33D; --vermillion: #C1362F;
  --brass: #B08D57; --ink: #16223D; --paper: #F4EAD5;
  --danger: #C1362F; --ok: #2F7A55; --muted: #9DA9C4;
  --rule: rgba(176,141,87,.55); --rule-strong: rgba(176,141,87,.85);
  --r-sm: 3px; --r-md: 5px; --r-lg: 9px;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
}
body {
  font-family: 'Karla', system-ui, sans-serif;
  background: var(--grain), linear-gradient(178deg, #16223D 0%, #1B2A4A 46%, #0E1526 100%);
}
/* the bazaar, fixed behind everything */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(9,14,26,.34) 0%, rgba(7,11,22,.62) 100%),
    url('../img/bazaar-bg.jpg') center center / cover no-repeat,
    linear-gradient(178deg, #16223D, #0E1526);
}
h1, h2, h3, .lobby-code, .logo-mini { font-family: 'Rozha One', Georgia, serif; font-weight: 400; }
.btn, .turn-banner { font-family: 'Karla', system-ui, sans-serif; font-weight: 800; letter-spacing: .03em; }

/* carved panel in the ornate frame */
.home-card {
  border: 30px solid transparent;
  border-image: url('../img/frame.png?v=1') 102 / 30px / 0 round;
  border-radius: 0; padding: 1.1rem 1.2rem 1.2rem;
  background: var(--grain), linear-gradient(180deg, #2A3E68 0%, #1E2E51 42%, #16223D 100%);
  background-clip: padding-box;
  box-shadow: 0 26px 60px rgba(0,0,0,.7);
}
@media (max-width: 560px) { .home-card { border-width: 20px; border-image-width: 20px; padding: .9rem .8rem 1rem; } }

/* chunky beveled buttons */
.btn {
  border-radius: 12px; font-weight: 800; font-size: 1rem; padding: .78rem 1.4rem;
  border: none; text-shadow: 0 1px 0 rgba(0,0,0,.28);
  transition: transform .08s ease, filter .12s ease, box-shadow .12s ease;
}
.btn:active { transform: translateY(3px); }
.btn-primary {
  background: linear-gradient(180deg, #FFD98A 0%, #F0AE45 38%, #D4872A 100%);
  color: #4A2B05; border: 1px solid #8A5A16;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.75), inset 0 -3px 0 rgba(120,70,10,.45), 0 5px 0 #7E4E12, 0 12px 22px rgba(0,0,0,.5);
}
.btn-secondary {
  background: linear-gradient(180deg, #5C7FC4 0%, #3B5A9B 40%, #2A4278 100%);
  color: #F2F6FF; border: 1px solid #1B2C52;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.35), inset 0 -3px 0 rgba(10,20,45,.5), 0 5px 0 #1B2C52, 0 12px 22px rgba(0,0,0,.5);
}
.btn-danger {
  background: linear-gradient(180deg, #E86A5E 0%, #C1362F 42%, #97231D 100%);
  color: #fff; border: 1px solid #6E1815;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.4), 0 5px 0 #6E1815, 0 12px 22px rgba(0,0,0,.5);
}
.btn-ghost {
  background: linear-gradient(180deg, rgba(88,112,160,.4), rgba(30,46,81,.6));
  color: var(--paper); border: 1px solid rgba(232,196,120,.3);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 3px 0 rgba(10,18,36,.6);
}
.btn:disabled { filter: grayscale(.55) brightness(.75); box-shadow: none; transform: none; }

.logo-coin {
  font-size: 2rem; display: grid; place-items: center; width: 62px; height: 62px;
  margin: 0 auto 2px; border: 1px solid var(--rule-strong); border-radius: 50%;
  background: radial-gradient(circle at 50% 32%, rgba(232,163,61,.22), rgba(0,0,0,.3));
  box-shadow: inset 0 0 0 3px rgba(176,141,87,.12); filter: none;
}
.logo h1 {
  font-size: 3rem; color: #FFD98A; background: none;
  -webkit-background-clip: initial; background-clip: initial;
  text-shadow: 0 2px 0 #8A5A16, 0 4px 0 rgba(90,55,10,.7), 0 0 30px rgba(255,190,90,.45);
}
.tagline { color: var(--brass); letter-spacing: 3px; font-size: .68rem; }
.home-hint { color: var(--muted); font-size: .78rem; }

/* carved room-code plaque */
.lobby-code {
  display: inline-block; margin: 2px auto 0; padding: .35rem 1.5rem .45rem;
  letter-spacing: 16px; padding-left: 30px; font-size: 3.1rem; color: #FFD98A; border-radius: 12px;
  background: linear-gradient(180deg, rgba(9,15,28,.85), rgba(5,9,18,.9)); border: 2px solid #8A6C3E;
  text-shadow: 0 0 22px rgba(255,190,90,.55), 0 2px 0 rgba(0,0,0,.7);
  box-shadow: inset 0 3px 10px rgba(0,0,0,.75);
}
.lobby-player {
  background: linear-gradient(180deg, rgba(44,64,104,.85), rgba(24,38,68,.9));
  border: 1px solid rgba(232,196,120,.3); border-radius: 11px; padding: .6rem .8rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 4px 12px rgba(0,0,0,.4);
}
.lobby-player .host-tag {
  background: linear-gradient(180deg,#F0AE45,#C6871F); color:#3B2405; border: none;
  font-weight: 800; box-shadow: 0 2px 0 #8A5A16;
}
.room-tag {
  background: rgba(10,17,32,.55); border: 1px solid var(--rule); color: var(--brass);
  border-radius: var(--r-sm); padding: 3px 10px;
}
.turn-banner { background: rgba(10,17,32,.5); border: 1px solid var(--rule); border-radius: var(--r-sm); }
.turn-banner.mine {
  background: linear-gradient(90deg, rgba(232,163,61,.2), rgba(193,54,47,.16));
  color: #FBE7C2; border-color: var(--marigold); box-shadow: none;
}
.modal {
  background: var(--grain), linear-gradient(180deg, #2A3E68 0%, #1E2E51 45%, #16223D 100%);
  border: 1px solid var(--rule-strong);
  box-shadow: 0 0 0 3px rgba(176,141,87,.13), 0 26px 60px rgba(0,0,0,.72);
}
.modal h3 { color: #FFD98A; font-family: 'Rozha One', Georgia, serif; font-weight: 400; }

/* painted player portraits (shared with Taash Adda) */
.avatar.face {
  width: 34px; height: 34px; flex: 0 0 auto; display: inline-block;
  background-size: contain; background-position: center; background-repeat: no-repeat;
  font-size: 0 !important; color: transparent; border: none !important;
  box-shadow: none !important; border-radius: 50%; vertical-align: middle;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.55));
}
.lobby-player .avatar.face { width: 44px; height: 44px; }

/* "no real money" notice */
.no-money {
  display: flex; flex-direction: column; gap: 2px; align-items: center;
  font-weight: 800; font-size: .78rem; letter-spacing: .03em;
  color: #9FE0BC; background: rgba(47,122,85,.16);
  border: 1px solid rgba(47,122,85,.55); border-radius: var(--r-sm);
  padding: .5rem .7rem; text-align: center;
}
.no-money span { font-weight: 600; font-size: .7rem; color: #BFD8CB; letter-spacing: 0; }
.avatar.face.face-1 { background-image: url('../img/av-1.png?v=1'); background-color: transparent; }
.avatar.face.face-2 { background-image: url('../img/av-2.png?v=1'); background-color: transparent; }
.avatar.face.face-3 { background-image: url('../img/av-3.png?v=1'); background-color: transparent; }
.avatar.face.face-4 { background-image: url('../img/av-4.png?v=1'); background-color: transparent; }
.avatar.face.face-5 { background-image: url('../img/av-5.png?v=1'); background-color: transparent; }
.avatar.face.face-6 { background-image: url('../img/av-6.png?v=1'); background-color: transparent; }
.avatar.face.face-7 { background-image: url('../img/av-7.png?v=1'); background-color: transparent; }
.avatar.face.face-8 { background-image: url('../img/av-8.png?v=1'); background-color: transparent; }
.avatar.face.face-9 { background-image: url('../img/av-9.png?v=1'); background-color: transparent; }
.avatar.face.face-10 { background-image: url('../img/av-10.png?v=1'); background-color: transparent; }
.avatar.face.face-11 { background-image: url('../img/av-11.png?v=1'); background-color: transparent; }
.avatar.face.face-12 { background-image: url('../img/av-12.png?v=1'); background-color: transparent; }
.avatar.face.face-13 { background-image: url('../img/av-13.png?v=1'); background-color: transparent; }
.avatar.face.face-14 { background-image: url('../img/av-14.png?v=1'); background-color: transparent; }
.avatar.face.face-15 { background-image: url('../img/av-15.png?v=1'); background-color: transparent; }
.avatar.face.face-16 { background-image: url('../img/av-16.png?v=1'); background-color: transparent; }

/* ---------------- in-game legibility over the bazaar scene ----------------
   The play surfaces were translucent, so the busy background showed straight
   through them. Darken the scene while a game is on, and give the surfaces
   real, near-opaque panels. */
#screen-game::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: rgba(8,13,24,.72);
}
.opp {
  background: var(--grain), linear-gradient(180deg, rgba(34,50,84,.94), rgba(20,32,58,.96));
  border: 1px solid rgba(232,196,120,.28); border-radius: 11px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 6px 16px rgba(0,0,0,.5);
}
.opp.turn { border-color: var(--marigold); box-shadow: inset 0 0 0 1px rgba(232,163,61,.45), 0 6px 18px rgba(0,0,0,.55); }
.table-center {
  background: var(--grain),
    radial-gradient(ellipse at 50% 0%, rgba(244,234,213,.06), transparent 68%),
    linear-gradient(180deg, rgba(30,77,58,.95), rgba(17,48,36,.96));
  border: 1px solid rgba(232,196,120,.28);
  box-shadow: inset 0 0 0 3px rgba(176,141,87,.10), 0 10px 26px rgba(0,0,0,.5);
}
.my-area {
  background: var(--grain), linear-gradient(180deg, rgba(34,50,84,.93), rgba(19,30,55,.96));
  border: 1px solid rgba(232,196,120,.26);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 8px 20px rgba(0,0,0,.5);
}
.hand-bar, .center-status { text-shadow: 0 1px 2px rgba(0,0,0,.6); }

/* ---------------- painted chrome: logo, topbar icons, card back ---------------- */
/* home logo is the same V-coin image as the favicon (an <img> in index.html) */
.logo-coin {
  display: block; background: none; object-fit: contain;
  border: none; box-shadow: none; width: 92px; height: 92px; font-size: 0;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.55));
}
.logo-mini { display: inline-flex; align-items: center; gap: 7px; }
.logo-badge {
  width: 26px; height: 26px; display: inline-block;
  background: url('../img/logo.png?v=2') center / contain no-repeat;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.5));
}
#btn-quit, #btn-help, #btn-mute, #btn-log { font-size: 0; color: transparent; position: relative; }
#btn-quit::before, #btn-help::before, #btn-mute::before, #btn-log::before {
  content: ''; position: absolute; inset: 0; margin: auto; width: 22px; height: 22px;
  background-position: center; background-size: contain; background-repeat: no-repeat;
}
#btn-quit::before { background-image: url('../img/ic-leave.png?v=1'); }
#btn-help::before { background-image: url('../img/ic-help.png?v=1'); }
#btn-mute::before { background-image: url('../img/ic-sound.png?v=1'); }
#btn-mute.is-muted::before { background-image: url('../img/ic-mute.png?v=1'); opacity: .7; }
#btn-log::before { background-image: url('../img/ic-log.png?v=2'); }
#btn-log .btn-txt { display: none; }

/* painted deck back (keep the count span) */
.card-back {
  background: url('../img/card-back.jpg?v=1') center / cover no-repeat, #8E2018;
  border-color: rgba(22,34,61,.5);
  box-shadow: inset 0 0 0 1px rgba(255,225,170,.25);
}
.card-back::after { display: none; }   /* the art carries the centre motif */

/* ---------------- coach marks (first-run guided tour) ---------------- */
.coach-overlay { position: fixed; inset: 0; z-index: 80; }
.coach-hole {
  position: absolute; border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(6,10,20,.76), 0 0 0 2px var(--marigold), 0 0 22px rgba(232,163,61,.5);
  transition: left .2s ease, top .2s ease, width .2s ease, height .2s ease; pointer-events: none;
}
.coach-hole-none { left: 50%; top: 50%; width: 0; height: 0; box-shadow: 0 0 0 9999px rgba(6,10,20,.8); }
.coach-card {
  position: absolute; width: min(310px, 88vw);
  background: var(--grain), linear-gradient(180deg, #2A3E68, #16223D);
  border: 1px solid var(--rule-strong); border-radius: var(--r-lg);
  box-shadow: 0 0 0 3px rgba(176,141,87,.14), 0 20px 44px rgba(0,0,0,.6);
  padding: .9rem 1rem 1rem; color: var(--paper);
}
.coach-card.coach-pop { animation: modal-in .22s ease both; }
.coach-title { font-family: 'Rozha One', Georgia, serif; font-size: 1.15rem; color: #FFD98A; margin-bottom: 3px; }
.coach-body { font-size: .86rem; line-height: 1.45; color: #DCE4F5; }
.coach-dots { display: flex; gap: 5px; justify-content: center; margin: .7rem 0 .5rem; }
.coach-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(232,196,120,.3); }
.coach-dot.on { background: var(--marigold); }
.coach-btns { display: flex; justify-content: space-between; gap: 8px; }

/* ---------------- accessibility: focus visibility + tap targets ---------------- */
.btn:focus-visible, .game-card:focus-visible, input:focus-visible,
button.card:focus-visible, button.pile:focus-visible, a:focus-visible,
.coach-btns .btn:focus-visible {
  outline: 3px solid var(--marigold); outline-offset: 2px; border-radius: 4px;
}
#btn-quit, #btn-help, #btn-mute, #btn-log { min-width: 42px; min-height: 40px; }
.tagline { color: #D6B67A; }

/* ---------------- avatar picker (home) ---------------- */
.name-avatar { display: flex; flex-direction: row; align-items: flex-end; gap: .7rem; margin-bottom: .6rem; }
.na-fields { flex: 1; display: flex; flex-direction: column; gap: .4rem; }
.avatar-choose {
  width: 56px; height: 56px; flex: none; cursor: pointer; padding: 0;
  border: 2px solid var(--rule-strong); border-radius: 50%;
  background: rgba(10,17,32,.5) center / contain no-repeat;
  box-shadow: inset 0 2px 5px rgba(0,0,0,.5), 0 0 10px rgba(232,163,61,.2); position: relative;
}
.avatar-choose::after {
  content: '✎'; position: absolute; right: -2px; bottom: -2px; width: 20px; height: 20px;
  display: grid; place-items: center; font-size: 11px; border-radius: 50%;
  background: var(--marigold); color: #3B2405; border: 1px solid #8A5A16;
}
.avatar-grid {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); z-index: 90;
  background: var(--grain), linear-gradient(180deg, #2A3E68, #16223D);
  border: 1px solid var(--rule-strong); border-radius: var(--r-lg);
  box-shadow: 0 0 0 3px rgba(176,141,87,.14), 0 22px 50px rgba(0,0,0,.65);
  padding: .9rem 1rem 1rem; width: min(360px, 92vw);
}
.ag-title { font-family: 'Rozha One', Georgia, serif; color: #FFD98A; font-size: 1.1rem; margin-bottom: .6rem; text-align: center; }
.ag-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ag-row .avatar.face { width: 100%; height: auto; aspect-ratio: 1; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.ag-row .avatar.face.on { border-color: var(--marigold); box-shadow: 0 0 0 2px rgba(232,163,61,.4); }
.coach-card { max-height: calc(100dvh - 24px); }

/* ---------------- lobby share buttons ---------------- */
.lobby-share { display: flex; gap: 8px; justify-content: center; margin: 8px 0 6px; flex-wrap: wrap; }
.lobby-share .btn { flex: 1 1 auto; min-width: 130px; }

/* ---------------- home footer (legal links) ---------------- */
.home-foot { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.home-foot a { color: var(--brass); text-decoration: none; }
.home-foot a:hover { color: var(--marigold); text-decoration: underline; }

/* ---------------- topbar on phones: banner gets its own row ---------------- */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; row-gap: .3rem; }
  .topbar-left { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: .4rem; }
  .logo-mini { display: inline-flex; font-size: 1rem; gap: 5px; white-space: nowrap; }
  .logo-badge { width: 22px; height: 22px; }
  .turn-banner { order: 99; flex: 1 1 100%; white-space: normal; text-align: center; }
  #btn-quit, #btn-help, #btn-mute, #btn-log { min-width: 40px; }
}

/* ---------------- payment: grouped by bank and colour ---------------- */
.pay-tools { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.pay-group {
  border: 1px solid rgba(232,196,120,.25); border-radius: var(--r-md);
  padding: .45rem .5rem .6rem; background: rgba(10,17,32,.35);
}
.pay-group.full { border-color: var(--marigold); }
.pay-group-head { font-weight: 800; font-size: .82rem; color: #FBE7C2; text-align: left; margin-bottom: .4rem; }
.pay-wild { display: flex; flex-direction: column; align-items: center; }
.pay-wild-as { font-size: .68rem; font-weight: 800; color: #cdd7f0; margin-top: 3px; }
.pay-warn, .countered-line {
  font-weight: 800; font-size: .85rem; border-radius: var(--r-sm); padding: .4rem .6rem;
}
.pay-warn { color: #FFD3C9; background: rgba(193,54,47,.22); border: 1px solid rgba(193,54,47,.6); }
.countered-line { color: #FBE7C2; background: rgba(232,163,61,.16); border: 1px solid rgba(232,163,61,.55); }
.modal.no-anim { animation: none; }
.pay-modal .modal-btns {
  position: sticky; bottom: -1.4rem; margin: 0 -1.4rem; padding: .6rem 1.4rem .8rem;
  background: linear-gradient(180deg, rgba(22,34,61,.85), #16223D 40%); z-index: 2;
}

/* ---------------- end of game ---------------- */
.waiting-host { font-style: italic; }
.result-pill {
  position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 45; box-shadow: 0 6px 18px rgba(0,0,0,.55);
}
.pay-group .modal-cards { padding-top: 10px; }  /* room for the lifted selected card */

/* new-version notice (shell adds #update-bar when /version.txt changes) */
.update-bar {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 9999; border: 1px solid #8A5A16; border-radius: 999px; padding: .6rem 1.1rem;
  font: 800 .9rem/1 'Karla', system-ui, sans-serif; color: #3B2609; cursor: pointer;
  background: linear-gradient(180deg, #FFD98A, #E8A33D); box-shadow: 0 6px 18px rgba(0,0,0,.5);
  animation: pop-in .25s ease both;
}
