/* ============================================================
   Pixel Hold'em — retro pixel poker theme (ฟอนต์ Silver ไทย+EN)
   ============================================================ */
@font-face {
  font-family: 'Silver';
  src: url('./fonts/Silver.woff2') format('woff2');
  font-weight: normal; font-style: normal; font-display: swap;
}
:root {
  --felt: #0b6b34; --felt2: #0a5f2e; --felt-dark: #053b1c;
  --gold: #ffd23f; --gold-dk: #b8860b; --ink: #0d0b14;
  --panel: #241d3a; --panel-lit: #3a2f5e; --panel-shd: #14102a;
  --text: #f3efe3; --red: #ff4d5e; --green: #4cd97a; --blue: #4a86ff;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Silver', sans-serif; background: var(--ink); color: var(--text);
  overflow-x: hidden; image-rendering: pixelated;
}
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
.screen { min-height: 100vh; width: 100%; }
body::after {
  content: ''; position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,.16) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply; opacity: .5;
}

/* ---------- ปุ่ม ---------- */
.gbtn {
  font-family: 'Silver', monospace; font-size: 18px; line-height: 1.4; letter-spacing: .5px;
  border: 3px solid var(--ink); border-radius: 0; padding: 11px 16px; cursor: pointer; color: #fff;
  background: var(--blue);
  box-shadow: inset -3px -3px 0 0 rgba(0,0,0,.35), inset 3px 3px 0 0 rgba(255,255,255,.25), 0 5px 0 0 var(--ink);
  text-shadow: 1px 1px 0 rgba(0,0,0,.4);
}
.gbtn:hover { filter: brightness(1.12); }
.gbtn:active { transform: translateY(5px);
  box-shadow: inset -3px -3px 0 0 rgba(0,0,0,.35), inset 3px 3px 0 0 rgba(255,255,255,.25), 0 0 0 0 var(--ink); }
