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

:root {
  --bg: #100018;
  --surface: rgba(36, 8, 64, 0.72);
  --surface2: rgba(88, 20, 126, 0.62);
  --accent: #ff4fd8;
  --accent2: #5af2ff;
  --text: #f7eeff;
  --text-muted: #b9a6cf;
  --radius: 12px;
  --shadow: 0 10px 40px rgba(5, 0, 16, 0.65);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(1200px 800px at 12% 0%, rgba(255, 79, 216, 0.2), transparent 60%),
    radial-gradient(1200px 800px at 88% 100%, rgba(90, 242, 255, 0.16), transparent 62%),
    linear-gradient(145deg, #100018 0%, #1b0a34 42%, #0d0830 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle 90s CRT / arcade texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.035) 0px,
      rgba(255,255,255,0.035) 1px,
      transparent 2px,
      transparent 4px
    ),
    repeating-linear-gradient(
      to right,
      rgba(90, 242, 255, 0.04) 0px,
      rgba(90, 242, 255, 0.04) 1px,
      transparent 1px,
      transparent 28px
    );
}

/* ── Landing page ── */

.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
  gap: 24px;
  position: relative;
  z-index: 1;
}

.landing h1 {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -1px;
  text-align: center;
  margin-bottom: 8px;
  text-shadow: 0 0 24px rgba(255, 79, 216, 0.35);
}

.landing h1 span { color: var(--accent); }

.landing p.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  text-align: center;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 36px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--surface2);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(255,79,216,0.12);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-zone .icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.upload-zone p { color: var(--text-muted); font-size: 0.9rem; }
.upload-zone p strong { color: var(--text); }

.upload-zone .preview {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 8px;
  display: none;
}

/* Piece count selector */
.piece-options {
  display: flex;
  gap: 6px;
}

.piece-options label {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.piece-options input[type="radio"] { display: none; }

.piece-options span {
  display: block;
  padding: 10px 4px;
  border-radius: 8px;
  border: 2px solid var(--surface2);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s;
}

.piece-options input:checked + span {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(233,69,96,0.1);
}

.piece-options span:hover { border-color: var(--text-muted); color: var(--text); }

/* Button */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.24);
  background: linear-gradient(180deg, #ff78e7 0%, #c843c7 45%, #6b2fba 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    0 0 16px rgba(255, 79, 216, 0.35),
    inset 0 1px 0 rgba(255,255,255,0.45),
    inset 0 -1px 0 rgba(10,0,24,0.55);
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn:hover { opacity: 0.95; box-shadow: 0 0 24px rgba(255, 79, 216, 0.5); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.piece-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Status/error */
.status {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  min-height: 20px;
}

.status.error { color: var(--accent); }

.in-app-hint {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  padding: 10px 40px 10px 14px;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text);
  background: rgba(24, 10, 48, 0.96);
  border-bottom: 1px solid var(--surface2);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.in-app-hint p { margin: 0; max-width: 36em; }

.in-app-hint-dismiss {
  position: absolute;
  top: 4px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.in-app-hint-dismiss:hover { color: var(--text); }

/* ── Name modal ── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7, 0, 20, 0.76);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.modal-overlay[style*="flex"] { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.14);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 340px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}

.modal h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.name-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 2px solid var(--surface2);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}

.name-input:focus { border-color: var(--accent); }

/* ── Puzzle page ── */

.puzzle-page {
  display: flex;
  flex-direction: column;
  /* dvh + fallback for older iOS */
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  width: 100%;
  max-width: 100vw;
}

/* iOS/Safari hard lock for puzzle route so header can't drift horizontally */
body.puzzle-body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

.puzzle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  background: linear-gradient(180deg, rgba(43, 10, 71, 0.92), rgba(28, 8, 58, 0.92));
  border-bottom: 1px solid var(--surface2);
  flex-shrink: 0;
  gap: 12px;
  width: 100%;
  max-width: 100vw;
  overflow-x: clip;
}

.puzzle-header h2 {
  font-size: 1rem;
  font-weight: 700;
}

.hard-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent2);
  color: #000;
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: default;
}

.icon-btn {
  background: linear-gradient(180deg, rgba(117, 41, 169, 0.98), rgba(71, 19, 129, 0.95));
  border: 1px solid rgba(255,255,255,0.2);
  border: none;
  color: var(--text);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(255, 79, 216, 0.2);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  text-decoration: none;
}

