/* Algorand Poker - Criptomedia visual system
   navy / gold / purple · IBM Plex Mono + Space Grotesk */

:root {
  --navy-950: #060b18;
  --navy-900: #0a1224;
  --navy-800: #101c38;
  --navy-700: #182848;
  --felt: #0d1b34;
  --gold: #e8b93b;
  --gold-dim: #a8862c;
  --purple: #4a2d7a;
  --purple-bright: #7b52c4;
  --blue: #3f8cff;
  --blue-bright: #5aa2ff;
  --red: #e2504c;
  --text: #e8ecf4;
  --text-dim: #8b96ad;
  --card-face: #f4f1e8;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'Space Grotesk', sans-serif;
}

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

body {
  background: var(--navy-950);
  background-image: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(74,45,122,.12), transparent);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }
.mono { font-family: var(--mono); font-size: .85em; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 22px;
  border-bottom: 1px solid rgba(232,185,59,.18);
  background: rgba(6,11,24,.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 30;
}
.brand { gap: 12px; }
.brand-logo {
  height: 54px;
  width: auto;
  display: block;
  filter: drop-shadow(0 0 10px rgba(232,185,59,.3));
}
.brand-text h1 { font-size: 1.25rem; letter-spacing: .02em; }
.brand-text h1 em { font-style: normal; color: var(--gold); }
.brand-sub { font-family: var(--mono); font-size: .68rem; color: var(--text-dim); letter-spacing: .08em; }
.wallet-area { display: flex; align-items: center; gap: 10px; }
.wallet-addr { font-family: var(--mono); font-size: .78rem; color: var(--blue-bright); }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--sans); font-weight: 500; font-size: .9rem;
  padding: 9px 18px; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; transition: transform .08s, filter .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-gold { background: var(--gold); color: var(--navy-950); }
