/* Grani placeholder — brand tokens from docs/brand.md. No external fonts or requests (CSP: self only). */

:root {
  --bg: #1B2230;
  --bg-deep: #131925;
  --surface: #1F2837;
  --surface-hi: #253043;
  --line: rgba(232, 236, 244, 0.1);
  --text: #E8ECF4;
  --muted: #8A93A6;
  --accent: #3DD6B5;
  --accent-hi: #7FF0D6;
  --accent-lo: #1E8F7A;
  --accent2: #FFB547;
  --ok: #6BE38A;
  --warn: #FFD166;
  --err: #FF5C6C;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg) 55%, var(--bg-deep) 100%) fixed var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; }
b { font-weight: 650; }

:focus-visible { outline: 3px solid var(--accent2); outline-offset: 3px; }
::selection { background: rgba(61, 214, 181, 0.35); color: var(--text); }

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

.wrap { width: min(100% - 32px, 1040px); margin-inline: auto; }
.hero, main, .footer { position: relative; z-index: 1; }

/* Pixel corners: a two-step chamfer like the letters of the logo. --p is the step size. */
.card::before, .card::after, .status::before, .status::after, .btn::before,
.address-row, .step-n, .tile, .tag {
  clip-path: polygon(
    0 calc(var(--p) * 2), var(--p) calc(var(--p) * 2), var(--p) var(--p), calc(var(--p) * 2) var(--p), calc(var(--p) * 2) 0,
    calc(100% - var(--p) * 2) 0, calc(100% - var(--p) * 2) var(--p), calc(100% - var(--p)) var(--p), calc(100% - var(--p)) calc(var(--p) * 2), 100% calc(var(--p) * 2),
    100% calc(100% - var(--p) * 2), calc(100% - var(--p)) calc(100% - var(--p) * 2), calc(100% - var(--p)) calc(100% - var(--p)), calc(100% - var(--p) * 2) calc(100% - var(--p)), calc(100% - var(--p) * 2) 100%,
    calc(var(--p) * 2) 100%, calc(var(--p) * 2) calc(100% - var(--p)), var(--p) calc(100% - var(--p)), var(--p) calc(100% - var(--p) * 2), 0 calc(100% - var(--p) * 2)
  );
}

/* --- background ------------------------------------------------------------------------------ */

.bg {
  position: absolute; inset: 0 0 auto; height: 960px;
  overflow: hidden; pointer-events: none; z-index: 0;
}
.bg::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(232, 236, 244, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 236, 244, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  background-position: center -1px;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 0%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse 75% 65% at 50% 0%, #000 25%, transparent 75%);
}
.bg::after {
  content: ""; position: absolute; left: 50%; top: -280px;
  width: 1200px; height: 760px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(61, 214, 181, 0.17), rgba(61, 214, 181, 0.05) 55%, transparent);
}

.spark {
  position: absolute; width: 8px; height: 8px;
  background: var(--accent); opacity: 0.55;
  animation: float 10s ease-in-out infinite alternate;
}
.spark:nth-child(1) { left: 9%;  top: 132px; width: 12px; height: 12px; background: var(--accent-hi); animation-duration: 12s; }
.spark:nth-child(2) { left: 17%; top: 352px; background: var(--accent-lo); opacity: 0.8; animation-duration: 9s; }
.spark:nth-child(3) { left: 4%;  top: 520px; width: 6px; height: 6px; background: var(--accent2); opacity: 0.6; animation-delay: -4s; }
.spark:nth-child(4) { right: 8%; top: 168px; width: 10px; height: 10px; background: var(--accent2); opacity: 0.5; animation-duration: 11s; animation-delay: -2s; }
.spark:nth-child(5) { right: 16%; top: 404px; width: 12px; height: 12px; background: var(--accent); opacity: 0.35; animation-duration: 13s; }
.spark:nth-child(6) { right: 5%; top: 610px; width: 6px; height: 6px; background: var(--accent-hi); animation-delay: -6s; }
.spark:nth-child(7) { left: 28%; top: 72px; width: 6px; height: 6px; background: var(--accent-hi); opacity: 0.35; animation-duration: 8s; }
.spark:nth-child(8) { right: 27%; top: 96px; width: 6px; height: 6px; background: var(--accent-lo); opacity: 0.9; animation-delay: -3s; }
.spark:nth-child(9) { left: 50%; top: 760px; width: 8px; height: 8px; background: var(--accent-lo); opacity: 0.5; animation-duration: 14s; }

@keyframes float {
  from { transform: translateY(0); }
  to   { transform: translateY(-18px); }
}

