/* ═══════════════════════════════════════════════════════════════
   Phase 10 · Online — Full CSS
   Dark purple theme matching offline app, Ravensburger card design
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg:        #0f0a1e;
  --bg2:       #1a1030;
  --bg3:       #120d28;
  --surface:   rgba(255,255,255,.07);
  --surface2:  rgba(255,255,255,.12);
  --border:    rgba(255,255,255,.12);
  --border2:   rgba(255,255,255,.20);
  --text:      #f0eaff;
  --text2:     rgba(240,234,255,.55);
  --gold:      #FFC845;
  --gold2:     #ffda7b;
  --green:     #6BCB77;
  --red-ui:    #ff6b6b;
  --accent:    #a855f7;
  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --font:      'Fredoka', 'Nunito', sans-serif;

  /* Phase 10 card colors (Ravensburger palette) */
  --c-red:     #CC0000;
  --c-blue:    #0052A5;
  --c-green:   #007836;
  --c-yellow:  #FFCD00;
  --c-wild-a:  #e74c3c;
  --c-wild-b:  #3498db;
  --c-skip:    #333333;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ══════════════════════════════════════════════════════════
   SCREENS
   ══════════════════════════════════════════════════════════ */

.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.screen.active {
  display: flex;
  opacity: 1;
  transform: none;
  pointer-events: all;
}

/* ══════════════════════════════════════════════════════════
   BACK LINK
   ══════════════════════════════════════════════════════════ */

.back-link {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  background: rgba(255,255,255,.1);
  border: 1.5px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.8);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  text-decoration: none;
  transition: background .15s;
  z-index: 10;
}
.back-link:active { background: rgba(255,255,255,.2); }

/* ══════════════════════════════════════════════════════════
   SETUP HEADER (shared between connect & lobby)
   ══════════════════════════════════════════════════════════ */

.setup-header {
  margin-top: max(60px, env(safe-area-inset-top) + 40px);
  text-align: center;
  margin-bottom: 20px;
  width: 100%;
  max-width: 380px;
  padding: 28px 20px 20px;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255,255,255,.03);
  position: relative;
  flex-shrink: 0;
}

.setup-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    -42deg,
    transparent 38%,
    #c0392b 38%, #c0392b 47%,
    #2563c7 47%, #2563c7 56%,
    #27a844 56%, #27a844 65%,
    #d4a017 65%, #d4a017 74%,
    transparent 74%
  );
  opacity: 0.26;
  pointer-events: none;
}

.game-logo  { font-size: 52px; line-height: 1; margin-bottom: 6px; position: relative; z-index: 1; }
.game-title {
  font-size: clamp(28px, 9vw, 48px);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,.8);
  line-height: 1.1;
  position: relative;
  z-index: 1;
  letter-spacing: -1px;
}
.game-subtitle {
  font-size: 13px;
  color: rgba(255,255,255,.5);
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

/* ══════════════════════════════════════════════════════════
   SCREEN-CONNECT
   ══════════════════════════════════════════════════════════ */

#screen-connect {
  justify-content: flex-start;
  padding: 0 20px max(20px, env(safe-area-inset-bottom));
}

.connect-form {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.name-input {
  width: 100%;
  background: rgba(255,255,255,.08);
  border: 2px solid rgba(255,255,255,.15);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  font-weight: 600;
  padding: 14px 16px;
  outline: none;
  transition: border-color .2s, background .2s;
  text-align: center;
}
.name-input::placeholder { color: rgba(240,234,255,.35); }
.name-input:focus {
  border-color: var(--gold);
  background: rgba(255,200,69,.06);
}

.connect-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.divider {
  text-align: center;
  font-size: 13px;
  color: var(--text2);
  position: relative;
}
.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 38%;
  height: 1px;
  background: var(--border);
}
.divider::before { left: 0; }
.divider::after  { right: 0; }

.join-row {
  display: flex;
  gap: 8px;
  width: 100%;
  overflow: hidden;
}

.code-input {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,.08);
  border: 2px solid rgba(255,255,255,.15);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Courier New', Courier, monospace;
  font-size: 22px;
  font-weight: 700;
  padding: 12px 12px;
  outline: none;
  text-align: center;
  letter-spacing: 6px;
  text-transform: uppercase;
  transition: border-color .2s;
}
.code-input::placeholder { letter-spacing: 3px; color: rgba(240,234,255,.3); font-size: 16px; }
.code-input:focus { border-color: var(--accent); }

/* ══════════════════════════════════════════════════════════
   SCREEN-LOBBY
   ══════════════════════════════════════════════════════════ */

#screen-lobby {
  justify-content: flex-start;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  gap: 16px;
}

.lobby-header {
  text-align: center;
  padding-top: 16px;
  flex-shrink: 0;
}

.lobby-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text2);
  margin-bottom: 6px;
}

.room-code-display {
  font-family: 'Courier New', Courier, monospace;
  font-size: 52px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 10px;
  text-shadow:
    0 0 20px rgba(255,200,69,.5),
    0 0 40px rgba(255,200,69,.2);
  line-height: 1;
  margin-bottom: 6px;
}

.lobby-hint {
  font-size: 13px;
  color: var(--text2);
}

