/* ── Reset & base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

:root {
  --bg:          #0a0f1e;
  --surface:     #131929;
  --surface2:    #1a2540;
  --border:      #1e2d45;
  --border2:     #253550;
  --text:        #e8f0fe;
  --text2:       #7a90b8;
  --text3:       #4a607d;
  --accent:      #00d4aa;
  --accent-glow: rgba(0, 212, 170, 0.25);
  --green:       #16c784;
  --green-bg:    #0d3d26;
  --yellow:      #f0b429;
  --yellow-bg:   #3d2e0a;
  --red:         #e53e3e;
  --red-bg:      #3d1212;
  --grey:        #3a4a5c;
  --grey-bg:     #151e2d;
  --radius:      10px;
  --radius-sm:   6px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

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

.loading-logo {
  font-family: 'Rajdhani', sans-serif;
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--text);
}
.loading-logo span { color: var(--accent); }

.loading-bar {
  width: 280px;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
#loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #7af0d8);
  border-radius: 99px;
  transition: width 0.3s ease;
  width: 0%;
}

#loading-text {
  color: var(--text2);
  font-size: 0.85rem;
  text-align: center;
}

/* ── Game area ──────────────────────────────────────────────── */
#game-area { display: none; }

/* ── Header ─────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
  flex-wrap: wrap;
}

.logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}
.logo-beta-tag {
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #a855f7;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.4;
  margin-bottom: 1px;
}
.logo {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  user-select: none;
}
.logo .dot { color: var(--accent); }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Difficulty pills */
.diff-group {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px;
  gap: 2px;
}

.diff-btn {
  background: transparent;
  border: none;
  color: var(--text2);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.diff-btn:hover { color: var(--text); background: var(--border); }
.diff-btn.active {
  background: var(--accent);
  color: #051a14;
  box-shadow: 0 0 12px var(--accent-glow);
}

.new-game-btn-header {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}
.new-game-btn-header:hover { border-color: var(--accent); color: var(--accent); }

.header-feedback-btn {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
  font-size: 1rem;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.header-feedback-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Main layout ─────────────────────────────────────────────── */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 16px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Player card ─────────────────────────────────────────────── */
.player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.silhouette-wrapper {
  position: relative;
  width: 260px;
  height: 340px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

#silhouette-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 16px;
  opacity: 0.4;
}

#player-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  z-index: 3;
  transition: clip-path 0.6s ease, filter 0.6s ease;
}

.guess-badge-outer {
  background: rgba(10, 15, 30, 0.7);
  border: 1px solid var(--border2);
  border-radius: 99px;
  padding: 4px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: 0.06em;
}

#mystery-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text3);
  text-transform: uppercase;
}

/* ── Search ─────────────────────────────────────────────────── */
.search-wrapper {
  position: relative;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.search-box {
  display: flex;
  align-items: center;
  background: rgba(19, 25, 41, 0.8);
  border: 1px solid var(--border2);
  border-radius: 99px;
  padding: 0 20px;
  gap: 10px;
  backdrop-filter: blur(12px);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon { color: var(--text3); font-size: 1.1rem; flex-shrink: 0; }

#player-search {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  padding: 14px 0;
}
#player-search::placeholder { color: var(--text3); }

#search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
  z-index: 40;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
  max-height: 360px;
  overflow-y: auto;
}
#search-dropdown.hidden { display: none; }

.search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover, .search-item.active { background: var(--surface); }

.search-thumb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.search-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.search-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-meta { font-size: 0.75rem; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.search-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  color: var(--text2);
  font-size: 0.88rem;
}

.search-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  animation: spin 0.7s linear infinite;
}

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

/* ── Attribute grid headers ─────────────────────────────────── */
.grid-header {
  display: grid;
  grid-template-columns: 56px repeat(8, minmax(84px, 1fr)) 90px;
  gap: 6px;
  padding: 0 2px;
  min-width: 860px;
}

.grid-header-cell {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 4px 0;
}
.cell-photo { /* photo column header — no label needed */ }

/* ── Guess rows ──────────────────────────────────────────────── */
.guess-section {
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}

/* Scrollbar styling */
.guess-section::-webkit-scrollbar { height: 4px; }
.guess-section::-webkit-scrollbar-track { background: transparent; }
.guess-section::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

.guess-rows { display: flex; flex-direction: column; gap: 6px; min-width: 860px; }

