/* ============================================================
   Burraco Online — Global Stylesheet
   Palette: verde panno #1a472a, oro #f0c040, avorio #fdf6e3
   Font: Playfair Display (titoli) + Nunito (UI)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=Nunito:wght@400;600;700;800&display=swap');

/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --felt:      #1a472a;
  --felt-dark: #0f2e1c;
  --felt-mid:  #245c35;
  --gold:      #f0c040;
  --gold-dark: #c89520;
  --card-bg:   #fdf6e3;
  --red:       #c0392b;
  --black:     #1a1a2e;
  --ui-bg:     #0d1f13;
  --ui-panel:  #162b1d;
  --ui-border: rgba(240,192,64,0.25);
  --text:      #e8f5e0;
  --text-dim:  #8fb88f;
  --danger:    #e74c3c;
  --success:   #2ecc71;
  --info:      #3498db;
  --radius:    10px;
  --shadow:    0 4px 24px rgba(0,0,0,0.5);
  --card-w:    82px;
  --card-h:    115px;
  --card-fs:   18px;
  --card-sym:  32px;
}

html, body { height: 100%; }
body {
  font-family: 'Nunito', sans-serif;
  background: var(--ui-bg);
  color: var(--text);
  overflow-x: hidden;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: 'Playfair Display', serif; }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--ui-bg); }
::-webkit-scrollbar-thumb { background: var(--felt-mid); border-radius: 3px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: var(--radius);
  border: none; cursor: pointer; font-family: 'Nunito', sans-serif;
  font-weight: 700; font-size: 14px; transition: all .18s;
  white-space: nowrap;
}
.btn:active { transform: scale(.96); }
.btn-gold   { background: var(--gold); color: #1a1a1a; }
.btn-gold:hover { background: #ffd060; }
.btn-green  { background: var(--felt-mid); color: #fff; border: 1px solid var(--ui-border); }
.btn-green:hover { background: #2d7a42; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-ghost  { background: transparent; color: var(--text); border: 1px solid var(--ui-border); }
.btn-ghost:hover { background: rgba(255,255,255,.07); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ── Form ─────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }
.form-group input, .form-group select, .form-group textarea {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius);
  color: var(--text); padding: 10px 14px;
  font-family: 'Nunito', sans-serif; font-size: 14px;
  transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus {
  outline: none; border-color: var(--gold);
}
.form-group input::placeholder { color: var(--text-dim); }

/* ── Card (gioco) ─────────────────────────────────────────── */
.card-play {
  width: var(--card-w); height: var(--card-h);
  border-radius: 7px;
  background: var(--card-bg);
  border: 1.5px solid rgba(0,0,0,.15);
  box-shadow: 1px 2px 8px rgba(0,0,0,.4);
  display: flex; flex-direction: column;
  align-items: center; justify-content: space-between;
  padding: 4px 5px;
  cursor: pointer;
  user-select: none;
  transition: transform .15s, box-shadow .15s;
  position: relative;
  flex-shrink: 0;
}
.card-play:hover { transform: translateY(-6px); box-shadow: 2px 8px 18px rgba(0,0,0,.5); }
.card-play.selected {
  transform: translateY(-14px);
  box-shadow: 0 12px 28px rgba(240,192,64,.6);
  border-color: var(--gold);
  z-index: 10;
}
.card-play .rank-top, .card-play .rank-bot {
  font-family: 'Playfair Display', serif;
  font-weight: 700; line-height: 1;
}
.card-play .rank-top { font-size: var(--card-fs); align-self: flex-start; }
.card-play .rank-bot { font-size: var(--card-fs); align-self: flex-end; transform: rotate(180deg); }
.card-play .suit-center { font-size: var(--card-sym); line-height: 1; }
.card-play.hearts, .card-play.diamonds { color: var(--red); }
.card-play.spades,  .card-play.clubs   { color: var(--black); }
.card-play.joker {
  background: linear-gradient(135deg, #1a1a2e 0%, #2c1654 50%, #1a1a2e 100%);
  color: var(--gold); border: 2px solid var(--gold);
}
.card-play.joker .suit-center { font-size: 28px; }
.card-play.face-down {
  background: repeating-linear-gradient(
    45deg, #1a4a7a 0px, #1a4a7a 8px, #0d2137 8px, #0d2137 16px
  );
  border: 2px solid #2a5a8a;
  cursor: default;
}
.card-play.face-down:hover { transform: none; }
.card-back-logo {
  font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  height: 100%;
}

/* Mini card per le calate sul tavolo */
.card-mini {
  --card-w: 48px; --card-h: 66px;
  --card-fs: 11px; --card-sym: 18px;
  width: 48px; height: 66px;
}

/* ── Meld (calata) ────────────────────────────────────────── */
.meld-container {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 10px;
}
.meld {
  display: flex; flex-direction: column; gap: 4px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius);
  padding: 8px;
  cursor: pointer;
  transition: border-color .2s;
}
.meld:hover { border-color: var(--gold); }
.meld.target { border-color: var(--success); box-shadow: 0 0 12px rgba(46,204,113,.3); }
.meld-cards { display: flex; gap: 3px; flex-wrap: wrap; }
.meld-info { font-size: 11px; color: var(--text-dim); text-align: center; }
.meld-burraco { color: var(--gold); font-weight: 700; }