.icon-btn:hover { background: var(--accent); box-shadow: 0 0 16px rgba(255, 79, 216, 0.45); transform: translateY(-1px); }

.card, .modal, .share-box, .puzzle-header {
  position: relative;
}

/* Neon frame edge for retro UI feel */
.card::after,
.modal::after,
.puzzle-header::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  border: 1px solid rgba(90, 242, 255, 0.18);
  box-shadow: inset 0 0 18px rgba(255, 79, 216, 0.12);
}
.icon-btn.active {
  background: var(--accent);
  color: #fff;
}

.mode-hint {
  font-size: 0.82rem;
  color: var(--accent2);
  line-height: 1.5;
  padding: 8px 10px;
  background: rgba(245,166,35,0.1);
  border-radius: 8px;
  border: 1px solid rgba(245,166,35,0.25);
}

/* Help modal list */
.help-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.help-list li {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.help-list li strong {
  color: var(--text);
  white-space: nowrap;
  min-width: 110px;
}

/* Box cover overlay */
#box-cover {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9997;
  background: rgba(0,0,0,0.85);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
}

#box-cover.show { display: flex; }

#box-cover-img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.box-cover-hint {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
}

.share-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(13, 8, 48, 0.72);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 6px 12px;
  flex: 1;
  max-width: 360px;
}

.share-box span {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.share-box button {
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.share-box button:hover { opacity: 0.85; }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.players-list {
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.player-dot.me {
  border-color: #fff;
}

.timer {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.progress-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

@media (max-width: 860px) and (pointer: coarse) {
  .puzzle-header {
    padding: 8px 10px;
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    padding-left: max(10px, env(safe-area-inset-left, 0px));
    padding-right: max(10px, env(safe-area-inset-right, 0px));
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
  }
  .puzzle-header h2 {
    order: 1;
    flex: 1;
    min-width: 0;
    font-size: 0.95rem;
  }
  .home-btn {
    order: 0;
  }
  .hard-badge {
    order: 2;
    font-size: 0.68rem;
    padding: 2px 6px;
  }
  .share-box {
    order: 3;
    flex: 1 1 100%;
    max-width: 100%;
    width: 100%;
    min-width: 0;
    padding: 5px 8px;
  }
  .share-box span {
    font-size: 0.72rem;
  }
  .share-box button {
    padding: 4px 8px;
    font-size: 0.7rem;
  }
  .header-right {
    order: 4;
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
  }
  .players-list {
    gap: 4px;
  }
  .player-dot {
    width: 24px;
    height: 24px;
    font-size: 0.62rem;
  }
  .timer, .progress-text {
    font-size: 0.76rem;
  }
  .icon-btn {
    width: 30px;
    height: 30px;
    font-size: 0.86rem;
  }
}

/* Very small phones (e.g. iPhone 13 mini) — more board space, smaller chrome */
@media (max-width: 400px) and (pointer: coarse) {
  .puzzle-header {
    padding: 6px 8px;
    padding-top: max(6px, env(safe-area-inset-top, 0px));
    padding-left: max(8px, env(safe-area-inset-left, 0px));
    padding-right: max(8px, env(safe-area-inset-right, 0px));
    gap: 6px;
  }
  .puzzle-header h2 {
    font-size: 0.88rem;
  }
  .icon-btn {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }
  .player-dot {
    width: 22px;
    height: 22px;
    font-size: 0.58rem;
  }
  .piece-hand {
    padding: 6px 10px;
    gap: 4px;
    max-width: calc(100vw - 16px);
  }
  .hand-thumb {
    width: 44px;
    height: 44px;
  }
  #chat-launcher button,
  #feedback-launcher button {
    width: 46px;
    height: 46px;
    font-size: 1.25rem;
  }
}

@media (max-width: 400px) and (pointer: coarse) and (max-height: 740px) {
  .puzzle-header h2 {
    font-size: 0.82rem;
  }
}

/* Board area */
.puzzle-board-wrap {
  flex: 1;
  overflow: auto;
  position: relative;
  background: var(--bg);
  touch-action: pan-x pan-y;
  overscroll-behavior: contain;
  scroll-behavior: auto;
  min-height: 0;
}

.puzzle-board-scroll-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 20px;
  box-sizing: border-box;
}
.puzzle-board-wrap.panning {
  cursor: grabbing;
}

/* Hide Vercel preview toolbar overlays in-app. */
#vercel-toolbar,
[data-vercel-toolbar],
.__vercel-toolbar,
iframe[src*="_vercel/toolbar"],
iframe[src*="vercel.live"] {
  display: none !important;
}

#puzzle-board {
  position: relative;
  margin: 0;
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  /* width/height set by JS */
  backface-visibility: hidden;
  /* Must match applyScale() math (zoom toward point uses top-left origin). */
  transform-origin: 0 0;
}

/* Individual piece */
.piece {
  position: absolute;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
  touch-action: none;
}

.piece:hover { z-index: 10; }
.piece.dragging {
  cursor: grabbing;
  z-index: 1000;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.7));
}

