/* KRL Apps (games and apps). One stylesheet for every page. A page picks its colours with data-theme on <body>. */

:root {
  color-scheme: dark;
  --bg: #0b0a16;
  --bg-top: #1c1838;
  --panel: #171430;
  --line: rgba(255, 255, 255, .13);
  --text: #f6f4ff;
  --dim: #b9b5d3;
  --accent: #ffd43b;
  --link: #bdaaff;
  --btn: #f6f4ff;
  --on-btn: #0b0a16;
  --display: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: max(20px, env(safe-area-inset-left), env(safe-area-inset-right));
}
[data-theme="tenlands"] {
  --bg: #120a30;
  --bg-top: #3b2a8c;
  --panel: #231a45;
  --line: rgba(190, 170, 255, .2);
  --dim: #c3bbe4;
  --accent: #ffd43b;
  --link: #c0aeff;
  --btn: #51cf66;
  --on-btn: #06230d;
}
[data-theme="laser"] {
  --bg: #050a1c;
  --bg-top: #0f3566;
  --panel: #0c1838;
  --line: rgba(110, 220, 255, .22);
  --dim: #afc3dc;
  --accent: #ffc83d;
  --link: #6fe8ff;
  --btn: #3eefe0;
  --on-btn: #04141c;
}

[data-theme="haven"] {
  --bg: #0a0720;
  --bg-top: #2a1e6e;
  --panel: #17103a;
  --line: rgba(170, 150, 255, .22);
  --dim: #beb6e2;
  --accent: #ffb3d6;
  --link: #8fdcff;
  --btn: #9c82ff;
  --on-btn: #0c0624;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 16px; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg) radial-gradient(130% 620px at 50% -60px, var(--bg-top), transparent) no-repeat;
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-wrap: break-word;
}
img { display: block; max-width: 100%; height: auto; }
svg { display: block; }
a { color: var(--link); text-underline-offset: .18em; }
a:hover { color: var(--text); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.08; letter-spacing: -.015em; text-wrap: balance; }
p { text-wrap: pretty; }
.dim { color: var(--dim); }

/* Text pages: privacy, support. Plain <main> with a <header>. */
main { max-width: 760px; margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) var(--gutter) max(72px, env(safe-area-inset-bottom)); }
main > header, .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 44px; }
main > header > a, .brand {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  color: var(--text); text-decoration: none; font: 800 20px/1 var(--display); letter-spacing: -.01em;
}
main > header > a::before, .brand::before { content: ""; width: 28px; height: 28px; flex: none; background: url(/favicon.svg) center / contain no-repeat; }
main > h1 { font-size: clamp(34px, 7vw, 46px); margin: 0 0 10px; }
main > h2 { font-size: 23px; margin: 40px 0 8px; color: var(--accent); }
main > h3 { font-size: 18px; margin: 26px 0 4px; letter-spacing: 0; line-height: 1.3; }
main > p, main > ul { margin: 0 0 14px; }
main li { margin-bottom: 8px; }
main li::marker { color: var(--dim); }
footer { margin-top: 56px; color: var(--dim); font-size: 14px; }

/* Landing pages. */
.page { max-width: none; padding: 0; }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.topbar { padding-top: max(14px, env(safe-area-inset-top)); margin-bottom: 0; }
.topnav { display: flex; gap: 6px 20px; flex-wrap: wrap; font-size: 15px; font-weight: 600; }
.topnav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--dim); text-decoration: none; }
.topnav a:hover { color: var(--text); }
.section { padding-top: clamp(56px, 8vw, 96px); }
.section > h2, .h-section { font-size: clamp(30px, 4.6vw, 46px); margin: 0 0 clamp(20px, 3vw, 32px); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 48px; padding: 11px 20px; border: 0; border-radius: 14px;
  background: var(--btn); color: var(--on-btn);
  font: 800 16px/1.15 var(--display); text-decoration: none; cursor: pointer;
  transition: transform .12s, filter .12s;
}
.btn:hover { color: var(--on-btn); filter: brightness(1.08); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn svg { width: 19px; height: 19px; flex: none; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ghost:hover { color: var(--text); background: rgba(255, 255, 255, .07); }
.btn[disabled] { opacity: .6; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }

.status {
  display: inline-flex; align-items: center; gap: 8px; margin: 0;
  font: 800 13px/1.2 var(--display); letter-spacing: .05em; text-transform: uppercase; color: var(--accent);
}
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }

/* Home. */
.intro { padding-top: clamp(36px, 5vw, 64px); padding-bottom: clamp(32px, 5vw, 56px); display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); align-items: end; }
.intro h1 { font-size: clamp(48px, 9vw, 104px); line-height: .98; letter-spacing: -.028em; margin: 0; font-weight: 900; }
.intro p { max-width: 34em; margin: 18px 0 0; color: var(--dim); font-size: clamp(18px, 2vw, 21px); line-height: 1.45; }
.intro-art { display: none; }
@media (min-width: 900px) {
  .intro { grid-template-columns: minmax(0, 1fr) 320px; }
  .intro-art { display: block; width: 100%; height: auto; }
}

