/* ============================================================
 * style.css — Sảnh Game "Trò chơi dân gian" · CHỦ ĐỀ NEON
 * Nền tối, viền/chữ phát sáng cyan–magenta, hiệu ứng glow.
 * Áp cho MỌI trang: sảnh, lobby, màn chơi caro, modal.
 * ============================================================ */

:root {
  --bg-0: #05010f;
  --bg-1: #0a0620;
  --bg-2: #140a34;
  --surface: rgba(18, 12, 46, 0.66);
  --surface-solid: #120a2e;

  --neon-cyan: #22e3ff;
  --neon-magenta: #ff2bd6;
  --neon-purple: #a35bff;
  --neon-green: #39ff9e;
  --neon-yellow: #ffe14d;

  --text: #eaf2ff;
  --muted: #8f93cf;
  --border: rgba(120, 110, 255, 0.38);

  --accent: var(--neon-cyan);
  --accent2: var(--neon-magenta);

  --x-color: var(--neon-cyan);
  --o-color: var(--neon-magenta);

  --radius: 16px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
}
/* Toggle "tông neon": mặc định = Cyan; dark = Magenta/Tím */
[data-theme="dark"] {
  --accent: var(--neon-magenta);
  --accent2: var(--neon-cyan);
  --x-color: var(--neon-magenta);
  --o-color: var(--neon-cyan);
}

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

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 15% -10%, rgba(34, 227, 255, 0.16), transparent 60%),
    radial-gradient(1000px 620px at 90% 0%, rgba(255, 43, 214, 0.16), transparent 60%),
    radial-gradient(900px 700px at 50% 120%, rgba(163, 91, 255, 0.18), transparent 60%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  background-attachment: fixed;
}

/* Lưới cyber mờ phủ nền */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 110, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 110, 255, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 55%, transparent 100%);
}

/* Lớp doodle lặp phủ nền — thưa hơn (ít icon, ô lớn) */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: url('../assets/doodle-tile.svg') 0 0 / 300px 250px repeat;
  opacity: 0.07;
  mask-image: radial-gradient(ellipse at 50% 45%, #000 70%, transparent 100%);
}
/* Chữ MEGAS ở giữa */
.bg-doodle {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: url('../assets/bg-megas.svg') center center / min(1700px, 100%) auto no-repeat;
  opacity: 0.22;
  filter: drop-shadow(0 0 8px rgba(34, 227, 255, 0.7));
}

.app { position: relative; z-index: 1; width: 100%; }
#screen-lobby, #screen-game { max-width: 900px; margin: 0 auto; padding: 16px; }

