/* ===== ROOT ===== */
:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --surface-3: #f5f3ed;
  --ink: #3a3835;
  --muted: #8c8982;
  --faint: #b0ada5;
  --line: #e8e5de;
  --line-2: #d5d2ca;
  --green: #8fa88f;
  --warm: #c4988a;
  --blue-muted: #8a9fa8;
  --gold: #c9b888;
  --dark: #1a1a1a;
  --dark-panel: rgba(20, 20, 20, 0.92);
  --white-10: rgba(255, 255, 255, 0.1);
  --white-15: rgba(255, 255, 255, 0.15);
  --white-40: rgba(255, 255, 255, 0.4);
  --white-70: rgba(255, 255, 255, 0.7);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.08);
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-full: 100px;
  font-family: "Helvetica Neue", "Hiragino Sans", "Noto Sans SC", ui-sans-serif, system-ui, sans-serif;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg); line-height: 1.6; }
button, input { font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.hidden { display: none !important; }

/* ===== BUTTONS ===== */
.btn {
  padding: 10px 28px;
  border-radius: var(--radius-full);
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.btn:hover { opacity: 0.8; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-secondary { background: var(--surface-3); color: var(--muted); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line-2); }
.btn-ghost-dark { padding: 6px 16px; border-radius: var(--radius-full); background: transparent; color: var(--white-70); border: 1px solid var(--white-15); font-size: 10px; letter-spacing: 1px; cursor: pointer; transition: all 0.15s; }
.btn-ghost-dark:hover { background: var(--white-10); color: #fff; }

/* ===== EYEBROW / LEAD ===== */
.eyebrow { margin: 0; font-size: 10px; letter-spacing: 3px; text-transform: uppercase; color: var(--faint); }
.lead { margin: 10px 0 0; max-width: 480px; font-size: 15px; color: var(--muted); line-height: 1.6; }
.error { min-height: 20px; margin: 10px 0 0; color: var(--warm); font-size: 12px; font-weight: 500; }

/* ====== HALL ====== */
.hall { position: relative; min-height: 100vh; padding: 40px 28px; }
.hall-hero {
  position: absolute; inset: 0; z-index: -2;
  background:
    image-set(url("/assets/hero-pixel-office-768.webp") 1x, url("/assets/hero-pixel-office-1280.webp") 2x) center / cover no-repeat,
    url("/assets/hero-pixel-office-lqip.webp") center / cover no-repeat;
}
.hall-hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(247, 245, 240, 0.85) 0%, rgba(247, 245, 240, 0.55) 45%, rgba(247, 245, 240, 0.08) 100%);
}
.hall-inner { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; }
.hall-head { margin-bottom: 36px; }
.hall-head h1 { margin: 8px 0 0; font-size: clamp(32px, 6vw, 48px); font-weight: 300; letter-spacing: 2px; }
.hall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.hall-card {
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid #eee;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
}
.hall-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.hall-card.selected { border-color: var(--green); box-shadow: 0 0 0 2px rgba(143, 168, 143, 0.3); }
.hall-card-img {
  height: 180px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hall-card-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hall-card-img-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.4) 0%, transparent 55%);
  z-index: 1;
}
.hall-card-tags {
  position: absolute; bottom: 12px; left: 12px;
  display: flex; gap: 6px;
  z-index: 2;
}
.hall-tag {
  padding: 2px 10px; border-radius: var(--radius-full);
  font-size: 10px; letter-spacing: 1px;
  color: #fff; background: rgba(255,255,255,0.18);
  backdrop-filter: blur(6px);
}
.hall-card-body { padding: 16px 18px 18px; }
.hall-card-body h4 { margin: 0 0 2px; font-size: 18px; font-weight: 500; }
.hall-card-body p { margin: 0; font-size: 12px; color: #999; line-height: 1.5; }
.hall-card-more {
  min-height: 260px;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--faint);
  font-size: 13px;
  letter-spacing: 2px;
  cursor: default;
}

