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

:root {
  --felt: #0c6b45;
  --felt-mid: #0a5236;
  --felt-dark: #062e1e;
  --gold: #e8c358;
  --gold-bright: #ffe08a;
  --gold-dim: #a3872f;
  --panel: #14181f;
  --panel-light: #1f2530;
  --panel-lighter: #2a3140;
  --line: #333c4d;
  --text: #f1f3f7;
  --text-dim: #97a1b5;
  --danger: #e6493f;
  --success: #34c47e;
  --accent: #4d8dff;
  --purple: #9b5de5;
}

body {
  font-family: 'Manrope', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #06070a;
  color: var(--text);
  min-height: 100vh;
  position: relative;
}

h1, h2, .brand, .gold-text {
  font-family: 'Cinzel', serif;
}

.bg-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, rgba(232, 195, 88, 0.10), transparent 60%),
    radial-gradient(ellipse 1000px 700px at 100% 100%, rgba(12, 107, 69, 0.25), transparent 60%),
    radial-gradient(ellipse 800px 600px at 0% 100%, rgba(155, 93, 229, 0.08), transparent 60%),
    #06070a;
}

.screen { min-height: 100vh; }
.hidden { display: none !important; }

.gold-text {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-dim));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Login ---------- */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, var(--felt) 0%, var(--felt-dark) 65%, #030904 100%);
}
.login-card {
  background: linear-gradient(180deg, rgba(20, 24, 30, 0.92), rgba(12, 14, 18, 0.96));
  border: 1px solid rgba(232, 195, 88, 0.35);
  border-radius: 20px;
  padding: 44px 40px;
  text-align: center;
  width: 360px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.65), 0 0 0 1px rgba(232,195,88,0.05) inset;
}
.login-emblem {
  font-size: 20px; letter-spacing: 10px; color: var(--gold);
  opacity: 0.85; margin-bottom: 14px;
}
.login-card h1 { font-size: 32px; font-weight: 800; letter-spacing: 1px; margin-bottom: 8px; color: var(--text); }
.subtitle { color: var(--text-dim); font-size: 13px; margin-bottom: 28px; letter-spacing: 0.3px; }
#name-input {
  width: 100%; padding: 13px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: #0e1116; color: var(--text); font-size: 14px; margin-bottom: 18px; outline: none;
  transition: border-color 0.15s;
}
#name-input:focus { border-color: var(--gold); }
#join-btn {
  width: 100%; padding: 14px; border: none; border-radius: 10px; cursor: pointer;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-dim)); color: #1b1300; font-weight: 800;
  font-size: 14px; letter-spacing: 0.4px; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#join-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(232,195,88,0.35); }

