﻿/* NORM - monochrome, hairlines, uppercase. Nothing colourful ever happens here. */

:root {
  --ink: #0d0d0d;
  --paper: #c4c4c4;
  --line: rgba(13, 13, 13, 0.18);
  --line-strong: rgba(13, 13, 13, 0.45);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* film grain + vignette give the render its photocopied feel ------------- */
.grain {
  position: fixed;
  inset: -50%;
  pointer-events: none;
  opacity: 0.14;
  z-index: 2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  animation: grain 0.7s steps(3) infinite;
}
@keyframes grain {
  0%   { transform: translate(0, 0); }
  33%  { transform: translate(-2%, 1%); }
  66%  { transform: translate(1%, -2%); }
  100% { transform: translate(0, 0); }
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background:
    radial-gradient(120% 90% at 50% 45%, rgba(0,0,0,0) 42%, rgba(0,0,0,0.30) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.16), rgba(0,0,0,0) 22%);
}

/* boot ------------------------------------------------------------------ */
#boot {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: var(--paper);
  transition: opacity 0.6s ease, visibility 0.6s;
}
#boot.gone { opacity: 0; visibility: hidden; }
.boot-mark { font-size: 13px; letter-spacing: 0.62em; margin-bottom: 18px; text-align: center; }
.boot-bar { width: 190px; height: 2px; background: var(--line); overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 40%; background: var(--ink); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-110%);} 100% { transform: translateX(260%);} }
.boot-sub { margin-top: 14px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.3em; opacity: 0.5; }

/* top bar --------------------------------------------------------------- */
#topbar {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 40px);
  padding-top: max(18px, env(safe-area-inset-top));
  mix-blend-mode: multiply;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand .logo {
  width: 32px; height: 32px; display: block;
  border: 1px solid var(--line-strong);
}
.brand-name { font-size: 12px; letter-spacing: 0.48em; font-weight: 700; }
#topbar nav { display: flex; align-items: center; gap: clamp(8px, 2vw, 22px); }

button { font: inherit; color: inherit; cursor: pointer; }

.link {
  background: none; border: 0; padding: 6px 2px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.26em;
  opacity: 0.62; transition: opacity 0.2s, letter-spacing 0.2s;
}
.link:hover { opacity: 1; letter-spacing: 0.32em; }

.ticker {
  background: var(--ink); color: var(--paper); border: 0;
  padding: 8px 14px; font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.22em; transition: transform 0.2s, opacity 0.2s;
}
.ticker:hover { transform: translateY(-1px); opacity: 0.88; }

.x-link {
  display: grid; place-items: center;
  width: 30px; height: 30px; color: var(--ink);
  border: 1px solid var(--line-strong);
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.x-link svg { width: 13px; height: 13px; fill: currentColor; }
.x-link:hover { background: var(--ink); color: var(--paper); transform: translateY(-1px); }

/* contract address ------------------------------------------------------ */
.ca {
  display: inline-flex; align-items: center; gap: 12px;
  margin-top: 30px; padding: 11px 14px;
  background: rgba(13, 13, 13, 0.04);
  border: 1px solid var(--line-strong);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
  max-width: 100%; transition: background 0.2s, border-color 0.2s;
}
.ca:hover { background: rgba(13, 13, 13, 0.09); }
.ca.done { border-color: var(--ink); background: rgba(13, 13, 13, 0.12); }
.ca-k { opacity: 0.45; letter-spacing: 0.3em; }
.ca-v { overflow-wrap: anywhere; text-align: left; opacity: 0.85; }
.ca-copy {
  flex: none; padding: 4px 9px; background: var(--ink); color: var(--paper);
  letter-spacing: 0.18em; font-size: 9px;
}
.ca.block { display: flex; width: 100%; margin-top: 10px; }

.field-k {
  margin: 26px 0 0; font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.3em; opacity: 0.5;
}

.row-link {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; color: inherit; text-decoration: none;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em;
  border-bottom: 1px solid var(--line);
  transition: gap 0.2s, opacity 0.2s;
}
.row-link svg { width: 13px; height: 13px; fill: currentColor; flex: none; }
.row-link .arrow { margin-left: auto; opacity: 0.5; }
.row-link:hover { gap: 16px; }

/* screens --------------------------------------------------------------- */
.screen {
  position: fixed; inset: 0; z-index: 15;
  display: none; place-items: center;
  padding: 20px;
}
body[data-state="menu"]   #menu   { display: grid; }
body[data-state="paused"] #paused { display: grid; }
body[data-state="play"]   #hud    { opacity: 1; pointer-events: none; }

#hud { position: fixed; inset: 0; z-index: 14; opacity: 0; transition: opacity 0.4s; pointer-events: none; }
body[data-state="paused"] #hud { opacity: 0.35; }

.menu-inner { text-align: center; animation: rise 0.8s cubic-bezier(.2,.7,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px);} to { opacity: 1; transform: none; } }