.lobby-players {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.lobby-player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  animation: fadeIn .2s ease;
}
.lobby-player-row.is-host { border-color: var(--gold); background: rgba(255,200,69,.06); }

.lobby-player-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: rgba(0,0,0,.75);
  flex-shrink: 0;
}
.lobby-player-name {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
}
.lobby-player-badge {
  font-size: 11px;
  background: rgba(255,200,69,.2);
  color: var(--gold);
  border-radius: 20px;
  padding: 2px 8px;
  font-weight: 700;
}

.lobby-footer {
  width: 100%;
  max-width: 400px;
  flex-shrink: 0;
  padding-bottom: 4px;
}

.lobby-waiting {
  text-align: center;
  font-size: 14px;
  color: var(--text2);
  padding: 12px;
}

/* ══════════════════════════════════════════════════════════
   SCREEN-GAME LAYOUT
   ══════════════════════════════════════════════════════════ */

#screen-game {
  justify-content: flex-start;
  padding: 0;
}

.game-top {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* ─── Game Header ─── */
.game-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 14px 10px;
  background: rgba(15,10,30,.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 20;
  gap: 8px;
}

.game-round-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
}

.game-turn-label {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-turn-label.my-turn {
  color: var(--green);
  font-weight: 700;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
}
.icon-btn:active { background: var(--surface2); }

/* ─── Opponents area ─── */
.opponents-area {
  width: 100%;
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
  scrollbar-width: none;
}
.opponents-area::-webkit-scrollbar { display: none; }

/* Opponent compact card */
.opponent-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  min-width: 145px;
  max-width: 170px;
  flex-shrink: 0;
  position: relative;
  transition: border-color .2s, background .2s;
}
.opponent-row.is-current {
  border-color: var(--green);
  background: rgba(107,203,119,.08);
  animation: current-glow 1.8s ease-in-out infinite;
}
@keyframes current-glow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(107,203,119,.25); }
  50%      { box-shadow: 0 0 14px 2px rgba(107,203,119,.5); }
}
.opponent-row.disconnected {
  opacity: .55;
}

/* Top row: avatar + name block + mic */
.opp-top-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.opp-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: rgba(0,0,0,.75);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}

.opp-name-block {
  flex: 1;
  min-width: 0;
}

.opp-name {
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  color: var(--text);
}

.opp-phase-lbl {
  font-size: 9.5px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
  font-weight: 600;
}

.opp-mic {
  font-size: 14px;
  flex-shrink: 0;
  opacity: .35;
  line-height: 1;
}
.opp-mic.on { opacity: 1; }

/* Bottom row: score + dots + cards */
.opp-bottom-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.opp-score {
  font-size: 10px;
  color: var(--gold);
  font-weight: 700;
  flex-shrink: 0;
}

/* Phase progress dots for opponent */
.opp-phase-dots {
  display: flex;
  gap: 2px;
  flex: 1;
}
.opp-phase-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  flex-shrink: 0;
}
.opp-phase-dot.done  { background: var(--green); }
.opp-phase-dot.cur   { background: var(--gold); }

/* Stacked face-down cards */
.opp-hand-stack {
  position: relative;
  height: 24px;
  width: 28px;
  flex-shrink: 0;
}
.opp-hand-stack .p10-card.face-down.opponent-card {
  position: absolute;
  top: 0;
}
.opp-hand-stack .p10-card.face-down.opponent-card:nth-child(1) { left: 0;   z-index: 1; }
.opp-hand-stack .p10-card.face-down.opponent-card:nth-child(2) { left: 7px; z-index: 2; }
.opp-hand-stack .p10-card.face-down.opponent-card:nth-child(3) { left: 14px;z-index: 3; }

.opp-hand-count {
  font-size: 10px;
  color: var(--text2);
  font-weight: 700;
  flex-shrink: 0;
}

/* ─── Table center (piles) ─── */
.table-center {
  width: 100%;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: 6px 16px;
}

.piles-row {
  display: flex;
  gap: 24px;
  align-items: center;
}

.pile {
  position: relative;
  width: 56px;
  height: 84px;
  cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
}
.pile:active { transform: scale(.95); }

.pile-back {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: #000;
  border: 1.5px solid rgba(255,255,255,.2);
  box-shadow: 0 4px 16px rgba(0,0,0,.7);
  position: relative;
  overflow: hidden;
}
/* 4 colored stripes at bottom — edge to edge, white separator on top */
.pile-back::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 26px;
  background: linear-gradient(
    to bottom,
    #CC0000 0% 25%,
    #0052A5 25% 50%,
    #007836 50% 75%,
    #FFCD00 75% 100%
  );
  border-top: 2px solid #fff;
  z-index: 1;
}
/* Phase 10 bold text — upper 2/3 */
.pile-back::after {
  content: 'Phase\A10';
  white-space: pre;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka', 'Nunito', Impact, sans-serif;
  font-size: 15px;
  font-weight: 900;
  font-style: normal;
  color: #fff;
  text-align: center;
  line-height: 1.0;
  z-index: 2;
  pointer-events: none;
}

.pile-count {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text2);
  font-weight: 600;
  white-space: nowrap;
}