/* ===== Màn hình ===== */
.screen { display: none; animation: fade 0.25s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ===== Nút & input ===== */
.btn {
  font: inherit; font-weight: 700; cursor: pointer; letter-spacing: 0.3px;
  border-radius: 12px; padding: 12px 18px; color: #04121a;
  border: 1px solid transparent;
  transition: transform 0.08s, box-shadow 0.2s, filter 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(180deg, var(--neon-cyan), #0bb6d6); color: #021018;
  box-shadow: 0 0 14px rgba(34, 227, 255, 0.6), inset 0 0 8px rgba(255, 255, 255, 0.25);
}
.btn-primary:hover { box-shadow: 0 0 22px rgba(34, 227, 255, 0.9); }
.btn-secondary {
  background: linear-gradient(180deg, var(--neon-green), #17c46e); color: #04160d;
  box-shadow: 0 0 14px rgba(57, 255, 158, 0.55);
}
.btn-secondary:hover { box-shadow: 0 0 22px rgba(57, 255, 158, 0.85); }
.btn-ghost {
  background: rgba(120, 110, 255, 0.08); color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { box-shadow: 0 0 14px rgba(120, 110, 255, 0.5); border-color: var(--accent); }
.btn-mini { padding: 8px 12px; font-size: 0.85rem; border-radius: 10px; }
.btn-block { display: block; width: 100%; margin-top: 10px; }

.input {
  font: inherit; padding: 11px 12px; border-radius: 10px; width: 100%;
  background: rgba(8, 6, 24, 0.8); color: var(--text);
  border: 1px solid var(--border);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.input::placeholder { color: var(--muted); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 12px rgba(34, 227, 255, 0.4); }
.field-label { display: block; font-size: 0.86rem; color: var(--muted); margin-bottom: 6px; }
select.input, select { color: var(--text); background: rgba(8, 6, 24, 0.9); }
option { background: var(--surface-solid); color: var(--text); }

/* ===== Avatar ===== */
.avatar {
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 44px; height: 44px; border-radius: 50%; font-size: 1.4rem;
  background: radial-gradient(circle at 30% 25%, #2a1b5e, #0c0723);
  border: 1.5px solid var(--accent);
  box-shadow: 0 0 12px rgba(34, 227, 255, 0.5), inset 0 0 8px rgba(163, 91, 255, 0.4);
}
.avatar-lg { width: 66px; height: 66px; font-size: 2rem; }

/* ============================================================
 * HUB — sảnh neon
 * ============================================================ */
.hub {
  position: relative; overflow: hidden;
  padding: 26px 22px 22px; min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  background:
    radial-gradient(900px 500px at 50% -12%, rgba(34, 227, 255, 0.14), transparent 60%),
    radial-gradient(800px 520px at 100% 100%, rgba(255, 43, 214, 0.12), transparent 60%);
}
.hub-decor { position: absolute; inset: 0; z-index: 0; color: var(--neon-cyan); opacity: 0.14; pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(34, 227, 255, 0.5)); }
.hub-decor svg { width: 100%; height: 100%; }
.hub-inner { position: relative; z-index: 1; max-width: 1060px; margin: 0 auto; width: 100%; }

.hub-titlebar { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 24px; }
.hub-title {
  font-size: clamp(1.3rem, 4.4vw, 2.1rem); font-weight: 900; letter-spacing: 3px;
  color: #eafcff;
  text-shadow: 0 0 8px var(--neon-cyan), 0 0 22px rgba(34, 227, 255, 0.7), 0 0 40px rgba(34, 227, 255, 0.4);
}
.title-orn { display: inline-flex; color: var(--neon-cyan); filter: drop-shadow(0 0 6px var(--neon-cyan)); }
.title-orn svg { width: 28px; height: 28px; }

.folk-grid { display: grid; gap: 18px; grid-template-columns: repeat(3, 1fr); }
.folk-card {
  display: flex; align-items: center; gap: 16px; padding: 16px; min-height: 96px; cursor: pointer;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(30, 20, 68, 0.7), rgba(12, 8, 32, 0.7));
  border: 1.5px solid color-mix(in srgb, var(--accent, var(--neon-cyan)) 45%, var(--border));
  backdrop-filter: blur(4px);
  box-shadow:
    inset 0 0 18px color-mix(in srgb, var(--accent, var(--neon-cyan)) 12%, transparent),
    0 0 16px color-mix(in srgb, var(--accent, var(--neon-cyan)) 20%, transparent),
    0 6px 20px rgba(0, 0, 0, 0.4);
  transition: transform 0.14s, box-shadow 0.2s, border-color 0.2s;
  position: relative; overflow: hidden;
}
.folk-card::after {
  content: ""; position: absolute; inset: 0; border-radius: 16px; pointer-events: none;
  box-shadow: inset 0 0 0 1px transparent; transition: box-shadow 0.2s;
}
.folk-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent, var(--neon-cyan));
  box-shadow: 0 0 0 1px var(--accent), 0 0 26px color-mix(in srgb, var(--accent) 55%, transparent), 0 10px 26px rgba(0, 0, 0, 0.5);
}
.folk-card.locked { opacity: 0.82; }
.folk-card.locked:hover { transform: none; }
.folk-icon {
  flex: 0 0 auto; width: 76px; height: 76px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent, var(--neon-cyan));
  background: radial-gradient(circle at 30% 25%, rgba(34, 227, 255, 0.12), rgba(6, 4, 20, 0.6));
  border: 1.5px solid color-mix(in srgb, var(--accent) 60%, var(--border));
  box-shadow: inset 0 0 14px color-mix(in srgb, var(--accent) 30%, transparent), 0 0 12px color-mix(in srgb, var(--accent) 35%, transparent);
}
.folk-icon svg { width: 50px; height: 50px; filter: drop-shadow(0 0 5px color-mix(in srgb, var(--accent) 70%, transparent)); }
.folk-qmark {
  font-size: 42px; font-weight: 900; line-height: 1; color: var(--accent, #8390c4);
  text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 70%, transparent);
}
.folk-label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.folk-name {
  font-size: clamp(1.05rem, 2.5vw, 1.5rem); font-weight: 900; letter-spacing: 1px;
  text-transform: uppercase; color: #f2f7ff;
  text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 65%, transparent);
}
.folk-soon {
  align-self: flex-start; font-size: 0.68rem; letter-spacing: 0.5px;
  color: var(--neon-yellow); border: 1px solid rgba(255, 225, 77, 0.5);
  padding: 2px 8px; border-radius: 20px; box-shadow: 0 0 8px rgba(255, 225, 77, 0.3);
}

