:root {
  color-scheme: dark;
  --bg: #070b14;
  --panel: rgba(15, 23, 42, 0.75);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-hover: rgba(26, 38, 66, 0.85);
  --text: #f8fafc;
  --muted: #94a3b8;
  --cyan: #00f2fe;
  --cyan-glow: rgba(0, 242, 254, 0.45);
  --pink: #ff2e63;
  --pink-glow: rgba(255, 46, 99, 0.45);
  --gold: #ffd166;
  --good: #10b981;
  --bad: #ef4444;
  --indigo: #6366f1;
}

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

.hidden {
  display: none !important;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Background Mesh */
.background-mesh {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 45% at 50% -10%, rgba(0, 242, 254, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 90% 90%, rgba(99, 102, 241, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 10% 70%, rgba(255, 46, 99, 0.07) 0%, transparent 60%);
}

.app {
  max-width: 1440px;
  margin: 0 auto;
  padding: 12px 20px 32px;
  position: relative;
  z-index: 1;
}

button, input, select {
  font: inherit;
}

/* Common Button Styles */
button {
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(22, 34, 58, 0.85);
  color: var(--text);
  font-weight: 600;
  padding: 10px 16px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

button:hover:not(:disabled) {
  transform: translateY(-1.5px);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(30, 48, 82, 0.95);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

/* Primary Cyan Neon Button */
button.primary {
  background: linear-gradient(135deg, #00d2ff 0%, #00f2fe 50%, #3a7bd5 100%);
  color: #04121e;
  border: 0;
  font-weight: 800;
  box-shadow: 0 6px 20px -2px rgba(0, 242, 254, 0.35);
}

button.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #1ae0ff 0%, #33f5ff 50%, #4a8ee6 100%);
  box-shadow: 0 8px 25px rgba(0, 242, 254, 0.55);
}

/* Secondary Frosted Button */
button.secondary {
  background: rgba(20, 32, 54, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #dbeafe;
}

button.secondary:hover:not(:disabled) {
  border-color: var(--cyan);
  color: #fff;
  background: rgba(28, 46, 78, 0.95);
}

button.action-indigo {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border: 0;
  color: #fff;
  box-shadow: 0 6px 18px -2px rgba(99, 102, 241, 0.35);
}

button.action-indigo:hover:not(:disabled) {
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.55);
}

button.danger {
  background: rgba(68, 24, 38, 0.8);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

button.danger:hover:not(:disabled) {
  background: rgba(88, 30, 48, 0.95);
  border-color: var(--pink);
  color: #fff;
  box-shadow: 0 4px 16px rgba(255, 46, 99, 0.35);
}

.small-btn {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 9px;
}

/* ================= 1. HEADER ================= */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 12px 18px;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

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

.logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-weight: 900;
  font-size: 16px;
  background: linear-gradient(135deg, #0e1e36, #14284b);
  border: 1.5px solid rgba(0, 242, 254, 0.4);
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.25), inset 0 0 10px rgba(0, 242, 254, 0.1);
}

.logo-mark .x-svg,
.logo-mark .x-glyph {
  color: var(--cyan);
  filter: drop-shadow(0 0 6px var(--cyan));
}

.logo-mark .dot-divider {
  color: #475569;
  font-size: 12px;
}

.logo-mark .o-svg,
.logo-mark .o-glyph {
  color: var(--pink);
  filter: drop-shadow(0 0 6px var(--pink));
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #ffffff 40%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 10px;
  background: rgba(22, 34, 58, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: all 0.2s ease;
}

.header-btn:hover {
  background: rgba(30, 48, 80, 0.9);
  border-color: rgba(0, 242, 254, 0.35);
  color: #fff;
}

.header-btn.icon-only {
  padding: 8px 10px;
  font-size: 14px;
}

/* ================= 3-COLUMN LAYOUT ================= */
.layout-three-cols {
  display: grid;
  grid-template-columns: 310px minmax(420px, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

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

.col-setup {
  min-width: 280px;
}

.col-board {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

.col-social {
  min-width: 280px;
}

.panel-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.panel-icon {
  font-size: 16px;
}

.panel-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cyan);
}

.panel-subtitle {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

/* ================= 2. KHỐI ĐIỀU KHIỂN PHÒNG (CỘT TRÁI) ================= */
.room-control-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Thẻ Lobby Mới Vào - Gaming Dashboard */
.lobby-init-card {
  background: linear-gradient(160deg, rgba(16, 26, 48, 0.92) 0%, rgba(9, 14, 28, 0.98) 100%);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(0, 242, 254, 0.22);
  border-radius: 20px;
  padding: 18px 18px 20px;
  box-shadow:
    0 16px 45px -10px rgba(0, 0, 0, 0.6),
    0 0 25px rgba(0, 242, 254, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: fadeIn 0.25s ease-out;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Header Gaming */
.lobby-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lobby-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(0, 242, 254, 0.4);
}

.lobby-badge-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: pulseBeacon 1.6s infinite;
}

.lobby-tag {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
}

/* Section Blocks */
.setup-section-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setup-block-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
}

.setup-block-label .label-icon {
  font-size: 15px;
}

.size-preview-badge {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  background: rgba(255, 209, 102, 0.12);
  border: 1px solid rgba(255, 209, 102, 0.3);
  padding: 2px 7px;
  border-radius: 6px;
}

/* Input Tên Người Chơi */
.input-with-avatar {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-avatar input {
  width: 100%;
  background: rgba(10, 18, 32, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 14px;
  outline: none;
  transition: all 0.25s ease;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

.input-with-avatar input:focus {
  border-color: var(--cyan);
  background: rgba(12, 24, 44, 0.95);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.4),
    0 0 0 3px rgba(0, 242, 254, 0.2);
}

/* Lưới Nút Chọn Nhanh Cỡ Bàn */
.size-pill-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.size-pill {
  background: rgba(14, 24, 42, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
}

.size-pill:hover {
  background: rgba(22, 36, 64, 0.9);
  border-color: rgba(0, 242, 254, 0.4);
  transform: translateY(-1.5px);
}

.size-pill.active {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.18), rgba(99, 102, 241, 0.22));
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(0, 242, 254, 0.25), inset 0 0 12px rgba(0, 242, 254, 0.1);
}

.size-pill .pill-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
}

.size-pill.active .pill-title {
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 242, 254, 0.6);
}

.size-pill .pill-desc {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
}

.size-pill.active .pill-desc {
  color: #e2e8f0;
}

.custom-size-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.custom-size-toggle-btn {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.custom-size-toggle-btn:hover {
  color: #fff;
  border-color: var(--cyan);
  background: rgba(255, 255, 255, 0.04);
}

.custom-size-input {
  width: 80px;
  text-align: center;
  background: rgba(10, 18, 32, 0.9);
  border: 1px solid var(--cyan);
  border-radius: 8px;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 5px 8px;
  outline: none;
}

/* Khối Action (Tạo phòng & Vào phòng) */
.setup-action-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 2px;
}

.hero-create-room-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 13px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #00d2ff 0%, #00f2fe 45%, #2563eb 100%);
  color: #03111e;
  border: 0;
  cursor: pointer;
  box-shadow:
    0 8px 24px -2px rgba(0, 242, 254, 0.45),
    inset 0 1px 1px rgba(255, 255, 255, 0.8);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.hero-create-room-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 30px rgba(0, 242, 254, 0.65),
    inset 0 1px 1px rgba(255, 255, 255, 0.9);
}

.hero-create-room-btn .btn-icon {
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.hero-create-room-btn .btn-text-group {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.hero-create-room-btn .btn-title {
  font-size: 14.5px;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.hero-create-room-btn .btn-subtitle {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.88;
  margin-top: 2px;
}

/* Divider HOẶC */
.or-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  color: #475569;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  user-select: none;
}

.or-divider::before,
.or-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Khung Nhập Mã Vào Phòng */
.join-room-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.join-input-wrapper {
  display: flex;
  gap: 8px;
}

.join-input-wrapper input {
  flex: 1;
  min-width: 0;
  background: rgba(8, 14, 26, 0.9);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: var(--cyan);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-align: center;
  padding: 10px 12px;
  outline: none;
  transition: all 0.2s;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

.join-input-wrapper input:focus {
  border-color: var(--cyan);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.5),
    0 0 0 2px rgba(0, 242, 254, 0.25);
}

.join-input-wrapper input::placeholder {
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: #64748b;
  font-weight: 600;
}

.join-room-card .join-submit-btn {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 800;
  border-radius: 12px;
  white-space: nowrap;
}

.join-bottom-chips {
  display: flex;
  gap: 6px;
}

.join-bottom-chips .chip-btn {
  flex: 1;
  font-size: 11px;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(18, 30, 52, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-weight: 600;
}

.join-bottom-chips .chip-btn:hover {
  background: rgba(26, 44, 76, 0.95);
  border-color: var(--cyan);
  color: #fff;
}

/* Thẻ chung cho Host & Joining */
.room-card {
  background: linear-gradient(145deg, rgba(17, 28, 48, 0.85), rgba(11, 18, 32, 0.9));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  padding: 18px 22px;
  box-shadow: 0 14px 40px -10px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.25s ease-out;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--cyan);
  background: rgba(0, 242, 254, 0.08);
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid rgba(0, 242, 254, 0.25);
}

.dot.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: pulseBeacon 1.8s infinite;
}

@keyframes pulseBeacon {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.head-tools {
  display: flex;
  gap: 6px;
}

.subtle-tool-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
}

.subtle-tool-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text);
  transform: none;
}

.subtle-tool-btn.danger {
  color: #f87171;
}

.subtle-tool-btn.danger:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* Khu vực hiển thị mã phòng của Host */
.room-code-display-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 6px 0 16px;
  text-align: center;
}

.code-intro {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.room-code-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: var(--cyan);
  text-shadow: 0 0 16px rgba(0, 242, 254, 0.6);
  background: rgba(6, 14, 26, 0.9);
  border: 2px dashed rgba(0, 242, 254, 0.4);
  border-radius: 16px;
  padding: 8px 24px;
  cursor: pointer;
  user-select: all;
  transition: all 0.2s;
  box-shadow: 0 0 25px rgba(0, 242, 254, 0.15), inset 0 0 15px rgba(0, 242, 254, 0.05);
}

.room-code-pill:hover {
  border-color: var(--cyan);
  transform: scale(1.02);
  box-shadow: 0 0 35px rgba(0, 242, 254, 0.3);
}

.code-hint {
  font-size: 11px;
  color: #64748b;
  margin-top: 6px;
}

.host-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
  width: 100%;
}

.host-actions button {
  width: 100%;
  padding: 12px 16px;
  font-size: 13.5px;
  border-radius: 12px;
}

.glow-btn {
  box-shadow: 0 4px 20px rgba(0, 242, 254, 0.45);
}

.host-wait-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  text-align: center;
  margin-top: 6px;
}