/* ---------- Shared topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px; background: linear-gradient(180deg, #171b23, #12151b);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
}
.brand { font-weight: 700; color: var(--gold); font-size: 19px; letter-spacing: 0.5px; }
.profile-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#player-name, #lobby-player-name { font-weight: 700; }
.chips-badge {
  background: #0e1116; border: 1px solid rgba(232,195,88,0.35); border-radius: 20px; padding: 7px 14px;
  font-weight: 800; color: var(--gold); font-size: 14px; box-shadow: 0 0 12px rgba(232,195,88,0.08) inset;
}
.small-btn {
  background: var(--panel-light); border: 1px solid var(--line); color: var(--text);
  padding: 9px 15px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.small-btn:hover { background: var(--panel-lighter); border-color: var(--gold-dim); transform: translateY(-1px); }
.small-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.icon-btn { padding: 9px 12px; font-size: 15px; }
.back-btn { color: var(--gold); }

/* ---------- Lobby screen ---------- */
.lobby-wrap {
  max-width: 1000px; margin: 0 auto; padding: 32px 24px 60px;
  display: flex; flex-direction: column; gap: 28px;
}
.lobby-create {
  background: linear-gradient(160deg, rgba(31,37,48,0.9), rgba(18,21,27,0.9));
  border: 1px solid var(--line); border-radius: 16px; padding: 24px 26px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.3);
}
.lobby-create h2, .lobby-list-header h2 {
  font-size: 17px; color: var(--gold); margin-bottom: 16px; letter-spacing: 0.4px;
}
.create-form { display: flex; flex-direction: column; gap: 14px; }
#table-name-input {
  width: 100%; padding: 12px 14px; border-radius: 9px; border: 1px solid var(--line);
  background: #0e1116; color: var(--text); font-size: 14px; outline: none;
}
#table-name-input:focus { border-color: var(--gold); }
.create-row { display: flex; gap: 16px; flex-wrap: wrap; }
.create-row label {
  display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.5px; flex: 1; min-width: 120px;
}
.create-row input, .create-row select {
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: #0e1116; color: var(--text); font-size: 14px; outline: none;
}
.create-row input:focus, .create-row select:focus { border-color: var(--gold); }
#create-table-btn {
  padding: 13px; border: none; border-radius: 9px; cursor: pointer; font-weight: 800; font-size: 14px;
  background: linear-gradient(135deg, var(--felt), var(--felt-mid)); color: #eafff2;
  border: 1px solid rgba(232,195,88,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
#create-table-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(12,107,69,0.4); }

.lobby-list-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.lobby-list { display: flex; flex-direction: column; gap: 12px; }
.lobby-empty {
  text-align: center; color: var(--text-dim); padding: 40px 20px; font-size: 14px;
  border: 1px dashed var(--line); border-radius: 14px;
}
.lobby-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(120deg, rgba(31,37,48,0.85), rgba(20,24,31,0.85));
  border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px;
  transition: border-color 0.15s, transform 0.15s;
}
.lobby-card:hover { border-color: rgba(232,195,88,0.45); transform: translateY(-2px); }
.lobby-card-name { font-weight: 800; font-size: 15px; margin-bottom: 8px; }
.lobby-card-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.lobby-tag {
  font-size: 11.5px; color: var(--text-dim); background: #0e1116; border: 1px solid var(--line);
  padding: 4px 10px; border-radius: 20px; font-weight: 600;
}
.lobby-tag.lobby-live { color: var(--success); border-color: rgba(52,196,126,0.4); }
.lobby-join-btn {
  flex-shrink: 0; padding: 11px 22px; border: none; border-radius: 9px; cursor: pointer;
  font-weight: 800; font-size: 13px; background: linear-gradient(135deg, var(--gold-bright), var(--gold-dim));
  color: #1b1300; transition: transform 0.15s, box-shadow 0.15s;
}
.lobby-join-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(232,195,88,0.3); }
.lobby-join-btn:disabled { background: var(--panel-lighter); color: var(--text-dim); cursor: not-allowed; box-shadow: none; }

/* ---------- Table ---------- */
#app { display: grid; grid-template-rows: auto 1fr; grid-template-columns: 1fr 280px; min-height: 100vh; }
.topbar { grid-column: 1 / -1; }

.table-wrap { display: flex; flex-direction: column; align-items: center; padding: 28px; gap: 22px; overflow-y: auto; }

.felt {
  position: relative;
  width: 100%; max-width: 860px; height: 480px;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(255,255,255,0.05), transparent 55%),
    radial-gradient(ellipse at center, var(--felt) 0%, var(--felt-mid) 55%, var(--felt-dark) 100%);
  border: 12px solid #3a2510;
  border-image: linear-gradient(135deg, #6b4a1f, #2a1a08, #6b4a1f) 1;
  border-radius: 230px / 170px;
  box-shadow:
    inset 0 0 70px rgba(0,0,0,0.55),
    inset 0 0 0 2px rgba(232,195,88,0.15),
    0 16px 50px rgba(0,0,0,0.65),
    0 0 40px rgba(12,107,69,0.25);
  transition: max-width 0.2s, height 0.2s;
}
.felt.large { max-width: 1040px; height: 580px; border-radius: 260px / 210px; }