.hub-footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin-top: 26px; }
.folk-btn {
  font: inherit; font-weight: 800; letter-spacing: 1px; cursor: pointer; text-transform: uppercase;
  color: var(--text); background: rgba(120, 110, 255, 0.06);
  border: 1.5px solid var(--accent); border-radius: 24px; padding: 10px 22px;
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 40%, transparent), inset 0 0 10px color-mix(in srgb, var(--accent) 15%, transparent);
  text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 50%, transparent);
  transition: box-shadow 0.2s, transform 0.08s, background 0.2s;
}
.folk-btn:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 70%, transparent); }
.folk-btn:active { transform: scale(0.96); }

/* Modal cài đặt / bảng xếp hạng */
.settings-avatar-row { display: flex; justify-content: center; margin-bottom: 10px; }
.lb-sub { font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; text-align: center; }
.lb-table { display: flex; flex-direction: column; gap: 6px; }
.lb-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  padding: 9px 12px; border-radius: 10px; background: rgba(120, 110, 255, 0.08);
  border: 1px solid var(--border);
}
.lb-row.lb-head { background: transparent; border: none; font-weight: 700; color: var(--muted); font-size: 0.8rem; }
.lb-game { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.lb-game svg { width: 20px; height: 20px; color: var(--accent); }
.lb-rank { font-weight: 900; color: var(--neon-green); text-shadow: 0 0 8px rgba(57, 255, 158, 0.5); }

/* ============================================================
 * LOBBY — neon
 * ============================================================ */
.lobby-header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.lobby-heading { font-size: 1.25rem; font-weight: 800; display: flex; align-items: center; gap: 8px;
  text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent); }
.lobby-game-icon { font-size: 1.4rem; }
.lobby-rank { margin-left: auto; font-weight: 800; color: var(--neon-green); text-shadow: 0 0 8px rgba(57, 255, 158, 0.5); }

.lobby-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 24px; max-width: 460px; margin: 0 auto;
  backdrop-filter: blur(6px);
  box-shadow: 0 0 26px rgba(120, 110, 255, 0.18), var(--shadow);
}
.lobby-settings { margin-bottom: 12px; }
.setup-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.setup-row select { max-width: 160px; }

.divider { display: flex; align-items: center; text-align: center; color: var(--muted); margin: 16px 0 6px; }
.divider::before, .divider::after { content: ""; flex: 1; border-bottom: 1px solid var(--border); }
.divider span { padding: 0 12px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 2px;
  color: var(--accent); text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 50%, transparent); }

.join-row { display: flex; gap: 8px; margin-top: 10px; }
.join-row .input { flex: 1; text-transform: uppercase; }

.lobby-status { margin-top: 16px; text-align: center; font-size: 0.92rem; min-height: 24px; color: var(--muted); }
.lobby-status.error { color: #ff6b8a; text-shadow: 0 0 8px rgba(255, 107, 138, 0.5); }
.waiting { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 8px 0; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid rgba(120, 110, 255, 0.25); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite; box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 50%, transparent);
}
@keyframes spin { to { transform: rotate(360deg); } }

.room-code-row { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 8px 0; }
.room-code {
  font-size: 1.7rem; font-weight: 900; letter-spacing: 4px;
  color: var(--neon-cyan); background: rgba(34, 227, 255, 0.08);
  padding: 6px 16px; border-radius: 10px; border: 1px solid rgba(34, 227, 255, 0.5);
  text-shadow: 0 0 12px rgba(34, 227, 255, 0.8);
}

/* ============================================================
 * MODAL / TOAST — neon
 * ============================================================ */
