/* ============================================================
   arcadefork - design system
   ============================================================ */

:root {
  --bg: #060a13;
  --bg-2: #0a1020;
  --panel: #101a2e;
  --panel-2: #16223c;
  --panel-3: #1d2b4a;
  --line: rgba(148, 170, 220, 0.14);
  --line-strong: rgba(148, 170, 220, 0.28);
  --text: #eaf0ff;
  --muted: #94a1c6;
  --accent: #2fe6ff;
  --accent-soft: rgba(47, 230, 255, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --tap: 44px;
  --font: 'Outfit', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shell-max: 1440px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Ambient aurora - very slow, very subtle, disabled for reduced motion. */
body::before {
  content: '';
  position: fixed;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(38vw 38vw at 12% 8%, rgba(47, 230, 255, 0.13), transparent 62%),
    radial-gradient(34vw 34vw at 88% 14%, rgba(255, 79, 168, 0.10), transparent 60%),
    radial-gradient(42vw 42vw at 70% 92%, rgba(179, 136, 255, 0.10), transparent 62%);
  animation: drift 34s var(--ease) infinite alternate;
}

@keyframes drift {
  from {
    transform: translate3d(-2%, -1%, 0) scale(1);
  }
  to {
    transform: translate3d(2%, 2%, 0) scale(1.08);
  }
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

@media (max-width: 640px) {
  .wrap {
    padding: 0 16px;
  }
}

/* ---------------------------------------------- site chrome */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(6, 10, 19, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.site-header .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}

.brand {
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
  transition: opacity 0.2s var(--ease);
}

.brand:hover {
  opacity: 0.82;
}

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

.site-nav {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
}

.site-nav::-webkit-scrollbar {
  display: none;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  padding: 6px 0;
  position: relative;
  transition: color 0.2s var(--ease);
}

.site-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s var(--ease-out);
}

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

.site-nav a:hover::after,
.site-nav a[aria-current='page']::after {
  transform: scaleX(1);
}

/* ---------------------------------------------- hero + sections */

.hero {
  padding: clamp(34px, 7vw, 68px) 0 26px;
}

.hero h1 {
  font-size: clamp(32px, 7.2vw, 60px);
  line-height: 1.04;
  margin: 0 0 14px;
  letter-spacing: -0.035em;
  font-weight: 800;
}

.hero p {
  color: var(--muted);
  font-size: clamp(15px, 2.2vw, 18px);
  max-width: 64ch;
  margin: 0 0 22px;
}

.pill {
  display: inline-block;
  padding: 6px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin: 0 6px 8px 0;
  background: rgba(255, 255, 255, 0.02);
}

.section {
  padding: 26px 0;
}

.section h2 {
  font-size: clamp(20px, 3vw, 26px);
  margin: 0 0 16px;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 0;
}

.section-more {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s var(--ease);
}

.section-more:hover {
  color: var(--accent);
}

/* ---------------------------------------------- game grid */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* Featured slots stretch to fill the row instead of leaving dead space. */
.grid-featured {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

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

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  background: linear-gradient(180deg, var(--panel) 0%, rgba(16, 26, 46, 0.55) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform 0.32s var(--ease-out),
    border-color 0.32s var(--ease),
    box-shadow 0.32s var(--ease);
}

.tile::before {
  content: '';
  position: absolute;
  inset: -40% 40% 60% -40%;
  background: radial-gradient(closest-side, var(--glow, var(--accent)), transparent 72%);
  opacity: 0;
  z-index: -1;
  transition: opacity 0.4s var(--ease);
}

.tile:hover {
  transform: translateY(-4px);
  border-color: var(--tile-accent, var(--accent));
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.9), 0 0 0 1px var(--tile-accent, var(--accent)) inset;
}

.tile:hover::before {
  opacity: 0.2;
}

.tile:active {
  transform: translateY(-1px) scale(0.995);
}

.tile .thumb {
  height: 108px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: border-color 0.32s var(--ease);
}

.tile:hover .thumb {
  border-color: var(--tile-accent, var(--accent));
}

.tile h3 {
  margin: 0 0 5px;
  font-size: 17.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.tile p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.45;
  flex: 1;
}

.tile .tag {
  margin-top: 12px;
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tile-accent, var(--accent));
}

.tile .badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-strong);
  color: var(--muted);
}