/* ====== MODAL ====== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
}
.modal {
  width: 480px; max-width: 92vw;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  overflow: hidden;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-hero {
  height: 150px;
  overflow: hidden;
  position: relative;
}
.modal-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.modal-close {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.85);
  font-size: 16px; cursor: pointer; color: var(--ink);
  display: grid; place-items: center;
}
.modal-body { padding: 24px; }
.modal-body h3 { margin: 0 0 4px; font-size: 20px; font-weight: 400; }
.modal-body > p { margin: 0 0 20px; font-size: 12px; color: #999; line-height: 1.5; }
.modal-field { margin-bottom: 14px; }
.modal-field label { display: block; font-size: 10px; letter-spacing: 2px; color: var(--faint); margin-bottom: 5px; }
.modal-field input {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  font-size: 13px; outline: none;
  background: var(--surface-2); color: var(--ink);
}
.modal-field input:focus { border-color: var(--line-2); }
.modal-actions { display: flex; gap: 10px; margin-top: 10px; align-items: center; }

/* ====== ROOM (live stream) ====== */
.room { min-height: 100vh; background: var(--dark); animation: roomIn 0.35s ease; display: flex; justify-content: center; }
@keyframes roomIn { from { opacity: 0; } to { opacity: 1; } }
.room-layout { display: flex; min-height: 100vh; width: 100%; max-width: 1440px; }
.room-main { flex: 1; display: flex; flex-direction: column; position: relative; min-width: 0; }

/* Room topbar */
.room-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(0,0,0,0.45) 0%, transparent 100%);
  z-index: 10;
}
.room-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.room-info-eyebrow { font-size: 10px; color: var(--white-40); letter-spacing: 2px; }
.room-info h3 { margin: 0; font-size: 15px; font-weight: 500; color: #fff; letter-spacing: 1px; }
.room-code-pill {
  padding: 2px 10px; border-radius: var(--radius-full);
  background: var(--white-15); color: #fff;
  font-size: 10px; letter-spacing: 1px; cursor: pointer;
  border: 0;
}

/* Players overlay */
.room-players {
  position: absolute; top: 62px; left: 12px; z-index: 5;
  display: flex; flex-direction: column; gap: 4px;
}
.player-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: var(--radius-full);
  background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
  color: #fff; font-size: 11px; letter-spacing: 0.5px;
}
.player-pill-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 10px; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.player-pill-score { margin-left: 2px; opacity: 0.5; font-size: 10px; }
.player-pill .host-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); margin-left: 2px; }

/* Game tabs */
.room-game-tabs {
  position: absolute; top: 62px; right: 12px; z-index: 5;
  display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end;
}
.game-tab-pill {
  padding: 4px 12px; border-radius: var(--radius-full);
  font-size: 10px; letter-spacing: 1px;
  border: 1px solid var(--white-15); background: transparent;
  color: rgba(255,255,255,0.5); cursor: pointer;
  transition: all 0.15s; white-space: nowrap;
}
.game-tab-pill:focus-visible { outline: 2px solid rgba(255,255,255,0.5); outline-offset: 2px; }
.game-tab-pill.active { background: var(--white-15); color: #fff; border-color: rgba(255,255,255,0.3); }
.game-tab-pill.readonly { cursor: default; opacity: 0.5; }
.game-tab-pill.readonly:hover { background: transparent; }

/* Stage */
.room-stage {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  padding: 16px;
}
.game-shell { width: 100%; max-width: 980px; }
.game-shell h3 { color: #fff; font-size: 16px; font-weight: 500; margin: 0 0 4px; }
.game-shell .game-subtitle { color: var(--white-40); font-size: 12px; margin: 0 0 14px; }
.result-banner {
  margin: 0 0 16px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.18);
  background: linear-gradient(135deg, rgba(143,168,143,0.22), rgba(255,255,255,0.05));
  box-shadow: 0 16px 36px rgba(0,0,0,0.18);
  text-align: center;
}
.result-banner.draw {
  background: linear-gradient(135deg, rgba(201,184,136,0.22), rgba(255,255,255,0.05));
}
.result-banner span {
  display: block;
  margin-bottom: 6px;
  color: var(--white-40);
  font-size: 10px;
  letter-spacing: 2px;
}
.result-banner strong {
  display: block;
  color: #fff;
  font-size: 22px;
  line-height: 1.35;
  font-weight: 600;
}
.result-banner p {
  margin: 8px 0 0;
  color: var(--white-70);
  font-size: 12px;
}
.rules-card {
  margin-bottom: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
}
.rules-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.rules-card-header span {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--white-40);
  font-weight: 500;
}
.rules-card-header button {
  padding: 2px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--white-10);
  background: transparent;
  color: var(--white-40);
  font-size: 10px;
  letter-spacing: 1px;
  cursor: pointer;
}
.rules-card ol {
  margin: 0;
  padding-left: 18px;
  color: var(--white-70);
  font-size: 12px;
  line-height: 1.8;
}

/* Tool row */
.room-tool-row {
  position: absolute; bottom: 48px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; z-index: 5;
}

/* Status bar */
.room-status-bar {
  display: flex; gap: 10px; padding: 12px 16px;
  background: linear-gradient(0deg, transparent, rgba(0,0,0,0.5));
  z-index: 5; justify-content: center;
}
.stat-pill {
  padding: 4px 14px; border-radius: var(--radius-full);
  background: var(--white-10); color: var(--white-70);
  font-size: 11px; letter-spacing: 1px;
}