.overlay {
  position: fixed; inset: 0; z-index: 60; padding: 16px;
  background: rgba(4, 2, 14, 0.72); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; animation: fade 0.2s ease;
}
.modal-card {
  background: linear-gradient(180deg, rgba(24, 16, 56, 0.96), rgba(12, 8, 32, 0.96));
  color: var(--text); border: 1.5px solid var(--accent); border-radius: var(--radius);
  padding: 26px; width: 100%; max-width: 400px; max-height: 88vh; overflow: auto;
  box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 45%, transparent), var(--shadow);
}
.modal-title { margin-bottom: 14px; font-size: 1.3rem; font-weight: 800;
  text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent); }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

.avatar-picker { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-top: 6px; }
.avatar-opt {
  width: 100%; aspect-ratio: 1; border: 1.5px solid var(--border); cursor: pointer;
  background: rgba(120, 110, 255, 0.08); font-size: 1.2rem; border-radius: 10px;
}
.avatar-opt.selected { border-color: var(--accent); box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 70%, transparent); }

.rules-list { padding-left: 20px; line-height: 1.7; }
.rules-list li { margin-bottom: 4px; }

.result-body { text-align: center; }
.result-rank { margin-top: 12px; font-size: 1.05rem; }
.result-rank .up { color: var(--neon-green); text-shadow: 0 0 8px rgba(57, 255, 158, 0.6); }
.result-rank .down { color: #ff6b8a; text-shadow: 0 0 8px rgba(255, 107, 138, 0.6); }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: rgba(10, 6, 30, 0.95); color: var(--text);
  border: 1px solid var(--accent); padding: 10px 18px; border-radius: 12px;
  font-size: 0.9rem; z-index: 70; max-width: 88vw; text-align: center;
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent);
}

.hidden { display: none !important; }

/* ============================================================
 * MÀN CHƠI CỜ CARO — neon
 * ============================================================ */
.caro-screen {
  border-radius: var(--radius); padding: 14px;
  background:
    radial-gradient(700px 380px at 50% -10%, rgba(34, 227, 255, 0.14), transparent 60%),
    linear-gradient(180deg, rgba(16, 10, 42, 0.9), rgba(7, 4, 22, 0.95));
  border: 1.5px solid var(--border);
  box-shadow: 0 0 30px rgba(120, 110, 255, 0.15), var(--shadow);
}

.caro-topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.caro-title { flex: 1; text-align: center; font-weight: 800; letter-spacing: 1px;
  color: #eafcff; text-shadow: 0 0 10px rgba(34, 227, 255, 0.7); }
.tool-btn {
  width: 42px; height: 42px; border-radius: 11px; cursor: pointer; font-size: 1.1rem;
  color: var(--text); background: rgba(120, 110, 255, 0.1);
  border: 1px solid var(--border); transition: box-shadow 0.2s, border-color 0.2s;
}
.tool-btn:hover { border-color: var(--accent); box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 60%, transparent); }

.caro-arena { display: flex; align-items: center; justify-content: center; gap: 14px; }