.eyebrow {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.34em;
  opacity: 0.55; margin: 0 0 14px;
}

.title {
  margin: 0; font-size: clamp(52px, 13vw, 148px);
  letter-spacing: -0.02em; line-height: 0.86; font-weight: 800;
  text-transform: uppercase;
}
.title span { -webkit-text-stroke: 2px var(--ink); color: transparent; }

.tagline {
  margin: 20px auto 0; max-width: 30ch;
  font-family: var(--mono); font-size: clamp(10px, 1.3vw, 12px);
  letter-spacing: 0.22em; line-height: 2; opacity: 0.72;
}

.cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 32px; }

.btn {
  background: transparent; border: 1px solid var(--line-strong);
  padding: 14px 26px; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.24em; transition: background 0.22s, color 0.22s, transform 0.22s;
}
.btn:hover { background: var(--ink); color: var(--paper); transform: translateY(-2px); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { opacity: 0.85; }

.best-line { margin-top: 26px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.3em; opacity: 0.5; }
.best-line b { margin-left: 8px; }
.hint { margin-top: 8px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.22em; opacity: 0.35; }

/* cards ----------------------------------------------------------------- */
.card {
  background: rgba(196, 196, 196, 0.88);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line-strong);
  padding: clamp(28px, 5vw, 48px);
  max-width: 560px; text-align: center;
  animation: rise 0.5s cubic-bezier(.2,.7,.2,1) both;
}
.card h2 { margin: 0 0 12px; font-size: clamp(22px, 4vw, 34px); letter-spacing: 0.02em; text-transform: uppercase; }
.muted { opacity: 0.6; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; line-height: 1.9; margin: 0; }
.small { font-size: 10px; }

.result { display: flex; justify-content: center; gap: clamp(18px, 5vw, 46px); margin: 28px 0 4px; }
.result div { display: flex; flex-direction: column; gap: 6px; }
.result .k { font-family: var(--mono); font-size: 9px; letter-spacing: 0.28em; opacity: 0.5; }
.result b { font-size: 30px; font-weight: 700; }

/* hud ------------------------------------------------------------------- */
.hud-top {
  position: absolute; top: max(74px, calc(env(safe-area-inset-top) + 58px));
  left: clamp(16px, 4vw, 40px);
  display: flex; gap: 26px;
}
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .k { font-family: var(--mono); font-size: 9px; letter-spacing: 0.3em; opacity: 0.55; }
.stat .v { font-size: 30px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
#clock { font-family: var(--mono); font-size: 26px; letter-spacing: -0.01em; }

.conformity {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: max(28px, env(safe-area-inset-bottom));
  width: min(420px, 74vw);
}
.c-head {
  display: flex; justify-content: space-between; margin-bottom: 7px;
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.3em; opacity: 0.6;
}
.c-warn { opacity: 0; transition: opacity 0.25s; }
body.warn .c-warn { opacity: 1; animation: blink 0.7s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.15; } }
.c-track { height: 3px; background: rgba(13,13,13,0.2); overflow: hidden; }
.c-track i { display: block; height: 100%; width: 0%; background: var(--ink); transition: width 0.12s linear; }
body.warn .c-track { box-shadow: 0 0 0 1px rgba(13,13,13,0.5); }

/* task list -------------------------------------------------------------- */
.tasks-box {
  position: absolute; top: max(74px, calc(env(safe-area-inset-top) + 58px));
  right: clamp(16px, 4vw, 40px);
  min-width: 232px; text-align: right;
}
.tasks-box .k { font-family: var(--mono); font-size: 9px; letter-spacing: 0.3em; opacity: 0.55; margin: 0 0 10px; }
.tasks-box ul { list-style: none; margin: 0; padding: 0; }
.tasks-box li {
  display: flex; align-items: center; justify-content: flex-end; gap: 9px;
  padding: 4px 0; font-family: var(--mono); font-size: 9.5px;
  letter-spacing: 0.12em; opacity: 0.72; transition: opacity 0.3s;
}
.tasks-box li i {
  order: 2; width: 9px; height: 9px; flex: none;
  border: 1px solid var(--line-strong);
}
.tasks-box li.done { opacity: 0.34; }
.tasks-box li.done span { text-decoration: line-through; }
.tasks-box li.done i { background: var(--ink); border-color: var(--ink); }