/* ── Toast ────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
}
.toast {
  padding: 12px 18px; border-radius: var(--radius);
  font-weight: 600; font-size: 14px;
  animation: slideIn .3s ease;
  max-width: 320px;
  box-shadow: var(--shadow);
}
.toast.success { background: #1e5c38; border-left: 4px solid var(--success); }
.toast.error   { background: #5c1e1e; border-left: 4px solid var(--danger); }
.toast.info    { background: #1e3c5c; border-left: 4px solid var(--info); }
.toast.warning { background: #5c4a1e; border-left: 4px solid var(--gold); }
@keyframes slideIn { from { opacity:0; transform:translateX(30px); } to { opacity:1; transform:none; } }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  animation: fadeIn .2s ease;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--ui-panel);
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  padding: 32px;
  max-width: 480px; width: 90%;
  max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal h2 { font-family: 'Playfair Display', serif; color: var(--gold); margin-bottom: 20px; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

/* ── Spinner ──────────────────────────────────────────────── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(240,192,64,.3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Badge / chip ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 50px;
  font-size: 12px; font-weight: 700;
}
.badge-gold   { background: rgba(240,192,64,.2); color: var(--gold); border: 1px solid rgba(240,192,64,.4); }
.badge-green  { background: rgba(46,204,113,.15); color: #2ecc71; }
.badge-red    { background: rgba(231,76,60,.15);  color: #e74c3c; }
.badge-blue   { background: rgba(52,152,219,.15); color: #3498db; }
.badge-gray   { background: rgba(255,255,255,.1); color: var(--text-dim); }

/* ── Avatar ───────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
  border: 2px solid rgba(255,255,255,.15);
}

/* ── Page layout helpers ──────────────────────────────────── */
.page-center {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: radial-gradient(ellipse at 50% 0%, #245c35 0%, var(--ui-bg) 60%);
}
.card-panel {
  background: var(--ui-panel);
  border: 1px solid var(--ui-border);
  border-radius: 20px;
  padding: 36px;
  width: 100%;
  box-shadow: var(--shadow);
}

/* ── Lobby layout ─────────────────────────────────────────── */
.lobby-layout {
  display: grid;
  grid-template-columns: 220px 1fr 260px;
  grid-template-rows: auto 1fr;
  height: 100vh;
  gap: 0;
  background: var(--ui-bg);
}
.lobby-header {
  grid-column: 1/-1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px;
  background: var(--ui-panel);
  border-bottom: 1px solid var(--ui-border);
}
.lobby-header h1 { font-size: 22px; color: var(--gold); }
.lobby-left, .lobby-right {
  background: var(--ui-panel);
  border-right: 1px solid var(--ui-border);
  overflow-y: auto;
  padding: 16px;
}
.lobby-right { border-right: none; border-left: 1px solid var(--ui-border); }
.lobby-center { overflow-y: auto; padding: 20px; }

.section-title {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-dim);
  margin-bottom: 12px; padding-bottom: 6px;
  border-bottom: 1px solid var(--ui-border);
}

