/* claed3d-games — shared shell stylesheet.
   Design contract: the claed3d.com TYPE/SINGULARITY token set (same fonts,
   palette, control grammar) reused from freetools.claed3d.com. Portal + game
   pages compose these classes; there is no per-page stylesheet. */

@font-face {
  font-family: "Space Grotesk";
  src: url("/vendor/fonts/space-grotesk-300.woff2") format("woff2");
  font-style: normal;
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("/vendor/fonts/space-grotesk-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("/vendor/fonts/space-grotesk-500.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --void: #07070b;
  --carbon: #0c0c13;
  --ink: #f1f3f8;
  --muted: #9297a8;
  --violet: #7957ff;
  --ultraviolet: #a88cff;
  --cyan: #69ddff;
  --line: rgba(221, 225, 242, 0.18);
  --danger: #ff8585;
  --ok: #7dedb2;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --page-pad: clamp(1.15rem, 3vw, 3.25rem);
  --content-max: 72rem;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  font-synthesis: none;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

/* the living 3D backdrop (cosmos.js) — behind content, never interactive.
   ALL page background stays on html (body background: none) or it would paint
   as a normal element layer ABOVE this z-index:-1 canvas and hide it. */
#cosmos {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

html {
  min-width: 20rem;
  background:
    radial-gradient(circle at 78% -8%, rgba(38, 28, 74, 0.34), transparent 42%),
    radial-gradient(circle at 12% 30%, rgba(21, 42, 64, 0.22), transparent 38%),
    var(--void);
}

body {
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background: none;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.5;
}

a, button, input { color: inherit; font: inherit; }

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: 1rem;
  left: 1rem;
  padding: 0.7rem 1rem;
  transform: translateY(-180%);
  border-radius: 100vmax;
  background: var(--ink);
  color: var(--void);
  font-size: 0.85rem;
  text-decoration: none;
  transition: transform 180ms ease;
}
.skip-link:focus { transform: translateY(0); }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: max(1.2rem, env(safe-area-inset-top)) var(--page-pad) 1rem;
  background: linear-gradient(rgba(7, 7, 11, 0.92), rgba(7, 7, 11, 0.72) 70%, transparent);
}
.brand-lockup {
  display: inline-flex;
  align-items: baseline;
  gap: clamp(0.55rem, 1.2vw, 1.2rem);
  text-decoration: none;
}
.brand-mark {
  font-size: clamp(0.9rem, 1.25vw, 1.1rem);
  font-weight: 500;
  letter-spacing: -0.035em;
}
.brand-tagline {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 2rem);
}
.contact-link, .signal-link {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.065em;
  text-decoration: none;
  text-transform: uppercase;
}
.contact-link { color: var(--muted); transition: color 180ms ease; }
.contact-link:hover { color: var(--ink); }
.signal-link {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid rgba(241, 243, 248, 0.18);
  border-radius: 100vmax;
  background: rgba(8, 8, 13, 0.42);
  backdrop-filter: blur(12px);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}
.signal-link:hover {
  border-color: rgba(105, 221, 255, 0.62);
  background: rgba(30, 24, 54, 0.7);
  transform: translateY(-1px);
}
.signal-dot {
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0.75rem var(--cyan);
}

/* ---------- page frame ---------- */
.page {
  width: min(var(--content-max), calc(100vw - var(--page-pad) * 2));
  margin: 0 auto;
  padding-bottom: clamp(3rem, 8vh, 6rem);
}