.guess-row {
  display: grid;
  grid-template-columns: 56px repeat(8, minmax(84px, 1fr)) 90px;
  gap: 6px;
  align-items: center;
}

/* Sub-rows only exist on mobile — no desktop rule needed */

/* ── Tile flip ───────────────────────────────────────────────── */
.guess-tile {
  perspective: 600px;
  height: 80px;
}

.tile-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.guess-tile.flipping .tile-inner {
  transform: rotateY(180deg);
}

.tile-face {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

.tile-front {
  background: var(--surface);
  border: 1px solid var(--border2);
}

.tile-back {
  transform: rotateY(180deg);
  border: 1px solid transparent;
}

.tile-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(232, 240, 254, 0.5);
  line-height: 1;
}

.tile-value {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  line-height: 1.2;
  max-width: 100%;
  flex-wrap: nowrap;
}
.tile-value > span:not(.arrow) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 72px;
}

.arrow {
  font-size: 1rem;
  font-weight: 900;
  flex-shrink: 0;
  line-height: 1;
}

.flag-img {
  width: 20px;
  height: auto;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Tile result colors */
.tile-green  { background: var(--green-bg);  border-color: var(--green);  }
.tile-yellow { background: var(--yellow-bg); border-color: var(--yellow); }
.tile-red    { background: var(--red-bg);    border-color: var(--red);    }
.tile-grey   { background: var(--grey-bg);   border-color: var(--grey);   }

.tile-green  .tile-label,
.tile-green  .tile-value { color: var(--green);  }
.tile-yellow .tile-label,
.tile-yellow .tile-value { color: var(--yellow); }
.tile-red    .tile-label,
.tile-red    .tile-value { color: var(--red);    }
.tile-grey   .tile-label,
.tile-grey   .tile-value { color: var(--text2);  }

/* ── Modal ───────────────────────────────────────────────────── */
#result-modal {
  position: fixed; inset: 0;
  background: rgba(5, 8, 18, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
  animation: fadeIn 0.3s ease;
}
#result-modal.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 32px 28px;
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: slideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
  max-height: 92vh;
  overflow-y: auto;
}

#result-modal.modal-win .modal-box {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 24px 64px rgba(0,0,0,0.7), 0 0 40px var(--accent-glow);
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

#modal-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
}

.modal-photo-wrap {
  width: 160px;
  height: 180px;
  border-radius: var(--radius);
  overflow: visible;
  background: var(--surface);
  border: 1px solid var(--border2);
}
#modal-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

#modal-player-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.05em;
}

#modal-player-detail {
  font-size: 0.8rem;
  color: var(--text2);
  text-align: center;
}

#modal-guesses {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
}

.share-section { text-align: center; }
.share-section-label {
  font-size: 0.75rem;
  color: var(--text3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

#share-grid {
  font-family: monospace;
  font-size: 1rem;
  line-height: 1.6;
  white-space: pre;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: inline-block;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-copy, .btn-new {
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}

.btn-copy {
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text2);
}
.btn-copy:hover { border-color: var(--accent); color: var(--accent); }

.btn-new {
  background: var(--accent);
  color: #051a14;
}
.btn-new:hover { opacity: 0.9; box-shadow: 0 0 16px var(--accent-glow); }

/* ── Confetti ────────────────────────────────────────────────── */
#confetti-container {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 300;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ── Row photo cell ──────────────────────────────────────────── */
.row-photo-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
}

.row-player-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border2);
  background: var(--surface);
  transition: border-color 0.3s;
}
.row-player-photo:not([src="assets/silhouette-base.svg"]) {
  border-color: var(--accent);
}

/* ── Heat indicator ──────────────────────────────────────────── */
.heat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 80px;
  padding: 6px 4px;
}

.heat-emoji {
  font-size: 1.1rem;
  line-height: 1;
}

.heat-bar-wrap {
  width: 100%;
  height: 5px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.heat-bar-fill {
  height: 100%;
  border-radius: 99px;
  width: 0%;
  transition: width 0.6s ease;
}

.heat-pct {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.empty-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 860px;
}
.empty-row {
  display: grid;
  grid-template-columns: 56px repeat(8, minmax(84px, 1fr)) 90px;
  gap: 6px;
}
.empty-tile {
  height: 80px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px dashed var(--border);
  opacity: 0.4;
}

/* ── Hint buttons ────────────────────────────────────────────── */
.hint-buttons-row {
  display: flex;
  gap: 10px;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  flex-wrap: wrap;
}

.hint-btn {
  flex: 1;
  min-width: 160px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text2);
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.03em;
}