/* User item in sidebar */
.user-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius);
  transition: background .15s;
}
.user-item:hover { background: rgba(255,255,255,.05); }
.user-item .user-info { flex: 1; min-width: 0; }
.user-item .username { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-item .status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-online  { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-ingame  { background: var(--gold); box-shadow: 0 0 6px var(--gold); }

/* Room card */
.room-card {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  transition: border-color .2s, transform .15s;
}
.room-card:hover { border-color: var(--gold); transform: translateY(-1px); }
.room-card .room-name { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 700; color: var(--gold); }
.room-card .room-meta { font-size: 12px; color: var(--text-dim); margin: 4px 0 10px; }
.room-card .room-players { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

/* ── Game layout ──────────────────────────────────────────── */
.game-layout {
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr 280px;
  grid-template-rows: 48px 1fr auto;
  background: var(--felt-dark);
  gap: 0;
}
.game-topbar {
  grid-column: 1/-1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: rgba(0,0,0,.4);
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: 13px; gap: 12px;
}
.game-table-area {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 50%, var(--felt-mid) 0%, var(--felt-dark) 70%);
}
/* Texture panno */
.game-table-area::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h60v60H0z' fill='none'/%3E%3Ccircle cx='30' cy='30' r='1' fill='rgba(255,255,255,0.03)'/%3E%3C/svg%3E");
  pointer-events: none;
}
.game-panel {
  background: var(--ui-panel);
  border-left: 1px solid var(--ui-border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.game-hand-area {
  grid-column: 1/2;
  background: rgba(0,0,0,.3);
  border-top: 1px solid rgba(255,255,255,.07);
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.game-panel-side { grid-column: 2/3; grid-row: 3/4; }

/* Seat positions around the table (top/sides) */
.seat {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.seat .seat-label {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .5px; color: rgba(255,255,255,.6);
  background: rgba(0,0,0,.4); padding: 2px 8px; border-radius: 4px;
}
.seat.active .seat-label { color: var(--gold); }
.seat .face-down-hand { display: flex; gap: -8px; }

/* Pile area (centro tavolo) */
.table-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 20px;
}
.pile-area {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.pile-label { font-size: 11px; color: rgba(255,255,255,.5); text-transform: uppercase; letter-spacing: .5px; }
.pile-card {
  width: var(--card-w); height: var(--card-h);
  border-radius: 7px; position: relative; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.pile-card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,.5); }
.pile-count {
  position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--text-dim); white-space: nowrap;
}
.deck-stack {
  width: var(--card-w); height: var(--card-h);
  position: relative;
}
.deck-stack .card-play {
  position: absolute;
}
.deck-stack .card-play:nth-child(1) { top:  0px; left:  0px; }
.deck-stack .card-play:nth-child(2) { top: -2px; left: -2px; }
.deck-stack .card-play:nth-child(3) { top: -4px; left: -4px; }

/* Calate sul tavolo */
.table-melds {
  position: absolute; bottom: 4px; left: 4px; right: 4px;
  display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-end;
  padding: 4px;
  max-height: 35%;
  overflow-y: auto;
}

/* Hand (mio) */
.my-hand {
  display: flex; gap: 4px; flex-wrap: nowrap;
  overflow-x: auto; padding: 4px 0 12px;
}
.hand-actions {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.phase-indicator {
  font-size: 13px; font-weight: 700;
  padding: 4px 12px; border-radius: 20px;
}
.phase-draw    { background: rgba(52,152,219,.2); color: #3498db; }
.phase-meld    { background: rgba(240,192,64,.2);  color: var(--gold); }
.phase-discard { background: rgba(46,204,113,.2); color: #2ecc71; }
.phase-finished { background: rgba(231,76,60,.2); color: #e74c3c; }

/* ── Chat ─────────────────────────────────────────────────── */
.chat-wrapper { display: flex; flex-direction: column; height: 100%; }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.chat-msg {
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  word-break: break-word;
}
.chat-msg .from { font-weight: 700; color: var(--gold); font-size: 12px; margin-bottom: 2px; }
.chat-msg.system { color: var(--text-dim); font-style: italic; background: none; }
.chat-input-area { padding: 10px; border-top: 1px solid var(--ui-border); }
.chat-input-area input {
  width: 100%; background: rgba(255,255,255,.06);
  border: 1px solid var(--ui-border); border-radius: 8px;
  color: var(--text); padding: 8px 12px;
  font-family: 'Nunito', sans-serif; font-size: 13px;
  margin-bottom: 6px;
}
.quick-msgs { display: flex; flex-wrap: wrap; gap: 4px; }
.quick-btn {
  font-size: 12px; padding: 4px 8px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--ui-border);
  border-radius: 6px; cursor: pointer; color: var(--text);
  transition: background .15s;
}
.quick-btn:hover { background: rgba(240,192,64,.15); }

/* ── Voice ────────────────────────────────────────────────── */
.voice-controls {
  padding: 10px;
  border-top: 1px solid var(--ui-border);
  display: flex; gap: 8px; align-items: center;
}
.voice-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px; border-radius: 8px;
  border: 1px solid var(--ui-border);
  background: rgba(255,255,255,.04);
  color: var(--text); cursor: pointer;
  font-size: 13px; font-weight: 700; font-family: 'Nunito', sans-serif;
  transition: all .15s;
}
.voice-btn.active { background: rgba(231,76,60,.2); border-color: var(--danger); color: var(--danger); }
.voice-btn:hover { background: rgba(255,255,255,.1); }
.voice-peer {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-dim); padding: 4px 8px;
  border-radius: 6px; background: rgba(255,255,255,.04);
}
.voice-peer.speaking { color: var(--success); }

/* ── Game over overlay ────────────────────────────────────── */
.gameover-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.85); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.gameover-card {
  background: var(--ui-panel);
  border: 2px solid var(--gold);
  border-radius: 20px; padding: 40px; text-align: center;
  max-width: 480px; width: 90%;
  animation: popIn .4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn { from { opacity:0; transform:scale(.7); } to { opacity:1; transform:scale(1); } }
.gameover-card h1 { font-size: 36px; color: var(--gold); margin-bottom: 8px; }
.score-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.score-table th { color: var(--text-dim); font-size: 12px; text-transform: uppercase; padding: 6px; }
.score-table td { padding: 8px; border-top: 1px solid var(--ui-border); font-size: 15px; }
.score-winner { color: var(--gold); font-weight: 700; }

/* ── Admin panel ──────────────────────────────────────────── */
.admin-layout {
  display: grid; grid-template-columns: 220px 1fr;
  height: 100vh; overflow: hidden;
}
.admin-nav {
  background: var(--ui-panel);
  border-right: 1px solid var(--ui-border);
  padding: 20px 12px;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.admin-nav h2 { font-size: 14px; color: var(--gold); margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--ui-border); text-align: center; }
.admin-nav .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  cursor: pointer; font-size: 14px; font-weight: 600;
  color: var(--text-dim); transition: all .15s;
}
.admin-nav .nav-item:hover, .admin-nav .nav-item.active {
  background: rgba(240,192,64,.1); color: var(--gold);
}
.admin-content { overflow-y: auto; padding: 24px; }
.admin-section { display: none; }
.admin-section.active { display: block; }
.admin-section h2 { font-size: 24px; color: var(--gold); margin-bottom: 20px; }

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--ui-panel); border: 1px solid var(--ui-border);
  border-radius: var(--radius); padding: 16px; text-align: center;
}
.stat-card .stat-num { font-size: 32px; font-weight: 800; color: var(--gold); font-family: 'Playfair Display', serif; }
.stat-card .stat-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; margin-top: 4px; }

