@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Inter:wght@500;600;700;800;900&display=swap');

:root {
  --ink: #07100d;
  --deep: #0a1713;
  --panel: #0e1d18;
  --line: #284139;
  --muted: #82958e;
  --paper: #f0eee4;
  --acid: #d8ff3e;
  --green: #2bd686;
  --red: #ff685f;
  --blue: #8fb7ff;
  color-scheme: dark;
  font-family: Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--ink); }
body { margin: 0; min-height: 100vh; color: var(--paper); background: radial-gradient(circle at 50% -20%, #18382d 0, var(--ink) 45%); }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .38; }
.hidden { display: none !important; }
.noise { position: fixed; inset: 0; pointer-events: none; opacity: .055; z-index: 10; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.75'/%3E%3C/svg%3E"); }

.wordmark { display: inline-flex; align-items: center; gap: 11px; color: var(--paper); text-decoration: none; font: 800 13px/11px Inter; letter-spacing: -.03em; }
.mark { display: grid; place-items: center; width: 36px; height: 36px; color: var(--ink); background: var(--acid); font: 900 20px/1 Inter; transform: rotate(-3deg); }
.landing { width: min(1240px, 100%); min-height: 100vh; margin: auto; padding: 26px 40px 70px; }
.landing-nav { display: flex; align-items: center; justify-content: space-between; }
.text-button, .icon-button { border: 0; background: transparent; font: 600 11px DM Mono; letter-spacing: .08em; }
.text-button { border-bottom: 1px solid var(--muted); padding: 8px 0; }
.hero { width: min(850px, 100%); padding: 11vh 0 42px; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: var(--green); font: 500 11px DM Mono; letter-spacing: .15em; }
.eyebrow span { width: 28px; height: 2px; background: currentColor; }
h1 { margin: 22px 0; font-size: clamp(47px, 7.5vw, 102px); line-height: .87; letter-spacing: -.075em; font-weight: 900; }
h1 em { color: var(--acid); font-style: normal; }
.hero-copy { width: min(640px, 100%); margin: 30px 0; color: #b8c5bf; font-size: 16px; line-height: 1.65; }
.proof-strip { display: flex; align-items: center; gap: 12px; width: min(520px, 100%); color: var(--muted); font: 500 10px DM Mono; letter-spacing: .12em; }
.proof-strip i { height: 1px; flex: 1; background: var(--line); }

.lobby-card { width: min(920px, 100%); display: grid; grid-template-columns: 1fr 2fr; border: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 90%, transparent); box-shadow: 0 30px 90px #0005; }
.tabs { border-right: 1px solid var(--line); }
.tab { display: block; width: 100%; padding: 24px 20px; border: 0; border-bottom: 1px solid var(--line); color: var(--muted); background: transparent; text-align: left; font: 600 11px DM Mono; letter-spacing: .08em; }
.tab.active { color: var(--acid); background: #15251e; box-shadow: inset 3px 0 var(--acid); }
.lobby-form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 26px; }
.lobby-form label:first-child, .lobby-form .primary { grid-column: span 2; }
label { display: grid; gap: 8px; color: var(--muted); font: 500 9px DM Mono; letter-spacing: .12em; }
input { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 0; outline: none; padding: 13px 14px; color: var(--paper); background: #08130f; font: 500 15px DM Mono; }
input:focus { border-color: var(--acid); box-shadow: 0 0 0 1px var(--acid); }
.primary { display: flex; align-items: center; justify-content: space-between; border: 0; padding: 16px 18px; color: var(--ink); background: var(--acid); font: 800 12px DM Mono; letter-spacing: .08em; }
.primary:hover { filter: brightness(1.08); }
.primary span { font-size: 20px; }
.microcopy { align-self: end; margin: 0; padding: 0 26px 25px; color: var(--muted); font: 400 10px DM Mono; }

.game { min-height: 100vh; padding-bottom: 50px; }
.game-nav { height: 66px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 24px; border-bottom: 1px solid var(--line); background: #07100dec; position: relative; z-index: 5; }
.wordmark.compact { font-size: 11px; }
.wordmark.compact .mark { width: 30px; height: 30px; font-size: 16px; }
.room-meta { text-align: center; font: 600 10px DM Mono; letter-spacing: .08em; }
.room-meta > span { display: block; color: var(--muted); margin-bottom: 3px; }
.room-code { padding: 0; border: 0; color: var(--paper); background: none; font: inherit; }
.room-code:hover { color: var(--acid); }
.nav-actions { justify-self: end; display: flex; align-items: center; gap: 14px; }
.icon-button { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid var(--line); }
.connection-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red); }
.connection-dot.online { background: var(--green); box-shadow: 0 0 10px var(--green); }
.mode-banner { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 32px; min-height: 82px; padding: 14px max(24px, calc((100vw - 1160px) / 2)); border-bottom: 1px solid var(--line); background: #0b1914; }
.mode-banner small { display: block; margin-bottom: 4px; color: var(--muted); font: 500 9px DM Mono; letter-spacing: .12em; }
.mode-banner strong { font-size: 30px; letter-spacing: -.04em; }
.mode-banner p { max-width: 420px; margin: 0; color: var(--muted); font: 400 11px/1.5 DM Mono; }
.mode-banner.high { box-shadow: inset 5px 0 var(--blue); }
.mode-banner.high strong { color: var(--blue); }
.mode-banner.low { box-shadow: inset 5px 0 var(--acid); }
.mode-banner.low strong { color: var(--acid); }
.verify-button { border: 1px solid var(--line); padding: 10px 12px; color: var(--muted); background: transparent; font: 500 9px DM Mono; letter-spacing: .08em; }
.verify-button:hover { border-color: var(--paper); color: var(--paper); }

.table-wrap { padding: 42px 20px 20px; overflow: hidden; }
.poker-table { position: relative; width: min(960px, 88vw); height: min(520px, 56vw); min-height: 430px; margin: auto; border: 2px solid #335748; border-radius: 48%; background: radial-gradient(ellipse, #173c2e 0, #0f2a20 68%, #0b1c17 100%); box-shadow: inset 0 0 0 13px #081611, inset 0 0 0 15px #29463b, 0 35px 80px #0008; }
.poker-table::after { content: "RETARD POKER · HIGH / LOW"; position: absolute; left: 50%; top: 60%; transform: translate(-50%, -50%); color: #55766955; font: 600 10px DM Mono; letter-spacing: .3em; white-space: nowrap; }
.table-center { position: absolute; z-index: 2; inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: 70%; display: grid; justify-items: center; gap: 13px; }
.pot-label { color: var(--muted); font: 500 10px DM Mono; letter-spacing: .1em; }
.pot-label strong { color: var(--paper); font-size: 13px; }
.board { display: flex; gap: 7px; min-height: 79px; }
.card { width: clamp(43px, 6vw, 62px); aspect-ratio: .71; display: grid; padding: 7px; border-radius: 5px; color: #111713; background: #f1efe5; box-shadow: 0 5px 12px #0006; font: 800 clamp(14px, 2vw, 20px)/1 DM Mono; }
.card.red { color: #d53d3d; }
.card span:last-child { align-self: end; justify-self: end; font-size: 1.25em; }
.card.back { place-items: center; padding: 3px; color: var(--acid); background: repeating-linear-gradient(45deg, #10261e, #10261e 4px, #19382d 4px, #19382d 8px); border: 2px solid #dbe2d9; }
.card.back::after { content: "R"; display: grid; place-items: center; width: 70%; aspect-ratio: 1; border: 1px solid var(--acid); }
.street-label { color: #759087; font: 500 9px DM Mono; letter-spacing: .12em; }
.seats { position: absolute; inset: 0; z-index: 3; }
.seat { position: absolute; width: 170px; min-height: 81px; padding: 11px; border: 1px solid #345047; background: #0a1512ed; box-shadow: 0 8px 25px #0007; transform: translate(-50%, -50%); }
.seat:nth-child(1) { left: 50%; top: 100%; }
.seat:nth-child(2) { left: 13%; top: 84%; }
.seat:nth-child(3) { left: 0%; top: 50%; }
.seat:nth-child(4) { left: 16%; top: 10%; }
.seat:nth-child(5) { left: 50%; top: 0%; }
.seat:nth-child(6) { left: 84%; top: 10%; }
.seat:nth-child(7) { left: 100%; top: 50%; }
.seat:nth-child(8) { left: 87%; top: 84%; }
.seat.current { border-color: var(--acid); box-shadow: 0 0 0 1px var(--acid), 0 0 28px #d8ff3e22; }
.seat.folded { opacity: .45; }
.seat.disconnected::after { content: "OFFLINE"; position: absolute; right: 7px; top: 7px; color: var(--red); font: 500 7px DM Mono; }
.seat-top { display: flex; justify-content: space-between; align-items: center; }
.player-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 700; }
.player-chips { color: var(--acid); font: 500 10px DM Mono; }
.badges { min-height: 15px; margin: 5px 0; display: flex; gap: 4px; }
.badge { padding: 2px 4px; color: var(--muted); background: #1a2b25; font: 500 7px DM Mono; }
.badge.dealer { color: var(--ink); background: var(--paper); }
.badge.allin { color: var(--ink); background: var(--red); }
.hole-cards { display: flex; gap: 4px; position: absolute; left: 50%; bottom: -28px; transform: translateX(-50%); }
.hole-cards .card { width: 38px; padding: 5px; font-size: 12px; }
.seat-bet { position: absolute; left: 50%; top: -22px; transform: translateX(-50%); color: var(--paper); font: 600 9px DM Mono; white-space: nowrap; }
.hand-result { color: var(--green); font: 500 8px/1.3 DM Mono; }

.action-dock { width: min(840px, calc(100% - 32px)); min-height: 76px; margin: 30px auto 0; display: grid; place-items: center; border: 1px solid var(--line); background: #0b1612; }
.turn-message { padding: 18px; color: var(--muted); font: 500 11px DM Mono; text-align: center; }
.actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr 2fr 1fr; gap: 8px; padding: 10px; }
.action { border: 1px solid var(--line); min-height: 52px; background: #12231d; font: 700 10px DM Mono; letter-spacing: .08em; }
.action:hover { border-color: var(--paper); }
.action.primary-action { color: var(--ink); border: 0; background: var(--acid); }
.action.danger { color: var(--red); }
.raise-group { display: grid; grid-template-columns: 1fr 1fr; }
.raise-group label { padding: 6px 9px; border: 1px solid var(--line); border-right: 0; }
.raise-group input { border: 0; padding: 0; font-size: 13px; }
.raise-group input:focus { box-shadow: none; }
.host-controls { padding: 10px; width: min(360px, 100%); }
.host-controls .primary { width: 100%; }

.lower-grid { width: min(960px, calc(100% - 32px)); margin: 36px auto; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { min-height: 190px; border: 1px solid var(--line); background: #09130f; }
.panel-title { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 12px 14px; color: var(--muted); font: 500 9px DM Mono; letter-spacing: .12em; }
.panel-title span { color: var(--green); }
.hand-log { max-height: 190px; overflow: auto; margin: 0; padding: 8px 14px; list-style: none; }
.hand-log li { padding: 7px 0; border-bottom: 1px solid #1b2b25; color: #9cadA6; font: 400 10px/1.4 DM Mono; }
.fairness-summary { padding: 15px; color: var(--muted); font: 400 9px/1.7 DM Mono; overflow-wrap: anywhere; }
.fairness-summary strong { color: var(--paper); }
.mono-value { display: block; margin: 4px 0 10px; padding: 7px; background: #07100d; color: #9db6ac; }

.dialog { width: min(700px, calc(100% - 28px)); border: 1px solid #426052; border-radius: 0; padding: 30px; color: var(--paper); background: #0b1713; box-shadow: 0 30px 120px #000; }
.dialog::backdrop { background: #020604d9; backdrop-filter: blur(5px); }
.dialog-close { position: absolute; top: 15px; right: 17px; border: 0; color: var(--muted); background: transparent; font-size: 27px; }
.dialog h2 { margin: 17px 0 8px; font-size: 32px; letter-spacing: -.05em; }
.dialog p { color: var(--muted); font: 400 11px/1.6 DM Mono; }
.dialog form { display: grid; gap: 18px; }
.rules-dialog { width: min(900px, calc(100% - 28px)); }
.rules-grid { display: grid; grid-template-columns: 1fr 1fr; margin-top: 25px; border: solid var(--line); border-width: 1px 0 0 1px; }
.rules-grid article { min-height: 170px; padding: 18px; border: solid var(--line); border-width: 0 1px 1px 0; }
.rules-grid b { color: var(--acid); font: 500 10px DM Mono; }
.rules-grid h3 { margin: 13px 0 7px; font-size: 14px; }
.rules-grid p { margin: 0; }
.proof-row { margin: 16px 0; }
.proof-row label { margin-bottom: 5px; }
.proof-row code { display: block; padding: 11px; background: #06100c; color: #a9bdb5; font: 400 10px/1.5 DM Mono; overflow-wrap: anywhere; }
.proof-result { border-left: 3px solid var(--acid); padding: 12px; background: #14231d; font: 500 11px DM Mono; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; transform: translate(-50%, 30px); padding: 12px 18px; opacity: 0; pointer-events: none; color: var(--ink); background: var(--paper); font: 600 10px DM Mono; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { color: white; background: var(--red); }

@media (max-width: 760px) {
  .landing { padding: 20px 18px 50px; }
  .hero { padding-top: 9vh; }
  h1 { font-size: clamp(45px, 15vw, 68px); }
  .hero-copy { font-size: 14px; }
  .lobby-card { grid-template-columns: 1fr; }
  .tabs { display: flex; border-right: 0; border-bottom: 1px solid var(--line); }
  .tab { border-bottom: 0; border-right: 1px solid var(--line); }
  .lobby-form { grid-template-columns: 1fr; padding: 20px; }
  .lobby-form label:first-child, .lobby-form .primary { grid-column: auto; }
  .microcopy { padding: 0 20px 20px; }
  .game-nav { grid-template-columns: auto 1fr auto; padding: 0 12px; }
  .wordmark.compact span:last-child { display: none; }
  .room-meta { justify-self: center; }
  .mode-banner { grid-template-columns: 1fr auto; gap: 10px; padding: 12px 16px; }
  .mode-banner p { grid-column: span 2; grid-row: 2; }
  .mode-banner strong { font-size: 24px; }
  .table-wrap { padding: 55px 10px 35px; overflow-x: clip; }
  .poker-table { width: 94vw; height: 540px; min-height: 0; border-radius: 46%; }
  .seat { width: 118px; min-height: 72px; padding: 8px; }
  .seat:nth-child(1) { left: 50%; top: 98%; }
  .seat:nth-child(2) { left: 12%; top: 85%; }
  .seat:nth-child(3) { left: 2%; top: 55%; }
  .seat:nth-child(4) { left: 15%; top: 17%; }
  .seat:nth-child(5) { left: 50%; top: 2%; }
  .seat:nth-child(6) { left: 85%; top: 17%; }
  .seat:nth-child(7) { left: 98%; top: 55%; }
  .seat:nth-child(8) { left: 88%; top: 85%; }
  .player-name { font-size: 10px; }
  .card { width: 43px; }
  .board { gap: 3px; }
  .table-center { width: 90%; }
  .actions { grid-template-columns: 1fr 1fr; }
  .raise-group { grid-column: span 2; }
  .lower-grid { grid-template-columns: 1fr; }
  .rules-grid { grid-template-columns: 1fr; }
  .dialog { padding: 25px 18px; }
}

@media (max-width: 410px) {
  .seat { width: 104px; }
  .hole-cards .card { width: 34px; }
  .card { width: 39px; }
}