.hint-btn-ready {
  border-color: rgba(240,180,41,0.5);
  color: var(--yellow);
  background: rgba(240,180,41,0.07);
}
.hint-btn-ready:hover {
  border-color: var(--yellow);
  background: rgba(240,180,41,0.14);
  box-shadow: 0 0 12px rgba(240,180,41,0.2);
}

.hint-btn-journey.hint-btn-ready {
  border-color: rgba(0,212,170,0.5);
  color: var(--accent);
  background: rgba(0,212,170,0.07);
}
.hint-btn-journey.hint-btn-ready:hover {
  border-color: var(--accent);
  background: rgba(0,212,170,0.14);
  box-shadow: 0 0 12px var(--accent-glow);
}

.hint-btn-locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.hint-btn-used {
  opacity: 0.35;
  cursor: default;
}

/* ── Hint cards ──────────────────────────────────────────────── */
#hint-area {
  display: none;
}

/* ── Hint popup modal ────────────────────────────────────────── */
#hint-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 16px;
}
#hint-modal.hidden { display: none; }

.hint-modal-box {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 28px 24px 24px;
  max-width: 480px;
  width: 100%;
  position: relative;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  max-height: 80vh;
  overflow-y: auto;
}

.hint-popup-inner { display: flex; flex-direction: column; gap: 14px; }
.hint-popup-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--yellow);
}
.hint-popup-text {
  font-size: 0.9rem;
  color: var(--text2);
  line-height: 1.6;
}

.hint-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: linear-gradient(135deg, rgba(240,180,41,0.08), rgba(240,180,41,0.04));
  border: 1px solid rgba(240,180,41,0.3);
  border-radius: var(--radius);
  padding: 10px 14px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.hint-card.hint-in {
  opacity: 1;
  transform: translateY(0);
}

.hint-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--yellow);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}

.hint-text {
  font-size: 0.84rem;
  color: var(--text2);
  line-height: 1.5;
}

/* ── Journey hint ────────────────────────────────────────────── */
.hint-journey {
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.hint-journey-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.journey-track {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
}

.journey-stop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.journey-badge {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  transition: transform 0.2s;
}
.journey-badge:hover { transform: scale(1.2); }

.journey-stop-current .journey-badge {
  width: 44px;
  height: 44px;
  filter: drop-shadow(0 0 8px rgba(0,212,170,0.6));
}

.journey-current-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-top: 3px;
  box-shadow: 0 0 6px var(--accent);
}

.journey-arrow {
  color: var(--text3);
  font-size: 1rem;
  line-height: 36px;
  flex-shrink: 0;
}

/* ── Trophy hint ─────────────────────────────────────────────── */
.hint-btn-trophies.hint-btn-ready {
  border-color: #f0b429;
  color: #f0b429;
}
.hint-btn-trophies.hint-btn-ready:hover {
  background: rgba(240,180,41,0.12);
}

.hint-trophies {
  background: linear-gradient(135deg, #1a2540, #1e1a30);
  border-color: rgba(240,180,41,0.3);
}

.trophy-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.trophy-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 80px;
  text-align: center;
}

.trophy-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(240,180,41,0.3));
  transition: transform 0.2s;
}
.trophy-img:hover { transform: scale(1.15); }

.trophy-placeholder {
  font-size: 2rem;
  line-height: 52px;
}

.trophy-name {
  font-size: 0.65rem;
  color: var(--text2);
  line-height: 1.2;
}

.trophy-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: #f0b429;
  background: rgba(240,180,41,0.15);
  border-radius: 10px;
  padding: 1px 7px;
}
.face-patch-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  border-radius: var(--radius);
  overflow: hidden;
  z-index: 2;
}

.face-patch-tile {
  background: #0a0f1e;
  border: 1px solid rgba(255,255,255,0.05);
  overflow: hidden;
  position: relative;
}

.face-patch-tile.revealed {
  border-color: rgba(0,212,170,0.35);
  background: #000;
}

.zone-img {
  display: none;
}