.games { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); }
.game {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr); overflow: hidden;
  border-radius: 30px; box-shadow: inset 0 0 0 1px var(--line);
  background: var(--panel) linear-gradient(160deg, var(--bg-top), var(--bg) 78%);
}
.game-text { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 26px 24px 22px; }
.game h2 { font-size: clamp(36px, 5vw, 50px); margin: 0; font-weight: 900; letter-spacing: -.025em; }
.game h2 a { color: inherit; text-decoration: none; }
.game .pitch { margin: 0; font-size: 18px; line-height: 1.4; max-width: 24em; }
.game .minor { display: flex; gap: 18px; margin: 2px 0 0; font-size: 15px; }
.game .minor a { display: inline-flex; align-items: center; min-height: 44px; }
.game-shot { display: block; height: 330px; overflow: hidden; padding: 0 24px; }
.game-shot img { width: 100%; max-width: 300px; margin: 0 auto; border-radius: 24px 24px 0 0; box-shadow: 0 0 0 6px rgba(0, 0, 0, .45), 0 18px 50px rgba(0, 0, 0, .45); }
@media (min-width: 620px) {
  .game { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); min-height: 500px; }
  .game-text { padding: 34px 8px 30px 32px; }
  .game .minor { margin-top: auto; }
  .game-shot { position: relative; height: auto; padding: 34px 26px 0 16px; }
  .game-shot img { position: absolute; left: 16px; top: 34px; width: calc(100% - 42px); max-width: 280px; }
}

/* Game page hero. */
.hero { display: grid; gap: 32px; padding-top: clamp(28px, 5vw, 60px); grid-template-columns: minmax(0, 1fr); }
.hero-text { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.hero h1 { font-size: clamp(54px, 9.4vw, 112px); line-height: .94; letter-spacing: -.028em; font-weight: 900; margin: 0; }
.hero h1 small { display: block; margin-top: 10px; font-size: .28em; letter-spacing: -.01em; line-height: 1.1; color: var(--link); font-weight: 800; }
.hero .lede { margin: 0; max-width: 28em; font-size: clamp(19px, 2.1vw, 23px); line-height: 1.4; }
.hero .small { margin: 0; color: var(--dim); font-size: 15px; }
.game-icon { width: 72px; height: 72px; border-radius: 17px; box-shadow: 0 0 0 1px var(--line); }
@media (min-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 430px); align-items: center; gap: 56px; }
}

/* Big numbers. */
.numbers { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 26px 28px; margin: 0; padding: 0; border-block: 1px solid var(--line); padding-block: 28px; }
.numbers div { margin: 0; }
.numbers dt { color: var(--dim); font-size: 15px; line-height: 1.3; }
.numbers dd { margin: 0; font: 900 clamp(40px, 5.4vw, 62px)/1 var(--display); letter-spacing: -.03em; color: var(--accent); }
.numbers div { display: flex; flex-direction: column-reverse; gap: 6px; }
.alsos { margin: 18px 0 0; color: var(--dim); }

/* Screens: a row of phones that scrolls on small widths. */
.shots {
  display: flex; gap: 16px; margin: 0 calc(var(--gutter) * -1); padding: 8px var(--gutter) 22px;
  overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter); list-style: none; -webkit-overflow-scrolling: touch;
}
.shots li { flex: 0 0 min(66vw, 216px); scroll-snap-align: start; margin: 0; }
.shots img { width: 100%; border-radius: 20px; box-shadow: 0 0 0 5px rgba(0, 0, 0, .5), 0 0 0 6px var(--line); background: var(--panel); }
.shots p { margin: 14px 2px 0; font-size: 15px; line-height: 1.35; color: var(--dim); }
@media (min-width: 1180px) { .shots { overflow: visible; } .shots li { flex: 1 1 0; } }