.discard-pile {
  width: 56px;
  height: 84px;
  border-radius: 8px;
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .15s;
}
.discard-pile:hover { border-color: var(--border2); }

.discard-top-card {
  width: 52px;
  height: 80px;
  border-radius: 7px;
  /* populated by JS with p10-card class/content */
}

/* ─── Table-laid (everyone's laid phases) ─── */
.table-laid {
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  /* flex growth now handled by .game-top wrapper */
  -webkit-overflow-scrolling: touch;
  padding: 4px 10px 6px;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.table-laid::-webkit-scrollbar { display: none; }

.table-laid-player {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 6px 8px;
}
.table-laid-player-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.table-laid-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.table-laid-group {
  display: flex;
  gap: 2px;
  align-items: center;
  flex-wrap: wrap;
}
.table-laid-sep {
  font-size: 10px;
  color: var(--border2);
  margin: 0 2px;
  font-weight: 700;
}

/* ─── My phase area ─── */
.my-phase-area {
  width: 100%;
  padding: 4px 10px;
  flex-shrink: 0;
  background: rgba(107,203,119,.05);
  border-top: 1px solid rgba(107,203,119,.2);
}
.my-phase-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
}
.my-phase-groups {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.laid-group.pending-placeholder {
  opacity: 0.45;
}
.card-slot {
  width: 40px;
  height: 58px;
  border: 2px dashed rgba(107,203,119,.4);
  border-radius: 8px;
  background: rgba(107,203,119,.06);
  flex-shrink: 0;
}

/* ─── Phase composer ─── */
.phase-composer {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(10,5,25,.95);
  display: flex;
  flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom));
  gap: 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.composer-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  flex-shrink: 0;
}

.composer-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.composer-group {
  background: rgba(255,255,255,.04);
  border: 2px dashed rgba(255,255,255,.2);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color .2s, background .2s;
}
.composer-group.valid {
  border-color: var(--green);
  background: rgba(107,203,119,.06);
}
.composer-group.invalid {
  border-color: var(--red-ui);
  background: rgba(255,107,107,.04);
}

.composer-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.composer-group-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 50px;
  align-items: center;
}

.composer-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.composer-actions .btn { flex: 1; }

/* ─── Hand area ─── */
.hand-area {
  width: 100%;
  flex-shrink: 0;
  /* garden photo as guaranteed CSS background; JS slideshow crossfades on top */
  background: linear-gradient(rgba(5,2,15,.60), rgba(5,2,15,.60)), url('/assets/bg3.jpg') center / cover no-repeat, var(--bg3);
  border-top: 1px solid var(--border);
  padding: 8px 10px max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 6px;
  touch-action: none;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.hand-area > *:not(.bg-hand-slide) { position: relative; z-index: 1; }

.hand-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hand-phase-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
}
.hand-phase-label strong {
  color: var(--gold);
}

.hand-cards {
  display: grid;
  grid-template-columns: repeat(5, 56px);
  grid-template-rows: repeat(2, auto);
  gap: 5px 4px;
  justify-content: center;
  overflow: visible;
  padding: 4px 4px 6px;
  touch-action: none;
}

.hand-actions {
  display: flex;
  justify-content: center;
  min-height: 28px;
}

/* ─── Skip overlay ─── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.overlay-card {
  background: var(--bg2);
  border: 1.5px solid var(--border2);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  max-width: 360px;
  max-height: 80vh;
  overflow-y: auto;
}

.overlay-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  text-align: center;
}

.skip-target-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skip-target-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  width: 100%;
  text-align: left;
  transition: background .15s, border-color .15s;
}
.skip-target-btn:active {
  background: rgba(255,107,107,.12);
  border-color: var(--red-ui);
}

/* ─── Chat panel ─── */
.chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: var(--bg2);
  border-left: 1.5px solid var(--border);
  z-index: 40;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  box-shadow: -8px 0 32px rgba(0,0,0,.4);
}
.chat-panel.hidden {
  transform: translateX(100%);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) 14px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.chat-message {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 90%;
}
.chat-message.mine { align-self: flex-end; }
.chat-message .chat-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--text2);
  padding: 0 4px;
}
.chat-message.mine .chat-name { text-align: right; }
.chat-message .chat-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}
.chat-message.mine .chat-bubble {
  background: rgba(168,85,247,.18);
  border-color: rgba(168,85,247,.3);
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 4px;
}

/* System messages */
.chat-message.system .chat-bubble {
  background: none;
  border: none;
  font-size: 11px;
  color: var(--text2);
  text-align: center;
  font-style: italic;
  padding: 2px 4px;
}
/* Chat messages from appendChat() */
.chat-msg { display: flex; gap: 5px; align-items: baseline; font-size: 13px; }
.chat-msg.mine { flex-direction: row-reverse; }
.cm-name { font-size: 10px; font-weight: 700; color: var(--accent); flex-shrink: 0; }
.chat-msg.mine .cm-name { color: var(--gold); }
.cm-text { color: var(--text); word-break: break-word; }
/* Game log entries */
.chat-log-entry {
  text-align: center;
  font-size: 11px;
  color: var(--gold);
  opacity: 0.8;
  padding: 1px 4px;
  font-weight: 600;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: rgba(255,255,255,.08);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 9px 12px;
  outline: none;
  transition: border-color .2s;
}
.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: rgba(240,234,255,.3); }