.zone-label {
  display: none;
  position: absolute;
  bottom: 3px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(0,212,170,0.75);
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
  z-index: 1;
}
.diff-legends {
  position: relative;
  border: 1px dashed rgba(251, 191, 36, 0.6) !important;
  color: #fbbf24 !important;
  background: rgba(251, 191, 36, 0.08) !important;
}
.diff-legends::after {
  content: 'LIMITED';
  position: absolute;
  top: -7px;
  right: -4px;
  background: #d97706;
  color: #fff;
  font-size: 0.45rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 1px 4px;
  border-radius: 4px;
  line-height: 1.4;
  pointer-events: none;
}
.diff-legends:hover {
  background: rgba(251, 191, 36, 0.18) !important;
  border-color: #fbbf24 !important;
}
.diff-legends.active {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.45);
}

/* ── Stats panel (inside modal) ─────────────────────────────── */
#stats-panel {
  width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.stats-row {
  display: flex;
  justify-content: space-around;
  gap: 8px;
  margin-bottom: 14px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.stat-num {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
}

.dist-title {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
  text-align: center;
  margin-bottom: 8px;
}

.dist-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dist-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dist-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text2);
  width: 14px;
  text-align: right;
  flex-shrink: 0;
}

.dist-bar-wrap {
  flex: 1;
  height: 18px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
}

.dist-bar {
  height: 100%;
  background: var(--grey);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text);
  min-width: 18px;
  transition: width 0.6s ease;
}

.dist-bar-highlight {
  background: var(--green);
}

@media (max-width: 600px) {
  header { padding: 12px 16px; }
  .logo { font-size: 1.3rem; }
  main { padding: 20px 12px 60px; gap: 18px; }
  .silhouette-wrapper { width: 180px; height: 240px; }
}

/* ── Scrollbar global ────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

/* ── Auth header ─────────────────────────────────────────────── */
#auth-area { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
#mobile-auth-dropdown { display: none; }
#mobile-auth-dropdown.open { display: flex; flex-direction: column; }

.auth-signin-btn {
  background: var(--accent);
  color: #051a14;
  border: none;
  border-radius: 99px;
  padding: 7px 18px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s;
  box-shadow: 0 0 12px var(--accent-glow);
}
.auth-signin-btn:hover { opacity: 0.85; box-shadow: 0 0 20px var(--accent-glow); }

.auth-user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 99px;
  padding: 4px 14px 4px 5px;
}
.auth-user-pill.hidden { display: none !important; }

.auth-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border2);
}

#auth-username {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-signout-btn {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 0.72rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}
.auth-signout-btn:hover { color: var(--text); }

/* ── Mode toggle ─────────────────────────────────────────────── */
.mode-toggle-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 24px 0;
  max-width: 960px;
  margin: 0 auto;
}

.mode-btn {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 99px;
  padding: 6px 20px;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text2);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.mode-btn.active {
  background: var(--accent);
  color: #051a14;
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}
.mode-btn:not(.active):hover { border-color: var(--accent); color: var(--text); }

.mode-label {
  font-size: 0.78rem;
  color: var(--text3);
  margin-left: 6px;
  letter-spacing: 0.03em;
}

/* ── Challenge banner ────────────────────────────────────────── */
.challenge-banner {
  background: linear-gradient(135deg, var(--surface), var(--surface2));
  border: 1px solid #4a6cf7;
  border-radius: var(--radius);
  padding: 10px 20px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text2);
  max-width: 700px;
  margin: 10px auto 0;
  box-shadow: 0 0 20px rgba(74, 108, 247, 0.15);
}
.challenge-banner.hidden { display: none; }

/* ── Auth modal overlay ──────────────────────────────────────── */
#auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 18, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 16px;
  animation: fadeIn 0.25s ease;
}
#auth-modal.hidden { display: none; }

.auth-modal-box {
  max-width: 400px;
  width: 100%;
  padding: 36px 32px 28px;
  position: relative;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 50%;
  color: var(--text3);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
  padding: 0;
}
.modal-close:hover { background: var(--border); color: var(--text); }

.auth-modal-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin: 0 0 4px;
  text-align: center;
  color: var(--text);
}
.auth-modal-subtitle {
  font-size: 0.84rem;
  color: var(--text3);
  text-align: center;
  margin: 0 0 24px;
}

.auth-oauth-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}

.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.oauth-btn:hover {
  background: var(--border);
  border-color: var(--text3);
  transform: translateY(-1px);
}
.oauth-btn:active { transform: translateY(0); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text3);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border2);
}

.auth-email-form { display: flex; flex-direction: column; gap: 10px; }