/* Thẻ Joining */
.join-connecting-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
}

.connecting-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.radar-spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2.5px solid rgba(0, 242, 254, 0.2);
  border-top-color: var(--cyan);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.connecting-text strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--cyan);
}

.connecting-text small {
  font-size: 11px;
  color: var(--muted);
}

/* Thẻ In-Game (Cột Trái) */
.ingame-bar {
  background: linear-gradient(145deg, rgba(16, 26, 44, 0.85), rgba(11, 18, 32, 0.9));
  border: 1px solid rgba(0, 242, 254, 0.35);
  border-radius: 20px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(0, 242, 254, 0.12);
  animation: fadeIn 0.25s ease-out;
}

.ingame-room-box {
  background: rgba(10, 18, 32, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ingame-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ingame-title-row strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: #fff;
}

.size-tag {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.role-pill-box {
  display: flex;
}

.role-pill {
  background: rgba(16, 185, 129, 0.15);
  color: var(--good);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
}

.ingame-actions-vertical {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.full-w-btn {
  width: 100%;
  padding: 11px 16px;
  border-radius: 12px;
}

/* ================= 3. ĐẤU THỦ HUD (PLAYERS BAR) ================= */
.game-container {
  max-width: min(530px, calc(100vh - 270px));
  margin: 0 auto;
}

.game-head {
  margin-bottom: 12px;
}

.players-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.player-hud-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  transition: all 0.25s;
  backdrop-filter: blur(12px);
}

.player-hud-card.active#playerX {
  border-color: var(--cyan);
  background: rgba(0, 242, 254, 0.08);
  box-shadow: 0 0 22px rgba(0, 242, 254, 0.25), inset 0 0 10px rgba(0, 242, 254, 0.1);
}

.player-hud-card.active#playerO {
  border-color: var(--pink);
  background: rgba(255, 46, 99, 0.08);
  box-shadow: 0 0 22px rgba(255, 46, 99, 0.25), inset 0 0 10px rgba(255, 46, 99, 0.1);
}