/* ---------- hero ---------- */
.hero { padding: clamp(2.5rem, 8vh, 5.5rem) 0 clamp(2rem, 5vh, 3.5rem); }
.eyebrow {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: clamp(0.75rem, 0.72vw, 0.82rem);
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.hero-title {
  margin: 0;
  font-size: clamp(2.9rem, 8vw, 6.5rem);
  font-weight: 300;
  letter-spacing: -0.06em;
  line-height: 0.95;
  text-shadow: 0 0 5rem rgba(121, 87, 255, 0.14);
}
.hero-tagline {
  max-width: 44rem;
  margin: clamp(1.2rem, 2.5vh, 1.8rem) 0 0;
  color: rgba(241, 243, 248, 0.88);
  font-size: clamp(1.02rem, 1.4vw, 1.3rem);
  font-weight: 300;
  letter-spacing: -0.015em;
}
.hero-rule {
  display: block;
  height: 1px;
  width: min(28rem, 60%);
  margin: clamp(1.6rem, 3.5vh, 2.4rem) 0 0;
  background: linear-gradient(90deg, var(--violet), var(--cyan) 55%, transparent);
  box-shadow: 0 0 0.5rem rgba(105, 221, 255, 0.35);
}

/* ---------- sections ---------- */
.game-section { margin: clamp(1.5rem, 4vh, 2.6rem) 0 clamp(2.4rem, 5vh, 3.6rem); }
.section-head { margin: 0 0 1.2rem; }
.section-title {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  font-weight: 300;
  letter-spacing: -0.03em;
}
.section-sub { margin: 0.35rem 0 0.9rem; color: var(--muted); font-size: 0.85rem; font-weight: 300; }
.section-rule {
  display: block;
  height: 1px;
  background: linear-gradient(90deg, var(--violet), var(--cyan) 55%, transparent);
  box-shadow: 0 0 0.5rem rgba(105, 221, 255, 0.35);
}

/* ---------- game cards ---------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
  gap: 0.9rem;
  perspective: 60rem;
}
.game-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 12.5rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(12, 12, 19, 0.62);
  text-decoration: none;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}
a.game-card:hover {
  border-color: rgba(168, 140, 255, 0.66);
  background: rgba(24, 19, 44, 0.62);
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4), 0 0 2.2rem rgba(121, 87, 255, 0.12);
}
@media (prefers-reduced-motion: no-preference) and (hover: hover) {
  a.game-card { transform-style: preserve-3d; will-change: transform; }
  a.game-card:hover {
    transform: translateY(-2px) rotateX(var(--tiltX, 0deg)) rotateY(var(--tiltY, 0deg));
  }
}
.game-card.is-soon { opacity: 0.6; }
.game-thumb {
  width: 100%;
  height: 6.2rem;
  border-radius: 0.7rem;
  border: 1px solid var(--line);
  background: rgba(7, 7, 11, 0.6);
  display: block;
}
.game-card-name {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 400;
  letter-spacing: -0.015em;
}
.game-card-desc {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 300;
  line-height: 1.45;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.1rem 0 0; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.28rem 0.6rem;
  border: 1px solid rgba(241, 243, 248, 0.14);
  border-radius: 100vmax;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.badge--live { color: rgba(241, 243, 248, 0.85); }
.badge--live::before {
  content: "";
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0.5rem rgba(105, 221, 255, 0.8);
}
.badge--soon { border-color: rgba(168, 140, 255, 0.35); color: var(--ultraviolet); }

/* ---------- footer ---------- */
.site-footer {
  padding: clamp(2.5rem, 6vh, 4.5rem) var(--page-pad) max(2.2rem, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(241, 243, 248, 0.08);
}
.footer-statement {
  width: min(var(--content-max), 100%);
  margin: 0 auto;
  font-size: clamp(1.7rem, 4.5vw, 3.2rem);
  font-weight: 300;
  letter-spacing: -0.05em;
  line-height: 1.02;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2.5rem;
  width: min(var(--content-max), 100%);
  margin: clamp(1.4rem, 3vh, 2.2rem) auto 0;
}
.footer-links a {
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(241, 243, 248, 0.28);
  font-size: 0.78rem;
  letter-spacing: 0.07em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 180ms ease, border-color 180ms ease;
}
.footer-links a:hover { color: var(--cyan); border-color: var(--cyan); }

/* ================= game page layer ================= */
.game-main {
  width: min(30rem, calc(100vw - var(--page-pad)));
  margin: 0 auto;
  padding: clamp(0.6rem, 2vh, 1.4rem) 0 clamp(2rem, 6vh, 4rem);
}
.breadcrumb {
  margin: clamp(0.8rem, 3vh, 1.6rem) 0 0.9rem;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.breadcrumb a { color: var(--muted); text-decoration: none; transition: color 180ms ease; }
.breadcrumb a:hover { color: var(--cyan); }

/* slim top bar: score/best + controls */
.game-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0 0 0.7rem;
}
.score-block { display: flex; gap: 1.1rem; align-items: baseline; }
.score-item { display: flex; flex-direction: column; }
.score-value {
  font-size: clamp(1.3rem, 5vw, 1.7rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1;
  transition: color 180ms ease, text-shadow 180ms ease;
}
.score-value.is-glint { color: var(--cyan); text-shadow: 0 0 0.8rem rgba(105, 221, 255, 0.7); }
.score-label {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.bar-controls { display: flex; align-items: center; gap: 0.4rem; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.3rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(239, 241, 250, 0.22);
  border-radius: 100vmax;
  background: rgba(8, 8, 13, 0.52);
  color: var(--ink);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}
.icon-btn:hover {
  border-color: rgba(168, 140, 255, 0.72);
  background: rgba(36, 25, 68, 0.66);
  transform: translateY(-1px);
}

/* next-orb slot (tap to swap) */
.next-slot { display: inline-flex; align-items: center; gap: 0.45rem; }
.next-orb {
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--violet);
  cursor: pointer;
  box-shadow: inset -0.2rem -0.25rem 0.35rem rgba(0, 0, 0, 0.4), inset 0.15rem 0.2rem 0.3rem rgba(255, 255, 255, 0.35);
  transition: transform 180ms ease, border-color 180ms ease;
}
.next-orb:hover { transform: scale(1.08); border-color: rgba(105, 221, 255, 0.62); }
.next-label { color: var(--muted); font-size: 0.56rem; letter-spacing: 0.12em; text-transform: uppercase; }

/* the canvas board frame */
.board-frame {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background:
    linear-gradient(rgba(10, 10, 17, 0.7), rgba(7, 7, 11, 0.85)),
    radial-gradient(circle at 50% -10%, rgba(121, 87, 255, 0.14), transparent 55%);
  overflow: hidden;
  touch-action: none;
}
#board {
  display: block;
  width: 100%;
  height: auto;
}

.game-over {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  background: rgba(7, 7, 11, 0.82);
  backdrop-filter: blur(4px);
  text-align: center;
}
.game-over h2 {
  margin: 0;
  font-size: clamp(1.8rem, 7vw, 2.6rem);
  font-weight: 300;
  letter-spacing: -0.04em;
}
.game-over p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.game-over .final { font-size: 2.4rem; color: var(--cyan); font-weight: 300; }

.game-help {
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 300;
  line-height: 1.5;
}
.game-help kbd {
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: rgba(7, 7, 11, 0.6);
  font-family: var(--mono);
  font-size: 0.72rem;
}

/* ---------- load rise ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero > * { animation: rise 640ms cubic-bezier(0.22, 1, 0.36, 1) both; }
  .hero .hero-title { animation-delay: 60ms; }
  .hero .hero-tagline { animation-delay: 120ms; }
  .hero .hero-rule { animation-delay: 180ms; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(0.9rem); }
    to { opacity: 1; transform: translateY(0); }
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- mobile ---------- */
@media (max-width: 700px) {
  .brand-tagline, .contact-link { display: none; }
  .signal-link { padding: 0.55rem 0.72rem; }
  .hero-title { font-size: clamp(2.6rem, 13vw, 4rem); letter-spacing: -0.05em; }
  .game-grid { grid-template-columns: 1fr; }
}