.cat-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-input {
  width: 100%;
  max-width: 460px;
  min-height: var(--tap);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.filter-input::placeholder {
  color: var(--muted);
}

.filter-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
}

.filter-status {
  color: var(--muted);
  font-size: 13.5px;
  min-height: 20px;
  margin: 10px 0 0;
}

.cat-block .section-head {
  margin-bottom: 14px;
}

.cat-block .section-head .pill {
  margin: 0;
}

.cat-chip {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition:
    color 0.2s var(--ease),
    border-color 0.2s var(--ease),
    background 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.cat-chip:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

/* ---------------------------------------------- prose + faq */

.prose {
  max-width: 72ch;
  color: #c5cee8;
  line-height: 1.7;
}

.prose h1 {
  color: var(--text);
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: -0.025em;
  margin: 8px 0 12px;
}

.prose h2 {
  color: var(--text);
  margin: 32px 0 10px;
  font-size: 20px;
  letter-spacing: -0.015em;
}

.prose h3 {
  color: var(--text);
  margin: 22px 0 8px;
  font-size: 16px;
}

.prose p {
  margin: 0 0 14px;
}

.prose ul {
  padding-left: 20px;
  margin: 0 0 16px;
}

.prose li {
  margin-bottom: 7px;
}

.prose a {
  color: var(--accent);
  text-underline-offset: 3px;
  transition: opacity 0.2s var(--ease);
}

.prose a:hover {
  opacity: 0.8;
}

.credit-line {
  font-size: 13.5px;
  color: var(--muted);
  border-left: 2px solid var(--line-strong);
  padding-left: 12px;
}

.credit-line a {
  color: var(--accent);
}

.faq {
  border-top: 1px solid var(--line);
}

.faq details {
  border-bottom: 1px solid var(--line);
  padding: 4px 0;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  padding: 12px 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  transition: color 0.2s var(--ease);
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary:hover {
  color: var(--accent);
}

.faq summary::before {
  content: '+';
  color: var(--accent);
  font-weight: 800;
  line-height: 1.5;
  transition: transform 0.25s var(--ease);
}

.faq details[open] summary::before {
  content: '\2212';
}

.faq p {
  margin: 0 0 16px 26px;
  color: var(--muted);
}

.linklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.linklist a {
  display: block;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition:
    border-color 0.22s var(--ease),
    background 0.22s var(--ease),
    transform 0.22s var(--ease-out);
}

.linklist a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

/* ---------------------------------------------- tables */

.answer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 12px 0 4px;
}

.answer-table th,
.answer-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.answer-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.answer-table a {
  color: var(--accent);
}

.credits-table {
  max-width: 720px;
}

/* ---------------------------------------------- board */

.board {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 2px;
  width: min(520px, 100%);
  margin: 14px 0;
}

.board div {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  font-weight: 700;
  font-size: clamp(11px, 2.6vw, 19px);
}

/* ---------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 48px;
  padding: 30px 0 calc(40px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 13.5px;
}

.site-footer p {
  margin: 0 0 10px;
}

.foot-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 14px;
}

.foot-nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

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

.foot-note {
  font-size: 13px;
  opacity: 0.85;
}

.copyright {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* ============================================================
   Game shell
   ============================================================ */

.game-layout {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

.game-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: rgba(6, 10, 19, 0.9);
  backdrop-filter: blur(10px);
  flex: 0 0 auto;
}

.topbar .brand {
  font-size: 18px;
  justify-self: start;
}

.hud {
  display: flex;
  gap: 18px;
  justify-self: center;
  overflow: hidden;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}

.hud-label {
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.hud-value {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  width: var(--tap);
  height: var(--tap);
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  justify-self: end;
  transition:
    background 0.2s var(--ease),
    border-color 0.2s var(--ease),
    transform 0.12s var(--ease);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--line-strong);
}

.icon-btn:active {
  transform: scale(0.94);
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.stage canvas {
  display: block;
  touch-action: none;
  max-width: 100%;
  max-height: 100%;
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(6, 10, 19, 0.86);
  backdrop-filter: blur(6px);
  padding: 20px;
  z-index: 10;
  overflow-y: auto;
}

.overlay.is-open {
  display: grid;
}

.card {
  background: linear-gradient(180deg, var(--panel) 0%, rgba(16, 26, 46, 0.8) 100%);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 30px 26px;
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.95);
  animation: rise 0.4s var(--ease-out) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card h1,
.card h2 {
  margin: 0 0 8px;
  letter-spacing: -0.025em;
  font-weight: 800;
}

.card p {
  color: var(--muted);
  margin: 0 0 18px;
}

.card .score {
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  margin: 10px 0 6px;
  font-variant-numeric: tabular-nums;
}

.card .meta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 18px;
}

.card .fine {
  font-size: 12px;
  margin: 14px 0 0;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--font);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 0.16s var(--ease-out),
    background 0.2s var(--ease),
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}