.player-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 17px;
  flex-shrink: 0;
}

.player-avatar.x-avatar {
  background: rgba(0, 242, 254, 0.15);
  color: var(--cyan);
  border: 1.5px solid rgba(0, 242, 254, 0.4);
  text-shadow: 0 0 10px var(--cyan);
}

.player-avatar.o-avatar {
  background: rgba(255, 46, 99, 0.15);
  color: var(--pink);
  border: 1.5px solid rgba(255, 46, 99, 0.4);
  text-shadow: 0 0 10px var(--pink);
}

.player-info strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.player-info small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.text-right {
  text-align: right;
  margin-left: auto;
}

/* Khối chính giữa HUD */
.match-center-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 4px;
  flex-shrink: 0;
}

/* Bảng tỉ số 2 bên */
.hud-scoreboard {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(8, 14, 28, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  padding: 2px 14px;
  margin-bottom: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.hud-score-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.hud-score-val.x-val {
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(0, 242, 254, 0.6);
}

.hud-score-val.o-val {
  color: var(--pink);
  text-shadow: 0 0 10px rgba(255, 46, 99, 0.6);
}

.hud-score-sep {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.35);
}

.player-score-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 900;
  padding: 4px 9px;
  border-radius: 8px;
  flex-shrink: 0;
  line-height: 1;
}