.auth-input {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 11px 14px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.auth-input::placeholder { color: var(--text3); }

.auth-email-btns { display: flex; gap: 8px; margin-top: 2px; }

.auth-btn-primary {
  flex: 1;
  background: var(--accent);
  color: #051a14;
  border: none;
  border-radius: var(--radius);
  padding: 11px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s;
  box-shadow: 0 0 10px var(--accent-glow);
}
.auth-btn-primary:hover { opacity: 0.88; box-shadow: 0 0 18px var(--accent-glow); }

.auth-btn-secondary {
  flex: 1;
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 11px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.auth-btn-secondary:hover { border-color: var(--accent); color: var(--text); }

.auth-error {
  font-size: 0.82rem;
  color: #ef4444;
  text-align: center;
  margin: 0;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.auth-error.hidden { display: none; }

/* ── Modal score + percentile ────────────────────────────────── */
.modal-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--surface), var(--surface2));
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  width: 100%;
}
.modal-score.hidden { display: none; }

.score-points {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text2);
}
.score-points strong {
  color: var(--accent);
  font-size: 1.5rem;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.04em;
}

.score-percentile {
  font-size: 0.85rem;
  color: var(--text2);
  font-weight: 500;
  padding: 4px 12px;
  background: rgba(0, 212, 170, 0.1);
  border: 1px solid rgba(0, 212, 170, 0.2);
  border-radius: 99px;
}

/* ── Challenge link in modal ─────────────────────────────────── */
.modal-challenge-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.btn-challenge {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 10px 22px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text2);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  letter-spacing: 0.02em;
}
.btn-challenge:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 212, 170, 0.05);
}

.challenge-link-wrap {
  display: flex;
  gap: 8px;
  width: 100%;
}
.challenge-link-wrap.hidden { display: none; }

.challenge-link-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text3);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  outline: none;
  min-width: 0;
}

.btn-copy-challenge {
  background: var(--accent);
  color: #051a14;
  border: none;
  border-radius: var(--radius);
  padding: 9px 18px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.btn-copy-challenge:hover { opacity: 0.85; }

/* ── Friend results table ────────────────────────────────────── */
.friend-results {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
}
.friend-results.hidden { display: none; }

.fr-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 10px 14px 6px;
  border-bottom: 1px solid var(--border);
}

.fr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.fr-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.fr-table tr:last-child td { border-bottom: none; }

.fr-avatar-cell { width: 38px; }
.fr-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; vertical-align: middle; }
.fr-avatar-placeholder { font-size: 1rem; vertical-align: middle; }
.fr-name { color: var(--text); font-weight: 600; }
.fr-score { color: var(--accent); font-weight: 700; text-align: right; }
.fr-guesses { color: var(--text3); text-align: right; font-size: 0.78rem; }

/* ── Responsive additions ────────────────────────────────────── */
@media (max-width: 600px) {
  .auth-user-pill { padding: 4px 10px 4px 4px; }
  #auth-username { max-width: 60px; font-size: 0.76rem; }
  .mode-toggle-row { padding: 10px 16px 0; }
  .auth-modal-box { padding: 28px 20px 22px; }
  .score-points strong { font-size: 1.3rem; }
}

/* ── Profile panel ───────────────────────────────────────────── */
#profile-panel {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 18, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  padding: 16px;
  animation: fadeIn 0.25s ease;
}
#profile-panel.hidden { display: none; }

.profile-box {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 32px 28px 24px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
  animation: slideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Identity header */
.profile-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.profile-avatar-wrap {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.profile-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-avatar-initials {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--accent), #00a080);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: #051a14;
}

.profile-identity-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.profile-display-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-member-since,
.profile-email {
  font-size: 0.78rem;
  color: var(--text3);
}

/* Difficulty tabs — inherits .diff-group / .diff-btn from existing CSS */
.profile-tabs {
  align-self: center;
  flex-wrap: wrap;
  justify-content: center;
}

/* History section */
.history-header {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
  padding-top: 4px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, background 0.15s;
}
.history-row:hover { border-color: var(--border2); background: var(--surface2); }

.history-player {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.diff-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid;
  background: transparent;
  white-space: nowrap;
}

.history-daily-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(0, 212, 170, 0.1);
  border: 1px solid rgba(0, 212, 170, 0.25);
  color: var(--accent);
  white-space: nowrap;
}

.history-score {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}
.history-pts {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text3);
}

.result-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}
.result-badge-win {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green);
}
.result-badge-loss {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red);
}