/* ====== CHAT PANEL ====== */
.chat-panel {
  width: 280px; flex-shrink: 0;
  background: var(--dark-panel); backdrop-filter: blur(12px);
  border-left: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column;
  padding: 14px 12px 12px;
}
.chat-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 10px; letter-spacing: 2px; color: var(--white-40);
  padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 8px;
}
.chat-msgs {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px;
  margin-bottom: 8px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 90%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 90%, transparent 100%);
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.chat-msgs::-webkit-scrollbar { width: 4px; }
.chat-msgs::-webkit-scrollbar-track { background: transparent; }
.chat-msgs::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
.chat-msg { padding: 3px 8px; border-radius: 2px; font-size: 12px; line-height: 1.5; color: rgba(255,255,255,0.75); }
.chat-msg .author { color: var(--white-40); font-size: 10px; margin-right: 6px; }
.chat-msg.sys { color: rgba(255,255,255,0.35); font-size: 11px; font-style: italic; }
.chat-msg.guess { background: rgba(143,168,143,0.15); }
.chat-input-row { display: flex; gap: 6px; }
.chat-input-row input {
  flex: 1; padding: 9px 12px;
  border: 1px solid var(--white-10); border-radius: var(--radius-full);
  font-size: 12px; outline: none;
  background: rgba(255,255,255,0.06); color: #fff;
}
.chat-input-row input::placeholder { color: rgba(255,255,255,0.25); }
.chat-input-row input:focus { border-color: rgba(255,255,255,0.2); }
.chat-send {
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: var(--white-10); color: #fff;
  font-size: 14px; cursor: pointer; flex-shrink: 0;
  transition: background 0.15s;
}
.chat-send:hover { background: rgba(255,255,255,0.2); }

/* Disconnect banner */
.disconnect-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  padding: 8px; text-align: center;
  background: var(--warm); color: #fff;
  font-size: 12px; letter-spacing: 1px;
  animation: bannerIn 0.25s ease;
}
@keyframes bannerIn { from { transform: translateY(-100%); } to { transform: translateY(0); } }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 220;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: var(--radius-full);
  background: rgba(30, 30, 30, 0.92);
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.5px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}
.toast.error { background: rgba(145, 76, 64, 0.96); }
.toast.success { background: rgba(92, 124, 92, 0.96); }

/* ====== GAME: LOBBY ====== */
.lobby-shell { text-align: center; padding: 20px 0; }
.lobby-art-wrap {
  position: relative; overflow: hidden; border-radius: var(--radius-md);
  margin-top: 16px;
}
.lobby-art-wrap img { width: 100%; display: block; object-fit: cover; }
.lobby-art-copy {
  position: absolute; left: 16px; bottom: 16px; right: 16px;
  padding: 12px 16px; border-radius: var(--radius-md);
  background: rgba(0,0,0,0.55); backdrop-filter: blur(4px);
  color: #fff;
}
.lobby-art-copy strong { display: block; font-size: 15px; font-weight: 500; }
.lobby-art-copy span { display: block; margin-top: 4px; font-size: 12px; color: rgba(255,255,255,0.65); }