.btn-gold:hover:not(:disabled) { filter: brightness(1.1); }
.btn-gold-outline { background: transparent; color: var(--gold); border-color: var(--gold); }
.btn-gold-outline:hover:not(:disabled) { background: rgba(232,185,59,.1); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover:not(:disabled) { filter: brightness(1.12); }
.btn-red { background: transparent; color: var(--red); border-color: var(--red); }
.btn-red:hover:not(:disabled) { background: rgba(226,80,76,.12); }
.btn-ghost { background: transparent; color: var(--text-dim); border-color: rgba(139,150,173,.35); }
.btn-ghost:hover:not(:disabled) { color: var(--text); }

/* ---------- lobby ---------- */
.lobby { max-width: 860px; margin: 0 auto; padding: 34px 20px 60px; width: 100%; }
.lobby-head h2 { font-size: 1.5rem; margin-bottom: 6px; }
.lobby-head p { color: var(--text-dim); font-size: .9rem; margin-bottom: 26px; }
.table-list { display: grid; gap: 14px; }
.table-card {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-900));
  border: 1px solid rgba(232,185,59,.22);
  border-radius: 12px; padding: 18px 22px;
  transition: border-color .2s, box-shadow .2s;
}
.table-card:hover { border-color: rgba(232,185,59,.5); box-shadow: 0 0 18px rgba(232,185,59,.08); }
.table-card h3 { font-size: 1.05rem; margin-bottom: 4px; }
.table-card .tc-info { font-family: var(--mono); font-size: .74rem; color: var(--text-dim); }
.table-card .tc-players { font-family: var(--mono); font-size: .8rem; color: var(--blue-bright); margin-right: 16px; }
.loading { color: var(--text-dim); font-family: var(--mono); }
.fair-note {
  margin-top: 30px; padding: 14px 16px;
  border-left: 3px solid var(--gold);
  background: rgba(232,185,59,.05);
  font-size: .82rem; color: var(--text-dim); line-height: 1.55;
}

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(4,8,18,.85);
  display: grid; place-items: center; z-index: 50;
}
.modal-box {
  width: min(420px, 92vw);
  background: var(--navy-800);
  border: 1px solid rgba(232,185,59,.3);
  border-radius: 14px; padding: 26px;
}
.modal-box h3 { margin-bottom: 18px; }
.modal-box label { display: block; font-size: .82rem; color: var(--text-dim); margin-bottom: 14px; }
.modal-box input {
  display: block; width: 100%; margin-top: 6px;
  background: var(--navy-950); color: var(--text);
  border: 1px solid rgba(139,150,173,.3); border-radius: 8px;
  padding: 10px 12px; font-family: var(--mono); font-size: .95rem;
}
.modal-box .hint { font-size: .72rem; font-family: var(--mono); color: var(--text-dim); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.status { margin-top: 12px; font-family: var(--mono); font-size: .76rem; color: var(--blue-bright); min-height: 1.2em; }

/* ---------- game ---------- */
.game { flex: 1; display: flex; flex-direction: column; padding: 12px 16px 20px; max-width: 1080px; margin: 0 auto; width: 100%; }
.game-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.game-title { text-align: center; }
.game-title #game-table-name { font-weight: 700; }
.game-title #game-blinds { display: block; color: var(--text-dim); font-size: .72rem; }
.game-head-right { display: flex; gap: 8px; }

/* ---------- poker table (signature element) ---------- */
.table-wrap { position: relative; width: 100%; }
.poker-table {
  position: relative;
  width: 100%; aspect-ratio: 16 / 9.5;
  max-height: 62vh;
}
.table-rail {
  position: absolute; inset: 9% 4%;
  border-radius: 50% / 56%;
  background: linear-gradient(160deg, #2a1a40, #120d20);
  box-shadow:
    0 0 0 2px rgba(232,185,59,.6),
    0 0 0 4px rgba(74,45,122,.4),
    0 18px 50px rgba(0,0,0,.7),
    inset 0 2px 8px rgba(232,185,59,.2);
}
.table-felt {
  position: absolute; inset: 12.5% 7%;
  border-radius: 50% / 56%;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(74,45,122,.25), transparent 65%),
    radial-gradient(ellipse at 50% 50%, #1a1030, #0d0820 75%);
  box-shadow: inset 0 0 60px rgba(0,0,0,.6);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
}
.felt-logo {
  position: absolute; top: 18%;
  font-family: var(--mono); font-size: clamp(.55rem, 1.4vw, .8rem);
  letter-spacing: .5em; color: rgba(232,185,59,.2);
  pointer-events: none;
}
.board { display: flex; gap: clamp(3px, .8vw, 8px); min-height: clamp(44px, 8vw, 74px); align-items: center; }
.pot { font-family: var(--mono); color: var(--gold); font-size: clamp(.7rem, 1.6vw, .95rem); }
.phase-tag {
  font-family: var(--mono); font-size: clamp(.55rem, 1.1vw, .7rem);
  color: var(--purple-bright); letter-spacing: .2em; text-transform: uppercase;
}

/* cards */
.card {
  width: clamp(30px, 5.2vw, 52px); height: clamp(44px, 7.6vw, 74px);
  border-radius: 6px;
  background: var(--card-face);
  color: var(--navy-950);
  font-family: var(--mono); font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: clamp(.7rem, 1.7vw, 1.05rem);
  box-shadow: 0 3px 8px rgba(0,0,0,.45);
  line-height: 1.05;
}
.card .suit { font-size: 1.15em; }
.card.red { color: #c0392b; }
.card.back {
  background: linear-gradient(135deg, var(--purple) 0%, #2a1a50 100%);
  border: 1px solid var(--gold-dim);
  color: transparent;
}
.card.back::after {
  content: '♠'; color: rgba(232,185,59,.35); font-size: 1.4em; position: absolute;
}
.card { position: relative; }
.card.dim { opacity: .35; }

/* seats */
.seat {
  position: absolute; width: clamp(110px, 17vw, 168px);
  transform: translate(-50%, -50%);
  text-align: center;
}
.pos-0 { left: 50%; top: 94%; }
.pos-1 { left: 12%; top: 76%; }
.pos-2 { left: 8%;  top: 28%; }
.pos-3 { left: 50%; top: 5%; }
.pos-4 { left: 92%; top: 28%; }
.pos-5 { left: 88%; top: 76%; }

.seat-box {
  background: rgba(10,18,36,.92);
  border: 1px solid rgba(139,150,173,.3);
  border-radius: 10px; padding: 6px 8px;
  transition: border-color .2s, box-shadow .2s;
}
.seat.to-act .seat-box {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(232,185,59,.5);
}
.seat.folded .seat-box { opacity: .4; }
.seat.viewer .seat-box { border-color: var(--purple-bright); }
.seat-name { font-size: clamp(.62rem, 1.3vw, .8rem); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-stack { font-family: var(--mono); font-size: clamp(.58rem, 1.2vw, .74rem); color: var(--gold); }
.seat-cards { display: flex; justify-content: center; gap: 3px; margin-top: 4px; min-height: clamp(30px, 5vw, 48px); }
.seat-cards .card { width: clamp(22px, 3.4vw, 34px); height: clamp(30px, 5vw, 48px); font-size: clamp(.55rem, 1.1vw, .8rem); border-radius: 4px; }
.seat-bet { font-family: var(--mono); font-size: clamp(.58rem, 1.1vw, .72rem); color: var(--blue-bright); margin-top: 3px; min-height: 1em; }
.seat-tag {
  position: absolute; top: -8px; right: -4px;
  font-family: var(--mono); font-size: .58rem;
  background: var(--gold); color: var(--navy-950);
  border-radius: 50%; width: 18px; height: 18px;
  display: grid; place-items: center; font-weight: 600;
}
.seat-status { font-family: var(--mono); font-size: .58rem; color: var(--red); }
.seat-result { font-family: var(--mono); font-size: .6rem; color: var(--gold); }
.seat-empty {
  border: 1px dashed rgba(139,150,173,.25); border-radius: 10px;
  padding: 12px 8px; color: var(--text-dim);
  font-family: var(--mono); font-size: .64rem;
}

/* ---------- result banner ---------- */
.result-banner {
  margin: 10px auto 0; max-width: 640px; width: 100%;
  background: rgba(74,45,122,.15);
  border: 1px solid rgba(232,185,59,.4);
  border-radius: 10px; padding: 10px 16px;
  text-align: center; font-size: .88rem;
}
.result-banner .rb-amount { color: var(--gold); font-family: var(--mono); }

/* ---------- action bar ---------- */
.action-bar {
  margin: 12px auto 0; max-width: 640px; width: 100%;
  background: var(--navy-800);
  border: 1px solid rgba(232,185,59,.25);
  border-radius: 12px; padding: 12px 14px;
}
.action-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.action-buttons .btn { flex: 1; min-width: 84px; }
.raise-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.raise-row input[type=range] { flex: 1; accent-color: var(--gold); }
.raise-amount {
  width: 110px; background: var(--navy-950); color: var(--gold);
  border: 1px solid rgba(232,185,59,.4); border-radius: 8px;
  padding: 7px 10px; font-family: var(--mono);
}
.raise-row .hint { font-family: var(--mono); font-size: .7rem; color: var(--text-dim); }
.timer-bar { height: 4px; background: var(--navy-950); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.timer-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--gold), var(--purple-bright)); transition: width .5s linear; }

/* ---------- fair line / toast / footer ---------- */
.fair-line {
  display: flex; gap: 16px; justify-content: center; align-items: center;
  margin-top: 12px; font-family: var(--mono); font-size: .66rem; color: var(--text-dim);
  flex-wrap: wrap;
}
.fair-line a { color: var(--blue-bright); }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--navy-700); border: 1px solid var(--gold);
  color: var(--text); border-radius: 10px; padding: 11px 20px;
  font-size: .85rem; z-index: 90; max-width: 90vw; text-align: center;
}
.footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 14px 22px; border-top: 1px solid rgba(139,150,173,.15);
  font-size: .72rem; color: var(--text-dim);
}
.footer a { color: var(--blue-bright); text-decoration: none; }

@media (max-width: 640px) {
  .poker-table { aspect-ratio: 4 / 5; max-height: none; }
  .pos-1 { left: 14%; top: 80%; }
  .pos-2 { left: 6%;  top: 32%; }
  .pos-4 { left: 94%; top: 32%; }
  .pos-5 { left: 86%; top: 80%; }
  .topbar { flex-direction: column; gap: 10px; }
  .brand-logo { height: 38px; }
  .brand-text h1 { font-size: 1rem; }
  .brand-sub { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
