/* ── Modal shell ─────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  z-index: 30;
  padding: 24px;
  animation: modalFade 240ms ease;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 36px 40px 32px;
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.2),
    0 40px 80px -20px rgba(0, 0, 0, 0.6);
  animation: modalRise 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-header {
  margin: 0 0 24px;
  text-align: center;
}

.modal-header h2 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.modal-sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

/* ── Option groups ───────────────────────────────────────── */
.option-group {
  border: 0;
  padding: 0;
  margin: 0 0 22px;
}

.option-group legend {
  padding: 0;
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
}

.option-tiles {
  display: grid;
  gap: 10px;
}

.option-tiles.cols-2 { grid-template-columns: repeat(2, 1fr); }
.option-tiles.cols-3 { grid-template-columns: repeat(3, 1fr); }
.option-tiles.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Board-size tiles: 4 across on desktop, 2 across on mobile. */
.size-tiles { grid-template-columns: repeat(4, 1fr); }
.size-tiles .tile-body {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 16px 10px;
}
.size-tiles .tile-text {
  text-align: center;
  align-items: center;
}

/* ── Toggle switch (used for the Blindfold peek option) ──── */
.option-toggle {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  padding: 12px 16px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface-2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 160ms ease, border-color 160ms ease;
}

.option-toggle.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.option-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  flex: 0 0 auto;
  width: 40px;
  height: 22px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 11px;
  position: relative;
  transition: background 160ms ease;
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.option-toggle input:checked ~ .switch-track {
  background: var(--accent);
}

.option-toggle input:checked ~ .switch-track .switch-thumb {
  transform: translateX(18px);
}

.switch-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.switch-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

.switch-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.option-select {
  width: 100%;
  appearance: none;
  border: 1.5px solid var(--line-strong);
  background:
    linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%) calc(100% - 19px) 50% / 6px 6px no-repeat,
    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%) calc(100% - 13px) 50% / 6px 6px no-repeat,
    var(--surface-2);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 14px 42px 14px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.option-select:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.option-select:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.option-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  cursor: pointer;
  border-radius: var(--radius);
  transition: transform 140ms ease;
  height: 100%;
}

.option-tile:hover {
  transform: translateY(-1px);
}

.option-tile input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
  margin: 0;
}

.tile-body {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  padding: 14px 14px 12px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface-2);
  border-radius: var(--radius);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.tile-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  color: var(--muted);
  transition: color 160ms ease;
  stroke-width: 2px;
}

.tile-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  text-align: left;
}

.tile-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 2px;
  transition: color 160ms ease;
}

.tile-desc {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.option-tile input:checked + .tile-body {
  border-color: var(--accent);
  background: radial-gradient(circle at top right, rgba(124, 129, 255, 0.22), var(--accent-soft));
  box-shadow: 0 0 14px -4px var(--accent);
}

.option-tile input:checked + .tile-body .tile-icon {
  color: var(--accent);
}

.option-tile input:checked + .tile-body .tile-title {
  color: #a4a8ff;
}

.option-tile input:focus-visible + .tile-body {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Footer ──────────────────────────────────────────────── */
.modal-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.btn-lg {
  font-size: 15px;
  padding: 12px 32px;
  min-width: 200px;
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-loading::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 700ms linear infinite;
}

.modal-hint {
  color: var(--muted);
  font-size: 12px;
  min-height: 16px;
  text-align: center;
}

/* ── Win overlay (reuses .modal, .modal-card) ────────────── */
.win-card {
  text-align: center;
  padding: 40px 44px 36px;
  min-width: 460px;
  width: auto;
}

.win-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px 32px;
  margin: 24px 0 20px;
}

.win-stats div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.win-stats dt {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.win-stats dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.win-verdict {
  margin: 4px 0 22px;
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
}

.win-verdict.great { color: var(--match); }
.win-verdict.okay  { color: var(--accent); }
.win-verdict.rough { color: var(--miss); }

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

.win-actions .btn {
  min-width: 140px;
}

/* ── Modal on mobile ─────────────────────────────────────── */
@media (max-width: 768px) {
  .modal { padding: 12px; }

  .modal-card {
    padding: 24px 20px 22px;
    border-radius: var(--radius);
  }

  .modal-header { margin-bottom: 18px; }
  .modal-header h2 { font-size: 20px; }

  .option-group { margin-bottom: 18px; }
  .option-tiles.cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .size-tiles {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px;
  }

  .size-tiles .tile-body {
    padding: 12px 6px;
    text-align: center;
    gap: 2px;
  }

  .tile-body { padding: 12px 12px 10px; }
  .tile-title { font-size: 14px; }
  .tile-desc { font-size: 11px; }

  .btn-lg { padding: 12px 20px; min-width: 0; width: 100%; }

  .win-card {
    padding: 28px 20px 22px;
    min-width: 0;
    width: 100%;
  }

  .win-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px 12px;
    margin: 18px 0 14px;
  }
  .win-stats dt { font-size: 10px; }
  .win-stats dd { font-size: 18px; }

  .win-verdict { font-size: 12px; margin-bottom: 18px; }

  .win-actions { flex-direction: column-reverse; gap: 8px; }
  .win-actions .btn { min-width: 0; width: 100%; }

  /* Cursor-based modes don't make sense on touch. */
  .option-tile.desktop-only { display: none; }
}

@keyframes modalFade {
  from { opacity: 0; }
}

@keyframes modalRise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

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

/* ── Immersive Fullscreen Page Layouts ────────────────────── */
.page-start, .page-result {
  flex-direction: column !important;
  overflow-y: auto !important;
  height: 100vh !important;
  height: 100dvh !important;
}

/* Start Page Splits */
.start-page {
  width: 100%;
  min-height: 100%;
  display: flex;
  position: relative;
}

.start-container {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  width: 100%;
  min-height: 100%;
  align-items: stretch;
}

.start-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 8% 10% 6%;
  background: rgba(14, 14, 19, 0.45);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: relative;
}