/* --- hero ------------------------------------------------------------------------------------ */

.hero {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: clamp(56px, 11vh, 120px) 0 clamp(44px, 7vh, 72px);
}

/* 132×36 grid: 2× on phones, 3× from tablets — whole multiples keep the pixels crisp. */
.logo { width: 264px; height: 72px; }

.slogan {
  margin: clamp(28px, 5vh, 44px) 0 0;
  font-size: clamp(2.25rem, 1.15rem + 4.6vw, 4.5rem);
  font-weight: 800; line-height: 1.04; letter-spacing: -0.035em;
  text-wrap: balance;
}
.amber { color: var(--accent2); }

.lead {
  margin: 18px auto 0; max-width: 34ch;
  color: var(--muted);
  font-size: clamp(1.05rem, 0.98rem + 0.4vw, 1.25rem);
  text-wrap: pretty;
}

/* status widget */
.status {
  --p: 3px;
  position: relative; isolation: isolate;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 6px 16px;
  margin-top: 32px; padding: 12px 20px;
  color: var(--muted); font-size: 0.95rem;
}
.status::before { content: ""; position: absolute; inset: 0; z-index: -2; background: var(--line); }
.status::after  { content: ""; position: absolute; inset: 1px; z-index: -1; background: rgba(19, 25, 37, 0.82); }

.status-main { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; }
.status-dot { width: 10px; height: 10px; background: var(--muted); }
.status-sep { display: none; width: 2px; height: 16px; background: var(--line); }
.status-players b { color: var(--accent2); font-weight: 700; font-variant-numeric: tabular-nums; }
.status-players, .status-time { font-variant-numeric: tabular-nums; }
.status-time:empty, .status-sep:has(+ .status-time:empty) { display: none !important; }

.status[data-state="loading"] .status-dot { animation: blink 1.2s linear infinite; }
.status[data-state="up"]    .status-dot { background: var(--ok); animation: pulse 2.4s ease-out infinite; }
.status[data-state="down"]  .status-dot { background: var(--err); }
.status[data-state="stale"] .status-dot { background: var(--warn); }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(107, 227, 138, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(107, 227, 138, 0); }
  100% { box-shadow: 0 0 0 0 rgba(107, 227, 138, 0); }
}
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0.2; } }

/* --- cards ----------------------------------------------------------------------------------- */

.card {
  --p: 6px;
  position: relative; isolation: isolate;
  padding: clamp(22px, 4.2vw, 40px);
}
.card::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: linear-gradient(180deg, rgba(232, 236, 244, 0.16), rgba(232, 236, 244, 0.05));
  transition: background-color 0.2s;
}
.card::after {
  content: ""; position: absolute; inset: 1px; z-index: -1;
  background: linear-gradient(180deg, var(--surface-hi), var(--surface));
}

.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.section-head h2 {
  margin: 0;
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem);
  font-weight: 750; line-height: 1.2; letter-spacing: -0.02em;
}
.pixels { display: inline-flex; gap: 3px; }
.pixels i { display: block; width: 8px; height: 8px; }
.pixels i:nth-child(1) { background: var(--accent-hi); }
.pixels i:nth-child(2) { background: var(--accent); }
.pixels i:nth-child(3) { background: var(--accent-lo); }
.pixels i:nth-child(4) { background: var(--accent2); }

/* --- connect --------------------------------------------------------------------------------- */

.connect { filter: drop-shadow(0 24px 48px rgba(0, 0, 0, 0.35)); }
.connect::before {
  background: linear-gradient(135deg, rgba(127, 240, 214, 0.6), rgba(61, 214, 181, 0.18) 38%, rgba(232, 236, 244, 0.06) 70%, rgba(255, 181, 71, 0.3));
}

.address-row {
  --p: 4px;
  display: flex; flex-direction: column; align-items: stretch; gap: 16px;
  padding: 18px 20px;
  background: rgba(19, 25, 37, 0.75);
}
.label {
  display: block;
  color: var(--muted); font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.address {
  display: block; margin-top: 4px;
  color: var(--accent-hi);
  font: 700 clamp(1.45rem, 1rem + 2.6vw, 2.35rem)/1.2 var(--mono);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  -webkit-user-select: all; user-select: all;
}

.btn {
  --p: 3px;
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 22px;
  border: 0; background: none; cursor: pointer;
  color: var(--bg); font: 700 1rem/1 var(--sans);
  text-decoration: none; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--accent);
  transition: background-color 0.15s;
}
.btn:hover::before { background: var(--accent-hi); }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 16px; height: 16px; flex: none; }
.btn .icon-done { display: none; }
.btn[data-state="done"]::before { background: var(--ok); }
.btn[data-state="done"] .icon-copy { display: none; }
.btn[data-state="done"] .icon-done { display: block; }
.btn[data-state="fail"]::before { background: var(--warn); }

