@layer reset, tokens, layout, components, games;

@view-transition { navigation: auto; }

:root {
  color-scheme: dark;
  --bg: oklch(0.18 0.04 270);
  --bg-alt: oklch(0.21 0.04 270);
  --surface: oklch(0.24 0.045 270);
  --card: color-mix(in oklch, oklch(0.28 0.05 270) 88%, white 12%);
  --text: oklch(0.95 0.02 270);
  --muted: oklch(0.74 0.04 270);
  --gold: oklch(0.86 0.14 95);
  --cyan: oklch(0.78 0.12 220);
  --emerald: oklch(0.8 0.14 160);
  --blue: oklch(0.74 0.12 270);
  --pink: oklch(0.78 0.12 350);
  --teal: oklch(0.8 0.12 185);
  --violet: oklch(0.72 0.14 300);
  --line: color-mix(in oklch, var(--text) 12%, transparent);
  --radius: 1.15rem;
  --font: "DM Sans", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --space: clamp(1rem, 2vw, 1.5rem);
}

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { scroll-behavior: smooth; text-size-adjust: 100%; }
  img, svg { max-width: 100%; }
}
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  overflow-x: hidden;
  text-wrap: pretty;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.bg-glow {
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 70vh;
  background:
    radial-gradient(ellipse 50% 60% at 20% 30%, rgba(124, 156, 255, 0.18), transparent 55%),
    radial-gradient(ellipse 40% 50% at 80% 20%, rgba(232, 197, 71, 0.12), transparent 50%),
    radial-gradient(ellipse 35% 40% at 60% 60%, rgba(52, 211, 153, 0.08), transparent 50%);
  pointer-events: none;
  z-index: 0;
  animation: glow-drift 18s ease-in-out infinite alternate;
}
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(232, 236, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 236, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: grid-pan 40s linear infinite;
}
@keyframes glow-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(2%, 3%, 0) scale(1.05); }
}
@keyframes grid-pan {
  from { background-position: 0 0; }
  to { background-position: 48px 48px; }
}

.site-header, main, .site-footer { position: relative; z-index: 1; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  position: sticky;
  top: 0;
  backdrop-filter: blur(12px);
  background: rgba(11, 16, 32, 0.75);
  border-bottom: 1px solid rgba(232, 236, 255, 0.06);
  z-index: 10;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--gold), var(--blue));
  box-shadow: 0 0 20px rgba(124, 156, 255, 0.45);
  animation: mark-pulse 3s ease-in-out infinite;
}
@keyframes mark-pulse {
  0%, 100% { box-shadow: 0 0 14px rgba(124, 156, 255, 0.35); }
  50% { box-shadow: 0 0 28px rgba(232, 197, 71, 0.5); }
}
.nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.nav a {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
}
.nav a:hover { color: var(--text); }