.history-date {
  font-size: 0.73rem;
  color: var(--text3);
  white-space: nowrap;
  flex-shrink: 0;
}

.history-empty {
  text-align: center;
  color: var(--text3);
  font-size: 0.88rem;
  padding: 32px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.profile-load-more {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text2);
  font-family: 'Inter', sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 10px;
  cursor: pointer;
  width: 100%;
  transition: border-color 0.15s, color 0.15s;
}
.profile-load-more:hover { border-color: var(--accent); color: var(--accent); }

.profile-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 16px;
  color: var(--text2);
  font-size: 0.9rem;
}

/* Profile button in auth pill */
.profile-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 2px;
  line-height: 1;
  opacity: 0.75;
  transition: opacity 0.15s, transform 0.15s;
}
.profile-btn:hover { opacity: 1; transform: scale(1.15); }

@media (max-width: 600px) {
  .profile-box { padding: 24px 16px 20px; gap: 16px; }
  .profile-display-name { font-size: 1.2rem; }
  .history-row { grid-template-columns: 1fr auto auto; gap: 8px; }
  .history-date { display: none; }
  .history-meta { display: none; }
}

/* ── Mobile responsive overhaul ─────────────────────────────── */
@media (max-width: 768px) {

  /* Header: logo left, sign-in right, nothing else */
  header {
    padding: 12px 16px;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .logo { font-size: 1.4rem; flex-shrink: 0; }
  .header-right {
    flex-wrap: nowrap;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
    flex: 1;
    min-width: 0;
  }

  /* Hide difficulty pills and new game from header on mobile — moved below */
  .diff-group { display: none; }
  .new-game-btn-header { display: none; }

  /* Auth pill: mobile — avatar only, rest in dropdown */
  .auth-user-pill { padding: 2px; gap: 0; background: transparent; border: none; box-shadow: none; cursor: pointer; }
  #auth-username { display: none; }
  .auth-signout-btn { display: none; }
  .profile-btn { display: none; }
  .auth-avatar { width: 34px; height: 34px; border-radius: 50%; cursor: pointer; border: 2px solid var(--accent); display: block !important; background: var(--surface2); }
  .auth-avatar:not([src]), .auth-avatar[src=""] { background: var(--surface2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2300c8a0'%3E%3Cpath d='M12 12c2.7 0 4.8-2.1 4.8-4.8S14.7 2.4 12 2.4 7.2 4.5 7.2 7.2 9.3 12 12 12zm0 2.4c-3.2 0-9.6 1.6-9.6 4.8v2.4h19.2v-2.4c0-3.2-6.4-4.8-9.6-4.8z'/%3E%3C/svg%3E") center/60% no-repeat; }

  /* Mobile auth dropdown */
  .mobile-auth-dropdown {
    position: absolute;
    top: 48px;
    right: 16px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 12px;
    padding: 8px 0;
    min-width: 160px;
    z-index: 300;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    flex-direction: column;
  }
  .mobile-auth-dropdown-item {
    padding: 10px 16px;
    font-size: 0.88rem;
    color: var(--text1);
    cursor: pointer;
    border: none;
    background: none;
    text-align: left;
    width: 100%;
    font-family: inherit;
    transition: background 0.15s;
  }
  .mobile-auth-dropdown-item:hover { background: var(--surface); }
  .mobile-auth-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

  /* Mobile controls bar below header */
  .mobile-controls {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }
  .mobile-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  /* Difficulty pills full-width on mobile */
  .mobile-controls .diff-group {
    display: flex;
    flex: 1;
    justify-content: space-between;
  }
  .mobile-controls .diff-btn {
    padding: 6px 10px;
    font-size: 0.72rem;
    flex: 1;
    text-align: center;
  }
  .mobile-controls .new-game-btn-header {
    display: block;
    flex-shrink: 0;
    padding: 7px 14px;
    font-size: 0.75rem;
  }

  /* Mode toggle */
  .mode-toggle-row { padding: 8px 16px 0; gap: 8px; }
  .mode-btn { font-size: 0.78rem; padding: 6px 14px; }
  .mode-label { font-size: 0.72rem; }

  /* Main content */
  main { padding: 16px 12px 80px; gap: 16px; }

  /* Player card */
  .silhouette-wrapper { width: 160px; height: 200px; }
  #mystery-name { font-size: 1.1rem; }

  /* Search */
  .search-box { padding: 0 14px; }
  #player-search { font-size: 0.9rem; padding: 12px 0; }

  /* Guess grid — scrollable horizontally */
  /* Hint buttons */
  .hint-buttons-row { flex-wrap: wrap; gap: 6px; }
  .hint-btn { font-size: 0.75rem; padding: 7px 10px; flex: 1; min-width: 120px; text-align: center; }

  /* Result modal */
  .modal-box {
    padding: 24px 16px 20px;
    margin: 12px;
    max-height: 92vh;
    overflow-y: auto;
  }
  #modal-photo { width: 100%; height: 100%; }
  .modal-photo-wrap { margin: 8px 0; }
  #modal-player-name { font-size: 1.2rem; }
  #modal-player-detail { font-size: 0.78rem; }
  .modal-actions { flex-direction: row; gap: 8px; }
  .btn-copy, .btn-new { flex: 1; font-size: 0.82rem; padding: 10px 12px; }

  /* Auth modal */
  .auth-modal-box { padding: 24px 18px 20px; margin: 12px; }
  .oauth-btn { padding: 10px 16px; font-size: 0.82rem; }

  /* Score display */
  .modal-score { flex-direction: column; gap: 8px; padding: 12px 16px; }

  /* Stats panel */
  .stats-row { gap: 8px; }
  .stat-box { padding: 10px 8px; min-width: 60px; }
  .stat-num { font-size: 1.4rem; }

  /* Profile panel */
  .profile-box { padding: 20px 14px 16px; }
  .profile-display-name { font-size: 1.1rem; }
  .history-row { font-size: 0.78rem; gap: 6px; }
  .history-date { display: none; }

  /* Challenge link */
  .challenge-link-wrap { flex-direction: column; gap: 8px; }
  .challenge-link-input { font-size: 0.78rem; }
}

/* ── Mobile grid: two-row layout ─────────────────────────────── */
@media (max-width: 820px) {
  .guess-section { overflow-x: visible; padding-bottom: 4px; }
  .grid-header { display: none; }
  .guess-rows { gap: 8px; min-width: unset; }

  /* Row: flex with left column (photo+heat) and right column (tiles) */
  .guess-row {
    display: flex !important;
    flex-direction: row;
    gap: 6px;
    min-width: unset;
    border-bottom: 1px solid var(--border);
    padding: 6px 0;
    align-items: stretch;
  }

  /* Left column: fixed height = row1 + gap + row2, items centred in each half */
  .row-photo-cell {
    position: static;
    width: 52px;
    height: 125px; /* 68 + 3 + 54 */
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .row-player-photo {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    object-position: top;
    flex-shrink: 0;
    margin-top: 8px; /* centres within 68px row1 slot */
  }

  /* Heat slot: fills remaining 54px at bottom */
  .row-heat-slot {
    position: static;
    width: 52px;
    height: 54px;
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .row-heat-slot .heat-cell {
    width: 46px;
    flex-direction: column;
    gap: 1px;
    padding: 2px 3px;
    height: auto;
    justify-content: center;
    align-items: center;
  }
  .row-heat-slot .heat-emoji { font-size: 0.9rem; }
  .row-heat-slot .heat-bar-wrap { width: 100%; height: 3px; }
  .row-heat-slot .heat-pct { font-size: 0.48rem; }

  /* Right column: subrows stacked */
  .row-tiles-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
  }

  /* Sub-rows */
  .guess-row-subrow {
    display: flex !important;
    gap: 3px;
    width: 100%;
  }

  /* Row 1: 3 big tiles */
  .guess-row-subrow:first-of-type .guess-tile { height: 68px; }

  /* Row 2: 5 tiles, full width */
  .guess-row-subrow:last-of-type .guess-tile { height: 54px; }

  /* All tiles */
  .guess-tile { flex: 1; min-width: 0; perspective: 400px; }
  .tile-face {
    padding: 4px 3px;
    gap: 2px;
    border-radius: 5px;
    align-items: center;
    justify-content: center;
  }
  .tile-label { font-size: 0.5rem; letter-spacing: 0.03em; }
  .tile-value { font-size: 0.65rem; gap: 1px; align-items: center; justify-content: center; }
  .tile-value > span:not(.arrow) { max-width: 100%; font-size: 0.62rem; text-align: center; }
  .arrow { font-size: 0.8rem; }
  .flag-img { width: 14px; height: 10px; }

  /* Empty rows */
  .empty-rows { min-width: unset; }
  .empty-row {
    display: block;
    padding: 6px 0 6px 58px;
    border-bottom: 1px solid var(--border);
  }
  .empty-tile-photo { display: none; }
  .empty-row-subrow {
    display: flex !important;
    gap: 3px;
    margin-bottom: 3px;
  }
  .empty-row-subrow:last-child { margin-bottom: 0; }
  .empty-row-subrow:first-of-type .empty-tile { height: 68px; }
  .empty-row-subrow:last-of-type .empty-tile { height: 54px; }
  .empty-tile { flex: 1; border-radius: 5px; min-width: 0; }
}

/* ── Beta Welcome Modal ───────────────────────────────────────── */
#beta-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.3s ease;
}
#beta-modal.hidden { display: none; }

.beta-modal-box {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 36px 32px 32px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  animation: slideUp 0.35s cubic-bezier(.22,.68,0,1.2);
  position: relative;
}

.beta-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}

.beta-logo {
  font-family: 'Rajdhani', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text1);
}
.beta-logo span { color: var(--accent); }

.beta-badge {
  background: var(--accent);
  color: #000;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 3px 8px;
  border-radius: 20px;
  align-self: flex-start;
  margin-top: 4px;
}

.beta-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text1);
  margin: 0 0 8px;
}