.start-hero .brand-centered {
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
  gap: 18px;
}

.start-hero .brand-mark {
  width: 96px;
  height: 96px;
}

.start-hero .brand-name {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.start-hero .brand-tag {
  font-size: 18px;
  color: #a4a8ff;
  margin-bottom: 24px;
}

.start-hero .hero-desc {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 420px;
  margin-bottom: 0;
}

/* Game logo image shown in desktop hero on config pages */
.game-hero-logo {
  width: 140px;
  height: 140px;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.45));
  transition: transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.start-hero:hover .game-hero-logo {
  transform: scale(1.06) translateY(-4px);
}

/* Profile button on home page */
.profile-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin-top: 28px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
  width: 100%;
  max-width: 400px;
  text-align: left;
}

.profile-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: radial-gradient(circle at left, rgba(124, 129, 255, 0.12), var(--surface-2));
  box-shadow: 0 0 20px -6px var(--accent);
}

.profile-btn:active {
  transform: translateY(0);
}

.profile-btn-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  flex: 0 0 auto;
  transition: border-color 160ms ease;
  padding-bottom: 2px;
  box-sizing: border-box;
}

.profile-btn:hover .profile-btn-avatar {
  border-color: var(--accent);
}

.profile-btn-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 2px;
  min-width: 0;
}

.profile-btn-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-btn-sub {
  font-size: 12px;
  color: var(--muted);
}

.profile-btn-arrow {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex: 0 0 auto;
  transition: color 160ms ease, transform 160ms ease;
}

.profile-btn:hover .profile-btn-arrow {
  color: var(--accent);
  transform: translateX(2px);
}

.home-menu {
  display: none;
}

.start-footer {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 6%;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 16px;
  z-index: 10;
}

.start-footer a {
  color: var(--accent);
  text-decoration: none;
  transition: color 140ms ease;
}

.start-footer a:hover {
  color: #9498ff;
  text-decoration: underline;
}

.start-form-section {
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  padding: 6% 8%;
  overflow-y: auto;
}

.start-form-section .modal-card {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  max-height: none;
  overflow: visible;
}

/* Result Page Dashboard */
.result-page {
  width: 100%;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100%;
  padding: 40px 24px;
}

.result-card-fullscreen {
  width: 100%;
  max-width: 800px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 48px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.2),
    0 40px 80px -20px rgba(0, 0, 0, 0.6);
  text-align: center;
  backdrop-filter: blur(10px);
  animation: modalRise 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

.result-celebration {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--ink), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.result-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin: 36px 0;
}

.result-stat-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 140ms ease, border-color 140ms ease;
}