/* ══════════════════════════════════════════════════════════
   SCREEN-ROUND-END
   ══════════════════════════════════════════════════════════ */

#screen-round-end {
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: rgba(10,5,25,.97);
}

.round-end-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 380px;
}

.round-end-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
}

.round-scores {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.round-score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  animation: fadeIn .25s ease;
}

.rs-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: rgba(0,0,0,.75);
  flex-shrink: 0;
}

.rs-name {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
}

.rs-phase {
  font-size: 12px;
  color: var(--text2);
}

.rs-delta {
  font-size: 15px;
  font-weight: 700;
  min-width: 44px;
  text-align: right;
}
.rs-delta.plus  { color: var(--red-ui); }
.rs-delta.zero  { color: var(--green); }

.rs-total {
  font-size: 13px;
  color: var(--text2);
  min-width: 40px;
  text-align: right;
}

.round-end-hint {
  font-size: 13px;
  color: var(--text2);
  text-align: center;
}

/* ══════════════════════════════════════════════════════════
   SCREEN-GAME-OVER
   ══════════════════════════════════════════════════════════ */

#screen-game-over {
  justify-content: center;
  align-items: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  overflow-y: auto;
}

#screen-game-over::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    -42deg,
    transparent 20%,
    #c0392b 20%, #c0392b 32%,
    #2563c7 32%, #2563c7 44%,
    #27a844 44%, #27a844 56%,
    #d4a017 56%, #d4a017 68%,
    transparent 68%
  );
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.winner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 2;
  gap: 6px;
}