.player-score-badge.x-score {
  background: rgba(0, 242, 254, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(0, 242, 254, 0.35);
}

.player-score-badge.o-score {
  background: rgba(255, 46, 99, 0.12);
  color: var(--pink);
  border: 1px solid rgba(255, 46, 99, 0.35);
}

.turn-highlight {
  font-size: 13px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.move-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  margin-top: 2px;
}

/* ================= 4. BÀN CỜ CARO (THE BOARD) ================= */
.board-container {
  width: 100%;
  aspect-ratio: 1;
  position: relative;
  border-radius: 18px;
  padding: 8px;
  transition: all 0.3s ease;
}

/* Theme 1: Obsidian Midnight (Mặc định - Cực Sang) */
.board-container.theme-obsidian {
  background: radial-gradient(circle at 50% 50%, #0e172a 0%, #080d19 100%);
  border: 2px solid rgba(0, 242, 254, 0.25);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.75),
    0 0 30px rgba(0, 242, 254, 0.12),
    inset 0 0 40px rgba(0, 0, 0, 0.6);
}

/* Theme 2: Kaya Royal Wood (Gỗ Tự Nhiên Cao Cấp) */
.board-container.theme-wood {
  background: radial-gradient(circle at 45% 45%, #e0b670 0%, #c5964f 60%, #9e732e 100%);
  border: 3px solid #855b20;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.65),
    inset 0 0 35px rgba(90, 50, 10, 0.4),
    inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.board-frame {
  width: 100%;
  height: 100%;
  position: relative;
}

/* Lưới Bàn Cờ Caro - Luôn căn chính xác 100% không bao giờ lệch */
.board {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(var(--board-size, 15), minmax(0, 1fr));
  grid-template-rows: repeat(var(--board-size, 15), minmax(0, 1fr));
  padding: 0;
  gap: 0;
  border-radius: 12px;
  overflow: hidden;
  box-sizing: border-box;
  background: transparent;
}

.board-container.theme-obsidian .board {
  border: 2px solid rgba(0, 242, 254, 0.45);
  background: #090e1a;
}

.board-container.theme-wood .board {
  border: 2px solid #855b20;
  background: #cca05a;
}

/* Từng ô cờ (Cell) - Chuẩn hình vuông có viền ô sắc nét */
.cell {
  aspect-ratio: 1;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  box-sizing: border-box;
  border-radius: 0;
  transform: none !important;
  box-shadow: none;
}

/* Ô cờ trên Bàn Đêm Obsidian */
.board-container.theme-obsidian .cell {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(13, 22, 40, 0.65);
  transition: background-color 0.15s, border-color 0.15s;
}

.board-container.theme-obsidian .cell:hover:not(:disabled) {
  background: rgba(0, 242, 254, 0.16);
  border-color: rgba(0, 242, 254, 0.6);
  box-shadow: inset 0 0 10px rgba(0, 242, 254, 0.25);
}

/* Ô cờ trên Bàn Gỗ */
.board-container.theme-wood .cell {
  border: 1px solid rgba(100, 60, 20, 0.38);
  background: rgba(230, 186, 120, 0.3);
  transition: background-color 0.15s;
}

.board-container.theme-wood .cell:hover:not(:disabled) {
  background: rgba(140, 85, 30, 0.28);
  border-color: rgba(140, 85, 30, 0.7);
  box-shadow: inset 0 0 10px rgba(100, 50, 10, 0.2);
}

.cell:disabled {
  cursor: default;
}

/* Điểm sao (Hoshi points) - Đã ẩn để mặt bàn cờ Caro phẳng mịn, không bị phân tâm */
.cell.star-point::before {
  display: none;
}

/* ================= QUÂN CỜ VECTOR SVG CAO CẤP (X & O) ================= */
.mark-svg {
  width: 78%;
  height: 78%;
  display: block;
  margin: auto;
  position: relative;
  z-index: 2;
  overflow: visible;
  pointer-events: none;
  animation: markPopIn 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes markPopIn {
  0% { transform: scale(0.25) rotate(-6deg); opacity: 0; }
  70% { transform: scale(1.15) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Các nét vẽ của SVG */
.mark-stroke-base {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4.6px;
  transition: all 0.2s ease;
}

.mark-stroke-core {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8px;
  stroke: #ffffff;
  opacity: 0.95;
  transition: all 0.2s ease;
}

.mark-o .mark-stroke-base {
  stroke-width: 4.4px;
}

.mark-o .mark-stroke-core {
  stroke-width: 1.6px;
}

/* 1. THEME OBSIDIAN (BÀN ĐÊM CYBERPUNK SANG TRỌNG) */
/* Quân X: Băng Lam Neon Siêu Sáng */
.board-container.theme-obsidian .mark-x .mark-stroke-base {
  stroke: #00f2fe;
  filter: drop-shadow(0 0 6px #00f2fe) drop-shadow(0 0 14px rgba(0, 242, 254, 0.85));
}
.board-container.theme-obsidian .mark-x .mark-stroke-core {
  stroke: #e0faff;
  opacity: 0.98;
}

/* Quân O: Ruby Neon Đỏ Hồng Rực Rỡ */
.board-container.theme-obsidian .mark-o .mark-stroke-base {
  stroke: #ff2e63;
  filter: drop-shadow(0 0 6px #ff2e63) drop-shadow(0 0 14px rgba(255, 46, 99, 0.85));
}
.board-container.theme-obsidian .mark-o .mark-stroke-core {
  stroke: #ffe4e8;
  opacity: 0.98;
}

/* 2. THEME WOOD (BÀN GỖ TỰ NHIÊN HOÀNG GIA) */
/* Quân X: Xanh Sapphire Đậm Đẳng Cấp */
.board-container.theme-wood .mark-x .mark-stroke-base {
  stroke: #1d4ed8;
  filter: drop-shadow(0 2px 4px rgba(10, 20, 50, 0.7)) drop-shadow(0 0 8px rgba(37, 99, 235, 0.8));
}
.board-container.theme-wood .mark-x .mark-stroke-core {
  stroke: #bfdbfe;
  opacity: 0.9;
}

/* Quân O: Đỏ Thắm Ruby Đậm Đẳng Cấp */
.board-container.theme-wood .mark-o .mark-stroke-base {
  stroke: #dc2626;
  filter: drop-shadow(0 2px 4px rgba(50, 10, 20, 0.7)) drop-shadow(0 0 8px rgba(220, 38, 38, 0.8));
}
.board-container.theme-wood .mark-o .mark-stroke-core {
  stroke: #fca5a5;
  opacity: 0.9;
}

/* Nước đi cuối (Last Move) - Khung nét đứt nhấp nháy tinh tế */
.cell.last::after {
  content: '';
  position: absolute;
  inset: 7%;
  border-radius: 6px;
  border: 2px dashed rgba(255, 209, 102, 0.9);
  box-shadow: 0 0 10px rgba(255, 209, 102, 0.4), inset 0 0 6px rgba(255, 209, 102, 0.2);
  pointer-events: none;
  animation: lastMovePulse 1.6s infinite ease-in-out;
  z-index: 3;
}

@keyframes lastMovePulse {
  0% { transform: scale(0.95); opacity: 0.6; }
  50% { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.6; }
}

/* Nước cờ chiến thắng (5 quân liên tiếp) - Vàng Gold Vương Giả */
.cell.winning {
  background: rgba(255, 209, 102, 0.25) !important;
  border-color: #ffd166 !important;
  z-index: 5;
}

.cell.winning .mark-svg .mark-stroke-base {
  stroke: #ffd166 !important;
  filter: drop-shadow(0 0 10px #ffd166) drop-shadow(0 0 22px #eab308) !important;
}

.cell.winning .mark-svg .mark-stroke-core {
  stroke: #ffffff !important;
  opacity: 1 !important;
}

.cell.winning .mark-svg {
  animation: winPulseSvg 0.8s infinite alternate !important;
}

@keyframes winPulseSvg {
  0% { transform: scale(0.96); }
  100% { transform: scale(1.22); filter: drop-shadow(0 0 16px #ffd166); }
}

/* ================= 5. THÔNG BÁO VÀ CẢM XÚC ================= */
.notice {
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 500;
  margin-top: 14px;
  text-align: center;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.notice.error {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(45, 14, 24, 0.85);
  color: #fca5a5;
}

.notice.success {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(10, 36, 28, 0.85);
  color: #6ee7b7;
}

/* Cảm xúc nhanh */
/* ================= 5. KHỐI THẢ EMOJI CẢM XÚC (CỘT PHẢI) ================= */
.reactions-panel {
  background: linear-gradient(145deg, rgba(16, 26, 44, 0.85), rgba(11, 18, 32, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.reactions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.reaction-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  background: rgba(20, 32, 54, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform: none;
}

.emoji-symbol {
  font-size: 24px;
  line-height: 1;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.emoji-text {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  transition: color 0.2s;
}

.reaction-btn:hover:not(:disabled) {
  background: rgba(30, 48, 80, 0.95);
  border-color: var(--cyan);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 242, 254, 0.25);
}

.reaction-btn:hover .emoji-symbol {
  transform: scale(1.25);
}

.reaction-btn:hover .emoji-text {
  color: #fff;
}

.reaction-btn:active {
  transform: translateY(0);
}

/* Hiệu ứng Emoji bay */
.floating-reactions {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 10;
}

.floating-emoji {
  position: absolute;
  bottom: 20px;
  font-size: 42px;
  animation: floatUp 2.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes floatUp {
  0% { transform: translateY(0) scale(0.6); opacity: 0; }
  15% { transform: translateY(-30px) scale(1.3); opacity: 1; }
  80% { transform: translateY(-180px) scale(1); opacity: 0.9; }
  100% { transform: translateY(-240px) scale(0.8); opacity: 0; }
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.96);
  color: #090d16;
  padding: 9px 20px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 242, 254, 0.4);
  z-index: 999;
  max-width: 90vw;
  animation: popInTop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popInTop {
  from { transform: translate(-50%, -15px) scale(0.9); opacity: 0; }
  to { transform: translate(-50%, 0) scale(1); opacity: 1; }
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  display: inline-block;
}

/* ================= 6. KHUNG CHAT TÁN GẪU (CỘT PHẢI) ================= */
.chat-section {
  margin-top: 0;
  background: linear-gradient(145deg, rgba(16, 26, 44, 0.85), rgba(11, 18, 32, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(20, 32, 54, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
}

.chat-badge-icon {
  font-size: 16px;
}

.chat-unread-badge {
  background: var(--pink);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  box-shadow: 0 0 10px rgba(255, 46, 99, 0.7);
  animation: pulseBeacon 1.5s infinite;
}

.chat-toggle-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
}

.chat-toggle-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.chat-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-body.collapsed {
  display: none;
}

/* Quick chat chips */
.quick-messages-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.quick-messages-bar::-webkit-scrollbar {
  display: none;
}

.quick-msg-chip {
  background: rgba(25, 40, 68, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}

.quick-msg-chip:hover {
  background: rgba(35, 58, 96, 0.95);
  border-color: var(--cyan);
  color: #fff;
  transform: translateY(-1px);
}

/* Message bubbles */
.chat-messages {
  height: 280px;
  max-height: 380px;
  min-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.chat-msg-row {
  display: flex;
  flex-direction: column;
  max-width: 84%;
  animation: fadeIn 0.15s ease-out;
}

.chat-msg-row.me {
  align-self: flex-end;
}

.chat-msg-row.them {
  align-self: flex-start;
}

.chat-sender-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 2px;
  margin-left: 6px;
}

.chat-bubble {
  padding: 7px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-bubble.me {
  background: linear-gradient(135deg, #00d2ff, #00a8cc);
  color: #04121e;
  font-weight: 600;
  border-bottom-right-radius: 3px;
  box-shadow: 0 4px 12px rgba(0, 210, 255, 0.25);
}

.chat-bubble.them {
  background: rgba(22, 36, 62, 0.9);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.chat-time {
  font-size: 9px;
  opacity: 0.65;
  align-self: flex-end;
  margin-top: 1px;
}

.chat-sys-bubble {
  align-self: center;
  font-size: 11px;
  color: #64748b;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 12px;
  border-radius: 99px;
  text-align: center;
}

/* Chat Input Bar */
.chat-input-bar {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.chat-input-bar input {
  flex: 1;
  background: rgba(8, 14, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #fff;
  padding: 8px 14px;
  font-size: 13px;
  outline: none;
  transition: all 0.2s;
}

.chat-input-bar input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(0, 242, 254, 0.2);
}

.chat-send-btn {
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 13px;
}

/* ================= MODAL ĐỔI CỠ BÀN CỜ ================= */
.game-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.game-modal-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(160deg, rgba(16, 26, 48, 0.96) 0%, rgba(9, 14, 28, 0.99) 100%);
  border: 1.5px solid rgba(0, 242, 254, 0.35);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(0, 242, 254, 0.15);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: popInModal 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popInModal {
  from { transform: scale(0.9) translateY(12px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--cyan);
}

.modal-close-x {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.modal-close-x:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.modal-desc {
  font-size: 12.5px;
  color: #cbd5e1;
  line-height: 1.5;
}

.modal-size-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.modal-size-pill {
  background: rgba(14, 24, 42, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-size-pill:hover {
  border-color: var(--cyan);
  background: rgba(22, 36, 64, 0.9);
  transform: translateY(-2px);
}

.modal-size-pill.active {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.2), rgba(99, 102, 241, 0.25));
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.3);
}

.pill-size-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

.modal-size-pill.active .pill-size-num {
  color: var(--cyan);
}

.pill-size-tag {
  font-size: 11px;
  color: var(--muted);
}

.modal-size-pill.active .pill-size-tag {
  color: #e2e8f0;
}

.modal-custom-size-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(10, 18, 32, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-size: 12px;
  color: #94a3b8;
}

.modal-custom-size-group input {
  width: 80px;
  background: rgba(12, 22, 38, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 6px 10px;
  text-align: center;
  outline: none;
}

.modal-custom-size-group input:focus {
  border-color: var(--cyan);
}

.modal-actions-row {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.modal-actions-row button {
  flex: 1;
}

/* Modal Xác Nhận Từ Đối Thủ */
.confirm-modal-card {
  text-align: center;
  border-color: var(--gold);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(255, 209, 102, 0.2);
}

.modal-badge-alert {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 209, 102, 0.15);
  color: var(--gold);
  border: 1px solid rgba(255, 209, 102, 0.35);
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin: 0 auto;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulseBeacon 1.2s infinite;
}

.confirm-icon-bubble {
  font-size: 42px;
  margin: 8px 0;
  filter: drop-shadow(0 4px 10px rgba(255, 209, 102, 0.4));
}

.confirm-heading {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}

.confirm-size-highlight {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 26px;
  font-weight: 900;
  color: var(--cyan);
  text-shadow: 0 0 16px rgba(0, 242, 254, 0.6);
  padding: 6px 16px;
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid rgba(0, 242, 254, 0.3);
  border-radius: 12px;
  margin: 8px 0 12px;
}

.confirm-hint {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
}

.confirm-actions-row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.confirm-actions-row button {
  flex: 1;
  padding: 12px;
  font-size: 14px;
}

/* ================= MODAL LỜI MỜI VÀO PHÒNG (BẮT BUỘC NHẬP TÊN) ================= */
.invite-modal-card {
  max-width: 420px;
  border-color: rgba(0, 242, 254, 0.4);
}

.invite-code-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(14, 24, 42, 0.65);
  border: 1px solid rgba(0, 242, 254, 0.25);
  border-radius: 14px;
  padding: 12px 18px;
  margin-bottom: 14px;
}

.invite-code-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}

.invite-code-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--cyan);
  text-shadow: 0 0 16px rgba(0, 242, 254, 0.5);
}

.invite-name-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 8px;
  text-align: left;
}

.invite-name-input-group label {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
}

.invite-name-input-group input {
  width: 100%;
  background: rgba(12, 22, 38, 0.95);
  border: 1.5px solid rgba(0, 242, 254, 0.3);
  border-radius: 12px;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 16px;
  outline: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.invite-name-input-group input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* ================= RESPONSIVE ================= */
@media (max-width: 1120px) {
  .layout-three-cols {
    grid-template-columns: 280px minmax(360px, 1fr) 290px;
    gap: 14px;
  }
  .chat-messages {
    height: 240px;
  }
}

@media (max-width: 960px) {
  .layout-three-cols {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .col-panel {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
  }
  .col-setup { order: 1; }
  .col-board { order: 2; }
  .col-social { order: 3; }
  .chat-messages {
    height: 180px;
  }
}

@media (max-width: 600px) {
  .app {
    padding: 10px 8px 30px;
  }
  .top-nav {
    padding: 10px 14px;
    border-radius: 14px;
  }
  .brand-title {
    font-size: 16px;
  }
  .host-actions {
    flex-direction: column;
  }
  .players-hud {
    gap: 6px;
  }
  .player-hud-card {
    padding: 8px 10px;
    gap: 6px;
  }
  .player-avatar {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }
  .player-info strong {
    font-size: 11px;
  }
  .player-info small {
    font-size: 10px;
  }
  .turn-highlight {
    font-size: 11px;
  }
  .board-container {
    border-radius: 14px;
    padding: 6px;
  }
}