.result-stat-box:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.result-stat-box dt {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.result-stat-box dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.result-stat-box.photo-source-card {
  grid-column: 1 / -1;
  align-items: flex-start;
  text-align: left;
  text-decoration: none;
  color: inherit;
}

.result-stat-box.photo-source-card dd {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.45;
  letter-spacing: 0;
}

.result-stat-box.photo-source-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

/* Responsiveness overrides */
@media (max-width: 960px) {
  html,
  body,
  body.page-start {
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }
  
  .start-page {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    flex-direction: column;
  }

  .start-container {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
  }
  
  .start-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    justify-content: stretch;
    padding: 10px 14px;
    min-height: 59px;
    gap: 8px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }
  
  .start-hero .hero-desc {
    display: none;
  }

  .profile-btn {
    grid-column: 2;
    margin-top: 0;
    padding: 7px 10px;
    gap: 8px;
    max-width: none;
    width: auto;
    min-width: 0;
    margin-left: auto;
  }

  .profile-btn-avatar {
    width: 30px;
    height: 30px;
    font-size: 16px;
    padding-bottom: 1px;
  }

  .profile-btn-sub {
    display: none;
  }

  .profile-btn-name {
    font-size: 12px;
    max-width: 82px;
  }

  .profile-btn-arrow {
    display: none;
  }

  .start-hero .brand-centered {
    grid-column: 1;
    flex-direction: row;
    margin-bottom: 0;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }

  .start-hero .brand-mark {
    display: block;
    width: 26px;
    height: 26px;
    box-shadow: none;
  }

  .start-hero .brand-name {
    font-size: 18px;
    margin-bottom: 0;
    line-height: 1.05;
    white-space: nowrap;
  }

  .home-menu {
    grid-column: 3;
    display: block;
    position: relative;
  }

  .home-menu-btn {
    appearance: none;
    width: 38px;
    height: 38px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    color: var(--ink-soft);
    border-radius: var(--radius-sm);
  }

  .home-menu-btn svg {
    width: 18px;
    height: 18px;
  }

  .home-menu-btn[aria-expanded="true"] {
    border-color: var(--accent);
    color: var(--ink);
    background: var(--accent-soft);
  }

  .home-menu-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 30;
    min-width: 172px;
    display: grid;
    gap: 2px;
    padding: 6px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: rgba(28, 29, 39, 0.98);
    box-shadow: 0 18px 38px -18px rgba(0, 0, 0, 0.75);
  }

  .home-menu-popover[hidden] {
    display: none;
  }

  .home-menu-popover a {
    display: block;
    padding: 10px 12px;
    color: var(--ink);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
  }

  .home-menu-popover a:active,
  .home-menu-popover a:hover {
    background: var(--accent-soft);
  }

  .page-config .start-hero {
    grid-template-columns: 1fr;
  }

  .page-config .back-link {
    grid-column: 1;
    align-self: center;
    justify-self: start;
    margin-bottom: 0;
    padding: 0;
    gap: 8px;
    color: var(--ink);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.03em;
  }

  .page-config .back-link svg {
    width: 18px;
    height: 18px;
    color: var(--ink-soft);
    stroke-width: 2;
  }

  .page-config .back-link-home {
    display: none;
  }

  .page-config .back-link-game {
    display: inline;
    white-space: nowrap;
  }

  .page-config .start-hero .brand-centered {
    display: none;
  }

  .start-hero .brand-tag {
    display: none;
  }
  
  .start-form-section {
    padding: 30px 20px;
    overflow-y: visible;
  }

  .start-hero .start-footer {
    display: none;
  }
}

@media (max-width: 360px) {
  .start-hero {
    padding-inline: 10px;
    gap: 6px;
  }

  .start-hero .brand-mark {
    width: 22px;
    height: 22px;
  }

  .start-hero .brand-name {
    font-size: 16px;
  }

  .profile-btn-name {
    max-width: 64px;
  }
}

@media (max-width: 768px) {
  .result-card-fullscreen {
    padding: 32px 20px;
  }
  
  .result-celebration {
    font-size: 28px;
  }
  
  .result-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  
  .result-stat-box {
    padding: 16px;
  }
  
  .result-stat-box dd {
    font-size: 24px;
  }
}

.form-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-align: center;
  margin: 0 auto 28px;
  display: block;
}