.winner-trophy {
  font-size: 80px;
  line-height: 1;
  animation: trophy-bounce 1s ease forwards;
  margin-bottom: 4px;
}
@keyframes trophy-bounce {
  0%   { transform: scale(0) rotate(-15deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(5deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.winner-label {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text2);
}

.winner-name {
  font-size: clamp(28px, 10vw, 48px);
  font-weight: 700;
  line-height: 1.1;
  margin: 4px 0 12px;
}

.final-table {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.final-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.final-rank  { font-size: 20px; width: 28px; flex-shrink: 0; }
.final-name  { flex: 1; font-size: 15px; font-weight: 700; text-align: left; }
.final-phase { font-size: 12px; color: var(--text2); }
.final-score { font-size: 16px; font-weight: 700; color: var(--gold); }

/* ══════════════════════════════════════════════════════════
   PHASE 10 CARDS — Mattel design
   ══════════════════════════════════════════════════════════ */

/* CSS custom property per color */
.p10-card.red    { --cc: #CC0000; --cc-dark: #990000; }
.p10-card.blue   { --cc: #0052A5; --cc-dark: #003d7a; }
.p10-card.green  { --cc: #007836; --cc-dark: #005528; }
.p10-card.yellow { --cc: #FFCD00; --cc-dark: #cc9e00; }

.p10-card {
  position: relative;
  background: #FAFAFA;
  border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.3);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  overflow: hidden;
  width: 56px;
  height: 84px;
  user-select: none;
}

/* ─── Size variants ─── */
.p10-card.in-hand     { width: 56px; height: 84px; }
.p10-card.on-table    { width: 44px; height: 66px; }
.p10-card.opponent-card { width: 36px; height: 54px; }
.p10-card.small       { width: 36px; height: 54px; }

/* ─── Top colored band ─── */
.card-corner-tl {
  background: var(--cc, #888);
  color: #fff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  padding: 3px 5px 2px;
  flex-shrink: 0;
  text-align: left;
  letter-spacing: -0.3px;
}

/* ─── Bottom colored band (rotated) ─── */
.card-corner-br {
  background: var(--cc, #888);
  color: #fff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  padding: 3px 5px 2px;
  flex-shrink: 0;
  text-align: left;
  letter-spacing: -0.3px;
  transform: rotate(180deg);
  margin-top: auto;
}

/* ─── Center: number area ─── */
.card-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: transparent;
  width: 100%;
  height: auto;
  border-radius: 0;
  padding-bottom: 0;
}

/* ─── Number in center ─── */
.card-center-num {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 700;
  color: var(--cc, #888);
  line-height: 1;
  font-size: 34px;
  z-index: 1;
  position: relative;
}

/* ─── Size-responsive font sizes ─── */
.p10-card.on-table .card-corner-tl,
.p10-card.on-table .card-corner-br { font-size: 9px; padding: 2px 4px; }
.p10-card.on-table .card-center-num { font-size: 26px; }

.p10-card.opponent-card .card-corner-tl,
.p10-card.opponent-card .card-corner-br { font-size: 7px; padding: 2px 3px; }
.p10-card.opponent-card .card-center-num { font-size: 20px; }

/* ─── Joker + Aussetzen: vertical stripes design (like real Phase 10) ─── */
.p10-card.wild,
.p10-card.skip {
  background: #fff;
  border: 1.5px solid rgba(0,0,0,.15);
  box-shadow: 0 3px 10px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.2);
}

/* Black corner bands */
.p10-card.wild .card-corner-tl,
.p10-card.wild .card-corner-br,
.p10-card.skip .card-corner-tl,
.p10-card.skip .card-corner-br {
  background: #111;
  color: #fff;
  font-style: normal;
  font-size: 13px;
  padding: 3px 5px 2px;
}

/* Vertical color stripes */
.p10-card.wild .card-center,
.p10-card.skip .card-center {
  background: linear-gradient(
    to right,
    #CC0000 0% 25%,
    #0052A5 25% 50%,
    #007836 50% 75%,
    #FFCD00 75% 100%
  );
  overflow: hidden;
}

/* JOKER — vertical text */
.p10-card.wild .card-center-num {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 9px;
  font-weight: 900;
  font-style: normal;
  color: #111;
  -webkit-text-stroke: 1.5px #fff;
  text-shadow: none;
  letter-spacing: 2px;
  line-height: 1;
}

/* AUSSETZEN — vertical text, smaller font to fit */
.p10-card.skip .card-center-num {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 5.5px;
  font-weight: 900;
  font-style: normal;
  color: #111;
  -webkit-text-stroke: 0.8px #fff;
  text-shadow: none;
  letter-spacing: 1.5px;
  line-height: 1;
}

/* on-table size (44×66) */
.p10-card.on-table.wild .card-corner-tl,
.p10-card.on-table.wild .card-corner-br,
.p10-card.on-table.skip .card-corner-tl,
.p10-card.on-table.skip .card-corner-br  { font-size: 10px; padding: 2px 4px; }
.p10-card.on-table.wild .card-center-num  { font-size: 7px; }
.p10-card.on-table.skip .card-center-num  { font-size: 4.5px; letter-spacing: 1px; }

/* opponent-card (36×54) — just show stripes, hide tiny text */
.p10-card.opponent-card.wild .card-corner-tl,
.p10-card.opponent-card.wild .card-corner-br,
.p10-card.opponent-card.skip .card-corner-tl,
.p10-card.opponent-card.skip .card-corner-br { font-size: 8px; padding: 2px 3px; }
.p10-card.opponent-card.wild .card-center-num,
.p10-card.opponent-card.skip .card-center-num { display: none; }

/* ─── Yellow: dark text (yellow on white needs contrast) ─── */
.p10-card.yellow .card-center-num { color: #b08800; }

/* ─── Selected state ─── */
.p10-card.selected {
  transform: translateY(-14px);
  box-shadow:
    0 10px 24px rgba(0,0,0,.5),
    0 0 0 2.5px #FFC845,
    0 0 16px rgba(255,200,69,.55);
  z-index: 10;
}

/* ─── Hit target ─── */
.p10-card.hit-target {
  outline: 2px dashed var(--gold);
  outline-offset: 2px;
}

/* ─── Face-down card: Phase 10 Mattel style ─── */
.p10-card.face-down {
  background: #000;
  border: 1.5px solid rgba(255,255,255,.2);
  cursor: default;
  box-shadow: 0 2px 8px rgba(0,0,0,.55);
}
.p10-card.face-down .card-corner-tl,
.p10-card.face-down .card-corner-br,
.p10-card.face-down .card-center {
  display: none;
}
/* Colored stripes edge-to-edge at bottom + white separator */
.p10-card.face-down::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(
    to bottom,
    #CC0000 0% 25%,
    #0052A5 25% 50%,
    #007836 50% 75%,
    #FFCD00 75% 100%
  );
  border-top: 1.5px solid #fff;
  z-index: 1;
  pointer-events: none;
}
/* Phase 10 bold text — upper area */
.p10-card.face-down::after {
  content: 'Phase\A10';
  white-space: pre;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka', 'Nunito', Impact, sans-serif;
  font-size: 10px;
  font-weight: 900;
  font-style: normal;
  color: #fff;
  text-align: center;
  line-height: 1.0;
  z-index: 2;
  pointer-events: none;
}
/* opponent-card (36×54) variant */
.p10-card.face-down.opponent-card::before { height: 13px; }
.p10-card.face-down.opponent-card::after  { font-size: 7px; bottom: 15px; }

/* Clickable pile glow */
.pile.clickable .pile-back {
  box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(255,200,69,.35);
}
.pile.clickable { animation: pulse-pile .9s ease-in-out infinite alternate; }
@keyframes pulse-pile {
  from { transform: scale(1); }
  to   { transform: scale(1.04); }
}

/* ══════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  padding: 13px 20px;
  transition: transform .12s, opacity .12s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.95); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(120deg, #FFC845, #ff6b6b);
  color: #1a0a20;
}
.btn-primary:active { box-shadow: 0 0 16px rgba(255,200,69,.4); }

.btn-secondary {
  background: rgba(168,85,247,.2);
  border: 1.5px solid rgba(168,85,247,.4);
  color: #d8b4fe;
}

.btn-ghost {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
}

.btn-danger {
  background: rgba(255,107,107,.15);
  border: 1.5px solid rgba(255,107,107,.4);
  color: #ff6b6b;
}

.btn-accent {
  background: rgba(168,85,247,.2);
  border: 1.5px solid rgba(168,85,247,.35);
  color: #c084fc;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
}

.btn-sm {
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
}

.btn-wide { width: 100%; }

/* ══════════════════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20,10,40,.95);
  border: 1.5px solid rgba(255,200,69,.4);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  padding: 11px 20px;
  border-radius: 30px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 200;
  transition: opacity .25s, transform .25s;
  max-width: 88vw;
  text-align: center;
  backdrop-filter: blur(8px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ══════════════════════════════════════════════════════════
   CONFETTI
   ══════════════════════════════════════════════════════════ */

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ══════════════════════════════════════════════════════════
   UTILITIES / ANIMATIONS
   ══════════════════════════════════════════════════════════ */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(255,200,69,.3); }
  50%       { box-shadow: 0 0 20px rgba(255,200,69,.6); }
}

.pulse-glow { animation: pulse-glow 1.5s ease-in-out infinite; }

/* Player color palette (cycle via data-color index) */
.player-color-0 { background: #e74c3c; }
.player-color-1 { background: #3498db; }
.player-color-2 { background: #27ae60; }
.player-color-3 { background: #f39c12; }
.player-color-4 { background: #9b59b6; }
.player-color-5 { background: #1abc9c; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE TWEAKS
   ══════════════════════════════════════════════════════════ */

/* Very small phones */
@media (max-height: 600px) {
  .setup-header { margin-top: 46px; padding: 16px; margin-bottom: 12px; }
  .game-logo    { font-size: 36px; }
  .game-title   { font-size: 28px; }
  .room-code-display { font-size: 38px; }
}

/* Landscape */
@media (orientation: landscape) and (max-height: 500px) {
  .opponents-area { padding: 4px 8px; }
  .hand-area      { padding: 4px 8px 4px; }
  .p10-card.in-hand { width: 44px; height: 66px; }
  .p10-card.in-hand .card-center-num { font-size: 16px; }
  .p10-card.in-hand .card-corner-tl,
  .p10-card.in-hand .card-corner-br  { font-size: 9px; }
}

/* ── КНБ (RPS) OVERLAY ──────────────────────────────────── */
.rps-overlay {
  z-index: 200;
}

.rps-card {
  background: linear-gradient(135deg, #1a0f35 0%, #0f1a35 100%);
  border: 2px solid rgba(255, 200, 69, 0.4);
  border-radius: 20px;
  padding: 24px 20px;
  width: min(380px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(255, 200, 69, 0.15);
}

.rps-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--gold, #FFC845);
  text-align: center;
  margin-bottom: 4px;
}

.rps-subtitle {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  text-align: center;
  margin-bottom: 16px;
}

.rps-timer-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}

.rps-timer-fill {
  height: 100%;
  background: linear-gradient(90deg, #FF6B6B, #FFC845);
  border-radius: 3px;
  width: 100%;
  transition: width 0.1s linear;
}

.rps-players {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.rps-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 60px;
}

.rps-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.2);
  transition: border-color 0.3s;
  overflow: hidden;
}

.rps-avatar.chose {
  border-color: #6BCB77;
  box-shadow: 0 0 12px rgba(107, 203, 119, 0.5);
}

.rps-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rps-player-name {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  text-align: center;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rps-choices {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 12px;
}

.rps-btn {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
  font-size: 36px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rps-btn:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.5);
  transform: scale(1.08);
}

.rps-btn:active {
  transform: scale(0.96);
}

.rps-btn.selected {
  border-color: #FFC845;
  background: rgba(255, 200, 69, 0.15);
  box-shadow: 0 0 16px rgba(255, 200, 69, 0.4);
}

.rps-my-choice {
  text-align: center;
  font-size: 16px;
  color: #FFC845;
  font-weight: 600;
  padding: 8px;
}

.rps-result {
  text-align: center;
  padding: 16px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
}

.rps-result.loser {
  background: rgba(255, 107, 107, 0.15);
  border: 1px solid rgba(255, 107, 107, 0.4);
  color: #FF6B6B;
}

.rps-result.redo {
  background: rgba(255, 200, 69, 0.1);
  border: 1px solid rgba(255, 200, 69, 0.3);
  color: #FFC845;
}

.rps-reveal-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin: 4px 0;
  font-size: 14px;
}

.rps-reveal-icon {
  font-size: 22px;
}

/* ── RULES OVERLAY ──────────────────────────────────────── */
.rules-card {
  background: #1a0f35;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  width: min(520px, 95vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rules-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.rules-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold, #FFC845);
}

.rules-content {
  overflow-y: auto;
  padding: 16px 20px 24px;
  flex: 1;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(240, 234, 255, 0.85);
}

.rules-content h3 {
  font-family: 'Fredoka', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #FFC845;
  margin: 18px 0 8px;
}

.rules-content h3:first-child { margin-top: 0; }

.rules-content p, .rules-content li { margin: 4px 0; }

.rules-content ul, .rules-content ol {
  padding-left: 18px;
}

.phases-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 8px 0;
}

.phases-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.phases-table td:first-child {
  font-weight: 700;
  color: #FFC845;
  width: 24px;
}

/* ── MIC BUTTON ─────────────────────────────────────────── */
.mic-btn {
  position: relative;
}

.mic-btn.active {
  background: rgba(107, 203, 119, 0.2);
  color: #6BCB77;
  border-color: rgba(107, 203, 119, 0.5) !important;
}

.mic-btn.muted {
  opacity: 0.5;
}

/* Speaking indicator on opponent avatar */
.opp-avatar.speaking {
  box-shadow: 0 0 0 3px #6BCB77, 0 0 12px rgba(107, 203, 119, 0.6);
}

/* ── CHAT BADGE ─────────────────────────────────────────── */
.chat-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background: #FF6B6B;
  border-radius: 50%;
  font-size: 0;
}

.chat-toggle-btn {
  position: relative;
}

/* ── ROOMS LIST ─────────────────────────────────────────── */
.rooms-list {
  width: 100%;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.rooms-list-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}
.room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.room-item:last-of-type { border-bottom: none; }
.room-item-info { display: flex; flex-direction: column; gap: 2px; }
.room-item-host { font-size: 13px; font-weight: 700; }
.room-item-count { font-size: 11px; color: var(--text2); }
.room-item-code { font-size: 10px; color: var(--gold); font-family: monospace; letter-spacing: 2px; }

/* ── INVITE MODAL ───────────────────────────────────────── */
.invite-modal-card {
  background: var(--bg2);
  border: 1.5px solid var(--border2);
  border-radius: var(--radius);
  padding: 24px 20px;
  width: min(380px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.invite-modal-emoji { font-size: 40px; }
.invite-modal-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
}
.invite-modal-code {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 8px;
}
.invite-modal-code strong {
  color: var(--text);
  font-family: monospace;
  font-size: 24px;
  letter-spacing: 4px;
}
.invite-modal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  min-height: 4px;
}
.contact-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.contact-chip:active { background: rgba(255,255,255,.14); }
.lobby-invite-manual {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  text-align: left;
}

/* ── PENDING REQUESTS (lobby, host view) ────────────────── */
.lobby-pending {
  width: 100%;
  max-width: 400px;
  background: rgba(255,200,69,.07);
  border: 1px solid rgba(255,200,69,.25);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  flex-shrink: 0;
}
.lobby-pending-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}
.pending-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,200,69,.12);
}
.pending-item:last-child { border-bottom: none; }
.pending-name {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
}

/* ══════════════════════════════════════════════════════════
   DEAL ANIMATION — cards fly in from above on new round
   ══════════════════════════════════════════════════════════ */

@keyframes deal-in {
  0% {
    transform: translateY(-220px) scale(0.15) rotate(var(--deal-rot, 0deg));
    opacity: 0;
  }
  45% { opacity: 1; }
  78% { transform: translateY(10px) scale(1.07) rotate(0deg); }
  92% { transform: translateY(-3px) scale(0.97) rotate(0deg); }
  100% {
    transform: translateY(0) scale(1) rotate(0deg);
    opacity: 1;
  }
}

.p10-card.in-hand.dealing {
  animation: deal-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) var(--deal-delay, 0ms) both;
}

/* ── Drag / insert highlight ── */
.p10-card.in-hand.insert-before {
  box-shadow: -5px 0 0 0 var(--gold), 0 3px 10px rgba(0,0,0,.45);
  transform: scale(1.04) translateX(4px);
  transition: transform .08s, box-shadow .08s;
}

/* ── Marked card (long press — for phase laying) ── */
.p10-card.marked {
  transform: translateY(-16px);
  box-shadow:
    0 8px 22px rgba(0,0,0,.55),
    0 0 0 2.5px #6BCB77,
    0 0 14px rgba(107,203,119,.55);
  z-index: 10;
}
.p10-card.marked.selected {
  transform: translateY(-16px);
  box-shadow:
    0 8px 22px rgba(0,0,0,.55),
    0 0 0 2.5px #6BCB77,
    0 0 14px rgba(107,203,119,.55);
}

/* Cards already staged to a pending group — green outline, waiting for 2nd group */
.p10-card.in-hand.staged {
  visibility: hidden;
  pointer-events: none;
  transform: none !important;
  outline: none;
  filter: none;
  box-shadow: none;
}

/* ══════════════════════════════════════════════════════════
   TABLE CENTER — felt-style background
   ══════════════════════════════════════════════════════════ */

.table-center {
  background: radial-gradient(ellipse at center, rgba(0,60,20,.35) 0%, transparent 70%);
}

/* ══════════════════════════════════════════════════════════
   LAID CARDS — half-size horizontal (28×42px)
   ══════════════════════════════════════════════════════════ */

.p10-card.laid {
  width: 28px;
  height: 42px;
}
.p10-card.laid .card-corner-tl,
.p10-card.laid .card-corner-br { font-size: 6px; padding: 1px 2px; }
.p10-card.laid .card-center-num { font-size: 13px; }
.p10-card.laid.wild .card-corner-tl,
.p10-card.laid.wild .card-corner-br,
.p10-card.laid.skip .card-corner-tl,
.p10-card.laid.skip .card-corner-br { font-size: 7px; }
.p10-card.laid.wild .card-center-num { font-size: 5px; }
.p10-card.laid.skip .card-center-num { font-size: 3.5px; letter-spacing: 1px; }

/* face-down laid variant */
.p10-card.laid.face-down::before { height: 10px; }
.p10-card.laid.face-down::after  { font-size: 6px; bottom: 12px; }

/* Laid groups: horizontal row */
.laid-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 5px 8px;
}
.laid-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
}
.laid-groups-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-end;
}
.laid-group {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 2px;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.laid-group::-webkit-scrollbar { display: none; }

/* Drag-to-hit drop targets */
.laid-group.drop-candidate {
  outline: 2px dashed rgba(255,200,69,.75);
  outline-offset: 3px;
  border-radius: 8px;
}
.laid-group.drop-ok {
  outline: 3px solid #6BCB77;
  outline-offset: 3px;
  border-radius: 8px;
  background: rgba(107,203,119,.20);
  animation: drop-pulse .7s ease-in-out infinite;
}
@keyframes drop-pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(107,203,119,.4); }
  50%      { box-shadow: 0 0 26px rgba(107,203,119,.8); }
}