/* Table styles */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 10px 12px; text-align: left; color: var(--text-dim); text-transform: uppercase; font-size: 11px; letter-spacing: .5px; border-bottom: 1px solid var(--ui-border); }
.data-table td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,.04); }
.data-table tr:hover td { background: rgba(255,255,255,.03); }

/* ── Waiting room overlay ─────────────────────────────────────── */
.waiting-overlay {
  position: absolute; inset: 0;
  background: rgba(10,25,15,.92); backdrop-filter: blur(4px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; z-index: 50;
}
.waiting-overlay h2 { color: var(--gold); font-size: 26px; }
.waiting-seats { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.waiting-seat {
  width: 80px; text-align: center;
  padding: 12px 8px; border-radius: 10px;
  border: 2px dashed rgba(255,255,255,.2);
  font-size: 12px; color: var(--text-dim);
}
.waiting-seat.filled { border-color: var(--gold); color: var(--text); }
.waiting-seat .seat-avatar { width: 44px; height: 44px; margin: 0 auto 6px; font-size: 16px; }

/* ── Responsive ───────────────────────────────────────────────── */

/* Impedisce qualsiasi overflow orizzontale a qualsiasi dimensione */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

@media (max-width: 768px) {
  /* Card leggermente più piccole su mobile per stare nel viewport */
  :root {
    --card-w:   54px;
    --card-h:   76px;
    --card-fs:  12px;
    --card-sym: 20px;
  }

  /* Impedisci overflow su ogni elemento della pagina */
  *, *::before, *::after {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Lobby compatta */
  .lobby-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .lobby-left, .lobby-right { display: none; }
  .lobby-center { padding: 12px; }

  /* ── Game layout: colonna verticale che occupa esattamente il viewport ── */
  .game-layout {
    display: flex !important;
    flex-direction: column !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    height: 100vh !important;     /* fallback per browser senza dvh */
    overflow: hidden !important;
    background: var(--felt-dark);
  }

  /* Top bar compatta */
  .game-topbar {
    flex: 0 0 auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 44px;
    font-size: 11px;
    padding: 4px 8px !important;
    gap: 4px;
    flex-wrap: wrap;
  }
  .game-topbar .btn { font-size: 10px !important; padding: 3px 6px !important; }
  #room-name-display { font-size: 11px !important; max-width: 100px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

  /* Tavolo: occupa tutto lo spazio rimanente */
  .game-table-area {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    width: 100% !important;
    position: relative !important;
    overflow: hidden !important;
  }

  /* Nasconde pannelli desktop */
  .game-panel, .game-panel-side { display: none !important; }

  /* Barra azioni mobile — visible e dentro il layout flex */
  .mobile-actions {
    display: flex !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    gap: 6px;
    padding: 6px 8px;
    background: rgba(0,0,0,.7);
    border-top: 1px solid rgba(255,255,255,.1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .mobile-actions::-webkit-scrollbar { display: none; }
  .mobile-actions .btn { flex-shrink: 0; font-size: 13px; padding: 8px 14px; white-space: nowrap; }

  /* Toolbar azioni desktop: nascosta su mobile (sostituita da mobile-actions) */
  #desktop-toolbar { display: none !important; }

  /* Mia mano: area card scrollabile orizzontalmente */
  .game-hand-area {
    flex: 0 0 auto !important;
    width: 100% !important;
    padding: 6px 8px !important;
    background: rgba(0,0,0,.5);
    border-top: 1px solid rgba(255,255,255,.1);
    max-height: 120px;
    overflow: hidden;
  }
  .game-hand-area > div:first-child > span { font-size: 11px !important; }
  .my-hand {
    gap: 3px !important;
    padding-bottom: 4px;
    overflow-x: auto !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    display: flex !important;
    flex-wrap: nowrap !important;
  }
  .my-hand .card-play {
    flex-shrink: 0 !important;
    scroll-snap-align: start;
  }

  /* Pozzetti/info mano */
  #hand-info { font-size: 10px !important; }

  /* Pile mazzo/scarti nel centro — ridimensionate */
  .table-center { gap: 20px !important; }
  .pile-card {
    width: var(--card-w) !important;
    height: var(--card-h) !important;
  }
  .deck-stack {
    width: var(--card-w) !important;
    height: var(--card-h) !important;
  }
  .deck-stack .card-play {
    width: var(--card-w) !important;
    height: var(--card-h) !important;
  }

  /* Seat avversari: compatti */
  .seat > div:first-child { padding: 3px 6px !important; }
  .seat .avatar { width: 22px !important; height: 22px !important; font-size: 9px !important; }
  .face-down-row .card-play { margin-left: -28px !important; }
  .face-down-row .card-play.card-mini {
    width: 36px !important; height: 50px !important;
  }

  /* Calate sul tavolo: scroll orizzontale */
  .table-melds {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    max-height: 25% !important;
    scrollbar-width: none;
  }
  .table-melds::-webkit-scrollbar { display: none; }
  .meld { padding: 4px !important; }

  /* Chat: bottone floating + drawer dal basso */
  .mobile-chat-toggle {
    position: fixed !important;
    bottom: 80px; right: 12px;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--gold);
    color: #1a1a1a;
    font-size: 20px;
    display: flex !important;
    align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,.5);
    cursor: pointer; z-index: 200; border: none;
  }
  .mobile-chat-drawer {
    position: fixed !important;
    bottom: 0; left: 0; right: 0;
    height: 60dvh; height: 60vh;
    background: var(--ui-panel);
    border-top: 2px solid var(--ui-border);
    border-radius: 16px 16px 0 0;
    z-index: 300;
    display: flex; flex-direction: column;
    transform: translateY(100%);
    transition: transform .3s ease;
  }
  .mobile-chat-drawer.open { transform: translateY(0); }
  .mobile-chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1px solid var(--ui-border);
    font-weight: 700; color: var(--gold);
  }

  /* Admin */
  .admin-layout { grid-template-columns: 1fr; }
  .admin-nav { display: none; }
}