@media (max-width: 960px) {
  .form-title {
    text-align: center;
    font-size: 22px;
  }
  .form-sub {
    text-align: center;
    font-size: 13px;
    margin-bottom: 22px;
  }
}

/* 2x2 Preview Grids inside option tiles */
.tile-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 3px;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  margin-top: 2px;
  padding: 0;
  background: transparent;
  border: none;
}

.tile-preview-grid svg {
  width: 100%;
  height: 100%;
  transition: transform 140ms ease;
  display: block;
}

/* Lucide Previews: outlined and single tone */
.lucide-grid svg {
  color: var(--muted);
}

.option-tile input:checked + .tile-body .lucide-grid svg {
  color: #a4a8ff;
}

/* OpenMoji Previews: colored fill style with black outline */
.openmoji-grid svg path,
.openmoji-grid svg circle,
.openmoji-grid svg rect {
  stroke: #000000;
  stroke-width: 2.5px;
}

.mode-description-row {
  margin-top: 14px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  text-align: left;
  animation: modalRise 200ms ease;
}

/* ── Game picker (home) ──────────────────────────────────── */
.game-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.game-card {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface-2);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.game-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: radial-gradient(circle at top right, rgba(124, 129, 255, 0.14), var(--surface-2));
  box-shadow: 0 0 24px -8px var(--accent);
}

.game-card:active {
  transform: translateY(0);
}

.game-card-preview {
  width: 80px;
  height: 80px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  transition: color 160ms ease, background 160ms ease;
}

.pairs-preview {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 8px;
  padding: 18px;
}

.pairs-preview svg {
  width: 100%;
  height: 100%;
  display: block;
}

.merge-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.merge-preview svg {
  display: block;
  color: var(--accent);
  opacity: 0.55;
  transition: opacity 200ms ease;
}

.merge-preview svg:nth-child(1) { opacity: 0.35; }
.merge-preview svg:nth-child(2) { opacity: 0.55; }
.merge-preview svg:nth-child(3) { opacity: 0.75; }
.merge-preview svg:nth-child(4) { opacity: 1; }

.game-card:hover .game-card-preview {
  color: var(--accent);
  background: rgba(0, 0, 0, 0.32);
}

.game-card-img-preview {
  padding: 0;
  background: transparent !important;
  border: none !important;
  overflow: visible;
}

.game-card-img-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 200ms ease;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

.game-card:hover .game-card-img-preview img {
  transform: scale(1.08);
}

.game-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.game-card-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.game-card-desc {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.45;
}

.game-card-cta {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.01em;
  transition: gap 160ms ease;
}

.game-card-cta svg {
  width: 14px;
  height: 14px;
  transition: transform 160ms ease;
}

.game-card:hover .game-card-cta {
  gap: 10px;
}

.game-card:hover .game-card-cta svg {
  transform: translateX(2px);
}

.soon-pill {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(124, 129, 255, 0.35);
}

/* Back link on config pages */
.back-link {
  position: absolute;
  top: 4%;
  left: 10%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 8px 8px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 140ms ease, background 140ms ease, transform 140ms ease;
}

.back-link svg {
  width: 16px;
  height: 16px;
  transition: transform 140ms ease;
}

.back-link:hover {
  color: var(--accent);
  background: rgba(124, 129, 255, 0.08);
}

.back-link:hover svg {
  transform: translateX(-2px);
}

.back-link-game {
  display: none;
}

@media (max-width: 960px) {
  .game-card {
    grid-template-columns: 80px 1fr;
    gap: 14px;
    padding: 16px;
  }

  .game-card-preview {
    width: 80px;
    height: 80px;
  }

  .pairs-preview {
    padding: 10px;
    gap: 5px;
  }

  .merge-preview {
    gap: 3px;
  }

  .merge-preview svg:nth-child(1) { width: 10px !important; height: 10px !important; }
  .merge-preview svg:nth-child(2) { width: 14px !important; height: 14px !important; }
  .merge-preview svg:nth-child(3) { width: 18px !important; height: 18px !important; }
  .merge-preview svg:nth-child(4) { width: 22px !important; height: 22px !important; }

  .game-card-title { font-size: 18px; }
  .game-card-desc { font-size: 12px; }

  .back-link {
    position: static;
    align-self: flex-start;
    margin-bottom: 4px;
    padding: 4px 8px 4px 4px;
    font-size: 12px;
  }
}