/* Card landing on the discard pile */
.card-dropped {
  animation: card-drop .3s cubic-bezier(.2,.8,.3,1.2);
}
@keyframes card-drop {
  from { transform: scale(1.45) translateY(-22px) rotate(-6deg); opacity: .5; }
  to   { transform: scale(1) translateY(0) rotate(0); opacity: 1; }
}

/* Hit zones inside laid groups */
.hit-zone {
  width: 20px;
  height: 42px;
  border: 2px dashed var(--gold);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  cursor: pointer;
  flex-shrink: 0;
}
.hit-zone:active { background: rgba(255,200,69,.15); }
.hittable { cursor: pointer; outline: 2px dashed rgba(255,200,69,.4); outline-offset: 2px; }

/* ══════════════════════════════════════════════════════════
   SWIPE HINT — above hand cards
   ══════════════════════════════════════════════════════════ */

.swipe-hint {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  height: 16px;
  line-height: 16px;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
  letter-spacing: .3px;
}
.swipe-hint.visible   { opacity: 1; color: var(--text2); }
.swipe-hint.visible.ready { color: var(--green); }

/* ══════════════════════════════════════════════════════════
   DEAL ANIMATION — rotating dealer hand + flying cards
   ══════════════════════════════════════════════════════════ */

.p10-dealer-hand {
  position: fixed;
  width: 230px;
  height: 130px;
  pointer-events: none;
  z-index: 8000;
  transform-origin: center center;
}
.p10-dealer-hand img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Face-down fly card (to opponents) */
.p10-fly-card {
  position: fixed;
  width: 36px;
  height: 54px;
  border-radius: 8px;
  background: #000;
  border: 1.5px solid rgba(255,255,255,.25);
  pointer-events: none;
  z-index: 8100;
  overflow: hidden;
}
.p10-fly-card::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 14px;
  background: linear-gradient(to bottom,
    #CC0000 0% 25%,
    #0052A5 25% 50%,
    #007836 50% 75%,
    #FFCD00 75% 100%);
  border-top: 1.5px solid #fff;
  pointer-events: none;
}

