/* ============================================================
   Paul Chamberlain — Portfolio
   Dark theme · Fraunces + Outfit · warm copper accent
   ============================================================ */

:root {
  --bg: #0c0e12;
  --bg-elevated: #14171e;
  --bg-card: #181c25;
  --border: rgba(232, 230, 225, 0.08);
  --border-strong: rgba(232, 230, 225, 0.14);
  --text: #e8e6e1;
  --text-muted: #9a968c;
  --accent: #d4a373;
  --accent-soft: rgba(212, 163, 115, 0.14);
  --accent-hover: #e4b88a;
  --focus: #f0c9a0;
  --radius: 12px;
  --radius-lg: 20px;
  --wrap: min(1120px, calc(100% - 2.5rem));
  --font-sans: "Outfit", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 4.25rem;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 0.75rem);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.2s var(--ease);
}

a:hover {
  color: var(--accent-hover);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(2.75rem, 7vw, 4.5rem); font-weight: 700; }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.35rem); }
h3 { font-size: 1.35rem; margin-bottom: 0.45em; }

p {
  margin: 0 0 1em;
}

p:last-child {
  margin-bottom: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 1000;
  padding: 0.65rem 1rem;
  background: var(--accent);
  color: var(--bg);
  font-weight: 500;
  text-decoration: none;
  border-radius: 6px;
}

.skip-link:focus {
  top: 1rem;
  color: var(--bg);
}