.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 4rem 1.5rem 3rem;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  margin: 0 0 1rem;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 3.75rem);
  line-height: 1.12;
  margin: 0 0 1.25rem;
  text-wrap: balance;
}
.hero h1 em {
  font-style: italic;
  background: linear-gradient(90deg, var(--gold), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-lead {
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.08rem;
  margin: 0 0 1.75rem;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 2.5rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.35rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid transparent;
  text-decoration: none !important;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: linear-gradient(135deg, var(--gold), #f5d76e);
  color: #0b1020;
  box-shadow: 0 8px 28px rgba(232, 197, 71, 0.25);
}
.btn-ghost {
  background: transparent;
  border-color: rgba(232, 236, 255, 0.18);
  color: var(--text);
}
.btn-small {
  margin-top: auto;
  padding: 0.55rem 0.95rem;
  font-size: 0.85rem;
  background: rgba(232, 236, 255, 0.06);
  border: 1px solid rgba(232, 236, 255, 0.12);
  color: var(--text);
  border-radius: 999px;
  align-self: flex-start;
}
.btn-small:hover { background: rgba(124, 156, 255, 0.2); border-color: var(--blue); }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}
.hero-stats div {
  padding: 1rem 1.1rem;
  background: rgba(26, 34, 64, 0.65);
  border: 1px solid rgba(232, 236, 255, 0.08);
  border-radius: var(--radius);
}
.hero-stats strong { display: block; margin-bottom: 0.25rem; }
.hero-stats span { color: var(--muted); font-size: 0.88rem; }

.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}
.section-alt {
  background: linear-gradient(180deg, transparent, rgba(20, 26, 46, 0.8), transparent);
  max-width: none;
  padding-left: max(1.5rem, calc((100% - 1100px) / 2 + 1.5rem));
  padding-right: max(1.5rem, calc((100% - 1100px) / 2 + 1.5rem));
}
.section-head { margin-bottom: 1.75rem; }
.section-head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin: 0 0 0.4rem;
}
.section-head p { color: var(--muted); margin: 0; max-width: 36rem; }
.section-note {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 1.5rem 0 0;
  max-width: 40rem;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16.5rem), 1fr));
  gap: 1.15rem;
  container-type: inline-size;
}
.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.35rem;
  background: var(--card);
  border: 1px solid rgba(232, 236, 255, 0.08);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease;
  animation: card-in 0.7s ease both;
}
.app-card:nth-child(1) { animation-delay: 0.05s; }
.app-card:nth-child(2) { animation-delay: 0.12s; }
.app-card:nth-child(3) { animation-delay: 0.19s; }
.app-card:nth-child(4) { animation-delay: 0.26s; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.app-card:hover {
  transform: translateY(-4px);
  border-color: rgba(232, 236, 255, 0.18);
}
.app-card-glow {
  position: absolute;
  inset: auto -20% 40% -20%;
  height: 60%;
  opacity: 0.35;
  filter: blur(40px);
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.app-card:hover .app-card-glow { opacity: 0.55; }
.app-card[data-accent="emerald"] .app-card-glow { background: var(--emerald); }
.app-card[data-accent="teal"] .app-card-glow { background: var(--teal); }
.app-card[data-accent="blue"] .app-card-glow { background: var(--blue); }
.app-card[data-accent="violet"] .app-card-glow { background: var(--violet); }
.app-card[data-accent="gold"] .app-card-glow { background: var(--gold); }
.app-card[data-accent="cyan"] .app-card-glow { background: var(--cyan); }

.app-card h3 {
  margin: 0;
  font-size: 1.25rem;
  position: relative;
}
.app-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  position: relative;
}
.app-card .tagline {
  color: var(--text);
  font-weight: 600;
  font-size: 0.88rem;
  opacity: 0.9;
}
.pill {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(124, 156, 255, 0.15);
  color: var(--blue);
  position: relative;
}
.pill-soon {
  background: rgba(232, 197, 71, 0.15);
  color: var(--gold);
  animation: soon-blink 2.4s ease-in-out infinite;
}
@keyframes soon-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0;
  margin: 0.25rem 0 0.5rem;
  position: relative;
}
.tags li {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgba(11, 16, 32, 0.55);
  border: 1px solid rgba(232, 236, 255, 0.06);
}

.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 720px) {
  .about-grid { grid-template-columns: 1fr; }
  .nav { display: none; }
}
.about-grid h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 2rem;
  margin: 0 0 0.75rem;
}
.about-grid p { color: var(--muted); }
.about-card {
  padding: 1.35rem;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid rgba(232, 236, 255, 0.08);
}
.about-card h3 { margin: 0 0 0.75rem; }
.about-card ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}
.about-card li { margin-bottom: 0.4rem; }

.contact-mail {
  display: inline-block;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.75rem;
}
.contact-mail:hover { color: var(--gold); }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem 2.5rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.footer-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.5;
}

.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;
}
.catalog-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}
.catalog-search-wrap { display: block; }
.catalog-search {
  width: 100%;
  padding: 0.85rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(232, 236, 255, 0.14);
  background: rgba(26, 34, 64, 0.75);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}
