/* ================================================================
   Durak - dark felt casino aesthetic, mobile-first
   ================================================================ */

:root {
  --felt-1: #0f5038;
  --felt-2: #0a3527;
  --bg: #061c14;
  --panel: rgba(255, 255, 255, 0.05);
  --panel-strong: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f2efe4;
  --muted: #9fbcaf;
  --accent: #e6b95c;
  --accent-deep: #c79a3a;
  --danger: #e05656;
  --card-red: #c8102e;
  --card-black: #20242b;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --cw: clamp(58px, 13vw, 92px);        /* hand card width */
  --cw-table: clamp(50px, 11vw, 76px);  /* table card width */
  --cw-mini: clamp(30px, 6.5vw, 44px);  /* pile card width */
}

/* ============================== themes ============================== */

html[data-theme='gold'] {
  --felt-1: #3d2d10;
  --felt-2: #261b09;
  --bg: #120d06;
  --text: #f5eddc;
  --muted: #c9b98c;
  --accent: #f2c14e;
  --accent-deep: #c9962f;
}

html[data-theme='velvet'] {
  --felt-1: #22307e;
  --felt-2: #141b4d;
  --bg: #080b24;
  --text: #eef0fb;
  --muted: #aab3de;
  --accent: #e3c06a;
  --accent-deep: #b8963f;
}

html[data-theme='vampire'] {
  --felt-1: #43103a;
  --felt-2: #2b0923;
  --bg: #150410;
  --text: #f6e9ee;
  --muted: #c4a4b6;
  --accent: #d8435f;
  --accent-deep: #a92c44;
}

html[data-theme='night'] {
  --felt-1: #1c2a4a;
  --felt-2: #101a33;
  --bg: #04060f;
  --text: #e8eefb;
  --muted: #8fa3c8;
  --accent: #9fc3ef;
  --accent-deep: #6f94c4;
}

/* --- theme swatches (fixed colours, they preview their theme) --- */

.theme-row { display: flex; gap: 10px; }

.theme-swatch {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--line);
  cursor: pointer;
}

.theme-swatch.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--panel-strong), var(--shadow);
}