.beta-subtitle {
  font-size: 0.95rem;
  color: var(--text2);
  margin: 0 0 22px;
  line-height: 1.5;
}

.beta-features {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.beta-features li {
  font-size: 0.92rem;
  color: var(--text2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  line-height: 1.4;
}
.beta-features li strong { color: var(--text1); }

.beta-note {
  font-size: 0.8rem;
  color: var(--text3);
  margin: 0 0 24px;
  font-style: italic;
}

.beta-cta {
  width: 100%;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 12px;
  padding: 14px 0;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s;
  letter-spacing: 0.02em;
}
.beta-cta:hover { background: #00bfa0; transform: translateY(-1px); }
.beta-cta:active { transform: translateY(0); }

.beta-diff-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 4px;
  text-align: left;
}
.beta-diff-item {
  font-size: 0.85rem;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.beta-diff-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.beta-diff-label.easy   { background: rgba(0,200,160,0.15); color: var(--accent); border: 1px solid var(--accent); }
.beta-diff-label.medium { background: rgba(240,180,40,0.15); color: #f0b429;       border: 1px solid #f0b429; }
.beta-diff-label.hard   { background: rgba(220,80,80,0.15);  color: #e05555;       border: 1px solid #e05555; }

.diff-note {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text3);
  margin: 4px 0 0;
  min-height: 1.2em;
  letter-spacing: 0.01em;
}

@media (max-width: 480px) {
  .beta-modal-box { padding: 28px 18px 24px; border-radius: 16px; }
  .beta-title { font-size: 1.2rem; }
  .beta-logo { font-size: 1.6rem; }
}

/* ── Feedback Modal ───────────────────────────────────────────── */
#feedback-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 450;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
#feedback-modal.hidden { display: none; }

.feedback-modal-box {
  position: relative;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 32px 28px 28px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  animation: slideUp 0.3s cubic-bezier(.22,.68,0,1.2);
}

.feedback-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text1);
  text-align: center;
  margin: 0 0 6px;
}

.feedback-subtitle {
  font-size: 0.85rem;
  color: var(--text3);
  text-align: center;
  margin: 0 0 20px;
}

.feedback-stars {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 18px;
}

.feedback-star {
  font-size: 2.2rem;
  cursor: pointer;
  color: var(--border2);
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
  transition: color 0.12s, transform 0.1s;
}
.feedback-star:hover,
.feedback-star.active { color: #f0b429; }
.feedback-star.active { transform: scale(1.15); }

.feedback-textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text1);
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  margin-bottom: 10px;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.feedback-textarea:focus { outline: none; border-color: var(--accent); }

.feedback-email-input { margin-bottom: 16px; }

.feedback-submit-btn { margin-top: 4px; }

.feedback-status {
  text-align: center;
  font-size: 0.88rem;
  margin-top: 12px;
}

.btn-feedback {
  border: 1px solid var(--border2);
  color: var(--text2);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 10px 22px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.04em;
  transition: all 0.2s;
}
.btn-feedback:hover { border-color: var(--accent); color: var(--accent); }