.catalog-search:focus {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.chip {
  border: 1px solid rgba(232, 236, 255, 0.14);
  background: rgba(26, 34, 64, 0.55);
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}
.chip[aria-pressed="true"],
.chip.active {
  background: rgba(124, 156, 255, 0.2);
  border-color: var(--blue);
  color: var(--text);
}
.catalog-count {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 1rem;
}
.catalog-empty { color: var(--gold); }

.mode-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
  padding: 0.35rem;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  border-radius: 999px;
  background: rgba(26, 34, 64, 0.72);
  border: 1px solid rgba(232, 236, 255, 0.12);
}
.mode-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  cursor: pointer;
}
.mode-tab:hover { color: var(--text); }
.mode-tab[aria-selected="true"],
.mode-tab.active {
  background: linear-gradient(135deg, var(--gold), #f5d76e);
  color: #0b1020;
  box-shadow: 0 6px 20px rgba(232, 197, 71, 0.22);
}
.mode-hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}
.btn-disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: default;
}
.featured-grid { margin-bottom: 0.5rem; }
.app-card-link {
  color: inherit;
  text-decoration: none !important;
  display: flex;
  flex-direction: column;
  gap: inherit;
  height: 100%;
}
.app-card.is-hidden { display: none; }
.app-card .card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
}
.play-shell { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1.5rem 4rem; }
.play-head { margin-bottom: 1.25rem; }
.play-head h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0.35rem 0 0.5rem;
}
.webapp-panel {
  background: var(--card);
  border: 1px solid rgba(232, 236, 255, 0.08);
  border-radius: var(--radius);
  padding: 1.1rem;
}
.webapp-panel input,
.webapp-panel textarea,
.webapp-panel select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(232, 236, 255, 0.14);
  background: rgba(11, 16, 32, 0.55);
  color: var(--text);
  font: inherit;
}
.webapp-panel textarea { min-height: 8rem; font-family: ui-monospace, Consolas, monospace; }
.webapp-row { display: flex; flex-wrap: wrap; gap: 0.55rem; margin: 0.65rem 0; }
.webapp-status { color: var(--muted); font-size: 0.92rem; margin: 0.4rem 0; }
.board-grid {
  display: grid;
  gap: 4px;
  margin: 0.75rem 0;
  width: min(100%, 420px);
}
.cell-btn {
  aspect-ratio: 1;
  border: 1px solid rgba(232, 236, 255, 0.12);
  background: rgba(11, 16, 32, 0.55);
  color: var(--text);
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}
.cell-btn:hover { border-color: var(--gold); }
.cell-btn.legal { box-shadow: inset 0 0 0 2px var(--gold); }
.banner-slot {
  margin-top: 1.25rem;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  background: rgba(232, 197, 71, 0.08);
  border: 1px dashed rgba(232, 197, 71, 0.35);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* Scroll reveal */
.anim-fade-up {
  opacity: 0;
  transform: translateY(18px);
  animation: fade-up 0.8s ease forwards;
}
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.45s; }
@keyframes fade-up {
  to { opacity: 1; transform: translateY(0); }
}

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .anim-fade-up, .reveal { opacity: 1; transform: none; }
}

/* —— visual pass —— */
.nav-toggle {
  display: none;
  appearance: none;
  border: 1px solid rgba(232, 236, 255, 0.18);
  background: rgba(26, 34, 64, 0.8);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}