.wrap {
  width: var(--wrap);
  margin-inline: auto;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(12, 14, 18, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.03em;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-elevated);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.logo:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 0.15rem 1.75rem;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.site-nav a:hover,
.site-nav a[aria-current="true"] {
  color: var(--text);
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text) !important;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.nav-cta:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover) !important;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-elevated);
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  width: 1rem;
  height: 2px;
  margin-inline: auto;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.25s var(--ease), opacity 0.2s;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:first-child {
  transform: translateY(4px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:last-child {
  transform: translateY(-4px) rotate(-45deg);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: clamp(4rem, 12vw, 7.5rem) 0 clamp(4.5rem, 10vw, 6.5rem);
  overflow: hidden;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 40rem;
}

.eyebrow {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.tagline {
  margin: 0 0 2rem;
  font-size: clamp(1.15rem, 2.2vw, 1.35rem);
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 28ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-glow {
  position: absolute;
  top: -20%;
  right: -10%;
  width: min(55vw, 520px);
  height: min(55vw, 520px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 163, 115, 0.18) 0%, transparent 68%);
  pointer-events: none;
}

/* ---------- Weather (homepage) ---------- */

.weather-card,
.pollen-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.65rem 1.5rem 1.35rem;
  max-width: 28rem;
}

.weather-today-duo .weather-card,
.weather-today-duo .pollen-card {
  height: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.weather-place {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.weather-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-bottom: 1.1rem;
}

.weather-temp {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(2.5rem, 6vw, 3.25rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
}

.weather-temp-unit {
  font-size: 0.45em;
  font-weight: 500;
  margin-left: 0.08em;
  color: var(--text-muted);
}

.weather-condition {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text);
}

.weather-meta {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-width: 0;
  max-width: 100%;
}

.weather-meta li {
  margin: 0;
  padding: 0.28rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 450;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.weather-updated {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.weather-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.98rem;
}

.weather-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 3rem;
  height: 3rem;
  color: var(--accent, #d4a373);
}

.weather-icon-svg {
  display: block;
  width: 2.75rem;
  height: 2.75rem;
}

.weather-main {
  align-items: center;
}

.weather-subheading {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 550;
  letter-spacing: 0.02em;
  color: var(--text);
}

.weather-history,
.pollen-history,
.pollen-explore,
.weather-radar {
  margin-top: 1.75rem;
  max-width: 40rem;
}

.weather-history-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.85rem;
}

.weather-history-range-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.weather-history-range-label select {
  appearance: none;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.weather-history-range-label select:focus-visible {
  outline: 2px solid var(--accent, #d4a373);
  outline-offset: 2px;
}

.weather-history-chart-wrap {
  position: relative;
  height: 14rem;
  padding: 0.75rem 0.5rem 0.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.weather-history-status,
.weather-radar-status {
  margin: 0.55rem 0 0;
  min-height: 1.2em;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.weather-radar-map {
  height: 18rem;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  z-index: 0;
}

.weather-radar-note {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.weather-radar-map .leaflet-container {
  font: inherit;
  background: var(--bg-elevated);
}

.weather-place--heading {
  margin: 0.35rem 0 0;
}

.weather-intro {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 40rem;
}

.weather-card-label {
  margin: 0 0 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.weather-today-duo {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 0.25rem;
  min-width: 0;
  max-width: 100%;
}

#weather .section-body,
#weather .weather-intro,
#weather .weather-history,
#weather .pollen-history,
#weather .pollen-explore,
#weather .weather-radar {
  min-width: 0;
  max-width: 100%;
}

#weather .wrap,
#weather.section {
  overflow-x: hidden;
}

@media (min-width: 720px) {
  .weather-today-duo {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
}

.pollen-overall {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin-bottom: 1rem;
}

.pollen-overall-label {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.pollen-overall-value .pollen-chip {
  min-width: 2.5rem;
  height: 2.5rem;
  font-size: 1.25rem;
  padding: 0 0.65rem;
}

.pollen-type-stats {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.pollen-type-stats li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin: 0;
  padding: 0.4rem 0.65rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 0.65rem);
}

.pollen-type-name {
  min-width: 3.25rem;
  font-size: 0.88rem;
  font-weight: 550;
  color: var(--text);
}

.pollen-type-cat {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pollen-plants-label {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.pollen-plants-empty {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.pollen-plant-list {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.pollen-plant-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
  font-size: 0.9rem;
}

.pollen-plant-name {
  color: var(--text);
}

.pollen-card-meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.pollen-soft {
  color: var(--text-muted);
}

.pollen-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.upi-0 { background: #2c313a; color: #b9b6ae; }
.upi-1 { background: #1e3328; color: #b7d4c2; }
.upi-2 { background: #343418; color: #e3d48a; }
.upi-3 { background: #4a3c1e; color: #f0d2a4; }
.upi-4 { background: #5c3418; color: #ffc7a2; }
.upi-5 { background: #6b2424; color: #ffc8c2; }

.pollen-na {
  color: var(--text-muted);
}

.pollen-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  margin: 0.75rem 0 0;
  align-items: center;
}

.pollen-key,
.pollen-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.pollen-toggle {
  appearance: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  font: inherit;
  color: var(--text-muted);
}

.pollen-toggle[aria-pressed="true"] {
  color: var(--text);
  border-color: rgba(212, 163, 115, 0.55);
  background: rgba(212, 163, 115, 0.12);
}

.pollen-toggle:disabled,
.pollen-toggle.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.pollen-swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
}

.pollen-swatch--overall { background: #d4a373; }
.pollen-swatch--tree { background: #8aa898; }
.pollen-swatch--grass { background: #b7b48a; }
.pollen-swatch--weed { background: #c4a3b2; }

.pollen-credit,
.pollen-admin-link {
  margin: 0.55rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pollen-admin-link a {
  color: var(--accent, #d4a373);
}

.pollen-explore {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  max-width: 100%;
}

.pollen-day-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 0.85rem;
}

.pollen-day-current {
  margin: 0;
  flex: 1 1 auto;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 550;
  color: var(--text);
}

.pollen-day-arrow.is-disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

.pollen-day-strip-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  padding-bottom: 0.15rem;
}

.pollen-day-strip {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem;
  width: max-content;
  max-width: none;
}

.pollen-day-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-decoration: none;
  white-space: nowrap;
}

.pollen-day-chip:hover {
  color: var(--text);
  border-color: rgba(212, 163, 115, 0.45);
}

.pollen-day-chip.is-selected {
  color: var(--text);
  border-color: rgba(212, 163, 115, 0.7);
  background: rgba(212, 163, 115, 0.16);
  font-weight: 550;
}

.pollen-explore-detail {
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-width: 0;
}

.pollen-explore-detail-heading {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  font-weight: 550;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.pollen-day-meta {
  margin: 0 0 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.85rem;
  font-size: 0.9rem;
}

.pollen-range-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pollen-range-chip {
  appearance: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font: inherit;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

.pollen-range-chip.is-active,
.pollen-range-chip[aria-pressed="true"] {
  color: var(--text);
  border-color: rgba(212, 163, 115, 0.55);
  background: rgba(212, 163, 115, 0.12);
}

.pollen-explore .pollen-history {
  margin-top: 0.25rem;
  max-width: 100%;
}

@media (max-width: 719px) {
  .pollen-day-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .pollen-day-current {
    order: -1;
    text-align: left;
  }

  .pollen-day-arrow {
    justify-content: center;
  }
}

.pollen-card--empty .weather-empty,
.weather-card--empty .weather-empty {
  margin-top: 0.25rem;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.35rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #1a120c;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #1a120c;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: var(--accent-soft);
}

/* ---------- Sections ---------- */

.section {
  padding: clamp(3.5rem, 8vw, 5.5rem) 0;
  border-top: 1px solid var(--border);
}

.section-alt {
  background: var(--bg-elevated);
}

.section-grid {
  display: grid;
  gap: 1.5rem 3rem;
}

@media (min-width: 720px) {
  .section-grid {
    grid-template-columns: 10rem 1fr;
    align-items: start;
  }
}

.section-label h2 {
  margin: 0;
  color: var(--accent);
  font-size: 1rem;
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-head {
  margin-bottom: 2.25rem;
  max-width: 36rem;
}

.section-head h2 {
  margin-bottom: 0.5rem;
}

.section-intro {
  color: var(--text-muted);
  margin: 0;
}

.section-intro.tight {
  margin-bottom: 1.25rem;
}

.lede {
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--text);
}

.section-body p {
  color: var(--text-muted);
}

.section-body .lede {
  color: var(--text);
  margin-bottom: 1rem;
}

/* ---------- Projects ---------- */

.project-grid {
  display: grid;
  gap: 1.15rem;
}

@media (min-width: 720px) {
  .project-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.65rem 1.5rem 1.5rem;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}

.project-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.project-index {
  display: block;
  margin-bottom: 1.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.project-card p {
  color: var(--text-muted);
  font-size: 0.98rem;
  margin-bottom: 1.25rem;
}

.text-link {
  font-weight: 500;
  font-size: 0.92rem;
  text-decoration: none;
  color: var(--accent);
}

.text-link::after {
  content: " →";
  transition: margin-left 0.2s var(--ease);
}

.text-link:hover::after {
  margin-left: 0.25rem;
}

.text-link.subtle {
  color: var(--text-muted);
}

.text-link.subtle:hover {
  color: var(--accent);
}

/* ---------- Skills ---------- */

.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.skill-list li {
  padding: 0.5rem 0.95rem;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* ---------- Contact ---------- */

.section-contact {
  text-align: center;
  background:
    radial-gradient(ellipse 70% 80% at 50% 100%, rgba(212, 163, 115, 0.1), transparent 55%),
    var(--bg);
}

.contact-inner {
  max-width: 32rem;
}

.contact-inner .lede {
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.contact-email {
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.15rem;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.contact-email:hover {
  color: var(--accent);
  border-color: var(--accent-hover);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.footer-inner p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ---------- Mobile nav ---------- */

@media (max-width: 719px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: rgba(12, 14, 18, 0.97);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem 1.35rem;
    display: none;
  }

  .site-nav.is-open {
    display: block;
  }

  .site-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
  }

  .site-nav a {
    display: block;
    padding: 0.7rem 0.85rem;
    border-radius: 8px;
  }

  .site-nav a:hover {
    background: var(--bg-elevated);
  }

  .nav-cta {
    justify-content: center;
    margin-top: 0.35rem;
  }
}

/* ---------- Feature shot (STORMY 1) ---------- */

.feature-shot {
  margin: 0 0 2.5rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-shot img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
}

.feature-copy {
  margin-top: 0.5rem;
}

.feature-kicker {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}

.section-body code {
  font-size: 0.88em;
  color: var(--accent-hover);
}

/* ---------- Games ---------- */

.game-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 560px) {
  .game-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .game-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.game-tile {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.game-tile:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.game-tile,
.game-tile:hover,
.game-tile:visited {
  text-decoration: none;
  color: inherit;
}

.game-tile:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.game-tile-shot {
  aspect-ratio: 16 / 10;
  background:
    linear-gradient(145deg, rgba(212, 163, 115, 0.12), transparent 55%),
    var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.game-tile-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-tile-shot.game-preview {
  min-height: clamp(9rem, 22vw, 12.5rem);
  padding: clamp(0.85rem, 2.5vw, 1.25rem);
  place-items: center;
}


/* Mini Sudoku board — mirrors live .sudoku-board chrome */
.preview-sudoku {
  --pc: clamp(0.72rem, 2.1vw, 0.95rem);
  display: grid;
  grid-template-columns: repeat(9, var(--pc));
  grid-template-rows: repeat(9, var(--pc));
  width: max-content;
  background: var(--bg-card);
  border: 2px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(212, 163, 115, 0.08);
  transition: transform 0.35s var(--ease);
}

.game-tile:hover .preview-sudoku {
  transform: scale(1.03);
}

.preview-sudoku-cell {
  display: grid;
  place-items: center;
  width: var(--pc);
  height: var(--pc);
  box-sizing: border-box;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: calc(var(--pc) * 0.58);
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}

.preview-sudoku-cell:nth-child(9n) {
  border-right: 0;
}

.preview-sudoku-cell:nth-child(n + 73) {
  border-bottom: 0;
}

.preview-sudoku-cell.box-left {
  border-left: 2px solid rgba(232, 230, 225, 0.22);
}

.preview-sudoku-cell.box-top {
  border-top: 2px solid rgba(232, 230, 225, 0.22);
}

.preview-sudoku-cell.is-given {
  color: var(--text-muted);
  font-weight: 600;
  background: rgba(232, 230, 225, 0.03);
}

.preview-sudoku-cell.is-filled {
  color: var(--text);
  font-weight: 500;
}

.preview-sudoku-cell.is-selected {
  background: var(--accent-soft);
  color: var(--accent-hover);
  outline: 1px solid var(--accent);
  outline-offset: -1px;
  z-index: 1;
}

/* Mini Le-Word board — mirrors live copper / present / absent tiles */
.preview-le-word {
  display: grid;
  gap: 0.28rem;
  width: max-content;
  transition: transform 0.35s var(--ease);
}

.game-tile:hover .preview-le-word {
  transform: scale(1.03);
}

.preview-le-row {
  display: grid;
  grid-template-columns: repeat(5, clamp(1.15rem, 3.4vw, 1.45rem));
  gap: 0.28rem;
}

.preview-le-tile {
  display: grid;
  place-items: center;
  width: clamp(1.15rem, 3.4vw, 1.45rem);
  height: clamp(1.15rem, 3.4vw, 1.45rem);
  box-sizing: border-box;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: clamp(0.55rem, 1.6vw, 0.7rem);
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1;
}

.preview-le-tile.is-correct {
  background: rgba(212, 163, 115, 0.55);
  border-color: var(--accent);
  color: var(--bg);
}

.preview-le-tile.is-present {
  background: rgba(212, 163, 115, 0.18);
  border-color: rgba(212, 163, 115, 0.55);
  color: var(--accent-hover);
}

.preview-le-tile.is-absent {
  background: #0a0c10;
  border-color: rgba(232, 230, 225, 0.06);
  color: var(--text-muted);
  opacity: 0.72;
}

.game-tile-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.25rem 1.35rem 1.4rem;
}

.game-tile-title {
  margin: 0 0 0.4em;
  font-size: 1.25rem;
  color: var(--text);
}

.game-tile-meta p {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  flex: 1;
}

.game-tile-meta::after {
  content: "Play →";
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--accent);
  margin-top: auto;
}

.game-tile:hover .game-tile-meta::after {
  color: var(--accent-hover);
}

/* ---------- Sudoku ---------- */

/* --- Sudoku --- */
.sudoku {
  border-top: none;
}

.sudoku-wrap {
  max-width: 52rem;
}

.sudoku-head {
  margin-bottom: 2rem;
  max-width: 36rem;
}

.sudoku-head h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  margin-bottom: 0.45em;
}

.sudoku-head .eyebrow {
  margin-bottom: 0.65rem;
}

.sudoku-layout {
  display: grid;
  gap: 1.75rem;
}

@media (min-width: 800px) {
  .sudoku-layout {
    grid-template-columns: minmax(0, 1fr) 14rem;
    align-items: start;
    gap: 2rem;
  }
}

.sudoku-board {
  --cell: clamp(2.15rem, 8.5vw, 3.15rem);
  display: grid;
  grid-auto-flow: row;
  grid-template-columns: repeat(9, var(--cell));
  grid-template-rows: repeat(9, var(--cell));
  width: max-content;
  max-width: 100%;
  margin-inline: auto;
  background: var(--bg-card);
  border: 2px solid var(--border-strong);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(212, 163, 115, 0.08);
}

.sudoku-board.is-won {
  box-shadow: 0 0 0 2px var(--accent), 0 0 28px rgba(212, 163, 115, 0.25);
  animation: sudoku-win-pulse 1.1s var(--ease) 1;
}

@keyframes sudoku-win-pulse {
  0% {
    box-shadow: 0 0 0 1px rgba(212, 163, 115, 0.2), 0 0 0 rgba(212, 163, 115, 0);
  }
  40% {
    box-shadow: 0 0 0 3px var(--accent), 0 0 36px rgba(212, 163, 115, 0.45);
  }
  100% {
    box-shadow: 0 0 0 2px var(--accent), 0 0 28px rgba(212, 163, 115, 0.25);
  }
}

.sudoku-cell {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--cell);
  min-width: 0;
  height: var(--cell);
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.sudoku-cell:nth-child(9n) {
  border-right: 0;
}

.sudoku-cell:nth-child(n + 73) {
  border-bottom: 0;
}

.sudoku-cell.box-left {
  border-left: 2px solid rgba(232, 230, 225, 0.22);
}

.sudoku-cell.box-top {
  border-top: 2px solid rgba(232, 230, 225, 0.22);
}

.sudoku-cell.is-given {
  color: var(--text-muted);
  font-weight: 600;
  background: rgba(232, 230, 225, 0.03);
  cursor: default;
}

.sudoku-cell.in-unit {
  background: rgba(212, 163, 115, 0.08);
}

.sudoku-cell.is-same-number {
  background: rgba(212, 163, 115, 0.16);
  color: var(--accent-hover);
}

.sudoku-cell.is-same-number.in-unit {
  background: rgba(212, 163, 115, 0.18);
}

.sudoku-cell.is-selected,
.sudoku-cell.is-selected.in-unit,
.sudoku-cell.is-selected.is-same-number {
  background: var(--accent-soft);
  color: var(--accent-hover);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 1;
}

.sudoku-cell.is-conflict {
  color: #f0a0a0;
  background: rgba(220, 80, 80, 0.12);
}

.sudoku-cell.is-conflict.is-selected {
  outline-color: #e08080;
}

.sudoku-cell:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
  z-index: 2;
}

/* Pencil-mark 3×3 grid inside empty cells (Play UI: .note) */
.sudoku-cell.is-notes {
  font-size: 0;
  color: transparent;
}

.sudoku-cell.is-notes .note,
.sudoku-cell .note {
  display: grid;
  place-items: center;
  font-size: clamp(0.42rem, 1.6vw, 0.58rem);
  font-weight: 500;
  line-height: 1;
  color: var(--text-muted);
  opacity: 0;
}

.sudoku-cell .note.is-on {
  opacity: 1;
  color: rgba(212, 163, 115, 0.9);
}

.sudoku-cell-notes,
.sudoku-cell.is-notes > span:first-child {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  padding: 2px;
  pointer-events: none;
}

.sudoku-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.65rem 1.25rem;
  margin-top: 1rem;
}

.sudoku-status {
  min-height: 1.5em;
  margin: 0;
  text-align: center;
  font-size: 0.95rem;
  color: var(--accent);
}

.sudoku-status.is-won,
.sudoku-status.is-solved {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3vw, 1.45rem);
  font-weight: 500;
  color: var(--accent-hover);
  letter-spacing: 0.01em;
}

/* Control rail (Play UI) */
.sudoku-rail {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-items: center;
  width: 100%;
}

@media (min-width: 800px) {
  .sudoku-rail {
    align-items: stretch;
  }
}

.sudoku-difficulty {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  width: min(100%, 18rem);
}

@media (min-width: 800px) {
  .sudoku-difficulty {
    width: 100%;
  }
}

.sudoku-chip {
  margin: 0;
  padding: 0.45rem 0.35rem;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.sudoku-chip:hover {
  color: var(--accent-hover);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.sudoku-chip.is-active,
.sudoku-chip[aria-pressed="true"] {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.sudoku-chip:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.sudoku-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: min(100%, 18rem);
}

@media (min-width: 800px) {
  .sudoku-toolbar {
    width: 100%;
    justify-content: space-between;
  }
}

.sudoku-timer {
  margin: 0;
  min-width: 2.75rem;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.sudoku-misses {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  opacity: 0.85;
}

.sudoku-tool {
  margin: 0;
  padding: 0.4rem 0.55rem;
  min-height: 2.15rem;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.sudoku-tool:hover:not(:disabled) {
  color: var(--accent-hover);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.sudoku-tool[aria-pressed="true"],
.sudoku-tool.is-active {
  color: var(--accent-hover);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.sudoku-tool:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sudoku-tool:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.sudoku-hint-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.15em;
  margin-left: 0.2em;
  padding: 0.05em 0.35em;
  border-radius: 999px;
  font-size: 0.72em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--bg);
  background: var(--accent);
  vertical-align: 0.05em;
}

.sudoku-tool:disabled .sudoku-hint-count {
  background: var(--text-muted);
  color: var(--bg);
}

.sudoku-pad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.45rem;
  width: min(100%, 18rem);
}

@media (min-width: 800px) {
  .sudoku-pad {
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
  }
}

.sudoku-pad-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.65rem;
  padding: 0.45rem;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.sudoku-pad-btn:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: var(--accent-soft);
}

.sudoku-pad-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.sudoku-pad-erase {
  grid-column: span 2;
  font-size: 0.88rem;
}

@media (min-width: 800px) {
  .sudoku-pad-erase {
    grid-column: span 3;
  }
}

.sudoku-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  width: 100%;
}

@media (min-width: 800px) {
  .sudoku-actions {
    flex-direction: column;
  }

  .sudoku-actions .btn {
    width: 100%;
  }
}

.sudoku-help {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  text-align: center;
  max-width: 18rem;
}

@media (min-width: 800px) {
  .sudoku-help {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sudoku-board.is-won {
    animation: none;
  }
}

/* ---------- Le-Word ---------- */

.le-word {
  border-top: none;
}

.le-word-wrap {
  max-width: 40rem;
}

.le-word-head {
  margin-bottom: 2rem;
  max-width: 36rem;
}

.le-word-head h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  margin-bottom: 0.45em;
}

.le-word-head .eyebrow {
  margin-bottom: 0.65rem;
}

.le-word-layout {
  display: grid;
  gap: 1.75rem;
  justify-items: center;
}

.le-word-board-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.le-word-legend {
  --tile: 1.55rem;
  list-style: none;
  margin: 0.7rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem 1rem;
}

.le-word-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.le-word-legend .le-word-tile {
  font-size: 0.7rem;
  border-radius: 5px;
  border-width: 1.5px;
  flex-shrink: 0;
}

.le-word-legend-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.le-word-board {
  --tile: clamp(2.85rem, 12vw, 3.65rem);
  display: grid;
  gap: 0.4rem;
  width: max-content;
  max-width: 100%;
  margin-inline: auto;
}

.le-word-row {
  display: grid;
  grid-template-columns: repeat(5, var(--tile));
  gap: 0.4rem;
}

.le-word-row.is-shake {
  animation: le-word-shake 0.4s var(--ease);
}

@keyframes le-word-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

.le-word-tile {
  display: grid;
  place-items: center;
  width: var(--tile);
  height: var(--tile);
  box-sizing: border-box;
  border: 2px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: clamp(1.25rem, 4.5vw, 1.65rem);
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease);
}

.le-word-tile.is-filled {
  border-color: rgba(212, 163, 115, 0.45);
  transform: scale(1.02);
}

/* Correct spot — copper tint (not Wordle green) */
.le-word-tile.is-correct {
  background: rgba(212, 163, 115, 0.55);
  border-color: var(--accent);
  color: var(--bg);
  box-shadow: inset 0 0 0 1px rgba(212, 163, 115, 0.35);
}

/* Present, wrong position — muted accent (not Wordle yellow) */
.le-word-tile.is-present {
  background: rgba(212, 163, 115, 0.18);
  border-color: rgba(212, 163, 115, 0.55);
  color: var(--accent-hover);
}

/* Miss — dark (not Wordle gray) */
.le-word-tile.is-absent {
  background: #0a0c10;
  border-color: rgba(232, 230, 225, 0.06);
  color: var(--text-muted);
  opacity: 0.72;
}

.le-word-board.is-won {
  animation: le-word-win-pulse 1.1s var(--ease) 1;
}

.le-word-board.is-won .le-word-tile.is-correct {
  box-shadow: 0 0 0 1px var(--accent), 0 0 18px rgba(212, 163, 115, 0.35);
}

@keyframes le-word-win-pulse {
  0% {
    filter: brightness(1);
  }
  40% {
    filter: brightness(1.12);
  }
  100% {
    filter: brightness(1);
  }
}

.le-word-meta {
  margin-top: 0.75rem;
  min-height: 2.75em;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.le-word-puzzle {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.le-word-status {
  margin: 0;
  font-size: 0.95rem;
  color: var(--accent);
  min-height: 1.35em;
}

.le-word-status.is-won {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3vw, 1.45rem);
  font-weight: 500;
  color: var(--accent-hover);
  letter-spacing: 0.01em;
}

.le-word-status.is-lost {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.8vw, 1.3rem);
  font-weight: 500;
  color: var(--text-muted);
}

.le-word-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 28rem;
}

.le-word-keyboard {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}

.le-word-keys {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
}

.le-word-key {
  flex: 1 1 0;
  min-width: 0;
  max-width: 2.6rem;
  min-height: 2.85rem;
  margin: 0;
  padding: 0.35rem 0.15rem;
  font-family: inherit;
  font-size: clamp(0.72rem, 2.4vw, 0.88rem);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.le-word-key:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: var(--accent-soft);
}

.le-word-key:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.le-word-key-wide {
  flex: 1.55 1 0;
  max-width: 4.25rem;
  font-size: clamp(0.65rem, 2vw, 0.78rem);
  text-transform: none;
  font-weight: 500;
}

.le-word-key.is-correct {
  background: rgba(212, 163, 115, 0.55);
  border-color: var(--accent);
  color: var(--bg);
}

.le-word-key.is-present {
  background: rgba(212, 163, 115, 0.18);
  border-color: rgba(212, 163, 115, 0.55);
  color: var(--accent-hover);
}

.le-word-key.is-absent {
  background: #0a0c10;
  border-color: rgba(232, 230, 225, 0.06);
  color: var(--text-muted);
  opacity: 0.7;
}

.le-word-actions {
  display: flex;
  justify-content: center;
  width: 100%;
  min-height: 2.75rem;
}

.le-word-actions .btn[hidden] {
  display: none;
}

.le-word-help {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  text-align: center;
  max-width: 26rem;
}

.le-word-credit {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.85;
  text-align: center;
}

.le-word-credit-name {
  color: var(--accent);
  font-weight: 500;
}

/* Short viewports (e.g. 1280×800): keep board + keyboard reachable */
@media (max-height: 860px) {
  .le-word.section {
    padding-top: 1.35rem;
    padding-bottom: 1.1rem;
  }

  .le-word-head {
    margin-bottom: 0.85rem;
  }

  .le-word-head h1 {
    font-size: clamp(1.65rem, 4vw, 2.1rem);
    margin-bottom: 0.3em;
  }

  .le-word-head .section-intro {
    font-size: 0.92rem;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .le-word-layout {
    gap: 0.85rem;
  }

  .le-word-board {
    --tile: clamp(2.35rem, 6.8vh, 3rem);
    gap: 0.28rem;
  }

  .le-word-row {
    gap: 0.28rem;
  }

  .le-word-tile {
    font-size: clamp(1.05rem, 3.2vw, 1.35rem);
    border-width: 1.5px;
    border-radius: 6px;
  }

  .le-word-meta {
    margin-top: 0.5rem;
    min-height: 2.4em;
  }

  .le-word-rail {
    gap: 0.65rem;
  }

  .le-word-keyboard {
    position: sticky;
    bottom: 0;
    z-index: 6;
    padding: 0.45rem 0 0.25rem;
    background: linear-gradient(to top, var(--bg) 62%, rgba(12, 14, 18, 0));
  }

  .le-word-key {
    min-height: 2.35rem;
  }

  .le-word-help {
    font-size: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .le-word-row.is-shake,
  .le-word-board.is-won {
    animation: none;
  }

  .le-word-tile.is-filled {
    transform: none;
  }
}

/* Mini Hex Sweeper honeycomb — dark copper */
.preview-hex {
  --hx: clamp(0.85rem, 2.4vw, 1.1rem);
  --hy: calc(var(--hx) * 0.866);
  position: relative;
  width: calc(var(--hx) * 5.2);
  height: calc(var(--hy) * 4.6);
  transition: transform 0.35s var(--ease);
}

.game-tile:hover .preview-hex {
  transform: scale(1.04);
}

.preview-hex-cell {
  position: absolute;
  width: var(--hx);
  height: calc(var(--hy) * 2);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: var(--bg-card);
  border: none;
  box-shadow: inset 0 0 0 1px rgba(212, 163, 115, 0.22);
  display: grid;
  place-items: center;
  font-family: var(--font-sans);
  font-size: calc(var(--hx) * 0.42);
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1;
}

.preview-hex-cell.is-open {
  background: #12151c;
  box-shadow: inset 0 0 0 1px rgba(232, 230, 225, 0.06);
  color: var(--accent);
}

.preview-hex-cell.is-flagged {
  background: rgba(212, 163, 115, 0.16);
  box-shadow: inset 0 0 0 1px rgba(212, 163, 115, 0.4);
  color: var(--accent-hover);
}

.preview-hex-cell.is-mine {
  background: rgba(212, 163, 115, 0.28);
  color: var(--accent-hover);
}

.preview-hex-cell[data-n="1"] { color: #7eb8d4; }
.preview-hex-cell[data-n="2"] { color: #8fbf88; }
.preview-hex-cell[data-n="3"] { color: #d4a373; }
.preview-hex-cell[data-n="4"] { color: #c9a0dc; }

/* row-major cluster positions (pointy, odd-r) — ~10 hexes */
.preview-hex-cell:nth-child(1)  { left: calc(var(--hx) * 1.05); top: 0; }
.preview-hex-cell:nth-child(2)  { left: calc(var(--hx) * 2.1);  top: 0; }
.preview-hex-cell:nth-child(3)  { left: calc(var(--hx) * 3.15); top: 0; }
.preview-hex-cell:nth-child(4)  { left: calc(var(--hx) * 0.525); top: calc(var(--hy) * 1.5); }
.preview-hex-cell:nth-child(5)  { left: calc(var(--hx) * 1.575); top: calc(var(--hy) * 1.5); }
.preview-hex-cell:nth-child(6)  { left: calc(var(--hx) * 2.625); top: calc(var(--hy) * 1.5); }
.preview-hex-cell:nth-child(7)  { left: calc(var(--hx) * 3.675); top: calc(var(--hy) * 1.5); }
.preview-hex-cell:nth-child(8)  { left: calc(var(--hx) * 1.05); top: calc(var(--hy) * 3); }
.preview-hex-cell:nth-child(9)  { left: calc(var(--hx) * 2.1);  top: calc(var(--hy) * 3); }
.preview-hex-cell:nth-child(10) { left: calc(var(--hx) * 3.15); top: calc(var(--hy) * 3); }

/* ---------- Hex Sweeper ---------- */

.hex-ms {
  border-top: none;
}

.hex-ms-wrap {
  max-width: 56rem;
}

.hex-ms-head {
  margin-bottom: 1.25rem;
  max-width: 36rem;
}

.hex-ms-head h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  margin-bottom: 0.45em;
}

.hex-ms-head .eyebrow {
  margin-bottom: 0.65rem;
}

.hex-ms-layout {
  display: grid;
  gap: 1.5rem;
  justify-items: center;
}

@media (min-width: 800px) {
  .hex-ms-layout {
    grid-template-columns: minmax(0, 1fr) 14rem;
    align-items: start;
    justify-items: stretch;
    gap: 1.75rem 2rem;
  }
}

.hex-ms-board-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.hex-ms-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  margin-bottom: 0.65rem;
  padding: 0.45rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.hex-ms-mines,
.hex-ms-timer {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.hex-ms-board {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px rgba(212, 163, 115, 0.06), inset 0 1px 0 rgba(232, 230, 225, 0.03);
  padding: 0.35rem;
  max-width: 100%;
  overflow: auto;
  outline: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

/* Beginner is scale-to-fit; hide inner scrollbars. Larger boards may still scroll. */
.hex-ms-board.hex-ms-board--fit {
  overflow: hidden;
}

.hex-ms-board:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.hex-ms-board.is-won {
  box-shadow: 0 0 0 1px rgba(212, 163, 115, 0.35), 0 0 24px rgba(212, 163, 115, 0.18);
  animation: hex-ms-win-pulse 1.1s var(--ease) 1;
}

.hex-ms-board.is-lost {
  box-shadow: 0 0 0 1px rgba(212, 163, 115, 0.2);
}

@keyframes hex-ms-win-pulse {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.12); }
  100% { filter: brightness(1); }
}

.hex-ms-svg {
  display: block;
  margin: 0 auto;
}

.hex-ms-poly {
  fill: var(--bg-card);
  stroke: rgba(212, 163, 115, 0.28);
  stroke-width: 1.25;
  transition: fill 0.15s var(--ease), stroke 0.15s var(--ease), filter 0.15s var(--ease);
  cursor: pointer;
}

.hex-ms-cell:hover .hex-ms-poly {
  fill: #1c212c;
  stroke: rgba(212, 163, 115, 0.55);
}

.hex-ms-cell.is-focus .hex-ms-poly,
.hex-ms-cell:focus-visible .hex-ms-poly {
  stroke: var(--focus);
  stroke-width: 2;
  filter: drop-shadow(0 0 4px rgba(240, 201, 160, 0.35));
}

.hex-ms-cell.is-open .hex-ms-poly {
  fill: #10131a;
  stroke: rgba(232, 230, 225, 0.08);
  cursor: default;
}

.hex-ms-cell.is-open:hover .hex-ms-poly {
  fill: #10131a;
  stroke: rgba(232, 230, 225, 0.08);
}

.hex-ms-cell.is-flagged .hex-ms-poly {
  fill: rgba(212, 163, 115, 0.14);
  stroke: rgba(212, 163, 115, 0.5);
}

.hex-ms-cell.is-mine .hex-ms-poly {
  fill: rgba(212, 163, 115, 0.32);
  stroke: var(--accent);
}

.hex-ms-cell.is-hit .hex-ms-poly {
  fill: rgba(196, 120, 72, 0.55);
  stroke: var(--accent-hover);
}

.hex-ms-cell.is-mine-safe .hex-ms-poly {
  fill: rgba(212, 163, 115, 0.22);
  stroke: rgba(212, 163, 115, 0.55);
}

.hex-ms-cell.is-bad-flag .hex-ms-poly {
  stroke: rgba(196, 120, 72, 0.7);
}

.hex-ms-board.is-flag-mode .hex-ms-poly {
  cursor: cell;
}


.hex-ms-flag-mark {
  pointer-events: none;
}

.hex-ms-flag-pole {
  stroke: var(--accent);
  fill: none;
}

.hex-ms-flag-banner {
  fill: var(--accent);
  stroke: none;
}

.hex-ms-cell.is-bad-flag .hex-ms-flag-banner {
  fill: rgba(196, 120, 72, 0.95);
}

.hex-ms-cell.is-bad-flag .hex-ms-flag-pole {
  stroke: rgba(196, 120, 72, 0.95);
}

.preview-hex-flag {
  display: block;
  width: 0.55rem;
  height: 0.55rem;
  margin: 0 auto;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 35%, 0 70%);
  box-shadow: -0.12rem 0 0 0.05rem var(--accent);
}

.hex-ms-label {
  fill: var(--text);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  pointer-events: none;
}

.hex-ms-cell.is-open .hex-ms-label[data-n="1"] { fill: #7eb8d4; }
.hex-ms-cell.is-open .hex-ms-label[data-n="2"] { fill: #8fbf88; }
.hex-ms-cell.is-open .hex-ms-label[data-n="3"] { fill: #d4a373; }
.hex-ms-cell.is-open .hex-ms-label[data-n="4"] { fill: #c9a0dc; }
.hex-ms-cell.is-open .hex-ms-label[data-n="5"] { fill: #e0b070; }
.hex-ms-cell.is-open .hex-ms-label[data-n="6"] { fill: #d4a0a0; }

.hex-ms-meta {
  margin-top: 0.65rem;
  min-height: 1.6em;
  text-align: center;
  width: 100%;
}

.hex-ms-status {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.hex-ms-status.is-won {
  color: var(--accent);
  font-weight: 500;
}

.hex-ms-status.is-lost {
  color: #e0b070;
  font-weight: 500;
}

.hex-ms-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  max-width: 20rem;
}

@media (min-width: 800px) {
  .hex-ms-rail {
    align-items: stretch;
    max-width: none;
    position: sticky;
    top: calc(var(--header-h) + 0.75rem);
  }
}

.hex-ms-difficulty {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  width: 100%;
}

@media (min-width: 800px) {
  .hex-ms-difficulty {
    flex-direction: column;
  }
}

.hex-ms-chip {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.hex-ms-chip:hover {
  border-color: rgba(212, 163, 115, 0.45);
  color: var(--accent-hover);
}

.hex-ms-chip.is-active,
.hex-ms-chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.hex-ms-chip:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.hex-ms-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  width: 100%;
}

@media (min-width: 800px) {
  .hex-ms-toolbar {
    justify-content: stretch;
  }
}

.hex-ms-tool {
  appearance: none;
  flex: 1;
  min-width: 6rem;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.hex-ms-tool:hover {
  border-color: rgba(212, 163, 115, 0.45);
  color: var(--accent-hover);
}

.hex-ms-tool[aria-pressed="true"],
.hex-ms-tool.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover);
}

.hex-ms-tool:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.hex-ms-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  width: 100%;
}

@media (min-width: 800px) {
  .hex-ms-actions {
    flex-direction: column;
  }

  .hex-ms-actions .btn {
    width: 100%;
  }
}

.hex-ms-help {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  text-align: center;
  max-width: 18rem;
}

@media (min-width: 800px) {
  .hex-ms-help {
    text-align: left;
  }
}

@media (max-height: 820px) and (min-width: 800px) {
  .hex-ms-head {
    margin-bottom: 0.75rem;
  }

  .hex-ms-head h1 {
    font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  }

  .hex-ms-head .section-intro {
    font-size: 0.95rem;
    margin-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hex-ms-board.is-won {
    animation: none;
  }

  .preview-hex {
    transition: none;
  }
}

/* ---------------------------------------------------------------------------
   Game scores panel + Le-Word guess distribution
   --------------------------------------------------------------------------- */

.game-scores {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(212, 163, 115, 0.18);
}

.game-scores-login {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.game-scores-head {
  margin-bottom: 0.75rem;
}

.game-scores-heading {
  margin: 0 0 0.25rem;
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
}

.game-scores-summary {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.game-scores-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.game-scores-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid rgba(212, 163, 115, 0.12);
  font-size: 0.85rem;
}

.game-scores-item.is-win {
  border-color: rgba(212, 163, 115, 0.35);
}

.game-scores-item.is-loss,
.game-scores-item.is-abandon,
.game-scores-item.is-abandoned {
  opacity: 0.85;
}

.game-scores-main {
  color: var(--text);
  font-weight: 500;
}

.game-scores-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.game-scores-more {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
}

/* Wordle-style guess distribution (wins only) */
.le-word-dist {
  margin: 0.85rem 0 1rem;
  padding: 0.75rem 0.7rem;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid rgba(212, 163, 115, 0.2);
}

.le-word-dist-heading {
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-hover);
}

.le-word-dist-note {
  margin: 0 0 0.65rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.le-word-dist-local-note {
  margin: -0.35rem 0 0.65rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.le-word-dist-bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.le-word-dist-row {
  display: grid;
  grid-template-columns: 1.1rem 1fr;
  align-items: center;
  gap: 0.45rem;
}

.le-word-dist-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
}

.le-word-dist-track {
  display: block;
  min-width: 0;
}

.le-word-dist-bar {
  display: inline-block;
  min-width: 1.5rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(212, 163, 115, 0.35);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: right;
  box-sizing: border-box;
  transition: width 0.25s var(--ease, ease);
}

.le-word-dist-bar.is-best {
  background: var(--accent);
  color: #1a120c;
}

/* Shared scores page */
.scores-page {
  padding-bottom: 3rem;
}

.scores-table-wrap {
  overflow-x: auto;
  margin-top: 1.25rem;
  border-radius: 12px;
  border: 1px solid rgba(212, 163, 115, 0.16);
  background: var(--bg-card);
}

.scores-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.scores-table th,
.scores-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid rgba(212, 163, 115, 0.1);
}

.scores-table th {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.scores-table tr:last-child td {
  border-bottom: none;
}

.scores-empty {
  color: var(--text-muted);
}

/* ---------- Drift ---------- */

.drift {
  border-top: none;
}

.drift-wrap {
  max-width: 56rem;
}

.drift-head {
  margin-bottom: 1.25rem;
  max-width: 36rem;
}

.drift-head h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  margin-bottom: 0.45em;
}

.drift-head .eyebrow {
  margin-bottom: 0.65rem;
}

.drift-layout {
  display: grid;
  gap: 1.5rem;
  justify-items: center;
}

@media (min-width: 800px) {
  .drift-layout {
    grid-template-columns: minmax(0, 1fr) 14rem;
    align-items: start;
    justify-items: stretch;
    gap: 1.75rem 2rem;
  }
}

.drift-board-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.drift-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: min(100%, 28rem);
  margin-bottom: 0.65rem;
  padding: 0.45rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.drift-level,
.drift-moves,
.drift-sparks,
.drift-timer {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.drift-board {
  position: relative;
  width: min(100%, 28rem);
  background: #0c0e12;
  border: 1px solid rgba(212, 163, 115, 0.28);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px rgba(212, 163, 115, 0.08);
  padding: 0.45rem;
  outline: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.drift-board:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.drift-stage {
  position: relative;
  width: 100%;
}

.drift-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  aspect-ratio: 1;
  width: 100%;
}

.drift-cell {
  display: grid;
  place-items: center;
  min-width: 0;
  background: #0c0e12;
  box-shadow: inset 0 0 0 1px rgba(212, 163, 115, 0.12);
}

.drift-cell.is-wall {
  background: #07080c;
  box-shadow: inset 0 0 0 1px rgba(212, 163, 115, 0.55);
}

.drift-cell.is-spark::after {
  content: "";
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: #e7c49a;
  box-shadow: 0 0 8px rgba(212, 163, 115, 0.85);
}

.drift-cell.is-spark.is-got::after {
  opacity: 0.28;
  box-shadow: none;
}

.drift-cell.is-crack {
  background:
    repeating-linear-gradient(135deg, #0c0e12 0 5px, #4a2a22 5px 7px);
}

.drift-cell.is-key::after {
  content: "";
  width: 36%;
  height: 22%;
  border: 2px solid #d4a373;
  border-radius: 2px 40% 40% 2px;
}

.drift-cell.is-key.is-got::after {
  opacity: 0.25;
}

.drift-cell.is-door {
  background: #1a120c;
  box-shadow: inset 0 0 0 2px rgba(212, 163, 115, 0.75);
}

.drift-cell.is-door.is-open {
  background: #0c0e12;
  box-shadow: inset 0 0 0 1px rgba(212, 163, 115, 0.18);
}

.drift-cell.is-arrow::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 9px solid #d4a373;
}

.drift-cell.is-arrow.dir-d::after { transform: rotate(180deg); }
.drift-cell.is-arrow.dir-l::after { transform: rotate(-90deg); }
.drift-cell.is-arrow.dir-r::after { transform: rotate(90deg); }


.drift-cell.is-gem::after {
  content: "";
  width: 46%;
  height: 46%;
  background: #f0d2a8;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.drift-cell.is-gem.is-flare::after {
  animation: drift-gem-flare 0.45s var(--ease) 1;
}

@keyframes drift-gem-flare {
  0% { transform: scale(1); }
  45% { transform: scale(1.45); }
  100% { transform: scale(1); }
}

.drift-board.is-clear .drift-cell:not(.is-gem) {
  opacity: 0.62;
}

.drift-piece {
  position: absolute;
  left: 0;
  top: 0;
  width: 12.5%;
  height: 12.5%;
  margin: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  transition: left 150ms linear, top 150ms linear;
}

.drift-piece.is-set {
  transition: none;
}

.drift-piece::before {
  content: "";
  width: 52%;
  height: 52%;
  border-radius: 50%;
  background: #d4a373;
}

.drift-banner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--accent);
  pointer-events: none;
}

.drift-banner.is-done {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  color: var(--accent-hover);
}

.drift-pad {
  display: grid;
  grid-template-columns: repeat(3, 3.4rem);
  grid-template-areas:
    ". up ."
    "left down right";
  gap: 0.55rem;
  justify-content: center;
  width: min(100%, 36rem);
  margin-top: 0.9rem;
}

.drift-pad-btn {
  min-height: 3.25rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--accent);
  border-color: rgba(212, 163, 115, 0.45);
  background: #10131a;
}

.drift-pad-btn[data-drift-dir="U"] { grid-area: up; }
.drift-pad-btn[data-drift-dir="L"] { grid-area: left; }
.drift-pad-btn[data-drift-dir="D"] { grid-area: down; }
.drift-pad-btn[data-drift-dir="R"] { grid-area: right; }

.drift-meta {
  margin-top: 0.65rem;
  min-height: 1.6em;
  text-align: center;
  width: min(100%, 28rem);
}

.drift-status,
.drift-best {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-muted);
}

.drift-status.is-clear {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 1.35rem;
}

.drift-status.is-done {
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.95rem;
}

.drift-status.is-fail {
  color: #e7c49a;
}


.drift-best {
  margin-top: 0.2rem;
  font-variant-numeric: tabular-nums;
}

.drift-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  max-width: 20rem;
}

@media (min-width: 800px) {
  .drift-rail {
    align-items: stretch;
    max-width: none;
    position: sticky;
    top: calc(var(--header-h) + 0.75rem);
  }
}

.drift-actions {
  display: flex;
  width: 100%;
  justify-content: center;
}

@media (min-width: 800px) {
  .drift-actions .btn {
    width: 100%;
  }
}

.drift-help {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  text-align: center;
  max-width: 18rem;
}

@media (min-width: 800px) {
  .drift-help {
    text-align: left;
    max-width: none;
  }
}

.preview-drift {
  --pc: clamp(0.85rem, 2.4vw, 1.15rem);
  display: grid;
  grid-template-columns: repeat(6, var(--pc));
  grid-template-rows: repeat(5, var(--pc));
  background: #0c0e12;
  border: 1px solid rgba(212, 163, 115, 0.28);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.35s var(--ease);
}

.game-tile:hover .preview-drift {
  transform: scale(1.03);
}

.preview-drift-cell.is-wall {
  background: #07080c;
  box-shadow: inset 0 0 0 1px rgba(212, 163, 115, 0.45);
}

.preview-drift-cell.is-ice {
  background: #0c0e12;
  box-shadow: inset 0 0 0 1px rgba(212, 163, 115, 0.12);
}

.preview-drift-cell.is-piece {
  background:
    radial-gradient(circle at center, #d4a373 0 28%, transparent 30%),
    #0c0e12;
}

.preview-drift-cell.is-gem {
  background:
    linear-gradient(45deg, transparent 46%, #f0d2a8 46% 54%, transparent 54%),
    linear-gradient(-45deg, transparent 46%, #f0d2a8 46% 54%, transparent 54%),
    #0c0e12;
}

/* ---------- Unpark ---------- */

.unpark {
  border-top: none;
  overflow-x: clip;
}

.unpark-wrap {
  max-width: 56rem;
  overflow-x: clip;
}

.unpark-head {
  margin-bottom: 1.25rem;
  max-width: 36rem;
}

.unpark-head h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  margin-bottom: 0.45em;
}

.unpark-head .eyebrow {
  margin-bottom: 0.65rem;
}

.unpark-layout {
  display: grid;
  gap: 1.5rem;
  justify-items: center;
}

@media (min-width: 800px) {
  .unpark-layout {
    grid-template-columns: minmax(0, 1fr) 16rem;
    align-items: start;
    justify-items: stretch;
    gap: 1.75rem 2rem;
  }
}

.unpark-board-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.unpark-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: min(100%, 36rem);
  margin-bottom: 0.65rem;
  padding: 0.45rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.unpark-diff,
.unpark-moves {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.unpark-lot {
  position: relative;
  width: min(100%, 36rem);
  max-width: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  background: #0c0e12;
  border: 3px solid rgba(212, 163, 115, 0.45);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px rgba(212, 163, 115, 0.08);
  outline: none;
  touch-action: pan-x pan-y;
  -webkit-user-select: none;
  user-select: none;
}

.unpark-stage {
  position: relative;
  width: max(100%, calc(15 * 1.75rem));
}

.unpark-lot:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.unpark-grid {
  display: grid;
  grid-template-columns: repeat(15, minmax(1.75rem, 1fr));
  aspect-ratio: 1;
  width: 100%;
}

.unpark-gaps {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.unpark-stall {
  background: #10131a;
  box-shadow: inset 0 0 0 1px rgba(232, 230, 225, 0.05);
}

.unpark-stall.is-lane {
  background: #16130f;
  box-shadow: inset 0 0 0 1px rgba(212, 163, 115, 0.16);
}

.unpark-stall.is-gap {
  background: #143224;
}

.unpark-gap {
  position: absolute;
  background: #3dbe6e;
  border-radius: 2px;
}

.unpark-gap.is-right { right: 0; width: 7px; }
.unpark-gap.is-left { left: 0; width: 7px; }
.unpark-gap.is-down { bottom: 0; height: 7px; }
.unpark-gap.is-up { top: 0; height: 7px; }

.unpark-car {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  min-width: 0;
  min-height: 0;
}

.unpark-car span {
  display: block;
  height: calc(100% - 4px);
  margin: 2px;
  border-radius: 5px;
  background: var(--car);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.unpark-car.is-h.is-face-high span {
  background: linear-gradient(90deg, var(--car) 0 70%, rgba(255, 255, 255, 0.5) 70% 86%, var(--car) 86%);
}

.unpark-car.is-h.is-face-low span {
  background: linear-gradient(90deg, var(--car) 14%, rgba(255, 255, 255, 0.5) 14% 30%, var(--car) 30% 100%);
}

.unpark-car.is-v.is-face-high span {
  background: linear-gradient(180deg, var(--car) 0 70%, rgba(255, 255, 255, 0.5) 70% 86%, var(--car) 86%);
}

.unpark-car.is-v.is-face-low span {
  background: linear-gradient(180deg, var(--car) 14%, rgba(255, 255, 255, 0.5) 14% 30%, var(--car) 30% 100%);
}

.unpark-car.is-bus span {
  height: calc(100% - 2px);
  margin: 1px;
  border-radius: 4px;
}

.unpark-car.is-selected span {
  box-shadow:
    0 0 0 2px #f0c9a0,
    0 0 14px rgba(212, 163, 115, 0.45),
    inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.unpark-pad {
  display: grid;
  grid-template-columns: repeat(3, 3.4rem);
  grid-template-areas:
    ". up ."
    "left down right";
  gap: 0.55rem;
  justify-content: center;
  width: min(100%, 28rem);
  margin-top: 0.9rem;
}

.unpark-pad-btn {
  min-height: 3.25rem;
  min-width: 3.25rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--accent);
  border-color: rgba(212, 163, 115, 0.45);
  background: #10131a;
}

.unpark-pad-btn[data-unpark-dir="up"] { grid-area: up; }
.unpark-pad-btn[data-unpark-dir="left"] { grid-area: left; }
.unpark-pad-btn[data-unpark-dir="down"] { grid-area: down; }
.unpark-pad-btn[data-unpark-dir="right"] { grid-area: right; }

.unpark-status {
  margin: 0.65rem 0 0;
  min-height: 1.6em;
  text-align: center;
  width: min(100%, 36rem);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-muted);
}

.unpark-status.is-clear {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 1.35rem;
}

.unpark-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  max-width: 22rem;
}

@media (min-width: 800px) {
  .unpark-rail {
    align-items: stretch;
    max-width: none;
    position: sticky;
    top: calc(var(--header-h) + 0.75rem);
  }
}

.unpark-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
}

.unpark-diffs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
}

@media (min-width: 800px) {
  .unpark-diffs {
    flex-direction: column;
  }

  .unpark-actions .btn {
    width: 100%;
  }
}

.unpark-diffs .btn.is-active {
  border-color: var(--accent);
  color: #1a120c;
  background: var(--accent);
}

.unpark-help {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  text-align: center;
  max-width: 18rem;
}

@media (min-width: 800px) {
  .unpark-help {
    text-align: left;
    max-width: none;
  }
}

.preview-unpark {
  --pc: clamp(0.85rem, 2.4vw, 1.15rem);
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, var(--pc));
  grid-template-rows: repeat(4, var(--pc));
  background-color: #10131a;
  background-image:
    linear-gradient(rgba(232, 230, 225, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 230, 225, 0.06) 1px, transparent 1px);
  background-size: var(--pc) var(--pc);
  border: 2px solid rgba(212, 163, 115, 0.4);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.35s var(--ease);
}

.preview-unpark::before,
.preview-unpark::after {
  content: "";
  position: absolute;
  background: #3dbe6e;
  z-index: 1;
}

.preview-unpark::before {
  left: 0;
  top: var(--pc);
  width: 4px;
  height: var(--pc);
}

.preview-unpark::after {
  right: 0;
  bottom: var(--pc);
  width: 4px;
  height: var(--pc);
  box-shadow: 0 calc(var(--pc) * -2) 0 #3dbe6e;
}

.game-tile:hover .preview-unpark {
  transform: scale(1.03);
}

.preview-unpark-car.is-copper {
  background: #d4a373;
  grid-column: 1 / span 2;
  grid-row: 2;
  margin: 2px;
  border-radius: 3px;
}

.preview-unpark-car.is-slate {
  background: #8a97a8;
  grid-column: 4;
  grid-row: 1 / span 2;
  margin: 2px;
  border-radius: 3px;
}

.preview-unpark-car.is-olive {
  background: #8a9a6a;
  grid-column: 3 / span 2;
  grid-row: 3;
  margin: 2px;
  border-radius: 3px;
}

.preview-unpark-car.is-rust {
  background: #b36a4a;
  grid-column: 5;
  grid-row: 3 / span 2;
  margin: 2px;
  border-radius: 3px;
}

/* ============================================================
   Stocks experiment (owner-only dashboard)
   ============================================================ */

.stocks-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.stocks-head .section-intro {
  max-width: 46rem;
}

.stocks-flash {
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.stocks-flash-err {
  background: rgba(224, 122, 106, 0.12);
  border-color: rgba(224, 122, 106, 0.35);
}

.stocks-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 860px) {
  .stocks-summary {
    grid-template-columns: 1fr;
  }
}

.stocks-card,
.stocks-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem 1.25rem;
}

.stocks-card-label,
.stocks-panel-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  margin: 0 0 0.35rem;
  letter-spacing: 0.01em;
}

.stocks-card-meta,
.stocks-hint,
.stocks-muted {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.stocks-chip {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.stocks-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 0;
}

.stocks-metrics dt {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stocks-metrics dd {
  margin: 0.2rem 0 0;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-size: 1.35rem;
  font-weight: 500;
}

.stocks-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  white-space: nowrap;
}

.stocks-num.is-pos,
.stocks-metrics dd.is-pos {
  color: #6fbf8a;
}

.stocks-num.is-neg,
.stocks-metrics dd.is-neg {
  color: #e07a6a;
}

.stocks-num.is-flat,
.stocks-metrics dd.is-flat {
  color: var(--text-muted);
}

.stocks-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.stocks-chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stocks-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stocks-field input,
.stocks-field select,
.stocks-start-form select,
.stocks-start-form input[type="text"] {
  font: inherit;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  min-width: 9rem;
}

.stocks-chart-wrap {
  position: relative;
  height: min(360px, 55vh);
  margin-top: 0.5rem;
}

.stocks-chart-status {
  min-height: 1.25rem;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.stocks-hint {
  margin-top: 0.75rem;
}

.stocks-rank-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 900px) {
  .stocks-rank-grid {
    grid-template-columns: 1fr;
  }
}

.stocks-table-wrap {
  overflow-x: auto;
  margin-top: 0.5rem;
}

.stocks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.stocks-table th,
.stocks-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.stocks-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stocks-table code {
  font-size: 0.85rem;
  color: var(--accent-hover);
}

.stocks-empty {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.stocks-linkish {
  appearance: none;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

.stocks-linkish:hover {
  color: var(--accent-hover);
}

.stocks-status {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stocks-status-active {
  background: rgba(111, 191, 138, 0.14);
  color: #6fbf8a;
}

.stocks-status-stopped {
  background: rgba(154, 150, 140, 0.16);
  color: var(--text-muted);
}

.stocks-start-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  align-items: flex-end;
}

.stocks-btn {
  appearance: none;
  font: inherit;
  font-weight: 500;
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.stocks-btn-primary {
  background: var(--accent);
  color: #1a120c;
}

.stocks-btn-primary:hover {
  background: var(--accent-hover);
}

.stocks-btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-strong);
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.stocks-btn-ghost:hover {
  color: var(--text);
  border-color: var(--accent);
}

.stocks-run-row.is-selected {
  background: var(--accent-soft);
}

.stocks-size {
  margin-left: 0.35rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.stocks-spark-cell {
  width: 124px;
}

.stocks-spark {
  display: block;
  width: 120px;
  height: 36px;
}

.stocks-actions form {
  margin: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.stocks-custom-range {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
}

.stocks-backtest-form {
  margin: 0.75rem 0 1rem;
}

.stocks-backtest-summary {
  margin-top: 0.75rem;
}

.stocks-backtest-body {
  margin-top: 0.5rem;
}

.stocks-sim-chart-wrap {
  height: min(400px, 58vh);
}

.stocks-rename-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: flex-end;
  margin: 0.5rem 0 0.75rem;
}

.stocks-rename-form .stocks-field {
  flex: 1 1 14rem;
}

.stocks-rename-form .stocks-field input {
  min-width: 12rem;
  width: 100%;
}