.steps {
  display: grid; gap: 20px;
  margin: 28px 0 0; padding: 0; list-style: none;
}
.steps li { display: flex; align-items: flex-start; gap: 14px; }
.step-n {
  --p: 3px;
  flex: none; display: grid; place-items: center;
  width: 36px; height: 36px;
  background: rgba(61, 214, 181, 0.14);
  color: var(--accent-hi); font: 800 1rem/1 var(--mono);
}
.steps h3 { margin: 5px 0 4px; font-size: 1.02rem; font-weight: 700; line-height: 1.35; }
.steps p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.steps b { color: var(--text); }

/* pixel dotted rule */
.meta, .footer {
  background: repeating-linear-gradient(90deg, var(--line) 0 4px, transparent 4px 10px) top left / 100% 2px no-repeat;
}
.meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  margin-top: 28px; padding-top: 22px;
  color: var(--muted); font-size: 0.92rem;
}
.tag {
  --p: 2px;
  display: inline-flex; align-items: center;
  padding: 6px 12px;
  background: rgba(255, 181, 71, 0.13);
  color: var(--accent2); font-weight: 650;
}

/* --- modes ----------------------------------------------------------------------------------- */

.modes { margin-top: clamp(48px, 8vh, 80px); }
.mode-grid { display: grid; gap: 20px; }
.mode {
  display: grid; grid-template-columns: auto 1fr; align-items: center;
  column-gap: 20px; row-gap: 8px;
}
.mode:hover::before { background-color: rgba(61, 214, 181, 0.22); }
.mode-creative:hover::before { background-color: rgba(255, 181, 71, 0.22); }
.tile {
  --p: 4px;
  grid-row: span 2; align-self: start;
  display: grid; place-items: center;
  width: 72px; height: 72px;
  background: rgba(61, 214, 181, 0.1);
}
.mode-creative .tile { background: rgba(255, 181, 71, 0.1); }
.mode h3 { margin: 0; align-self: end; font-size: 1.3rem; font-weight: 750; letter-spacing: -0.015em; line-height: 1.25; }
.mode p { margin: 0; align-self: start; color: var(--muted); }

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

.footer {
  margin-top: clamp(56px, 10vh, 96px); padding: 30px 0 44px;
  color: var(--muted); font-size: 0.9rem; text-align: center;
}
.wip { margin: 0; color: var(--text); }
.wip-dot {
  display: inline-block; width: 8px; height: 8px; margin-right: 10px; vertical-align: 0.05em;
  background: var(--accent2); animation: blink 1.6s linear infinite;
}
.legal { max-width: 62ch; margin: 12px auto 0; font-size: 0.8rem; }

/* --- 404 ------------------------------------------------------------------------------------- */

.notfound {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: clamp(72px, 16vh, 160px) 0 64px;
}
.notfound .code { margin: 40px 0 0; color: var(--accent2); font: 800 1rem/1 var(--mono); letter-spacing: 0.3em; }
.notfound h1 { margin: 14px 0 0; font-size: clamp(2rem, 1.2rem + 3.6vw, 3.5rem); font-weight: 800; line-height: 1.05; letter-spacing: -0.03em; }
.notfound .btn { margin-top: 32px; }

/* --- larger screens -------------------------------------------------------------------------- */

@media (min-width: 560px) {
  .status { padding: 12px 22px; flex-wrap: nowrap; }
  .status-sep { display: block; }
}

@media (min-width: 640px) {
  .address-row { flex-direction: row; align-items: center; justify-content: space-between; padding: 22px 24px; }
}

@media (min-width: 760px) {
  .logo { width: 396px; height: 108px; }
  .lead { max-width: 44ch; }
  .steps { grid-template-columns: repeat(3, 1fr); gap: 28px; }
  .steps li { flex-direction: column; gap: 12px; }
  .steps h3 { margin-top: 0; }
  .mode-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}

/* Phones: keep only the sparks around the logo, none over the text. */
@media (max-width: 759px) {
  .spark:nth-child(2), .spark:nth-child(3), .spark:nth-child(5), .spark:nth-child(6), .spark:nth-child(9) { display: none; }
  .spark:nth-child(1) { left: 4%; top: 40px; }
  .spark:nth-child(4) { right: 6%; top: 56px; }
}

/* --- motion ---------------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