.gbtn:disabled { opacity: .4; pointer-events: none; }
.gbtn.primary   { background: var(--gold); color: #2a1c00; text-shadow: 1px 1px 0 rgba(255,255,255,.35); }
.gbtn.secondary { background: var(--green); color: #06381b; }
.gbtn.warn      { background: var(--red); }
.gbtn.ghost     { background: #4a4368; }
.gbtn.chip      { background: #2c3650; font-size: 15px; padding: 8px 12px; }
.gbtn.big       { font-size: 24px; padding: 18px 22px; width: 100%; }
.gbtn.small     { font-size: 15px; padding: 9px 11px; }

/* ---------- หน้าเริ่ม ---------- */
#start {
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: repeating-linear-gradient(45deg, var(--felt2) 0 12px, var(--felt) 12px 24px);
}
.start-card {
  background: var(--panel); border: 4px solid var(--ink); padding: 30px 26px;
  width: 100%; max-width: 440px; text-align: center;
  box-shadow: inset -5px -5px 0 0 var(--panel-shd), inset 5px 5px 0 0 var(--panel-lit),
    0 0 0 4px var(--gold), 0 0 0 8px var(--ink), 0 12px 0 8px rgba(0,0,0,.4);
}
.logo { font-size: 34px; letter-spacing: 6px; margin-bottom: 16px; filter: drop-shadow(2px 2px 0 #000); }
.start-card h1 { font-family: 'Silver', monospace; font-size: 30px; line-height: 1.3; color: var(--gold);
  text-shadow: 3px 3px 0 var(--gold-dk), 5px 5px 0 #000; margin-bottom: 16px; }
.sub { font-size: 17px; opacity: .85; margin-bottom: 18px; line-height: 1.5; }
.room-tag { background: var(--felt-dark); border: 3px solid var(--ink); padding: 10px; margin-bottom: 14px;
  box-shadow: inset -2px -2px 0 rgba(0,0,0,.4); font-family: 'Silver', monospace; font-size: 19px; color: var(--gold); }
#nameInput { width: 100%; padding: 12px 14px; font-size: 21px; font-family: 'Silver', monospace;
  border: 3px solid var(--ink); background: #0e1626; color: var(--text); margin-bottom: 16px; text-align: center;
  box-shadow: inset 3px 3px 0 rgba(0,0,0,.5); }
#nameInput:focus { outline: none; border-color: var(--gold); }
#nameInput::placeholder { color: #6b6488; }
.note { font-size: 14px; opacity: .6; margin-top: 16px; line-height: 1.6; }

/* ---------- โต๊ะ ---------- */
#table { display: flex; flex-direction: column;
  background: repeating-linear-gradient(45deg, var(--felt2) 0 12px, var(--felt) 12px 24px); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
  background: var(--ink); border-bottom: 4px solid var(--gold); flex-wrap: wrap; gap: 8px; }
.brand { font-family: 'Silver', monospace; font-size: 19px; color: var(--gold); text-shadow: 2px 2px 0 #000; }
.invite { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.invite-label { font-size: 16px; opacity: .9; }
.invite-label b { color: var(--gold); font-family: 'Silver', monospace; font-size: 16px; }

.felt { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.phase-line { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center; }
.phase-tag { background: var(--gold); color: #2a1c00; font-family: 'Silver', monospace; padding: 5px 12px;
  font-size: 16px; letter-spacing: 1px; border: 3px solid var(--ink);
  box-shadow: inset -2px -2px 0 rgba(0,0,0,.25), inset 2px 2px 0 rgba(255,255,255,.4); }
.status { font-size: 18px; background: rgba(0,0,0,.35); padding: 5px 12px; border: 2px solid var(--ink); }

/* board */
.board-zone { display: flex; gap: 18px; align-items: center; justify-content: center;
  background: var(--felt-dark); border: 4px solid var(--ink); padding: 14px 24px; flex-wrap: wrap;
  box-shadow: inset -4px -4px 0 rgba(0,0,0,.4), inset 4px 4px 0 rgba(255,255,255,.08), 0 5px 0 rgba(0,0,0,.35); }
.dealer-sprite { width: 56px; height: 70px; }
.board-mid { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.board { display: flex; gap: 6px; }
.pot { font-family: 'Silver', monospace; font-size: 20px; color: var(--gold); }
.card { image-rendering: pixelated; box-shadow: 3px 3px 0 rgba(0,0,0,.45); }
.slot { border: 2px dashed rgba(255,255,255,.18); border-radius: 3px; background: rgba(0,0,0,.12); }

/* seats */
.seats { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; width: 100%; align-items: flex-start; }
.seat { background: var(--panel); border: 4px solid var(--ink); padding: 10px; width: 168px; min-height: 150px;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: inset -4px -4px 0 var(--panel-shd), inset 4px 4px 0 var(--panel-lit), 0 5px 0 rgba(0,0,0,.35); }
.seat.me { box-shadow: inset -4px -4px 0 var(--panel-shd), inset 4px 4px 0 var(--panel-lit), 0 0 0 4px var(--gold), 0 5px 0 rgba(0,0,0,.35); }
.seat.active { box-shadow: inset -4px -4px 0 var(--panel-shd), inset 4px 4px 0 var(--panel-lit), 0 0 0 4px var(--green), 0 0 14px var(--green); transform: translateY(-4px); }
.seat.winner { box-shadow: inset -4px -4px 0 var(--panel-shd), inset 4px 4px 0 var(--panel-lit), 0 0 0 4px var(--gold), 0 0 18px var(--gold); }
.seat.folded { opacity: .5; }
.s-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.s-name { font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-family: 'Silver', monospace; font-size: 14px; padding: 1px 6px; border: 2px solid var(--ink); }
.badge.dealer { background: #fff; color: #111; border-radius: 50%; }
.s-hand { display: flex; gap: 4px; min-height: 64px; }
.s-hand .card { width: 46px; height: 64px; }
.s-info { display: flex; justify-content: space-between; align-items: center; font-size: 16px; }
.s-chip { color: var(--gold); font-family: 'Silver', monospace; }
.s-status { font-size: 15px; font-weight: 700; }
.seat.active .s-status { color: var(--green); }
.s-bet { font-size: 16px; min-height: 22px; color: var(--gold); }
.seat.winner .s-bet { color: var(--gold); font-weight: 800; }

/* controls */
.controls { background: var(--ink); border-top: 4px solid var(--gold); padding: 14px;
  display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; min-height: 78px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.raise-box { display: flex; flex-direction: column; gap: 8px; align-items: stretch;
  background: rgba(255,255,255,.05); border: 2px solid #2c2745; padding: 10px; min-width: 280px; }
.quick-row { display: flex; gap: 6px; justify-content: center; }
.slider-row { display: flex; gap: 10px; align-items: center; }
.raise-label { font-family: 'Silver', monospace; font-size: 20px; color: var(--gold); min-width: 60px; text-align: right; }
input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 14px; background: #0e1626;
  border: 2px solid var(--ink); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 22px;
  background: var(--gold); border: 2px solid var(--ink); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 16px; height: 22px; background: var(--gold); border: 2px solid var(--ink); cursor: pointer; }
.hint { opacity: .85; font-size: 18px; background: rgba(255,255,255,.06); padding: 8px 14px; border: 2px solid #2c2745; }

@media (max-width: 640px) {
  .seat { width: 46%; max-width: 200px; }
  .board .card { width: 56px; height: 78px; }
  .brand { font-size: 15px; }
  .start-card h1 { font-size: 22px; }
}