.card-top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  position: relative;
}
.card-mark {
  width: 2.4rem;
  height: 2.4rem;
  flex: 0 0 2.4rem;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-family: var(--serif);
  font-size: 1.25rem;
  color: #0b1020;
  background: linear-gradient(145deg, var(--gold), #f3e08a);
  box-shadow: 0 8px 20px rgba(232, 197, 71, 0.22);
  overflow: hidden;
  position: relative;
}
.card-mark img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.app-card[data-accent="emerald"] .card-mark { background: linear-gradient(145deg, var(--emerald), #9af0cb); }
.app-card[data-accent="teal"] .card-mark { background: linear-gradient(145deg, var(--teal), #99f6e4); }
.app-card[data-accent="blue"] .card-mark { background: linear-gradient(145deg, var(--blue), #c7d4ff); }
.app-card[data-accent="violet"] .card-mark { background: linear-gradient(145deg, var(--violet), #ddd6fe); }
.app-card[data-accent="gold"] .card-mark { background: linear-gradient(145deg, var(--gold), #f3e08a); }
.app-card[data-accent="cyan"] .card-mark { background: linear-gradient(145deg, var(--cyan), #bae6fd); }
.app-card[data-accent="pink"] .card-mark { background: linear-gradient(145deg, var(--pink), #ffd1e3); }

.app-card {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.app-card h3 { letter-spacing: -0.02em; }

.play-page .play-shell {
  max-width: 960px;
}
.play-head {
  padding: 0.25rem 0 0.5rem;
}
.play-head .hero-cta {
  margin-bottom: 0.5rem;
}
.webapp-stage {
  margin-top: 0.25rem;
  padding-bottom: 4.5rem;
}
.webapp-config {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  align-items: end;
  margin: 0 0 0.85rem;
}
.webapp-cfg {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 0.78rem !important;
}
.webapp-cfg select {
  min-width: 7.5rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(11, 16, 32, 0.55);
  color: var(--text);
  padding: 0.4rem 0.55rem;
}
.web-banner {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  background: color-mix(in oklch, var(--surface) 88%, black 12%);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.28);
}
.web-banner[hidden],
.web-interstitial[hidden] { display: none !important; }
.web-ad-kicker {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}
.web-ad-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.web-ad-card:hover { text-decoration: none; }
.web-ad-card img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  flex: 0 0 auto;
}
.web-ad-card span { display: grid; min-width: 0; }
.web-ad-card strong { font-size: 0.95rem; }
.web-ad-card small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.web-interstitial {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: color-mix(in oklch, black 62%, transparent);
  backdrop-filter: blur(8px);
}
.web-interstitial-panel {
  width: min(28rem, 100%);
  padding: 1.25rem 1.2rem 1.1rem;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  display: grid;
  gap: 0.85rem;
}
.web-interstitial-panel .web-ad-card {
  padding: 0.7rem;
  border-radius: 12px;
  background: rgba(11, 16, 32, 0.4);
}
.web-interstitial-panel .web-ad-card img {
  width: 64px;
  height: 64px;
}
.web-interstitial-panel .btn { justify-self: stretch; }
.webapp-panel {
  padding: 1.25rem 1.25rem 1.4rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  background:
    linear-gradient(180deg, rgba(232, 236, 255, 0.04), transparent 40%),
    var(--card);
}
.webapp-panel > p:first-child {
  margin-top: 0;
  color: var(--muted);
}
.webapp-panel label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0.85rem 0 0.35rem;
}
.webapp-panel input[type="checkbox"] {
  width: auto;
  margin-right: 0.45rem;
}
.webapp-panel label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  background: rgba(11, 16, 32, 0.35);
}
.webapp-panel pre {
  margin: 0.85rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(11, 16, 32, 0.55);
  border: 1px solid rgba(232, 236, 255, 0.08);
  overflow: auto;
  color: var(--text);
  font-size: 0.88rem;
}
.webapp-row { margin-top: 0.85rem; }
.webapp-status {
  color: var(--gold);
  font-weight: 600;
}

.game-board {
  width: min(100%, 460px);
  margin-inline: auto;
  gap: 6px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(11, 16, 32, 0.45);
  border: 1px solid rgba(232, 236, 255, 0.08);
}
.cell-btn.tile {
  border-radius: 10px;
  font-size: clamp(0.95rem, 3vw, 1.25rem);
  background: rgba(232, 236, 255, 0.04);
}
.fusion-wrap { display: flex; justify-content: center; }
.fusion-board { width: min(100%, 360px); }
.tile-2048 { font-family: var(--serif); font-weight: 400; }
.cell-btn.tile-v0 { background: rgba(232, 236, 255, 0.06); color: transparent; }
.cell-btn.tile-v2 { background: #f3e6cf; color: #3d3428; }
.cell-btn.tile-v4 { background: #e8d09a; color: #3d3428; }
.cell-btn.tile-v8 { background: #e8a15a; color: #1a1208; }
.cell-btn.tile-v16 { background: #e07a3a; color: #fff8f0; }
.cell-btn.tile-v32 { background: #d4532c; color: #fff8f0; }
.cell-btn.tile-v64 { background: #c2341c; color: #fff8f0; }
.cell-btn.tile-v128 { background: #e8c547; color: #1a1400; }
.cell-btn.tile-v256 { background: #f0d35a; color: #1a1400; }
.cell-btn.tile-v512 { background: #f5dc6e; color: #1a1400; }
.cell-btn.tile-v1024 { background: #ffe566; color: #1a1400; }
.cell-btn.tile-v2048 { background: #ffe14a; color: #1a1400; box-shadow: 0 0 18px rgba(232, 197, 71, 0.45); }

.spider-toolbar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}
.spider-board {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.85rem 0.5rem 1rem;
  border-radius: 16px;
  background-color: #12301f;
  background-size: cover;
  background-position: center;
}
.spider-col {
  appearance: none;
  border: 0;
  background: transparent;
  min-height: 8rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  cursor: pointer;
}
.spider-col.is-sel .playing-card.is-up {
  box-shadow: 0 0 0 2px var(--gold);
}
.playing-card {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 3.1rem;
  margin-top: -1.7rem;
  padding-top: 0.4rem;
  border-radius: 7px;
  border: 1px solid rgba(20, 24, 40, 0.35);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: #f7f3ea;
  color: #1a1a1a;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}
.spider-col .playing-card:first-child { margin-top: 0; }
.playing-card.is-down {
  background:
    repeating-linear-gradient(135deg, #2a3f8f 0 7px, #3d56b8 7px 14px);
  color: transparent;
  border-color: #8ea4ff;
  min-height: 1.85rem;
  margin-top: -1.05rem;
  overflow: hidden;
  padding: 0;
}
.playing-card.has-art {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0.2rem 0.15rem 0.3rem;
}
.playing-card.has-art img,
.playing-card.is-down.has-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.playing-card.is-up.has-art {
  min-height: 3.4rem;
  background: #f7f3ea;
}
.playing-card.is-up.has-art b {
  font-size: 0.72rem;
  line-height: 1;
}
.playing-card.is-up.has-art .card-pip {
  width: 70%;
  height: auto;
  margin-top: 0.1rem;
}
.playing-card.is-empty {
  background: rgba(11, 16, 32, 0.35);
  border-style: dashed;
  min-height: 3.2rem;
}
.playing-card.is-red { color: #b42318; }
.playing-card.is-black { color: #14203c; }

.dpad { justify-content: center; }
.dpad .btn { min-width: 4.4rem; }

.klondike-top {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 4.2rem));
  gap: 0.45rem;
  margin-bottom: 1rem;
}
.klondike-slot {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}
.klondike-slot.is-sel .playing-card { box-shadow: 0 0 0 2px var(--gold); }
.klondike-board { grid-template-columns: repeat(7, minmax(0, 1fr)); }

.mancala-board {
  display: grid;
  grid-template-columns: 4.2rem 1fr 4.2rem;
  gap: 0.55rem;
  align-items: stretch;
}
.mancala-store, .mancala-pit {
  appearance: none;
  border: 1px solid rgba(232, 236, 255, 0.14);
  background: rgba(11, 16, 32, 0.45);
  color: var(--text);
  border-radius: 999px;
  font-family: var(--serif);
  font-size: 1.35rem;
  min-height: 4.5rem;
}
.mancala-store { display: grid; place-items: center; }
.mancala-store.is-mine, .mancala-pit.is-mine {
  background: rgba(232, 197, 71, 0.16);
  border-color: rgba(232, 197, 71, 0.35);
  cursor: pointer;
}
.mancala-rows { display: flex; flex-direction: column; gap: 0.55rem; }
.mancala-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.4rem; }
.mancala-pit { min-height: 3.4rem; }

.dots-board {
  display: grid;
  justify-content: center;
  gap: 0;
  margin: 0.75rem auto;
}
.dots-dot {
  width: 0.7rem;
  height: 0.7rem;
  margin: auto;
  border-radius: 50%;
  background: var(--gold);
}
.dots-edge {
  appearance: none;
  border: 0;
  background: rgba(232, 236, 255, 0.12);
  cursor: pointer;
  padding: 0;
}
.dots-edge.is-h { height: 0.35rem; margin: auto 0; border-radius: 99px; }
.dots-edge.is-v { width: 0.35rem; margin: 0 auto; border-radius: 99px; }
.dots-edge.is-on { background: var(--gold); }
.dots-box { min-height: 1.6rem; border-radius: 4px; }
.dots-box.owner-1 { background: rgba(232, 197, 71, 0.35); }
.dots-box.owner-2 { background: rgba(124, 156, 255, 0.35); }

.war-table {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin: 1rem 0;
}
.war-side { display: flex; flex-direction: column; align-items: center; gap: 0.45rem; }
.war-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.war-side .playing-card {
  margin: 0;
  width: 4.4rem;
  min-height: 6.2rem;
  align-items: center;
  font-size: 1.15rem;
}

.dice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0.75rem 0 1rem;
}
.die {
  appearance: none;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 10px;
  border: 1px solid rgba(232, 236, 255, 0.18);
  background-color: #f7f3ea;
  color: #1a1408;
  font-family: var(--serif);
  font-size: 1.45rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 2px rgba(20, 24, 40, 0.06), 0 6px 14px rgba(0, 0, 0, 0.18);
}
.die::after { content: attr(data-v); }
.die.is-hold { outline: 2px solid var(--gold); }

.nonogram {
  display: grid;
  grid-template-columns: 2.4rem repeat(5, minmax(2.2rem, 1fr));
  gap: 4px;
  width: min(100%, 320px);
  margin: 0.75rem auto;
  align-items: center;
}
.nonogram .game-board { display: contents; }
.ng-corner { }
.ng-clue {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}
.ng-clue.is-row { text-align: right; padding-right: 0.25rem; }

.c4-board {
  width: min(100%, 420px);
  background: #16324f;
  border-color: rgba(56, 189, 248, 0.25);
  padding: 12px;
}
.cell-btn.c4-cell {
  border-radius: 50%;
  background: #0b1020;
  border: 2px solid rgba(11, 16, 32, 0.65);
}
.c4-cell.is-you { background: radial-gradient(circle at 35% 30%, #ffe9a0, var(--gold) 55%, #a88412); }
.c4-cell.is-ai { background: radial-gradient(circle at 35% 30%, #b8ecff, var(--cyan) 55%, #0e7490); }

.hex-board { width: min(100%, 400px); }
.hex-cell { clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%); border-radius: 0; }
.hex-cell.is-offset { transform: translateX(10px); }
.hex-cell.is-you { background: var(--gold); }
.hex-cell.is-ai { background: var(--cyan); }

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none;
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 1rem;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.75rem;
    background: rgba(15, 21, 40, 0.96);
    border: 1px solid rgba(232, 236, 255, 0.12);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  }
  .nav.is-open { display: flex; }
  .site-header { position: sticky; }
  .spider-board { min-width: 520px; }
}