/* Reasons and modes. */
.points { display: grid; gap: 30px 36px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); margin: 0; padding: 0; list-style: none; }
.points li { margin: 0; }
.points svg { width: 40px; height: 40px; margin-bottom: 12px; color: var(--accent); }
.points h3 { font-size: 22px; margin: 0 0 6px; line-height: 1.2; }
.points p { margin: 0; color: var(--dim); }
.modes { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); margin: 0; padding: 0; list-style: none; }
.modes li { margin: 0; padding: 20px 20px 22px; border-radius: 20px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.modes h3 { font-size: 22px; margin: 0 0 6px; }
.modes p { margin: 0; color: var(--dim); font-size: 16px; line-height: 1.45; }

/* Mailing list. */
.signup {
  display: grid; gap: 22px 56px; grid-template-columns: minmax(0, 1fr); padding: clamp(24px, 5vw, 48px); border-radius: 30px;
  background: var(--panel); box-shadow: inset 0 0 0 1px var(--line);
}
.signup h2 { font-size: clamp(30px, 4.4vw, 44px); margin: 0 0 10px; }
.signup > div > p { margin: 0; color: var(--dim); }
@media (min-width: 860px) { .signup { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; } }
.signup-form, .form-fields { display: grid; gap: 14px; }
.form-fields[hidden] { display: none; }
.signup-form label { font-weight: 600; font-size: 15px; }
.field-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.signup-form input[type="email"] {
  flex: 1 1 220px; min-width: 0; min-height: 50px; padding: 11px 14px; border-radius: 14px; border: 2px solid var(--line);
  background: rgba(0, 0, 0, .3); color: var(--text); font: inherit;
}
.signup-form input[type="email"]::placeholder { color: #8f8cab; }
.signup-form input[aria-invalid="true"], .consent input[aria-invalid="true"] { border-color: #ff8a8a; outline: 2px solid #ff8a8a; }
.signup-form .btn { flex: 0 0 auto; }
.consent { display: flex; align-items: flex-start; gap: 12px; font-weight: 400 !important; line-height: 1.4; color: var(--dim); cursor: pointer; min-height: 44px; }
.consent input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--btn); }
.form-msg { margin: 0; min-height: 1.4em; font-size: 16px; line-height: 1.4; }
.form-msg[data-kind="error"] { color: #ffb3b3; }
.form-msg[data-kind="ok"] { color: #a7f3b5; font-weight: 700; font-size: 18px; }
/* Off-screen, not display:none, so simple bots still fill it in. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Demos. */
.demo { margin: 0; padding: 14px; border-radius: 26px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line), 0 24px 70px rgba(0, 0, 0, .4); scroll-margin-top: 16px; }
.demo-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; padding: 0 6px 10px; font: 800 17px/1.2 var(--display); }
.demo-dots { display: flex; gap: 6px; }
.demo-dots i { width: 22px; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .17); }
.demo-dots i.on { background: var(--btn); }
.demo-count { color: var(--dim); font-size: 15px; font-weight: 700; }
.demo-stage { position: relative; margin: 0 auto; border-radius: 16px; overflow: hidden; touch-action: manipulation; background: rgba(0, 0, 0, .28); }
.demo-stage canvas { display: block; width: 100%; height: 100%; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.demo-stage canvas:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--accent); }
[data-demo="laser"] .demo-stage { aspect-ratio: 1; max-width: 400px; }
[data-demo="tenlands"] .demo-stage { aspect-ratio: 5 / 7.05; max-width: min(360px, 62vh); }
.demo-status { min-height: 3em; margin: 12px 6px 2px; font-size: 16px; line-height: 1.4; color: var(--text); }
.demo-tools { display: flex; justify-content: flex-end; padding: 0 2px; }
.demo-tools button { min-height: 44px; padding: 8px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--link); font: 600 15px/1 system-ui, sans-serif; cursor: pointer; text-decoration: underline; text-underline-offset: .18em; }
.demo-tools button:hover { color: var(--text); }
.demo-end {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 18px; text-align: center; background: rgba(6, 6, 20, .9);
}
.demo-end[hidden] { display: none; }
.demo-end h3 { margin: 0; font-size: clamp(26px, 7vw, 34px); }
.demo-end p { margin: 0; color: var(--dim); max-width: 22em; line-height: 1.4; }
.demo-end .actions { justify-content: center; }
.demo-end button.again { min-height: 44px; border: 0; background: none; color: var(--link); font: 600 15px/1 system-ui, sans-serif; text-decoration: underline; text-underline-offset: .18em; cursor: pointer; }

/* A home card with the app's icon where a screenshot would go. */
.game-shot.is-icon { display: grid; place-items: center; height: auto; padding: 4px 24px 36px; }
.game-shot.is-icon img { position: static; width: min(56%, 230px); max-width: none; margin: 0; border-radius: 23%; box-shadow: 0 0 0 1px var(--line), 0 24px 70px rgba(124, 92, 255, .45); }
@media (min-width: 620px) { .game-shot.is-icon { padding: 34px; } }

/* Site footer. */
.site-foot { position: relative; margin-top: clamp(56px, 8vw, 96px); padding-top: 24px; padding-bottom: max(32px, env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 28px; color: var(--dim); font-size: 15px; }
.site-foot::before { content: ""; position: absolute; top: 0; left: var(--gutter); right: var(--gutter); height: 1px; background: var(--line); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.site-foot a { display: inline-flex; align-items: center; min-height: 44px; }
.site-foot p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}