.piece.in-hand {
  opacity: 0.25;
  filter: grayscale(0.5);
  pointer-events: none;
}

.piece.locked-by-other {
  cursor: not-allowed;
}

/* ── Hand container (multi-select) ── */

.piece-hand {
  position: fixed;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: none;
  gap: 6px;
  align-items: flex-end;
  z-index: 9200;
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.88);
  border-radius: 14px;
  border: 1px solid rgba(255, 222, 120, 0.35);
  box-shadow: 0 0 10px rgba(255, 222, 120, 0.18);
  max-width: 90vw;
  overflow-x: auto;
}

.hand-thumb-wrap {
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.12s;
}

.hand-thumb-wrap:hover {
  transform: scale(1.08);
}

.hand-thumb {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 6px;
  pointer-events: none;
}

.hand-thumb-timer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255, 222, 120, 0.7);
  border-radius: 0 0 6px 6px;
  transition: width 15s linear;
}

/* Player avatar shown on pieces being moved by another player */
.piece-avatar {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  pointer-events: none;
  z-index: 1001;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.piece.solved {
  cursor: default;
  z-index: 1;
}

/* Loading overlay */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 9999;
}

#loading-overlay p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

#loading-overlay.loading-overlay--error p {
  color: var(--text);
  max-width: 22rem;
  text-align: center;
  line-height: 1.45;
}

#loading-overlay.loading-overlay--error .spinner {
  display: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--surface2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Celebration — banner at top, doesn't cover the puzzle */
#celebration {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 2px solid var(--accent2);
  z-index: 9998;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 14px 24px;
  padding-top: max(14px, env(safe-area-inset-top, 0px));
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}

#celebration.show { display: flex; }

#celebration h2 {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--accent2);
}

#celebration p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

#celebration .btn {
  width: auto;
  padding: 8px 20px;
  font-size: 0.9rem;
  flex-shrink: 0;
}

#celebration-lb {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
  border-left: 1px solid var(--surface2);
  padding-left: 20px;
}

/* ── Puzzle of the Day ── */

#potd-section {
  width: 100%;
  max-width: 480px;
}

.potd-heading {
  text-align: center;
  margin-bottom: 8px;
}

.potd-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.potd-card--compact {
  padding: 16px 18px;
  gap: 12px;
}

.potd-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.potd-tab {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid transparent;
  border-radius: calc(var(--radius) * 0.65);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.potd-tab:hover {
  color: var(--text);
  background: var(--bg);
}

.potd-tab.is-active {
  color: var(--text);
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.potd-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.potd-desc {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.potd-play {
  text-align: center;
  text-decoration: none;
}

.potd-preview-wrap {
  border-radius: calc(var(--radius) * 0.75);
  overflow: hidden;
  border: 1px solid var(--surface2);
  background: var(--bg);
  aspect-ratio: 16 / 9;
  max-height: 200px;
}

.potd-preview-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.potd-leaderboard { display: flex; flex-direction: column; gap: 6px; }

.potd-lb-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.potd-lb-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.potd-lb-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text);
}

.lb-rank {
  width: 18px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.lb-names {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-time {
  font-variant-numeric: tabular-nums;
  color: var(--accent2);
  font-weight: 600;
  flex-shrink: 0;
}

.lb-empty {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.8rem;
}

@media (max-width: 960px) {
  .puzzle-board-wrap {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── Chat panel ── */

/* Chat launcher button — bottom left */
#chat-launcher {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: calc(24px + env(safe-area-inset-left, 0px));
  z-index: 9001;
}

#chat-launcher button {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.15s;
  position: relative;
}

#chat-launcher button:hover { transform: scale(1.1); }

/* Chat popup — expands upward from bottom-left */
.chat-panel {
  position: fixed;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  left: calc(24px + env(safe-area-inset-left, 0px));
  width: 300px;
  height: 400px;
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transform: scale(0.85) translateY(20px);
  transform-origin: bottom left;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
  z-index: 9000;
}

.chat-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--surface2);
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 82%;
}

.chat-msg.mine {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-msg-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  gap: 5px;
  align-items: center;
}

.chat-msg-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chat-msg-bubble {
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--surface2);
  font-size: 0.88rem;
  line-height: 1.4;
  word-break: break-word;
}