/* ====== GAME: DRAW ====== */
.draw-canvas-wrap {
  position: relative; overflow: hidden;
  aspect-ratio: 16 / 10; max-height: 50vh;
  border-radius: var(--radius-md);
  background: #fff;
}
#drawCanvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: default; }
#drawCanvas.drawable { cursor: crosshair; }
.canvas-mask {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.5); color: var(--white-70);
  font-size: 13px; letter-spacing: 1px; text-align: center;
}
.draw-controls { display: flex; align-items: center; gap: 10px; margin-top: 12px; justify-content: center; }
.swatches { display: flex; gap: 8px; }
.swatch {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2); cursor: pointer;
  transition: transform 0.15s;
}
.swatch:hover { transform: scale(1.2); }
.swatch.active { border-color: #fff; box-shadow: 0 0 8px rgba(255,255,255,0.3); }
.size-slider { accent-color: var(--green); width: 80px; }
.clear-btn {
  padding: 5px 14px; border-radius: var(--radius-full);
  border: 1px solid var(--white-15); background: transparent;
  color: var(--white-70); font-size: 11px; letter-spacing: 1px; cursor: pointer;
  transition: all 0.15s;
}
.clear-btn:hover { background: var(--white-10); color: #fff; border-color: rgba(255,255,255,0.3); }

/* ====== GAME: SPY ====== */
.word-card {
  text-align: center; padding: 32px 20px; margin-bottom: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid var(--white-10);
}
.word-card span { font-size: 10px; letter-spacing: 3px; color: var(--white-40); }
.word-card strong { display: block; margin-top: 8px; font-size: 36px; font-weight: 300; letter-spacing: 4px; color: #fff; }
.vote-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.vote-btn {
  padding: 12px; border-radius: var(--radius-md);
  border: 1px solid var(--white-10); background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.7); font-size: 13px;
  cursor: pointer; transition: all 0.15s; text-align: center;
}
.vote-btn:hover { border-color: rgba(255,255,255,0.2); }
.vote-btn.selected { background: var(--warm); border-color: var(--warm); color: #fff; }
.vote-btn:disabled { cursor: not-allowed; opacity: 0.35; }
.spy-result { text-align: center; padding: 20px; }
.spy-result h3 { color: #fff; font-size: 20px; font-weight: 400; margin-bottom: 8px; }

/* ====== GAME: QUICK ====== */
.arena { display: flex; align-items: center; justify-content: center; min-height: 260px; }
.buzz-btn {
  width: min(200px, 60vw); aspect-ratio: 1; border-radius: 50%;
  border: 2px solid var(--white-10);
  background: var(--warm); color: #fff;
  font-size: 28px; font-weight: 300; letter-spacing: 3px;
  cursor: pointer; transition: all 0.2s;
}
.buzz-btn:disabled { cursor: not-allowed; opacity: 0.72; }
.buzz-btn.go { background: var(--green); animation: pulse 1s infinite; }
.buzz-btn.waiting { background: var(--warm); }
.buzz-btn.between { background: rgba(255,255,255,0.06); color: var(--white-40); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(143,168,143,0.4); } 50% { box-shadow: 0 0 0 16px rgba(143,168,143,0); } }

/* ====== GAME: GOMOKU ====== */
.gomoku-panel {
  display: grid;
  gap: 14px;
}
.gomoku-players {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.gomoku-seat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--white-10);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.04);
}
.gomoku-seat.active { border-color: rgba(255,255,255,0.28); background: rgba(255,255,255,0.08); }
.gomoku-seat.winner { border-color: var(--gold); }
.gomoku-seat strong,
.gomoku-seat span { display: block; }
.gomoku-seat strong { color: #fff; font-size: 12px; font-weight: 500; }
.gomoku-seat span { color: var(--white-40); font-size: 11px; }
.gomoku-seat-stone {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
}
.gomoku-seat-stone.black,
.gomoku-stone.black { background: #1f1f1f; border: 1px solid rgba(255,255,255,0.22); }
.gomoku-seat-stone.white,
.gomoku-stone.white { background: #f4f1e9; border: 1px solid rgba(0,0,0,0.2); }
.gomoku-board {
  width: min(820px, 86vh, 100%);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(var(--size), minmax(0, 1fr));
  grid-template-rows: repeat(var(--size), minmax(0, 1fr));
  gap: 0;
  padding: 20px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.12);
  background: #c9b888;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08), 0 18px 40px rgba(0,0,0,0.18);
}
.gomoku-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
  line-height: 0;
}
.gomoku-cell::before,
.gomoku-cell::after {
  content: "";
  position: absolute;
  pointer-events: none;
  background: rgba(58,56,53,0.35);
  z-index: 0;
}
.gomoku-cell::before {
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  transform: translateY(-50%);
}
.gomoku-cell::after {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
}
.gomoku-cell[data-col="0"]::before { left: 50%; }
.gomoku-cell[data-col="14"]::before { right: 50%; }
.gomoku-cell[data-row="0"]::after { top: 50%; }
.gomoku-cell[data-row="14"]::after { bottom: 50%; }
.gomoku-cell:not(:disabled):hover {
  background: radial-gradient(circle at center, rgba(255,255,255,0.24) 0 30%, transparent 32%);
}
.gomoku-cell:disabled { cursor: default; opacity: 1; }
.gomoku-stone {
  position: relative;
  z-index: 1;
  width: min(72%, 34px);
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.22);
}
.gomoku-cell.last .gomoku-stone { outline: 2px solid var(--green); outline-offset: 2px; }
.gomoku-cell.win .gomoku-stone { outline: 2px solid var(--gold); outline-offset: 2px; }
.gomoku-spectators {
  margin: -4px 0 0;
  text-align: center;
  color: var(--white-40);
  font-size: 11px;
}

/* ====== MOBILE ====== */
@media (max-width: 760px) {
  /* Hall */
  .hall { padding: 20px 14px; }
  .hall-hero::after {
    background: linear-gradient(180deg, rgba(247,245,240,0.78) 0%, rgba(247,245,240,0.45) 55%, rgba(247,245,240,0.1) 100%);
  }
  .hall-head { margin-bottom: 24px; }
  .hall-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .hall-card-img { height: 110px; }
  .hall-card-body { padding: 10px 12px; }
  .hall-card-body h4 { font-size: 14px; }
  .hall-card-body p { font-size: 10px; }
  .hall-card-more { min-height: 160px; }

  /* Modal -> bottom sheet */
  .modal-overlay { align-items: flex-end; }
  .modal {
    width: 100%; max-width: 100%; border-radius: 12px 12px 0 0;
    animation: sheetIn 0.25s ease;
  }
  @keyframes sheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .modal-body { padding: 20px 16px 24px; }
  .modal-hero { height: 120px; }

  /* Room */
  .room-layout { flex-direction: column; }
  .chat-panel {
    width: 100%; max-height: 160px;
    border-left: 0; border-top: 1px solid rgba(255,255,255,0.06);
    transition: bottom 0.15s ease;
  }
  .chat-msgs { max-height: 80px; }
  .room-players {
    position: static; flex-direction: row; flex-wrap: wrap;
    padding: 4px 12px; gap: 4px;
  }
  .player-pill { font-size: 10px; padding: 3px 8px; }
  .player-pill-avatar { width: 18px; height: 18px; font-size: 9px; }
  .room-game-tabs {
    position: static; padding: 4px 12px;
  }
  .room-stage { min-height: 50vh; }
  .room-tool-row { bottom: 40px; }
  .draw-canvas-wrap { aspect-ratio: 4 / 3; max-height: none; }
  .gomoku-board { width: min(96vw, 66vh); padding: 12px; }
  .gomoku-players { grid-template-columns: 1fr; }
  .room-topbar { padding: 8px 12px; }
  .room-info h3 { font-size: 13px; }
}

/* Disconnected player */
.player-pill.disconnected { opacity: 0.45; }
.player-pill.disconnected .player-pill-avatar { filter: grayscale(0.6); }

/* Chat presets */
.chat-presets {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.chat-preset {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--white-10);
  background: rgba(255,255,255,0.04);
  color: var(--white-40);
  font-size: 10px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.chat-preset:hover { background: var(--white-10); color: var(--white-70); }

/* Quick progress bar */
.quick-progress-wrap {
  width: 100%;
  max-width: 280px;
  height: 4px;
  border-radius: 2px;
  background: var(--white-10);
  margin: 0 auto 12px;
  overflow: hidden;
}
.quick-progress-bar {
  height: 100%;
  border-radius: 2px;
  background: var(--green);
  transition: width 0.3s linear;
}

/* Score ranking */
.score-ranking {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
}
.score-ranking h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  letter-spacing: 1px;
  text-align: center;
}
.score-rank-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 12px;
  color: var(--white-70);
}
.score-rank-item .rank-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.score-rank-item .rank-num.gold { background: #c9b888; }
.score-rank-item .rank-num.silver { background: #9a9a9a; }
.score-rank-item .rank-num.bronze { background: #b08060; }
.score-rank-item .rank-num.default { background: var(--white-10); }
.score-rank-item .rank-name { flex: 1; }
.score-rank-item .rank-score { font-weight: 700; color: #fff; }

/* Mobile touch improvements */
@media (max-width: 760px) {
  .game-tab-pill {
    padding: 6px 14px;
    font-size: 11px;
  }
  .swatch {
    width: 32px;
    height: 32px;
  }
  .clear-btn, .btn {
    min-height: 40px;
    padding: 8px 16px;
  }
  .size-slider {
    height: 32px;
  }
  .vote-btn {
    min-height: 48px;
    padding: 14px;
    font-size: 14px;
  }
  .buzz-btn {
    width: min(240px, 72vw);
    font-size: 36px;
  }
  .chat-send {
    width: 42px;
    height: 42px;
    font-size: 18px;
  }
  .room-code-pill {
    padding: 4px 12px;
    font-size: 11px;
  }
  .chat-input-row input {
    padding: 11px 14px;
    font-size: 13px;
  }
  .hall-card-img > span {
    width: 56px;
    height: 56px;
  }
  .hall-card-more { min-height: 120px; }
  .rules-card { font-size: 12px; }
  .rules-card ol { font-size: 11px; line-height: 1.9; }
  .result-banner { padding: 14px 16px; }
  .result-banner strong { font-size: 18px; }
  .score-rank-item { font-size: 13px; padding: 8px 0; }
}
