/* Neon Indian Poker — 네온 계열 게임(네온 스네이크 / 에어하키 / 로그) 톤의 어두운 배경 + 네온 */
:root {
  --bg: #030712;
  --card: #0f172a;
  --card-2: #111c33;
  --border: #1e293b;
  --accent: #22d3ee;
  --violet: #a855f7;
  --neon-pink: #f43f5e;
  --neon-green: #34d399;
  --neon-yellow: #fde047;
  --text: #f8fafc;
  --muted: #94a3b8;
}

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

html, body {
  height: 100%;
}

body {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(168, 85, 247, 0.12), transparent 55%),
    radial-gradient(ellipse at 90% 100%, rgba(34, 211, 238, 0.1), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 상단 홈 네비게이션 (neon-snake 기준) ---------- */
.top-nav {
  width: 100%;
  max-width: 1080px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  z-index: 20;
}

.back-btn {
  color: #22d3ee;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.25);
  transition: all 0.2s;
}

.back-btn:hover {
  background: rgba(34, 211, 238, 0.25);
  transform: translateX(-2px);
}

.game-title {
  font-size: 1.1rem;
  font-weight: 800;
  background: linear-gradient(135deg, #22d3ee, #a855f7, #f43f5e);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.mute-btn {
  font-size: 1rem;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: var(--text);
  cursor: pointer;
}

/* ---------- 공통 ---------- */
.app {
  width: 100%;
  max-width: 1080px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hidden {
  display: none !important;
}

.panel {
  width: 100%;
  max-width: 760px;
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.96), rgba(17, 28, 51, 0.92));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(34, 211, 238, 0.08);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.panel-head h2 {
  font-size: 1.15rem;
}

.panel-head small,
.muted {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8rem;
}

.hint-text {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 14px;
}

.btn {
  font: inherit;
  font-weight: 800;
  font-size: 0.92rem;
  border-radius: 12px;
  padding: 11px 16px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.2s, background 0.2s, opacity 0.2s;
  touch-action: manipulation;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  border-color: rgba(168, 85, 247, 0.7);
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.35);
}

.btn-cyan {
  background: rgba(34, 211, 238, 0.14);
  border-color: rgba(34, 211, 238, 0.5);
  color: #a5f3fc;
}

.btn-pink {
  background: rgba(244, 63, 94, 0.14);
  border-color: rgba(244, 63, 94, 0.5);
  color: #fecdd3;
}

.btn-ghost {
  background: transparent;
}

.btn-mini {
  padding: 6px 10px;
  font-size: 0.78rem;
  border-radius: 9px;
}

input[type="text"],
input[type="number"],
select,
textarea {
  font: inherit;
  color: var(--text);
  background: #0b1222;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}

textarea {
  resize: vertical;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  word-break: break-all;
}

/* ---------- 로비 ---------- */
.lobby-panel {
  margin-top: 4vh;
}

.lobby-title {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-align: center;
  color: #e0f2fe;
  text-shadow: 0 0 12px rgba(34, 211, 238, 0.8), 0 0 30px rgba(34, 211, 238, 0.4);
}

.lobby-title span {
  color: #f5d0fe;
  text-shadow: 0 0 12px rgba(168, 85, 247, 0.9), 0 0 30px rgba(168, 85, 247, 0.4);
}

.lobby-sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 8px 0 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 14px;
}

.lobby-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.options {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin-bottom: 14px;
}

.options legend {
  padding: 0 6px;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
}

.opt {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 700;
}

.opt.check {
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  grid-column: 1 / -1;
}

.opt.check input {
  margin-top: 3px;
  accent-color: var(--violet);
  width: 16px;
  height: 16px;
}

.opt small {
  color: var(--muted);
  font-weight: 500;
}

.howto {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px dashed rgba(34, 211, 238, 0.35);
}

.howto p {
  color: var(--muted);
  font-size: 0.85rem;
  flex: 1 1 240px;
}

/* ---------- 설명서 ---------- */
.nav-actions {
  display: flex;
  gap: 6px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.modal-box {
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.99), rgba(17, 28, 51, 0.98));
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(34, 211, 238, 0.12);
  overflow: hidden;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 8px;
}

.modal-head h2 {
  font-size: 1.1rem;
}

.help-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 18px 10px;
  border-bottom: 1px solid var(--border);
}

.help-toc a {
  font-size: 0.75rem;
  font-weight: 700;
  color: #a5f3fc;
  text-decoration: none;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.3);
  background: rgba(34, 211, 238, 0.08);
}

.help-toc a:hover {
  background: rgba(34, 211, 238, 0.2);
}

.modal-body {
  overflow-y: auto;
  padding: 6px 18px 20px;
  font-size: 0.88rem;
  line-height: 1.7;
  color: #cbd5e1;
  -webkit-overflow-scrolling: touch;
}

.modal-body section {
  padding-top: 14px;
  scroll-margin-top: 6px;
}

.modal-body h3 {
  font-size: 0.98rem;
  color: var(--text);
  margin-bottom: 6px;
}

.modal-body p {
  margin-bottom: 6px;
}

.modal-body ul,
.modal-body ol {
  margin-left: 20px;
}

.modal-body b {
  color: var(--text);
}

.modal-body .note {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.25);
}

.help-terms {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px 12px;
  align-items: start;
}

.help-terms dt {
  font-weight: 900;
  color: var(--text);
  padding-top: 2px;
}

.help-terms dd {
  margin: 0;
}

.tag-fold,
.tag-call,
.tag-raise {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.tag-fold {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.55);
  color: #fecdd3;
}