.chat-msg.mine .chat-msg-bubble {
  background: var(--accent);
  color: #fff;
}

.chat-msg-bubble.emoji-only {
  background: none;
  font-size: 1.8rem;
  padding: 0;
}

.chat-msg.mine .chat-msg-bubble.emoji-only { background: none; }

.chat-input-row {
  border-top: 1px solid var(--surface2);
  flex-shrink: 0;
}

.chat-emojis {
  display: flex;
  gap: 2px;
  padding: 8px 12px 4px;
}

.emoji-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 6px;
  transition: background 0.1s;
  line-height: 1;
}

.emoji-btn:hover { background: var(--surface2); }

.chat-compose {
  display: flex;
  gap: 6px;
  padding: 6px 12px 12px;
}

.chat-input-field {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--surface2);
  border-radius: 20px;
  padding: 8px 14px;
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s;
}

.chat-input-field:focus { border-color: var(--accent); }

.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* ── Board emoji float animation ── */

.board-emoji {
  position: fixed;
  font-size: 2.2rem;
  pointer-events: none;
  z-index: 9999;
  animation: floatUp 2s ease-out forwards;
  transform-origin: center bottom;
}

@keyframes floatUp {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-90px) scale(1.5); }
}

/* ── Feedback widget (bottom-right) ── */

#feedback-launcher {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  right: calc(24px + env(safe-area-inset-right, 0px));
  z-index: 9001;
}

#feedback-launcher button {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--surface2);
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
  color: #fff;
}

#feedback-launcher button:hover {
  transform: scale(1.1);
  background: var(--accent);
  box-shadow: 0 6px 20px rgba(0,0,0,0.55);
}

.feedback-panel {
  position: fixed;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  right: calc(24px + env(safe-area-inset-right, 0px));
  width: 320px;
  max-width: 90vw;
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transform: scale(0.85) translateY(20px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
  z-index: 9000;
}

.feedback-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.feedback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--surface2);
  font-weight: 700;
  font-size: 0.95rem;
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 14px 14px;
}

.feedback-type-row {
  display: flex;
  gap: 6px;
}

.feedback-type-row label {
  flex: 1;
  text-align: center;
}

.feedback-type-row input[type="radio"] {
  display: none;
}

.feedback-type-row span {
  display: block;
  padding: 8px 4px;
  border-radius: 999px;
  border: 2px solid var(--surface2);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s;
}

.feedback-type-row input[type="radio"]:checked + span {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(233,69,96,0.12);
}

.feedback-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.feedback-field > span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.feedback-field .optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
}

.feedback-field textarea,
.feedback-field input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--surface2);
  background: var(--bg);
  color: var(--text);
  font-size: 0.86rem;
  outline: none;
  resize: vertical;
  min-height: 60px;
}

.feedback-field textarea:focus,
.feedback-field input[type="text"]:focus {
  border-color: var(--accent);
}

.feedback-context {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px dashed var(--surface2);
}

.feedback-context-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

#feedback-context-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── VS Mode ── */

.vs-lobby-back-link {
  align-self: flex-start;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: -6px; /* pull it closer to the title */
}

.vs-lobby-back-link:hover {
  color: var(--text);
}

.vs-lobby {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.85);
  z-index: 500;
}

.vs-lobby-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  max-width: 480px;
  width: 94%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vs-lobby-card h2 { margin: 0; font-size: 1.6rem; }

.vs-lobby-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.vs-players-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.vs-player-slot {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.vs-player-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}

.vs-player-name {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.vs-ready-badge {
  font-size: 0.8rem;
  font-weight: 600;
}

.vs-divider {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}

.vs-share-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vs-share-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.vs-lobby-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

/* Countdown overlay */
.vs-countdown {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 600;
}

#vs-countdown-num {
  font-size: 10rem;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 40px var(--accent);
  animation: countPulse 0.7s ease-out;
}

@keyframes countPulse {
  0%   { transform: scale(1.5); opacity: 0; }
  60%  { transform: scale(1.0); opacity: 1; }
  100% { transform: scale(1.0); opacity: 1; }
}

