/* ============================================================
   FREEROLL — premium dark poker lounge
   ============================================================ */

:root {
  --bg: #0a0a0c;
  --bg-2: #0d0d11;
  --panel: #141418;
  --panel-2: #1a1a20;
  --line: #2a2a31;
  --line-soft: rgba(255, 255, 255, 0.06);

  --text: #f4f0e8;
  --muted: #968f83;
  --muted-2: #6c665d;

  --gold-1: #f7dca0;
  --gold: #e7b86a;
  --gold-2: #c8923a;
  --gold-grad: linear-gradient(135deg, #f7dca0 0%, #e7b86a 45%, #c8923a 100%);

  --felt: #15533c;
  --felt-2: #0d3527;
  --felt-edge: #082018;

  --red: #e2596d;
  --green: #54d6a0;
  --info: #6ea8ff;

  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Hanken Grotesk", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 50% -8%, #17161c 0%, rgba(23, 22, 28, 0) 70%),
    radial-gradient(900px 700px at 85% 110%, #11211b 0%, rgba(17, 33, 27, 0) 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Subtle film grain for depth */
.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hidden { display: none !important; }

.error {
  color: var(--red);
  min-height: 1.2em;
  margin-top: 10px;
  font-size: 0.9rem;
}

::selection { background: rgba(231, 184, 106, 0.25); }

/* ---------- Buttons ---------- */

button { cursor: pointer; font-family: inherit; }

.btn-gold {
  border: none;
  border-radius: 11px;
  padding: 14px 22px;
  font-weight: 800;
  font-size: 0.98rem;
  letter-spacing: 0.2px;
  color: #2a1c05;
  background: var(--gold-grad);
  box-shadow: 0 8px 22px rgba(200, 146, 58, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn-gold:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-gold:active { transform: translateY(0); }
.btn-gold:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  border-radius: 11px;
  padding: 13px 18px;
  font-weight: 600;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.btn-ghost:hover { color: var(--text); border-color: #3c3c46; }

.btn-gold.sm, .btn-ghost.sm { padding: 9px 16px; font-size: 0.85rem; border-radius: 9px; }

/* ---------- Topbar ---------- */

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 30px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(20, 20, 24, 0.7), rgba(10, 10, 12, 0));
  backdrop-filter: blur(6px);
}
.topbar-left { display: flex; align-items: center; gap: 24px; }
.topbar-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: color 0.2s;
}
.topbar-link:hover { color: var(--gold-1); }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark { height: 38px; width: 38px; border-radius: 9px; display: block; object-fit: cover; box-shadow: 0 4px 12px rgba(0,0,0,0.5); }
.brand-word {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 1px;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.pot { text-align: right; line-height: 1.15; }
.pot-label {
  font-size: 0.62rem;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted-2);
}
.pot-amount {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 1.7rem;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pot-cur, .pot-symbol2 { font-size: 0.7em; opacity: 0.85; margin-left: 4px; }
.pot-sub { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.pot-sub strong { color: var(--gold-1); font-weight: 700; }

/* ---------- Enter / register ---------- */

.enter {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  padding: 7vh 20px 40px;
}
.enter-card {
  width: 440px;
  max-width: 100%;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 34px 32px 30px;
  box-shadow: var(--shadow);
  text-align: center;
  animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.enter-mark { width: 76px; height: 76px; border-radius: 18px; object-fit: cover; margin-bottom: 14px; box-shadow: 0 10px 26px rgba(0,0,0,0.5); }
.enter-title {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 2.2rem;
  line-height: 1.05;
  margin: 6px 0 12px;
}
.enter-title span {
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.enter-sub { color: var(--muted); font-size: 0.95rem; line-height: 1.5; margin: 0 0 22px; }

.field { text-align: left; margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.field .hint { text-transform: none; letter-spacing: 0; color: var(--muted-2); font-size: 0.78rem; }
.field input,
.raise-inputs input[type="number"] {
  width: 100%;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0c0c0f;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus {
  outline: none;
  border-color: var(--gold-2);
  box-shadow: 0 0 0 3px rgba(231, 184, 106, 0.15);
}
.enter-card .btn-gold { width: 100%; margin-top: 8px; }
.enter-docs-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: color 0.2s, border-color 0.2s;
}
.enter-docs-link:hover { color: var(--gold-1); border-color: var(--gold-2); }

/* ---------- Room layout ---------- */

.room { position: relative; z-index: 2; padding: 22px 24px 40px; }

.lobby-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 960px;
  margin: 0 auto 22px;
  padding: 13px 18px;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.lobby-left { display: flex; align-items: center; gap: 10px; }
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted-2);
  box-shadow: 0 0 0 0 rgba(84, 214, 160, 0.5);
}
.dot.live { background: var(--green); animation: pulse 1.8s infinite; }
.dot.wait { background: var(--gold); }
.lobby-status { font-weight: 600; font-size: 0.92rem; }
.lobby-meta { color: var(--muted); font-size: 0.88rem; }
.lobby-meta .sep { opacity: 0.4; margin: 0 4px; }
.lobby-meta #countdownInfo { color: var(--gold-1); font-weight: 700; }
.lobby-actions { display: flex; gap: 8px; }

/* ---------- Poker table ---------- */

.table-wrap { display: flex; justify-content: center; }
.poker-table {
  position: relative;
  width: min(860px, 92vw, 96vh);
  aspect-ratio: 1.55 / 1;
  border-radius: 50%;
  padding: 18px;
  background:
    linear-gradient(180deg, #3a2c12, #261c0c),
    var(--gold-grad);
  background-blend-mode: overlay;
  box-shadow: var(--shadow), inset 0 2px 4px rgba(255, 255, 255, 0.15);
}
.poker-table::before {
  /* gold rim sheen */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255,255,255,0.5), rgba(0,0,0,0.4));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.rail {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.felt {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(120% 120% at 50% 30%, #1d6347 0%, var(--felt) 38%, var(--felt-2) 78%, var(--felt-edge) 100%);
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.6), inset 0 0 0 2px rgba(0,0,0,0.35);
}
.felt::after {
  /* faint center logo watermark */
  content: "";
  position: absolute;
  inset: 0;
  background: url("/freeroll-emblem.png") center 42% / 130px no-repeat;
  opacity: 0.05;
  filter: grayscale(0.2);
  pointer-events: none;
}

.board {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 3;
}
.community { display: flex; gap: 8px; justify-content: center; min-height: 78px; }
.pot-pill {
  margin-top: 14px;
  display: inline-block;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(247, 220, 160, 0.25);
  color: var(--gold-1);
  padding: 6px 18px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.3px;
}
.street-label {
  margin-top: 9px;
  font-size: 0.66rem;
  letter-spacing: 3px;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
}

/* ---------- Cards ---------- */

.pcard {
  position: relative;
  width: 54px;
  height: 76px;
  border-radius: 8px;
  background: linear-gradient(160deg, #ffffff, #eceadf);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: deal 0.3s ease both;
}
.pcard .cr {
  position: absolute;
  top: 5px;
  left: 7px;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1;
}
.pcard .cs { font-size: 1.7rem; line-height: 1; }
.pcard.red { color: var(--red); }
.pcard.black { color: #1a1a20; }
.pcard.mini { width: 38px; height: 54px; }
.pcard.mini .cr { font-size: 0.7rem; top: 3px; left: 4px; }
.pcard.mini .cs { font-size: 1.15rem; }
.pcard.back {
  background:
    repeating-linear-gradient(45deg, #20314f 0 6px, #1a2942 6px 12px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45), inset 0 0 0 2px rgba(231, 184, 106, 0.4);
}
.pcard.back::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(231, 184, 106, 0.35);
  border-radius: 4px;
}

/* ---------- Seats ---------- */

.seats { position: absolute; inset: 0; z-index: 4; }
.seat {
  position: absolute;
  width: 132px;
  transform: translate(-50%, -50%);
  text-align: center;
}
.seat .hole { display: flex; gap: 4px; justify-content: center; margin-bottom: 5px; min-height: 54px; }
.seat .plate {
  background: linear-gradient(180deg, #1c1c22, #131318);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
}
.seat.toact .plate {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 22px rgba(231, 184, 106, 0.35);
}
.seat.folded { opacity: 0.45; filter: saturate(0.6); }
.seat .pname {
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seat .pstack {
  font-family: "Fraunces", serif;
  color: var(--gold-1);
  font-size: 0.9rem;
  font-weight: 600;
}
.seat .pbet { color: var(--muted); font-size: 0.72rem; min-height: 1em; }
.seat .status-tag {
  font-size: 0.6rem;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  min-height: 0.9em;
}
.seat .badge {
  display: inline-block;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 7px;
  margin-left: 5px;
  vertical-align: middle;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}
.seat .badge.btn { background: var(--gold-grad); color: #2a1c05; }

/* ---------- Table overlay (intermission) ---------- */

.table-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: radial-gradient(circle at 50% 45%, rgba(8, 12, 10, 0.55), rgba(6, 16, 12, 0.85));
  border-radius: 50%;
}
.overlay-title { font-size: 0.72rem; letter-spacing: 3px; text-transform: uppercase; color: var(--muted); }
.overlay-big {
  font-family: "Fraunces", serif;
  font-size: 4.2rem;
  font-weight: 600;
  line-height: 1.05;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.overlay-sub { color: var(--muted); font-size: 0.9rem; }

/* ---------- Control deck ---------- */

.control-deck { max-width: 720px; margin: 22px auto 0; }
.status-line {
  text-align: center;
  color: var(--muted);
  min-height: 1.4em;
  font-size: 0.95rem;
}
.turn-timer {
  width: min(360px, 80vw);
  height: 6px;
  margin: 10px auto 0;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  overflow: hidden;
}
.turn-timer.mine { height: 9px; box-shadow: 0 0 0 1px rgba(231, 184, 106, 0.4); }
.turn-timer-fill {
  height: 100%;
  width: 100%;
  background: var(--green);
  transition: width 0.2s linear, background 0.3s;
}
.turn-timer-fill.warn { background: var(--gold); }
.turn-timer-fill.danger { background: var(--red); }

.sit-in-row { text-align: center; }
.sit-in-row #sitInBtn { margin: 12px auto 0; }

.actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 18px;
  min-height: 52px;
}
.act {
  padding: 13px 24px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--panel-2);
  transition: transform 0.1s, filter 0.2s, opacity 0.2s;
}
.act:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.12); }
.act.fold { background: #3a1f25; color: #f0a9b3; border-color: #5a2c34; }
.act.check { background: #1e2a3f; color: #9cc0ff; border-color: #2c3f5f; }
.act.call { background: #143a2c; color: #79e8bf; border-color: #1f5a44; }
.act.raise { background: var(--gold-grad); color: #2a1c05; }
.act.allin {
  background: linear-gradient(135deg, #b9466b, #7d2b54);
  color: #ffd9e6;
}
.act:disabled { opacity: 0.3; cursor: not-allowed; }

.raise-group { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.raise-inputs { display: flex; flex-direction: column; gap: 4px; }
.raise-inputs input[type="number"] { width: 110px; padding: 9px 10px; text-align: center; }
.raise-inputs input[type="range"] { width: 130px; accent-color: var(--gold); }

.winner-banner {
  margin: 18px auto 0;
  text-align: center;
  background: linear-gradient(180deg, rgba(231,184,106,0.14), rgba(231,184,106,0.05));
  border: 1px solid rgba(231, 184, 106, 0.4);
  color: var(--gold-1);
  font-weight: 700;
  padding: 12px 18px;
  border-radius: 12px;
  animation: rise 0.4s ease both;
}

/* ---------- Payout feed ---------- */

.feed {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  width: 270px;
  max-height: 42vh;
  overflow: auto;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.feed h3 {
  margin: 0 0 10px;
  font-size: 0.68rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted-2);
}
.feed ul { list-style: none; margin: 0; padding: 0; }
.feed li {
  font-size: 0.82rem;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.feed li:last-child { border-bottom: none; }
.feed .amt { font-family: "Fraunces", serif; color: var(--green); font-weight: 600; }
.feed .amt.pending { color: var(--gold-1); }
.feed li.fail .amt { color: var(--red); }
.feed .ptag {
  margin-left: auto;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted-2);
}
.feed h3 .feed-tag {
  margin-left: 6px;
  font-size: 0.55rem;
  letter-spacing: 1px;
  color: var(--green);
  border: 1px solid color-mix(in srgb, var(--green) 40%, transparent);
  border-radius: 999px;
  padding: 2px 6px;
  vertical-align: middle;
}
.feed .feed-empty {
  color: var(--muted-2);
  font-size: 0.78rem;
  border-bottom: none;
}
.feed .parrow { color: var(--muted-2); }
.feed .paddr {
  font-family: "Hanken Grotesk", sans-serif;
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--line);
}
.feed .paddr:hover { color: var(--gold-1); }
.feed .verify {
  margin-left: auto;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--green);
  text-decoration: none;
  white-space: nowrap;
}
.feed .verify:hover { text-decoration: underline; }

/* ---------- Contract address bar ---------- */

.ca-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 18px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--muted);
  text-align: center;
  background: rgba(10, 10, 12, 0.72);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  backdrop-filter: blur(6px);
  max-width: 96vw;
}
.ca-bar .ca-line { white-space: nowrap; }
.ca-bar .ca-addr {
  color: var(--gold-1);
  font-family: ui-monospace, "SF Mono", monospace;
  font-weight: 600;
  user-select: all;
}

/* ---------- Animations ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes deal { from { opacity: 0; transform: translateY(-8px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(84, 214, 160, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(84, 214, 160, 0); }
  100% { box-shadow: 0 0 0 0 rgba(84, 214, 160, 0); }
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .topbar { padding: 12px 16px; }
  .topbar-link { display: none; }
  .brand img { height: 26px; }
  .pot-amount { font-size: 1.3rem; }
  .room { padding: 16px 12px 90px; }
  .feed { position: static; width: auto; max-height: none; margin: 20px auto 0; max-width: 960px; }
  .seat { width: 96px; }
  .pcard { width: 44px; height: 62px; }
  .pcard .cs { font-size: 1.3rem; }
}