.tag-call {
  background: rgba(34, 211, 238, 0.15);
  border: 1px solid rgba(34, 211, 238, 0.55);
  color: #cffafe;
}

.tag-raise {
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.65);
  color: #f3e8ff;
}

.key,
.kbd {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0b1222;
  color: #e2e8f0;
  white-space: nowrap;
}

.kbd {
  border-radius: 50%;
  background: #f8fafc;
  color: #0f172a;
}

.pill-green {
  display: inline-block;
  padding: 0 8px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.75rem;
  color: #052e16;
  background: var(--neon-green);
}

.help-mini {
  margin-left: auto;
}

/* ---------- 대기실 ---------- */
.seat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.seat {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(11, 18, 34, 0.8);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 110px;
}

.seat.filled {
  border-color: rgba(34, 211, 238, 0.45);
}

.seat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.seat-no {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 800;
}

.seat-name {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}

.status.waiting { color: var(--neon-yellow); }
.status.connected { color: var(--neon-green); }
.status.lost { color: var(--neon-pink); }
.status.host { color: var(--violet); }
.status.bot { color: var(--accent); }

.seat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seat textarea {
  font-size: 0.68rem;
}

.host-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  gap: 10px;
}

.steps {
  margin-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.steps li {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.88rem;
}

.join-status {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.25);
  font-weight: 700;
  font-size: 0.88rem;
}

.peer-list {
  list-style: none;
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.peer-list li {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
}

/* ---------- 게임 ---------- */
#screenGame {
  align-items: stretch;
  position: relative;
}

.game-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 10px;
  min-height: 0;
}

.table-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.table-wrap {
  position: relative;
  width: 100%;
  height: min(62vh, 560px);
  min-height: 300px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: #050b18;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(34, 211, 238, 0.1);
  touch-action: manipulation;
}

#tableCanvas {
  display: block;
}

.banner {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 16px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.85rem;
  color: #052e16;
  background: var(--neon-green);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.7);
  animation: pulse 1.2s ease-in-out infinite;
  pointer-events: none;
}

.timer-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  max-width: 60%;
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.8rem;
  color: #cffafe;
  background: rgba(8, 47, 73, 0.85);
  border: 1px solid rgba(34, 211, 238, 0.5);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.timer-badge.warn {
  color: #fff1f2;
  background: rgba(136, 19, 55, 0.9);
  border-color: var(--neon-pink);
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.6);
  animation: pulse 0.8s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.65; }
}

.controls {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.controls.disabled {
  opacity: 0.55;
}

.bet-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bet-row input[type="range"] {
  flex: 1;
  accent-color: var(--violet);
  height: 28px;
}

.bet-amount {
  min-width: 64px;
  text-align: right;
  font-weight: 900;
  color: var(--neon-yellow);
  font-variant-numeric: tabular-nums;
}

.quick-row {
  display: flex;
  gap: 6px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1.2fr;
  gap: 8px;
}

.btn-act {
  padding: 13px 8px;
  font-size: 0.95rem;
}

.btn-act.fold {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.55);
  color: #fecdd3;
}

.btn-act.call {
  background: rgba(34, 211, 238, 0.15);
  border-color: rgba(34, 211, 238, 0.55);
  color: #cffafe;
}

.btn-act.raise {
  background: rgba(168, 85, 247, 0.2);
  border-color: rgba(168, 85, 247, 0.65);
  color: #f3e8ff;
}

.side-col {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  max-height: calc(min(62vh, 560px) + 160px);
}

.side-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
  gap: 6px;
}

.log {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  font-size: 0.78rem;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 120px;
}

.log li {
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.45);
  word-break: break-word;
}

.log li.round {
  color: #a5f3fc;
  background: rgba(34, 211, 238, 0.1);
}

.log li.chat {
  color: #f5d0fe;
  background: rgba(168, 85, 247, 0.12);
}

.log li.win {
  color: var(--neon-yellow);
}

.chat {
  display: flex;
  gap: 6px;
}

.chat input {
  padding: 7px 9px;
  font-size: 0.8rem;
}

.chat .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  padding: 16px;
}

.result-panel {
  max-width: 420px;
  text-align: center;
}

.result-emoji {
  font-size: 3rem;
}

.result-panel h2 {
  margin: 6px 0;
}

.result-panel p {
  color: var(--muted);
  margin-bottom: 16px;
}

.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(92vw, 520px);
  padding: 10px 16px;
  border-radius: 12px;
  background: #1e1b2e;
  border: 1px solid rgba(244, 63, 94, 0.6);
  color: #fecdd3;
  font-weight: 700;
  font-size: 0.85rem;
  z-index: 50;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.toast.info {
  border-color: rgba(34, 211, 238, 0.6);
  color: #cffafe;
}

/* ---------- 모바일 ---------- */
@media (max-width: 820px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    height: min(52vh, 460px);
  }

  .side-col {
    max-height: 220px;
  }
}

@media (max-width: 520px) {
  body {
    padding: 6px;
  }

  .game-title {
    font-size: 0.95rem;
  }

  .panel {
    padding: 16px;
  }

  .options {
    grid-template-columns: 1fr;
  }

  .help-terms {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .help-terms dd {
    margin-bottom: 8px;
  }

  #helpBtn .btn-label {
    display: none;
  }

  .back-btn,
  .game-title {
    white-space: nowrap;
  }

  .top-nav {
    gap: 6px;
  }

  .table-wrap {
    min-height: 280px;
  }
}