/* Result overlay */
.vs-result {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 700;
}

.vs-result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vs-result-card h2 { margin: 0; font-size: 2rem; }

#vs-result-times {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Progress bar (top of game screen) */
.vs-progress-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.vs-progress-player {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.vs-progress-opponent {
  flex-direction: row-reverse;
  text-align: right;
}

.vs-prog-name {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.vs-prog-track {
  flex: 1;
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}

.vs-prog-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  width: 0%;
  transition: width 0.4s ease;
}

.vs-prog-pct {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 30px;
}

/* Active effect timers row */
.vs-effect-timers {
  display: flex;
  gap: 8px;
  padding: 4px 12px;
  flex-wrap: wrap;
  align-items: center;
  background: rgba(0,0,0,0.2);
}

.vs-effect-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
  min-width: 90px;
}

.vs-effect-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.vs-effect-track {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
  min-width: 40px;
}

.vs-effect-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s linear;
}

.vs-effect-time {
  min-width: 24px;
  text-align: right;
  font-size: 0.7rem;
}

.vs-prog-sep {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ── VS split boards ── */

.vs-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.vs-boards-wrap {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.vs-board-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.vs-board-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: 3px 8px;
  flex-shrink: 0;
}

.vs-board-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.vs-board-avatars {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.vs-board-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.vs-board-divider {
  width: 2px;
  background: var(--border);
  flex-shrink: 0;
}

.opp-wrap {
  pointer-events: none;
  opacity: 0.88;
}

/* ── Team VS Lobby ── */

.vs-team-lobby-card {
  max-width: 600px;
}

.team-columns {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.team-column {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
}

.team-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.team-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.team-badge-A { background: var(--accent); }
.team-badge-B { background: var(--accent2, #f5a623); }

.team-name-display {
  font-weight: 700;
  font-size: 0.95rem;
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-rename-btn {
  font-size: 0.8rem;
  opacity: 0.5;
  padding: 2px 4px;
  flex-shrink: 0;
}

.team-rename-btn:hover { opacity: 1; }

.team-avatars {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 32px;
}

.team-player-chip {
  display: flex;
  align-items: center;
  gap: 5px;
}

.team-player-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.team-player-name {
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-switch-btn {
  font-size: 0.8rem;
  padding: 6px 10px;
  margin-top: auto;
}

.team-vs-sep {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--accent);
  align-self: center;
  padding: 0 4px;
  flex-shrink: 0;
}

.btn-sm {
  font-size: 0.82rem;
  padding: 7px 14px;
}

/* ── VS image picker grid ── */

.vs-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 2px;
}

.vs-img-thumb {
  aspect-ratio: 1;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.1s;
}

.vs-img-thumb:hover {
  border-color: var(--accent);
  transform: scale(1.04);
}

.vs-img-thumb.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

/* ── VS open rooms list ── */

.vs-room-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.vs-room-row:last-child { border-bottom: none; }

.vs-room-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.88rem;
}

.vs-room-pieces {
  font-weight: 600;
  color: var(--text);
}

.vs-room-mode {
  color: var(--text-muted);
}

.vs-room-creator {
  color: var(--text-muted);
}

.vs-room-age {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.vs-room-join {
  padding: 6px 16px;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ── Image picker ── */

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

.play-image-card {
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  aspect-ratio: 4 / 3;
  transition: border-color 0.15s;
}

.play-image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.play-image-card.selected {
  border-color: var(--accent);
}

.play-image-card:hover:not(.selected) {
  border-color: var(--text-muted);
}

/* ── Public rooms list ── */

.room-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.room-row:last-child { border-bottom: none; }

.room-thumbnail {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.room-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.room-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.room-pieces {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.room-stat {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.room-join-btn {
  flex-shrink: 0;
  width: auto;
  padding: 6px 16px;
  font-size: 0.85rem;
}

/* ── Chaos mode powerups ── */

.powerup-marker {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 0 8px rgba(0,0,0,0.6);
  top: 0; left: 0;
  transform-origin: center;
  animation: powerup-pulse 1.4s ease-in-out infinite;
}

.powerup-bw       { background: #4b5563; }
.powerup-invert   { background: #7c3aed; }
.powerup-scramble { background: #d97706; }

@keyframes powerup-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.25); opacity: 0.75; }
}

.powerup-glow-bw {
  filter: drop-shadow(0 0 6px #9ca3af) drop-shadow(0 0 12px #6b7280);
  animation: glow-bw 1.4s ease-in-out infinite;
}
.powerup-glow-invert {
  filter: drop-shadow(0 0 6px #a78bfa) drop-shadow(0 0 12px #7c3aed);
  animation: glow-invert 1.4s ease-in-out infinite;
}
.powerup-glow-scramble {
  filter: drop-shadow(0 0 6px #fcd34d) drop-shadow(0 0 12px #f59e0b);
  animation: glow-scramble 1.4s ease-in-out infinite;
}

@keyframes glow-bw {
  0%, 100% { filter: drop-shadow(0 0 4px #9ca3af) drop-shadow(0 0 8px #6b7280); }
  50%       { filter: drop-shadow(0 0 10px #d1d5db) drop-shadow(0 0 20px #9ca3af); }
}
@keyframes glow-invert {
  0%, 100% { filter: drop-shadow(0 0 4px #a78bfa) drop-shadow(0 0 8px #7c3aed); }
  50%       { filter: drop-shadow(0 0 10px #c4b5fd) drop-shadow(0 0 20px #a78bfa); }
}
@keyframes glow-scramble {
  0%, 100% { filter: drop-shadow(0 0 4px #fcd34d) drop-shadow(0 0 8px #f59e0b); }
  50%       { filter: drop-shadow(0 0 10px #fef08a) drop-shadow(0 0 20px #fcd34d); }
}
.powerup-glow-flip {
  filter: drop-shadow(0 0 6px #f87171) drop-shadow(0 0 12px #ef4444);
  animation: glow-flip 1.4s ease-in-out infinite;
}
.powerup-glow-shake {
  filter: drop-shadow(0 0 6px #fb923c) drop-shadow(0 0 12px #ea580c);
  animation: glow-shake 1.4s ease-in-out infinite;
}
.powerup-glow-shuffle {
  filter: drop-shadow(0 0 6px #34d399) drop-shadow(0 0 12px #059669);
  animation: glow-shuffle 1.4s ease-in-out infinite;
}
@keyframes glow-flip {
  0%, 100% { filter: drop-shadow(0 0 4px #f87171) drop-shadow(0 0 8px #ef4444); }
  50%       { filter: drop-shadow(0 0 10px #fca5a5) drop-shadow(0 0 20px #f87171); }
}
@keyframes glow-shake {
  0%, 100% { filter: drop-shadow(0 0 4px #fb923c) drop-shadow(0 0 8px #ea580c); }
  50%       { filter: drop-shadow(0 0 10px #fdba74) drop-shadow(0 0 20px #fb923c); }
}
@keyframes glow-shuffle {
  0%, 100% { filter: drop-shadow(0 0 4px #34d399) drop-shadow(0 0 8px #059669); }
  50%       { filter: drop-shadow(0 0 10px #6ee7b7) drop-shadow(0 0 20px #34d399); }
}
.powerup-flip    { background: #ef4444; }
.powerup-shake   { background: #ea580c; }
.powerup-shuffle { background: #059669; }

.board-grayscale { filter: grayscale(1); }
.board-flip { transform: scaleX(-1); }
.board-shake { animation: board-shake 0.15s ease-in-out infinite; }

@keyframes board-shake {
  0%,100% { transform: translate(0, 0); }
  20%     { transform: translate(-6px, 3px); }
  40%     { transform: translate(6px, -3px); }
  60%     { transform: translate(-4px, -4px); }
  80%     { transform: translate(4px, 2px); }
}

.piece.face-down {
  filter: brightness(0.25) grayscale(1);
  cursor: pointer !important;
}

.powerup-toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 9998;
  pointer-events: none;
  animation: toast-slide 0.25s ease;
}

@keyframes toast-slide {
  from { opacity: 0; top: 50px; }
  to   { opacity: 1; top: 60px; }
}

/* ── VS score board ── */
.vs-score-board {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 2.4rem;
  font-weight: 900;
  margin: 4px 0;
}
.vs-score-sep {
  font-size: 1.6rem;
  color: var(--text-muted);
}

/* ── Rematch accept highlight ── */
.btn.rematch-accept {
  background: var(--accent2, #34d399);
  animation: rematchPulse 1s ease-in-out infinite alternate;
}
@keyframes rematchPulse {
  from { box-shadow: 0 0 0 0 rgba(52,211,153,0.4); }
  to   { box-shadow: 0 0 0 8px rgba(52,211,153,0); }
}