/* Panel người chơi — thẻ neon dọc */
.player-panel {
  width: 122px; flex: 0 0 auto;
  background: linear-gradient(180deg, rgba(28, 18, 66, 0.9), rgba(10, 6, 30, 0.9));
  border: 1.5px solid var(--border); border-radius: 16px;
  padding: 14px 8px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: inset 0 0 16px rgba(120, 110, 255, 0.12), 0 6px 16px rgba(0, 0, 0, 0.45);
  transition: box-shadow 0.25s, transform 0.25s, border-color 0.25s;
}
.player-panel[data-mark="X"] { --pcol: var(--x-color); }
.player-panel[data-mark="O"] { --pcol: var(--o-color); }
.player-panel.active {
  transform: translateY(-3px); border-color: var(--pcol, var(--accent));
  box-shadow: 0 0 0 1px var(--pcol), 0 0 26px color-mix(in srgb, var(--pcol) 70%, transparent);
}
.player-panel .pp-avatar {
  width: 56px; height: 56px; font-size: 1.7rem;
  border-color: var(--pcol, var(--accent));
  box-shadow: 0 0 14px color-mix(in srgb, var(--pcol) 60%, transparent);
}
.pp-name { font-weight: 700; color: #fff; font-size: 0.95rem;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-rank { font-size: 0.8rem; color: var(--neon-green); font-weight: 700; text-shadow: 0 0 6px rgba(57, 255, 158, 0.5); }
.pp-timer {
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 900; color: var(--text);
  background: rgba(6, 4, 20, 0.8); border: 2px solid var(--border);
}
.pp-timer.running { border-color: var(--pcol, var(--accent)); color: #fff;
  box-shadow: 0 0 16px color-mix(in srgb, var(--pcol) 65%, transparent); }
.pp-timer.urgent { color: #fff; border-color: #ff4d6d; background: rgba(90, 8, 24, 0.7);
  box-shadow: 0 0 18px rgba(255, 77, 109, 0.8); animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.pp-mark {
  font-size: 1.8rem; font-weight: 900; line-height: 1;
  width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: rgba(6, 4, 20, 0.6); border: 1px solid var(--border);
}
.pp-mark.mark-x { color: var(--x-color); text-shadow: 0 0 12px var(--x-color); }
.pp-mark.mark-o { color: var(--o-color); text-shadow: 0 0 12px var(--o-color); }

/* Bàn cờ neon */
.board-wrap { display: flex; justify-content: center; }
.board {
  display: grid; gap: 0;
  background: rgba(6, 4, 20, 0.85);
  border: 2px solid var(--accent); border-radius: 8px;
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 40%, transparent), inset 0 0 30px rgba(120, 110, 255, 0.08);
  touch-action: manipulation;
}
.cell {
  width: var(--cell-size, 30px); height: var(--cell-size, 30px);
  border: 1px solid rgba(120, 110, 255, 0.2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; user-select: none; line-height: 1;
}
.cell:hover:not(.filled) { background: rgba(34, 227, 255, 0.08); }
.cell.x { color: var(--x-color); }
.cell.o { color: var(--o-color); }
.cell .mark { font-size: calc(var(--cell-size, 30px) * 0.72); font-weight: 900; animation: pop 0.15s ease; }
.cell.x .mark { text-shadow: 0 0 10px var(--x-color), 0 0 18px var(--x-color); }
.cell.o .mark { text-shadow: 0 0 10px var(--o-color), 0 0 18px var(--o-color); }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.cell.last { box-shadow: inset 0 0 0 2px var(--neon-green), inset 0 0 12px rgba(57, 255, 158, 0.4); }
.cell.win { background: rgba(57, 255, 158, 0.25); box-shadow: inset 0 0 14px rgba(57, 255, 158, 0.7);
  animation: winpulse 0.8s ease infinite alternate; }
@keyframes winpulse { from { background: rgba(57, 255, 158, 0.15); } to { background: rgba(57, 255, 158, 0.42); } }
.board.disabled { pointer-events: none; }

/* Chat neon */
.caro-chat {
  margin-top: 12px; background: rgba(8, 5, 26, 0.7);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px;
  box-shadow: inset 0 0 16px rgba(120, 110, 255, 0.1);
}
.chat-head { display: flex; justify-content: space-between; align-items: center; color: var(--accent);
  font-weight: 700; margin-bottom: 8px; text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 50%, transparent); }
.chat-log { height: 140px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; }
.chat-msg { display: flex; align-items: center; gap: 8px; }
.chat-msg.me { flex-direction: row-reverse; }
.chat-avatar { font-size: 1.1rem; }
.chat-text {
  background: rgba(120, 110, 255, 0.14); color: var(--text);
  padding: 6px 10px; border-radius: 12px; max-width: 75%; font-size: 0.9rem; word-break: break-word;
  border: 1px solid var(--border);
}
.chat-msg.me .chat-text { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: var(--accent); }
.chat-input-row { display: flex; gap: 8px; margin-top: 8px; }
.chat-input-row .input { flex: 1; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .caro-arena { flex-wrap: wrap; }
  .board-wrap { order: 3; flex-basis: 100%; margin-top: 10px; }
  .player-panel { order: 1; flex: 1 1 45%; flex-direction: row; flex-wrap: wrap; justify-content: center; width: auto; }
  .player-panel .pp-avatar { width: 42px; height: 42px; font-size: 1.2rem; }
  .pp-timer { width: 44px; height: 44px; font-size: 1.2rem; }
  .pp-name { font-size: 0.85rem; }
}
@media (max-width: 760px) { .folk-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) {
  .folk-grid { grid-template-columns: 1fr; }
  .folk-icon { width: 62px; height: 62px; }
  .folk-icon svg { width: 42px; height: 42px; }
  .hub-footer .folk-btn { padding: 9px 16px; font-size: 0.9rem; }
  .avatar-picker { grid-template-columns: repeat(6, 1fr); }
}