/* Player fly card — starts face-down, flips face-up */
.p10-fly-player {
  position: fixed;
  width: 56px;
  height: 84px;
  border-radius: 10px;
  background: #000;
  border: 1.5px solid rgba(255,255,255,.25);
  pointer-events: none;
  z-index: 8200;
  overflow: hidden;
}
.p10-fly-player::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 22px;
  background: linear-gradient(to bottom,
    #CC0000 0% 25%,
    #0052A5 25% 50%,
    #007836 50% 75%,
    #FFCD00 75% 100%);
  border-top: 2px solid #fff;
  pointer-events: none;
}

/* Face-up state after flip */
.p10-fly-player-face {
  position: fixed;
  pointer-events: none;
  z-index: 8200;
  width: 56px;
  height: 84px;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,.55);
}

/* ─── Voice recordings modal ─── */
.vmodal-card {
  background: var(--bg2);
  border: 1.5px solid var(--border2);
  border-radius: var(--radius);
  width: 100%;
  max-width: 400px;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
}
.vmodal-card::-webkit-scrollbar { width: 3px; }
.vmodal-card::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.vmodal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg2);
  z-index: 2;
}
.vmodal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font);
}

.vmode-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.vmode-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  font-family: var(--font);
  flex-shrink: 0;
}
.vmode-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.vmode-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.vsections {
  padding: 12px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.vsection-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text2);
  font-family: var(--font);
  padding: 6px 0 4px;
}

.vrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-xs);
  background: var(--surface);
  border: 1px solid transparent;
  transition: border-color .15s;
}
.vrow:active { border-color: var(--border2); }

.vrow-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.vrow-status {
  font-size: 14px;
  flex-shrink: 0;
}
.vrow-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vrow-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.vrow-btn {
  font-size: 16px;
  padding: 5px 7px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .15s;
}
.vrow-btn:active { background: var(--surface2); }

.vrow-rec {
  border-color: var(--accent);
  color: var(--accent);
}
.vrow-rec:active { background: rgba(168,85,247,.15); }

@keyframes pulse-rec {
  0%,100% { opacity: 1; }
  50%      { opacity: .4; }
}