/* interaction prompt ------------------------------------------------------ */
#prompt {
  position: absolute; left: 50%; transform: translate(-50%, 10px);
  bottom: max(74px, calc(env(safe-area-inset-bottom) + 58px));
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.24em;
  opacity: 0; transition: opacity 0.22s, transform 0.22s;
}
#prompt.show { opacity: 1; transform: translate(-50%, 0); }
#prompt b {
  display: grid; place-items: center; width: 24px; height: 24px;
  background: var(--ink); color: var(--paper); font-size: 10px;
}

/* touch action buttons -- the E and F keys, for thumbs ------------------- */
.touch-actions {
  position: absolute; display: none; flex-direction: column; align-items: flex-end; gap: 12px;
  right: max(20px, calc(env(safe-area-inset-right) + 20px));
  bottom: max(96px, calc(env(safe-area-inset-bottom) + 82px));
  pointer-events: auto;
}
.round {
  min-width: 92px; padding: 0 14px; height: 62px; border-radius: 50%;
  display: grid; place-items: center; text-align: center;
  background: rgba(13, 13, 13, 0.82); color: var(--paper);
  border: 1px solid var(--ink);
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; line-height: 1.3;
  opacity: 0; transform: scale(0.9); transition: opacity 0.2s, transform 0.2s;
}
.round.small { min-width: 62px; height: 48px; font-size: 8px; opacity: 1; transform: none; }
#act.show { opacity: 1; transform: none; }
#act:active, .round:active { background: var(--ink); }

@media (pointer: coarse) {
  body[data-state="play"] .touch-actions { display: flex; }
  #prompt { display: none; }
}

#toast {
  position: absolute; left: 50%; transform: translate(-50%, 8px);
  top: max(76px, calc(env(safe-area-inset-top) + 60px));
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.28em;
  padding: 9px 16px; background: var(--ink); color: var(--paper);
  opacity: 0; transition: opacity 0.3s, transform 0.3s; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* panels ---------------------------------------------------------------- */
.panel {
  position: fixed; z-index: 30; top: 0; right: 0; height: 100%;
  width: min(430px, 88vw);
  background: rgba(198, 198, 198, 0.94);
  backdrop-filter: blur(18px);
  border-left: 1px solid var(--line-strong);
  padding: clamp(60px, 8vh, 90px) clamp(24px, 4vw, 42px) 40px;
  overflow-y: auto;
  transform: translateX(101%);
  transition: transform 0.5s cubic-bezier(.2,.8,.2,1);
}
.panel.open { transform: none; }
.panel h2 { margin: 0 0 22px; font-size: clamp(26px, 4vw, 38px); letter-spacing: -0.01em; text-transform: uppercase; }
.panel hr { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }
.close {
  position: absolute; top: 22px; right: 22px;
  background: none; border: 1px solid var(--line-strong);
  width: 34px; height: 34px; line-height: 1; font-size: 12px;
  transition: background 0.2s, color 0.2s;
}
.close:hover { background: var(--ink); color: var(--paper); }

.lore-body p {
  margin: 0 0 14px; padding-left: 18px; position: relative;
  font-size: 15px; line-height: 1.75; opacity: 0.82;
}
.lore-body p::before {
  content: ""; position: absolute; left: 0; top: 12px;
  width: 8px; height: 1px; background: var(--ink); opacity: 0.5;
}
.lore-body .accent { font-weight: 700; opacity: 1; letter-spacing: 0.01em; }

.keys, .rules { list-style: none; margin: 0; padding: 0; }
.keys li {
  display: flex; align-items: baseline; gap: 14px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.keys b {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em;
  border: 1px solid var(--line-strong); padding: 5px 9px; white-space: nowrap;
}
.keys span { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; opacity: 0.62; }
.rules li { padding: 9px 0; font-size: 13px; line-height: 1.7; opacity: 0.78; }
.rules b { font-weight: 700; opacity: 1; }

/* touch stick ------------------------------------------------------------ */
#stick {
  position: fixed; z-index: 18; display: none;
  width: 110px; height: 110px; margin: -55px 0 0 -55px;
  border: 1px solid var(--line-strong); border-radius: 50%;
  pointer-events: none;
}
#stick i {
  position: absolute; left: 50%; top: 50%;
  width: 44px; height: 44px; margin: 0; border-radius: 50%;
  background: rgba(13,13,13,0.55); transform: translate(-50%, -50%);
}

@media (max-width: 720px) {
  #topbar { padding: 14px 16px; }
  .link { display: none; }
  .hud-top { gap: 18px; }
  .stat .v { font-size: 22px; }
  .ca { flex-wrap: wrap; gap: 8px; font-size: 9px; margin-top: 22px; }
  .ca-v { width: 100%; }
  .tasks-box { min-width: 0; max-width: 46vw; }
  .tasks-box li { font-size: 8.5px; letter-spacing: 0.08em; }
}

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  * { transition-duration: 0.01ms !important; }
}