.btn:hover {
  border-color: var(--line-strong);
  background: var(--panel-3);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #04121a;
  box-shadow: 0 10px 30px -12px var(--accent);
}

.btn-primary:hover {
  background: #63edff;
  border-color: #63edff;
  box-shadow: 0 14px 34px -12px var(--accent);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
}

.promo {
  display: block;
  margin-top: 18px;
  padding: 13px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.03);
  transition:
    border-color 0.2s var(--ease),
    background 0.2s var(--ease);
}

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

.promo strong {
  display: block;
  font-size: 15px;
}

.promo span {
  color: var(--muted);
  font-size: 13px;
}

/* ---------------------------------------------- side rail */

.game-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 20px calc(34px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}

.side-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 4px;
}

.side-tag {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.side-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.side-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.side-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.side-links a {
  display: block;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.02);
  transition:
    border-color 0.2s var(--ease),
    background 0.2s var(--ease),
    transform 0.2s var(--ease-out);
}

.side-links a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateX(3px);
}

.side-credit {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}

.side-credit a {
  color: var(--accent);
}

.side-foot {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  opacity: 0.8;
}

@media (min-width: 1000px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
    max-width: var(--shell-max);
    margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }

  .game-main {
    min-height: 100vh;
  }

  /* Keep the play area a comfortable width instead of a letterboxed column. */
  .stage {
    max-width: 760px;
    margin-inline: auto;
    width: 100%;
  }

  .game-side {
    border-top: 0;
    border-left: 1px solid var(--line);
    padding: 28px 24px;
    background: linear-gradient(180deg, rgba(16, 26, 46, 0.55), rgba(6, 10, 19, 0.2));
    overflow-y: auto;
    gap: 22px;
  }

  .side-title {
    font-size: 24px;
  }

  .side-foot {
    margin: auto 0 0;
  }
}

/* ---------------------------------------------- embedded games */

.embed-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: rgba(6, 10, 19, 0.9);
  flex: 0 0 auto;
}

.embed-title {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.embed-open {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s var(--ease);
}

.embed-open:hover {
  color: var(--accent);
}

.embed-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0;
  background: #05070d;
}

.embed-stage iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #05070d;
}

@media (min-width: 1000px) {
  .embed-stage {
    padding: 18px;
  }

  .embed-stage iframe {
    max-width: 1180px;
    height: calc(100% - 36px);
    border-radius: 14px;
    border: 1px solid var(--line);
    box-shadow: 0 30px 70px -40px rgba(0, 0, 0, 1);
  }
}

/* ---------------------------------------------- sponsor */

.sponsor {
  display: block;
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  text-decoration: none;
  transition:
    border-color 0.2s var(--ease),
    background 0.2s var(--ease);
}

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

.sponsor strong {
  display: block;
  font-size: 15px;
}

.sponsor span {
  color: var(--muted);
  font-size: 13px;
}

.sponsor img {
  display: block;
  max-width: 100%;
  border-radius: 8px;
}

/* ---------------------------------------------- motion + a11y */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  body::before {
    animation: none;
  }
}

@media (hover: none) {
  .tile:hover {
    transform: none;
  }
}