.board {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.pot-display {
  background: rgba(0,0,0,0.45); padding: 7px 18px; border-radius: 20px;
  font-weight: 800; color: var(--gold); font-size: 15px; border: 1px solid rgba(232,195,88,0.4);
  box-shadow: 0 0 14px rgba(232,195,88,0.15);
  letter-spacing: 0.3px;
}
.community-cards { display: flex; gap: 7px; min-height: 74px; }

.card {
  width: 48px; height: 68px; border-radius: 7px; background: linear-gradient(160deg, #fff, #f1f1f1); color: #1a1a1a;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; box-shadow: 0 3px 8px rgba(0,0,0,0.45);
  border: 1px solid #d8d8d8; flex-shrink: 0;
}
.card.red { color: #c0392b; }
.card.back {
  background: repeating-linear-gradient(45deg, #123a24, #123a24 4px, #0a2a19 4px, #0a2a19 8px);
  border: 1px solid rgba(232,195,88,0.35);
}

.seats { position: absolute; inset: 0; }
.seat {
  position: absolute; width: 150px; transform: translate(-50%, -50%);
  text-align: center;
}
.seat.compact { width: 108px; }
.seat.compact .seat-player { padding: 6px; border-radius: 9px; }
.seat.compact .seat-name { font-size: 10.5px; }
.seat.compact .seat-chips { font-size: 10.5px; }
.seat.compact .seat-hole-cards { gap: 2px; margin-top: 3px; }
.seat.compact .seat-hole-cards .card { width: 20px; height: 29px; font-size: 8.5px; border-radius: 4px; }
.seat.compact .seat-bet, .seat.compact .seat-status { font-size: 9.5px; }
.seat.compact .seat-badge { width: 17px; height: 17px; font-size: 8px; top: -7px; left: -7px; }
.seat.compact .seat-empty { padding: 9px 5px; font-size: 10px; }

.seat-empty {
  border: 2px dashed rgba(255,255,255,0.18); border-radius: 12px; padding: 16px 8px;
  color: rgba(255,255,255,0.32); font-size: 12px; background: rgba(0,0,0,0.15);
}

.seat-player {
  background: linear-gradient(160deg, rgba(20,24,31,0.92), rgba(12,15,20,0.92));
  border: 1px solid var(--line); border-radius: 12px; padding: 10px;
  position: relative; transition: border-color 0.2s, box-shadow 0.2s;
}
.seat-player.acting {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 20px rgba(232,195,88,0.55);
  animation: acting-pulse 1.4s ease-in-out infinite;
}
@keyframes acting-pulse {
  0%, 100% { box-shadow: 0 0 0 1px var(--gold), 0 0 14px rgba(232,195,88,0.4); }
  50% { box-shadow: 0 0 0 1px var(--gold-bright), 0 0 26px rgba(232,195,88,0.75); }
}
.seat-player.folded { opacity: 0.4; }
.seat-player.me { border-color: var(--accent); box-shadow: 0 0 14px rgba(77,141,255,0.25); }

.seat-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-chips { font-size: 12px; color: var(--gold); font-weight: 700; }
.seat-badge {
  position: absolute; top: -9px; left: -9px; background: linear-gradient(135deg, var(--gold-bright), var(--gold-dim));
  color: #1a1300; font-size: 9.5px; font-weight: 900; border-radius: 50%; width: 21px; height: 21px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.seat-hole-cards { display: flex; gap: 3px; justify-content: center; margin-top: 5px; }
.seat-hole-cards .card { width: 30px; height: 42px; font-size: 11px; }
.seat-bet { font-size: 11px; color: var(--gold-dim); margin-top: 3px; font-weight: 600; }
.seat-status { font-size: 10px; color: var(--danger); font-weight: 800; margin-top: 3px; letter-spacing: 0.4px; }

/* ---------- Sit / Action panels ---------- */
.sit-panel, .action-panel {
  background: linear-gradient(160deg, rgba(31,37,48,0.85), rgba(18,21,27,0.85));
  border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; width: 100%; max-width: 860px; text-align: center;
}
.sit-panel p { margin-bottom: 12px; color: var(--text-dim); font-size: 13px; }
#buyin-input {
  width: 140px; padding: 9px; border-radius: 8px; border: 1px solid var(--line);
  background: #0e1116; color: var(--text); text-align: center; margin-right: 10px; outline: none;
}
#buyin-input:focus { border-color: var(--gold); }
#rebuy-input {
  width: 140px; padding: 9px; border-radius: 8px; border: 1px solid var(--line);
  background: #0e1116; color: var(--text); text-align: center; margin-right: 10px; outline: none;
}
#rebuy-input:focus { border-color: var(--gold); }
#rebuy-btn {
  padding: 11px 20px; border: none; border-radius: 9px; cursor: pointer; font-weight: 800; font-size: 13px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-dim)); color: #1a1300;
  transition: transform 0.12s, box-shadow 0.12s;
}
#rebuy-btn:hover:not(:disabled) { transform: translateY(-2px); }
#rebuy-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
#sit-btn, .act-btn {
  padding: 11px 20px; border: none; border-radius: 9px; cursor: pointer; font-weight: 800; font-size: 13px;
  transition: transform 0.12s, box-shadow 0.12s;
}
#sit-btn { background: linear-gradient(135deg, var(--success), #1f9d5e); color: #06170c; }
#sit-btn:hover:not(:disabled) { transform: translateY(-2px); }
#sit-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.action-info { display: flex; justify-content: space-between; margin-bottom: 14px; font-size: 13px; color: var(--text-dim); }
#turn-indicator { color: var(--gold); font-weight: 700; }
.action-buttons { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.act-btn.fold { background: linear-gradient(135deg, var(--danger), #b8352c); color: #fff; }
.act-btn.check { background: linear-gradient(135deg, var(--accent), #2f66d0); color: #fff; }
.act-btn.raise { background: linear-gradient(135deg, var(--gold-bright), var(--gold-dim)); color: #1a1300; }
.act-btn.allin { background: linear-gradient(135deg, var(--purple), #6d28c9); color: #fff; }
.act-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.35); }
.act-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }
.raise-controls { display: flex; align-items: center; gap: 6px; }
#raise-slider { width: 140px; accent-color: var(--gold); }
#raise-input { width: 80px; padding: 7px; border-radius: 7px; border: 1px solid var(--line); background: #0e1116; color: var(--text); outline: none; }
#raise-input:focus { border-color: var(--gold); }
.leave-btn { margin-top: 14px; }

/* ---------- Side log ---------- */
.side-log { background: var(--panel); border-left: 1px solid var(--line); padding: 18px; display: flex; flex-direction: column; }
.side-log h3 { font-size: 13px; color: var(--gold-dim); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.6px; }
.log-feed { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 110px); }
.log-entry { font-size: 12px; color: var(--text-dim); padding: 7px 9px; background: #0e1116; border-radius: 7px; border: 1px solid rgba(255,255,255,0.03); }

/* ---------- Modals ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-content {
  background: linear-gradient(160deg, #1a1e27, #12151b); border: 1px solid var(--line); border-radius: 16px;
  padding: 30px; width: 440px; max-width: 90vw; max-height: 80vh; overflow-y: auto; position: relative;
  box-shadow: 0 30px 70px rgba(0,0,0,0.6);
}
.modal-close {
  position: absolute; top: 14px; right: 16px; background: none; border: none; color: var(--text-dim);
  font-size: 22px; cursor: pointer; transition: color 0.15s;
}
.modal-close:hover { color: var(--gold); }
.modal h2 { margin-bottom: 18px; color: var(--gold); }
.shop-disclaimer { font-size: 12px; color: var(--text-dim); margin-bottom: 18px; line-height: 1.6; }
.shop-packs { display: flex; flex-direction: column; gap: 12px; }
.pack-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 15px 18px; background: var(--panel-light); border: 1px solid var(--line); border-radius: 11px;
}
.pack-card-main { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.pack-amount { font-weight: 800; }
.pack-price { color: var(--gold); font-size: 13px; font-weight: 800; }
.pack-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pack-donate-btn, .pack-confirm-btn {
  flex: 1; text-align: center; padding: 9px 10px; border: none; border-radius: 8px; cursor: pointer;
  font-weight: 800; font-size: 12px; text-decoration: none; transition: transform 0.12s;
}
.pack-confirm-btn { background: linear-gradient(135deg, var(--success), #1f9d5e); color: #06170c; }
.pack-confirm-btn:hover:not(:disabled) { transform: translateY(-1px); }
.pack-confirm-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; background: var(--panel-lighter); color: var(--text-dim); }

#rename-input {
  width: 100%; padding: 12px; border-radius: 9px; border: 1px solid var(--line);
  background: #0e1116; color: var(--text); outline: none; margin-bottom: 14px; font-size: 14px;
}
#rename-input:focus { border-color: var(--gold); }
#rename-confirm-btn {
  width: 100%; padding: 11px; border: none; border-radius: 9px; cursor: pointer; font-weight: 800; font-size: 13px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-dim)); color: #1a1300;
  transition: transform 0.12s;
}
#rename-confirm-btn:hover { transform: translateY(-1px); }

.missions-list { display: flex; flex-direction: column; gap: 10px; }
.mission-item { background: var(--panel-light); border-radius: 11px; padding: 14px; border: 1px solid var(--line); }
.mission-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.mission-desc { font-size: 13px; font-weight: 700; }
.mission-reward { font-size: 12px; color: var(--gold); font-weight: 800; }
.mission-bar-bg { background: #0e1116; border-radius: 20px; height: 8px; overflow: hidden; margin-bottom: 8px; }
.mission-bar-fill { background: linear-gradient(90deg, var(--success), #7be6ac); height: 100%; transition: width 0.3s; }
.mission-claim-btn {
  width: 100%; padding: 9px; border: none; border-radius: 7px; cursor: pointer; font-weight: 800; font-size: 12px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-dim)); color: #1a1300;
  transition: transform 0.12s;
}
.mission-claim-btn:hover:not(:disabled) { transform: translateY(-1px); }
.mission-claim-btn:disabled { background: var(--panel-lighter); color: var(--text-dim); cursor: not-allowed; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(160deg, #1f2530, #14171e); border: 1px solid var(--gold); color: var(--text);
  padding: 13px 22px; border-radius: 11px; font-size: 13px; z-index: 200;
  box-shadow: 0 10px 30px rgba(0,0,0,0.55);
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 14px 16px; font-size: 11.5px; color: var(--text-dim);
  border-top: 1px solid var(--line); background: var(--panel);
}
.site-footer a { color: var(--gold-dim); text-decoration: none; }
.site-footer a:hover { color: var(--gold); text-decoration: underline; }

/* ---------- Cookie banner ---------- */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 22px; background: linear-gradient(160deg, #1a1e27, #12151b);
  border-top: 1px solid var(--gold-dim); box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
}
.cookie-banner p { max-width: 720px; font-size: 12.5px; color: var(--text-dim); line-height: 1.6; margin: 0; }
.cookie-banner a { color: var(--gold); text-decoration: underline; }
#cookie-accept-btn {
  flex-shrink: 0; padding: 10px 20px; border: none; border-radius: 9px; cursor: pointer;
  font-weight: 800; font-size: 12.5px; background: linear-gradient(135deg, var(--gold-bright), var(--gold-dim));
  color: #1a1300; transition: transform 0.12s;
}
#cookie-accept-btn:hover { transform: translateY(-1px); }

@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  .side-log { display: none; }
  .create-row { flex-direction: column; }
  .cookie-banner { flex-direction: column; align-items: stretch; text-align: center; }
}