.swatch-classic { background: radial-gradient(circle at 35% 30%, #0f5038, #061c14 80%); }
.swatch-gold { background: radial-gradient(circle at 35% 30%, #3d2d10, #f2c14e 80%); }
.swatch-velvet { background: radial-gradient(circle at 35% 30%, #22307e, #080b24 80%); }
.swatch-vampire { background: radial-gradient(circle at 35% 30%, #43103a, #d8435f 80%); }
.swatch-night { background: radial-gradient(circle at 35% 30%, #1c2a4a, #04060f 80%); }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  /* iOS Safari inflates text per the system Dynamic Type without this,
     which overflows the layout on large-text phones. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(130% 90% at 50% -10%, var(--felt-1), var(--felt-2) 55%, var(--bg) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  overscroll-behavior: none;
}

#app {
  max-width: 1080px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.screen { flex: 1; display: flex; flex-direction: column; }
.screen[hidden] { display: none; }

button { font-family: inherit; }

/* ============================== cards ============================== */

.card {
  position: relative;
  width: var(--cw);
  height: calc(var(--cw) * 1.42);
  border-radius: calc(var(--cw) * 0.09);
  background: linear-gradient(160deg, #ffffff, #f1eee4);
  border: 1px solid #d6d2c4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  user-select: none;
  flex-shrink: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card.red { color: var(--card-red); }
.card.black { color: var(--card-black); }

.corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  font-weight: 800;
  gap: 1px;
}
.corner-tl { top: 7%; left: 8%; }
.corner-br { bottom: 7%; right: 8%; transform: rotate(180deg); }
.corner .cr { font-size: calc(var(--cw) * 0.30); }
.corner .cs { font-size: calc(var(--cw) * 0.24); }

.pip {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: calc(var(--cw) * 0.6);
  opacity: 0.92;
}

.card-back {
  background:
    repeating-linear-gradient(45deg, #17402f, #17402f 5px, #103324 5px, #103324 10px);
  border-color: #0b2418;
}
.card-back .back-pattern {
  position: absolute;
  inset: 7%;
  border: 1.5px solid rgba(230, 185, 92, 0.4);
  border-radius: 8%;
}
.card-back .back-pattern::after {
  content: '\2666';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(230, 185, 92, 0.55);
  font-size: calc(var(--cw) * 0.42);
}

.trump-mark::after {
  content: '';
  position: absolute;
  left: 6%;
  top: 32%;
  width: 3px;
  height: 34%;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.85;
}

/* ============================== home ============================== */

.home-header {
  padding: clamp(18px, 5vw, 44px) 16px 6px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.icon-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  flex: none;
}

.icon-btn:hover { background: var(--panel-strong); }




.lang-row { display: flex; flex-wrap: wrap; gap: 6px; }

.lang-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 20px;
  padding: 7px 11px;
  font-size: 12px;
  cursor: pointer;
}

.lang-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--panel-strong);
}

.version-note {
  margin: 22px 0 6px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  opacity: 0.65;
}

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

.logo-card {
  width: 54px;
  height: 76px;
  border-radius: 7px;
  background: linear-gradient(160deg, #fff, #efecdf);
  color: #20242b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow), 0 0 0 2px var(--accent);
  transform: rotate(-6deg);
}
.logo-rank { font-size: 24px; font-weight: 800; line-height: 1; }
.logo-suit { font-size: 26px; line-height: 1.1; }

.logo-text h1 {
  margin: 0;
  font-size: clamp(30px, 7vw, 44px);
  letter-spacing: 0.14em;
  font-weight: 800;
}
.tagline { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.home-body {
  padding: 10px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

input[type="text"] {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  outline: none;
}
input[type="text"]:focus { border-color: var(--accent); }

.seg {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.seg button {
  flex: 1;
  padding: 10px 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.seg button.active {
  background: var(--accent);
  color: #241a05;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 760px) {
  .mode-grid { grid-template-columns: 1fr 1fr; }
}

.mode-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mode-card h2 { margin: 0; font-size: 20px; }
.mode-desc { margin: 0; color: var(--muted); font-size: 14px; }
.mode-controls { display: flex; flex-direction: column; gap: 12px; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  min-height: 46px;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn-primary { background: linear-gradient(180deg, var(--accent), var(--accent-deep)); color: #241a05; }
.btn-outline { background: none; border: 1px solid var(--accent); color: var(--accent); }
.btn-ghost { background: var(--panel-strong); color: var(--text); }
.btn-danger { background: linear-gradient(180deg, #e56565, #c74444); color: #fff; }
.btn-lg { padding: 14px 22px; font-size: 17px; }
.btn-sm { padding: 8px 12px; min-height: 36px; font-size: 14px; }

.join-row { display: flex; gap: 10px; flex-wrap: wrap; }
.join-row input {
  flex: 1;
  min-width: 0; /* inputs carry a large intrinsic minimum; without this the
                   card cannot shrink and overflows on narrow/scaled-text phones */
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-weight: 700;
  text-align: center;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 15px;
  cursor: pointer;
  text-decoration: underline;
  padding: 6px;
  align-self: center;
}

.rules {
  margin: 0 16px 24px;
  color: var(--muted);
  font-size: 14px;
}
.rules summary { cursor: pointer; color: var(--text); font-weight: 600; padding: 6px 0; }
.rules-body { line-height: 1.55; padding-top: 6px; }

/* ============================== lobby ============================== */

.lobby-card {
  margin: clamp(16px, 6vw, 60px) auto;
  width: min(440px, calc(100% - 32px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
}

.lobby-label {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.room-code-row { display: flex; align-items: center; gap: 12px; }
.room-code {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: var(--accent);
  text-indent: 0.28em;
}
.lobby-hint { margin: 0; color: var(--muted); font-size: 14px; }

.lobby-players {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lobby-seat {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-strong);
  border-radius: 10px;
  padding: 10px 12px;
}
.seat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #241a05;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 17px;
  flex-shrink: 0;
  overflow: hidden;
}
.seat-avatar img, .opp-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.avatar-row { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-chip {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar-chip img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar-chip.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--panel-strong); }
.avatar-chip.none { border: 2px dashed var(--line); }
.seat-avatar.seat-empty { background: none; border: 2px dashed var(--line); color: var(--muted); }
.seat-name { font-weight: 600; }
.seat-bot, .seat-host, .seat-off, .seat-wins, .passed {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 20px;
  padding: 2px 8px;
  margin-left: 6px;
}
.seat-bot { background: rgba(96, 165, 250, 0.25); color: #9ec5ff; }
.seat-host { background: rgba(230, 185, 92, 0.25); color: var(--accent); }
.seat-off { background: rgba(224, 86, 86, 0.25); color: #f0a0a0; }
.seat-wins { background: rgba(134, 239, 172, 0.25); color: #a7e8b8; }

.lobby-options.hidden, .hidden { display: none; }
.lobby-status { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }

/* ============================== game layout ============================== */

#screen-game {
  padding: 8px 10px;
  gap: 6px;
}

#game-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
}
.topbar-left { display: flex; gap: 12px; align-items: baseline; }
.topbar-code { font-weight: 700; letter-spacing: 0.08em; color: var(--muted); font-size: 13px; }
.topbar-deck { color: var(--muted); font-size: 13px; }

/* --- opponents --- */

.opponents {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 4px 0;
  min-height: 74px;
}

.opponent {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 10px;
  min-width: 118px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.opponent.out { opacity: 0.45; }
.opponent.disconnected { border-style: dashed; }
.opponent.attacking { border-color: rgba(230, 185, 92, 0.7); }
.opponent.defending { border-color: rgba(96, 165, 250, 0.7); }

.opp-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--panel-strong);
  display: grid;
  place-items: center;
  font-weight: 800;
  flex-shrink: 0;
}
.opp-avatar.turn {
  box-shadow: 0 0 0 3px var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}

.opp-meta { display: flex; flex-direction: column; min-width: 0; }
.opp-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 92px;
}
.bot-tag { font-style: normal; font-size: 10px; color: #9ec5ff; }
.opp-cards { font-size: 12px; color: var(--muted); }

.opp-role { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.role { font-size: 15px; line-height: 1; }
.passed {
  margin: 0;
  background: var(--panel-strong);
  color: var(--muted);
}

.count-bump .opp-cards { animation: bump 0.4s ease; }

/* --- table + piles --- */

#table-area {
  flex: 1;
  display: flex;
  gap: 8px;
  align-items: stretch;
  min-height: 0;
}

#table-center {
  flex: 1;
  position: relative;
  border-radius: 18px;
  background:
    radial-gradient(80% 90% at 50% 30%, rgba(255, 255, 255, 0.055), transparent 70%);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.35), inset 0 0 0 1px var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
}

.table-slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: clamp(6px, 2vw, 14px);
  max-width: 100%;
}

.slot {
  position: relative;
  width: var(--cw-table);
  height: calc(var(--cw-table) * 1.42);
  transition: transform 0.15s ease;
}
.slot .card { width: var(--cw-table); height: calc(var(--cw-table) * 1.42); }

.slot.unbeaten .card:first-child { box-shadow: 0 0 0 2px var(--accent), 0 4px 10px rgba(0, 0, 0, 0.5); }
.slot.can-defend { cursor: pointer; }
.slot.can-defend .card:first-child {
  box-shadow: 0 0 0 2px var(--accent), 0 0 18px rgba(230, 185, 92, 0.55);
  animation: pulse 1.4s ease-in-out infinite;
}

.defend-card {
  position: absolute;
  left: 26%;
  top: 24%;
  transform: rotate(14deg);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.table-hint {
  position: absolute;
  bottom: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
}

/* piles */
#deck-area {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 4px 6px;
}
.pile-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pile-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

.pile { position: relative; width: var(--cw-mini); height: calc(var(--cw-mini) * 1.42); }
.pile .card { width: var(--cw-mini); height: calc(var(--cw-mini) * 1.42); border-radius: 5px; }
.pile .card .corner .cr, .pile .card .corner .cs { font-size: calc(var(--cw-mini) * 0.3); }

.stack-card { position: absolute; }
.stack-card { transform: translate(calc(var(--i) * 2px), calc(var(--i) * -2.5px)); }
.stack-card.discarded { transform: rotate(40deg) translate(calc(var(--i) * 6px), 0); }

#discard-pile .stack-card:nth-child(2) { transform: rotate(-32deg) translateX(4px); }

.pile-count {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.trump-under {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(90deg);
  z-index: -1;
}

.deck-pile .stack-card { z-index: 2; }

/* bito / take clear animations */
.table-slots.clear-to-discard .slot.clearing {
  animation: fly-discard 0.45s ease-in forwards;
}
.table-slots.clear-to-hand .slot.clearing {
  animation: fly-hand 0.45s ease-in forwards;
}

/* --- action bar --- */

#action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 6px;
  min-height: 48px;
}

.status-msg { font-size: 14px; color: var(--muted); flex: 1; }
.action-buttons { display: flex; gap: 10px; }

/* --- hand --- */

#hand-wrap {
  padding: 6px 8px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  position: relative;
}

.sort-btn {
  position: absolute;
  top: -2px;
  right: 10px;
  width: 30px;
  height: 30px;
  font-size: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

.hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
  min-height: calc(var(--cw) * 1.42 + 34px);
  padding-top: 34px;
}

.hand .card {
  transform: rotate(var(--rot, 0deg)) translateY(var(--lift, 0px));
  transform-origin: bottom center;
  cursor: pointer;
}
.hand .card.playable { box-shadow: 0 0 0 2px rgba(230, 185, 92, 0.75), 0 4px 10px rgba(0, 0, 0, 0.5); }
.hand .card.transferable { box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.8), 0 4px 10px rgba(0, 0, 0, 0.5); }
.hand .card.playable:hover { transform: rotate(var(--rot, 0deg)) translateY(calc(var(--lift, 0px) - 12px)); }
.hand .card.selected {
  transform: rotate(0deg) translateY(-30px) scale(1.07);
  box-shadow: 0 0 0 3px var(--accent), 0 10px 24px rgba(0, 0, 0, 0.55);
  z-index: 999;
}
.hand .card.is-trump .pip { opacity: 0.7; }

.hand .card.dragging {
  position: fixed;
  z-index: 1000;
  transform: rotate(0deg) scale(1.1);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  transition: none;
}

/* entry animations */
.card-enter { animation: card-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.card-enter-defend { animation: defend-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2); }

/* flying card ghost: travels from a hand, drop point or opponent chip to
   its slot; removed after the transition */
.flying-card {
  position: fixed;
  z-index: 300;
  margin: 0;
  pointer-events: none;
  transform-origin: 0 0;
  transition: transform 0.3s cubic-bezier(0.25, 0.75, 0.3, 1);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  border-radius: 7px;
}
.card-drawn { animation: draw-in 0.4s cubic-bezier(0.2, 0.8, 0.3, 1); }

@keyframes card-in {
  from { transform: translateY(46px) scale(0.85); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes defend-in {
  from { transform: rotate(60deg) scale(0.85); opacity: 0; }
  to { transform: rotate(14deg); opacity: 1; }
}
@keyframes draw-in {
  from { transform: translateY(-60px) translateX(60px) scale(0.6); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes fly-discard {
  to { transform: translate(140%, -30%) rotate(35deg) scale(0.5); opacity: 0; }
}
@keyframes fly-hand {
  to { transform: translateY(120%) scale(0.6); opacity: 0; }
}
@keyframes pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}
@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
@keyframes toast-in {
  from { transform: translateY(14px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* --- toast --- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(10, 26, 20, 0.94);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 1200;
  box-shadow: var(--shadow);
  max-width: 88vw;
  text-align: center;
}
.toast.toast-in { animation: toast-in 0.25s ease; }

/* --- overlay --- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 14, 10, 0.8);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 1100;
  padding: 20px;
}
.overlay[hidden] { display: none; }
.overlay-card {
  background: linear-gradient(170deg, #123c2c, #0c2b20);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 26px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
  max-width: 360px;
}
.overlay-card h2 { margin: 0; font-size: 26px; }
.overlay-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.overlay-card .btn-row { justify-content: center; margin-top: 8px; }

/* ============================== desktop tweaks ============================== */

@media (min-width: 760px) {
  #screen-game { padding: 12px 22px; }
  .opponents { justify-content: center; }
  .opp-name { max-width: 130px; }
  .status-msg { font-size: 15px; }
}

/* --- settings screen --- */

.settings-header {
  padding: clamp(18px, 5vw, 44px) 16px 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-header h2 { margin: 0; font-size: 22px; }

.settings-body {
  padding: 10px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}

/* mode explanations on the settings page */
.mode-help { margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.mode-help p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  padding-left: 10px;
  border-left: 2px solid transparent;
}
.mode-help p.active {
  color: var(--text);
  border-left-color: var(--accent);
}
