/* EnterTheInstance.com
   The look is the app's own: PSO Episode 1 navy scanline panels in steel-blue
   chamfered frames, orange tabs and focus, hexagon tab bar, Nunito + Share Tech Mono. */

@font-face {
  font-family: "Nunito";
  src: url("../assets/fonts/Nunito-Variable.ttf") format("truetype");
  font-weight: 200 1000;
  font-display: swap;
}
@font-face {
  font-family: "Share Tech Mono";
  src: url("../assets/fonts/ShareTechMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --void: #03060f;
  --navy: #0b1436;
  --navy-deep: #070d22;
  --line: #1c3070;
  --rule: #1a2b63;
  --edge: #5b8fd4;
  --edge-dim: #2c4a86;
  --text: #f3f6ff;
  --muted: #9fb0d6;
  --dim: #56617f;
  --orange: #ff7a2e;
  --orange-hi: #ff9d4d;
  --sel: #ff4a1c;
  --green: #46e04a;
  --blue: #2f8cff;
  --cyan: #4fd6ff;
  --warn: #ffd166;

  --con: #ed4131; /* the CON's body color; the color picker changes it */

  --k-journey: #6fb4ff;
  --k-fight: #ff9d4d;
  --k-danger: #ff5a5a;
  --k-progress: #46e04a;
  --k-flavor: #8a96b8;

  --scan: repeating-linear-gradient(180deg, var(--navy) 0 2px, var(--line) 2px 3px);
  --scan-orange: repeating-linear-gradient(180deg, #ff8a3d 0 2px, #e8641a 2px 3px);

  --ui: "Nunito", "Segoe UI", system-ui, sans-serif;
  --mono: "Share Tech Mono", ui-monospace, Consolas, monospace;

  --wrap: 1180px;
  --gutter: 16px;
  --header-h: 64px;
  --palette-h: 0px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 50% -10%, #0e1d4a 0%, transparent 60%),
    var(--void);
  color: var(--text);
  font-family: var(--ui);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
  padding-bottom: var(--palette-h);
}
img, canvas, svg { display: block; max-width: 100%; }
a { color: var(--orange-hi); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--orange-hi); outline-offset: 3px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--mono); font-weight: 400; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--orange); color: #2a0e00; padding: 8px 14px; font-weight: 800; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- Frames: chamfered steel-blue border around a scanline panel ---------- */
.frame { --c: 12px; background: var(--edge); padding: 2px; clip-path: var(--shape); }
.frame > .in { clip-path: var(--shape); background: var(--scan); padding: 14px 16px; height: 100%; }
.cut  { --shape: polygon(0 0, calc(100% - var(--c)) 0, 100% var(--c), 100% 100%, var(--c) 100%, 0 calc(100% - var(--c))); }
.oct  { --shape: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c)); }
.hexl { --shape: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 50%); }
.frame.dim { background: var(--edge-dim); }

/* Tabs sitting on a panel */
.tabs { display: flex; align-items: flex-end; gap: 4px; margin-bottom: -2px; position: relative; z-index: 1; flex-wrap: wrap; }
.tab {
  --t: 10px;
  display: inline-flex; align-items: center;
  min-height: 28px; padding: 0 18px;
  font-weight: 800; font-size: 14px;
  clip-path: polygon(var(--t) 0, calc(100% - var(--t)) 0, 100% 100%, 0 100%);
  border: 0; cursor: default;
}
.tab.on { background: var(--scan-orange); color: #2a0e00; }
.tab.alt { background: var(--edge); padding: 2px 2px 0; }
.tab.alt > span {
  display: inline-flex; align-items: center; height: 100%; min-height: 26px; padding: 0 14px;
  background: var(--scan); color: var(--muted);
  clip-path: polygon(var(--t) 0, calc(100% - var(--t)) 0, 100% 100%, 0 100%);
  font-family: var(--mono); font-weight: 400;
}
button.tab { cursor: pointer; }
button.tab:not(.on) { background: var(--edge-dim); padding: 2px 2px 0; }
button.tab:not(.on) > span {
  display: inline-flex; align-items: center; min-height: 26px; padding: 0 14px;
  background: var(--scan); color: var(--muted);
  clip-path: polygon(var(--t) 0, calc(100% - var(--t)) 0, 100% 100%, 0 100%);
}
button.tab:not(.on):hover > span { color: var(--text); }
button.tab.on > span { padding: 0; }

/* Buttons: framed menu entries. Primary = focused (orange glow). */
.btn {
  --c: 9px;
  display: inline-block; text-align: center; text-decoration: none; color: var(--text);
  background: var(--edge); padding: 2px; border: 0; cursor: pointer;
  clip-path: var(--shape); --shape: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c));
  transition: filter .15s;
}
.btn > span {
  display: block; padding: 11px 22px; font-weight: 800; font-size: 16px;
  background: var(--scan); clip-path: var(--shape);
}
.btn.primary { background: var(--orange); }
.btn.primary > span {
  background:
    linear-gradient(90deg, rgba(255,74,28,.25), rgba(255,106,58,.95) 50%, rgba(255,74,28,.25)),
    var(--scan);
}
.btn:hover { filter: brightness(1.15); }
.btn:active > span { background: linear-gradient(90deg, rgba(255,74,28,0), #ff6a3a 50%, rgba(255,74,28,0)), var(--scan); }
.btn.sm > span { padding: 6px 14px; font-size: 14px; }
.btn[disabled] { background: var(--edge-dim); cursor: default; filter: none; }
.btn[disabled] > span { color: var(--dim); background: var(--scan); }

/* Help box (PSO's boxed hint) */
.hint > .in { font-weight: 700; font-size: 15px; line-height: 1.5; color: var(--text); }

/* Bars */
.bar { height: 8px; background: #07102a; border: 1px solid #22346b; position: relative; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; display: block; transition: width .6s ease; }
.bar.hp > i { background: linear-gradient(180deg, #7dff80, var(--green) 50%, #1f9a24); }
.bar.ch > i { background: linear-gradient(180deg, #7cc0ff, var(--blue) 50%, #1656b8); }
.bar.xp > i { background: linear-gradient(180deg, #ffd08a, var(--orange) 50%, #b24a10); }

/* Hexagons */
.hex { clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.gem {
  width: 40px; height: 36px; flex: none;
  background: linear-gradient(160deg, #b8c0d4, #5b6478 55%, #3a4152);
  display: grid; place-items: center;
}
.gem i {
  width: 22px; height: 20px; display: block;
  background: radial-gradient(circle at 35% 30%, #fff 0 8%, var(--con) 42%, color-mix(in srgb, var(--con) 45%, #000));
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--void) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--edge-dim);
}
.site-header .wrap { display: flex; align-items: center; gap: 20px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); flex: none; }
.brand .gem { width: 34px; height: 30px; }
.brand .gem i { width: 19px; height: 17px; }
.brand b { font-weight: 900; font-size: 17px; letter-spacing: .16em; }
.brand b em { font-style: normal; color: var(--orange); }

.top-nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.top-nav a {
  font-family: var(--mono); font-size: 14px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; padding: 8px 12px; position: relative;
}
.top-nav a:hover { color: var(--text); }
.top-nav a.on { color: var(--orange-hi); }
.top-nav a.on::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; background: var(--orange); box-shadow: 0 0 8px var(--orange); }
.top-nav .btn { margin-left: 10px; }
.top-nav .btn > span { font-family: var(--ui); letter-spacing: 0; text-transform: none; }

/* ---------- Mobile tab bar: the app's row of hexagons ---------- */
.palette {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: none; justify-content: space-around;
  padding: 8px 8px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--edge-dim);
  background: linear-gradient(180deg, rgba(11,20,54,.92), rgba(3,6,15,.98));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.hx { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 60px; text-decoration: none; }
.hx-ring { width: 46px; height: 40px; padding: 2px; background: var(--edge-dim); }
.hx-in { width: 100%; height: 100%; display: grid; place-items: center; background: var(--scan); }
.hx svg { width: 20px; height: 20px; color: var(--muted); }
.hx span { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.hx.on .hx-ring { background: var(--orange); filter: drop-shadow(0 0 6px rgba(255,122,46,.8)); }
.hx.on svg, .hx.on span { color: var(--orange-hi); }

/* ---------- Sky Terminal ---------- */
.sky { position: absolute; inset: 0 0 auto 0; height: 340px; overflow: hidden; pointer-events: none; z-index: 0;
  mask-image: linear-gradient(180deg, #000 30%, transparent); -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent); }
.sky .ln {
  position: absolute; left: 0; white-space: nowrap;
  font-family: var(--mono); font-size: 13px; color: #3c5a9c; opacity: .55;
  animation: drift linear forwards;
}
.sky .ln.read { color: var(--text); opacity: .9; text-shadow: 0 0 10px rgba(143,208,255,.8); letter-spacing: .12em; }
@keyframes drift { from { transform: translateX(100vw); } to { transform: translateX(-100%); } }

.cursor {
  display: inline-block; width: .5em; height: .82em; margin-left: .1em; vertical-align: -.04em;
  background: var(--orange); box-shadow: 0 0 18px rgba(255,122,46,.7);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 56px 0 72px; }
.hero > .wrap { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 48px; align-items: center; }
.eyebrow { font-family: var(--mono); color: var(--muted); letter-spacing: .14em; font-size: 14px; text-transform: uppercase; }
.eyebrow .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--green); box-shadow: 0 0 8px var(--green); vertical-align: 1px; }
.hero h1 { font-weight: 900; font-size: clamp(44px, 7.4vw, 88px); line-height: .98; letter-spacing: -.02em; margin: 14px 0 22px; }
.hero h1 em { font-style: normal; color: var(--orange); display: block; }
.lede { color: var(--muted); font-size: clamp(17px, 1.6vw, 20px); line-height: 1.6; margin: 0 0 30px; max-width: 34em; }
.lede b { color: var(--text); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-note { margin-top: 26px; font-family: var(--mono); font-size: 13.5px; color: var(--dim); letter-spacing: .04em; }

/* Phone */
.phone-col { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.phone {
  width: min(360px, 100%); position: relative; overflow: hidden;
  border-radius: 34px; border: 9px solid #161b28;
  box-shadow: 0 0 0 1px #2a3348, 0 30px 70px rgba(0,0,0,.65), 0 0 120px color-mix(in srgb, var(--con) 18%, transparent);
  background:
    linear-gradient(rgba(91,143,212,.05) 1px, transparent 1px) 0 0 / 100% 22px,
    linear-gradient(90deg, rgba(91,143,212,.05) 1px, transparent 1px) 0 0 / 22px 100%,
    radial-gradient(500px 400px at 50% 30%, #0c1a44, var(--void) 70%);
  display: flex; flex-direction: column;
  font-size: 14px;
}
.hud { padding: 14px 10px 0; }
.plate { --c: 14px; }
.plate > .in { display: grid; grid-template-columns: 56px 1fr; gap: 8px; align-items: center; padding: 6px 12px 6px 16px; }
.gem-col { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.lv { font-family: var(--mono); font-size: 14px; }
.bars { display: grid; gap: 2px; }
.bar-row { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 13.5px; line-height: 1.15; }
.status { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 12.5px; color: var(--muted); padding: 6px 4px 0; gap: 8px; }
.status .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--green); box-shadow: 0 0 6px var(--green); }
.status .dot.out { background: var(--orange); box-shadow: 0 0 6px var(--orange); }
.titlebar { padding-top: 8px; display: flex; }
.titlebar .tab { min-height: 28px; font-size: 15px; padding: 0 20px; }
.titlebar::after { content: ""; flex: 1; align-self: flex-end; height: 2px; background: var(--orange); opacity: .7; }
.phone .page { padding: 12px 10px 14px; display: flex; flex-direction: column; gap: 12px; }
.phone .frame > .in { padding: 10px 12px; }
.phone .palette-in { display: flex; justify-content: space-between; padding: 8px 8px 12px; border-top: 1px solid var(--edge-dim); background: linear-gradient(180deg, rgba(11,20,54,.4), rgba(3,6,15,.9)); }
.phone .hx { width: 54px; }
.phone .hx-ring { width: 42px; height: 37px; }
.phone .hx svg { width: 18px; height: 18px; }
.phone .hx span { font-size: 10.5px; }

.con-card { display: grid; grid-template-columns: 112px 1fr; gap: 10px; align-items: center; }
.con-card .name { font-size: 20px; font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
.note { color: var(--muted); font-size: 12.5px; line-height: 1.45; font-weight: 600; }
.kv { display: grid; grid-template-columns: 1fr 14px auto; font-weight: 700; font-size: 13px; line-height: 1.65; }
.kv .c { color: var(--muted); }
.kv .v { text-align: right; font-family: var(--mono); font-weight: 400; font-size: 14px; }
.align { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.align span { font-family: var(--mono); font-size: 12px; color: var(--muted); padding: 1px 7px; border: 1px solid var(--edge-dim); }
.align span b { color: var(--text); font-weight: 400; margin-left: 4px; }

.portrait { position: relative; display: grid; place-items: center; }
.portrait::before {
  content: ""; position: absolute; inset: 6%; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--con) 55%, transparent), transparent 70%);
  filter: blur(8px); transition: background .4s;
}
.portrait > * { position: relative; width: 100%; height: auto; }
.con-art-canvas { width: 100%; height: auto; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.stat { display: grid; grid-template-columns: 28px 1fr auto; align-items: baseline; font-size: 13.5px; line-height: 1.85; }
.stat .key { font-family: var(--mono); color: var(--orange-hi); }
.stat .lbl { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat .val { font-family: var(--mono); font-size: 14.5px; }
.stat .val small { color: var(--green); font-size: 11.5px; margin-left: 3px; }

/* Make it yours */
.custom { width: min(360px, 100%); }
.custom > .in { padding: 14px 16px 16px; display: grid; gap: 12px; }
.custom label, .field-label { font-family: var(--mono); font-size: 12.5px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.name-input {
  width: 100%; margin-top: 4px; padding: 9px 12px;
  background: var(--navy-deep); border: 2px solid var(--edge-dim); color: var(--text);
  font-family: var(--ui); font-weight: 800; font-size: 17px;
}
.name-input:focus { border-color: var(--orange); outline: none; }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-top: 6px; }
.swatch {
  aspect-ratio: 1.15; border: 0; padding: 2px; background: var(--edge-dim); cursor: pointer;
}
.swatch i { display: block; width: 100%; height: 100%; }
.swatch[aria-pressed="true"] { background: var(--orange); filter: drop-shadow(0 0 6px rgba(255,122,46,.9)); }

/* ---------- Sections ---------- */
section.block { padding: 88px 0; position: relative; }
section.block.alt { background: linear-gradient(180deg, transparent, rgba(11,20,54,.35) 18%, rgba(11,20,54,.35) 82%, transparent); }
.sect {
  font-family: var(--mono); font-size: 14px; letter-spacing: .16em; color: var(--orange);
  margin: 0 0 14px; display: flex; align-items: center; gap: 14px; text-transform: uppercase;
}
.sect::after { content: ""; flex: 1; height: 1px; background: var(--edge-dim); }
h2 { font-weight: 900; font-size: clamp(32px, 4.6vw, 54px); line-height: 1.05; letter-spacing: -.015em; margin: 0 0 18px; }
h2 em { font-style: normal; color: var(--orange); }
h3 { font-weight: 800; font-size: 21px; margin: 0 0 6px; line-height: 1.2; }
.section-lede { color: var(--muted); font-size: 18.5px; max-width: 40em; margin: 0 0 40px; }
.section-lede b { color: var(--text); }
p { margin: 0 0 14px; }
.muted { color: var(--muted); }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.split.wide-right { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }

/* CONs */
.con-open { max-width: 460px; margin: 0 auto; }
.con-open .portrait::before { inset: 14%; }
.traits { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 14px; }
.traits li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; color: var(--muted); }
.traits li b { color: var(--text); display: block; font-weight: 800; }
.traits .ico {
  width: 34px; height: 30px; background: var(--edge-dim); padding: 2px;
}
.traits .ico > span { display: grid; place-items: center; width: 100%; height: 100%; background: var(--scan); }
.traits .ico svg { width: 16px; height: 16px; color: var(--orange-hi); }

.procs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 64px; }
.proc > .in { padding: 20px 20px 22px; }
.proc .code { font-family: var(--mono); font-size: 28px; letter-spacing: .14em; color: var(--text); line-height: 1; }
.proc .role { font-family: var(--mono); font-size: 13px; color: var(--orange-hi); letter-spacing: .1em; text-transform: uppercase; margin: 8px 0 12px; }
.proc p { color: var(--muted); font-size: 16px; }
.proc ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.proc li { font-size: 15px; display: flex; gap: 10px; align-items: baseline; }
.proc li::before { content: ""; width: 7px; height: 7px; flex: none; background: var(--cyan); transform: rotate(45deg) translateY(-1px); box-shadow: 0 0 6px rgba(79,214,255,.6); }
.procs-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 72px; }
.procs-head + .procs { margin-top: 22px; }
.procs-head h3 { font-size: 28px; font-weight: 900; margin: 0; }
.procs-head p { color: var(--muted); margin: 0; max-width: 34em; }

/* Outings */
/* The tabs and the card move together, so the tabs always sit on the card. */
.send-wrap { max-width: 480px; width: 100%; margin-left: auto; }
.send-card { width: 100%; }
.send-card > .in { padding: 18px 18px 18px; }
.send-card h4, .card-h { margin: 0 0 10px; font-size: 14px; font-weight: 800; color: var(--orange-hi); letter-spacing: .05em; text-transform: uppercase; }
.divider { height: 1px; background: #22346b; margin: 14px 0; }
.inf { display: grid; grid-template-columns: 104px 30px 1fr 30px; gap: 8px; align-items: center; font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.pm {
  --c: 6px; width: 30px; height: 26px; padding: 2px; border: 0; cursor: pointer; background: var(--edge);
  clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c));
}
.pm > span { display: grid; place-items: center; width: 100%; height: 100%; background: var(--scan); font-family: var(--mono); font-size: 17px; color: var(--green); clip-path: inherit; }
.pm:disabled { background: var(--edge-dim); cursor: default; }
.pm:disabled > span { color: var(--dim); }
.pips { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.pips i { height: 12px; background: #13235a; transform: skewX(-18deg); transition: background .15s, box-shadow .15s; }
.pips i.on { background: var(--cyan); box-shadow: 0 0 5px rgba(79,214,255,.5); }
.unspent { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 13.5px; color: var(--muted); margin-top: 6px; gap: 10px; }
.unspent b { color: var(--text); font-weight: 400; }
.rule { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; font-size: 15px; font-weight: 700; min-height: 36px; }
.rule input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rule .box { width: 22px; height: 22px; border: 2px solid var(--edge); background: var(--navy); display: grid; place-items: center; color: var(--green); font-size: 15px; font-weight: 900; }
.rule input:checked + .box::after { content: "✓"; }
.rule input:focus-visible + .box { outline: 2px solid var(--orange-hi); outline-offset: 2px; }
.rule label { cursor: pointer; display: contents; }
.stepper { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 14px; }
.stepper output { min-width: 46px; text-align: center; }
.send-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.send-row .btn { width: 100%; }

.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 28px 0 0; }
.act { border-left: 2px solid var(--edge-dim); padding: 2px 0 2px 14px; }
.act b { display: block; font-weight: 800; }
.act span { color: var(--muted); font-size: 15px; }

.bands { margin-top: 64px; }
.band-track { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; position: relative; margin-top: 18px; }
.band { padding: 18px 16px 6px; border-top: 3px solid var(--edge-dim); position: relative; }
.band::before { content: ""; position: absolute; top: -8px; left: 0; width: 13px; height: 13px; background: var(--edge); transform: rotate(45deg); }
.band:nth-child(2) { border-top-color: #3d63a8; } .band:nth-child(2)::before { background: var(--cyan); }
.band:nth-child(3) { border-top-color: #b4602a; } .band:nth-child(3)::before { background: var(--orange); }
.band:nth-child(4) { border-top-color: #b33a3a; } .band:nth-child(4)::before { background: var(--k-danger); }
.band .when { font-family: var(--mono); font-size: 13px; color: var(--muted); letter-spacing: .08em; }
.band b { display: block; font-size: 22px; font-weight: 900; margin: 2px 0 6px; }
.band p { font-size: 15px; color: var(--muted); margin: 0; }

/* Diary */
.log-panel { display: flex; flex-direction: column; }
.log-panel .frame > .in { padding: 4px 14px 10px; }
.log-scroll { height: 460px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--green) transparent; overscroll-behavior: contain; }
.log-scroll::-webkit-scrollbar { width: 4px; }
.log-scroll::-webkit-scrollbar-thumb { background: var(--green); border-radius: 2px; }
.le { display: grid; grid-template-columns: 70px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 15px; line-height: 1.5; font-weight: 700; }
.le.new { animation: rise .35s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .le.new { animation: none; } }
.le .t { font-family: var(--mono); font-weight: 400; font-size: 13.5px; color: var(--c, var(--muted)); padding-top: 1px; }
.le .lvl-up { display: block; color: var(--green); font-size: 14px; }
.more { color: var(--green); font-family: var(--mono); font-weight: 400; font-size: 13px; white-space: nowrap; background: none; border: 0; padding: 0 0 0 4px; cursor: pointer; }
.more:hover { text-decoration: underline; }
.details { margin-top: 6px; padding: 8px 10px; background: rgba(3,6,15,.55); border: 1px solid var(--rule); font-family: var(--mono); font-weight: 400; font-size: 13px; color: var(--muted); display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; }
.details b { color: var(--text); font-weight: 400; }
.k-journey { --c: var(--k-journey); }
.k-fight { --c: var(--k-fight); }
.k-danger { --c: var(--k-danger); }
.k-danger .x { color: #ffc2c2; }
.k-progress { --c: var(--k-progress); }
.k-flavor { --c: var(--k-flavor); }
.k-flavor .x { color: var(--k-flavor); font-style: italic; font-weight: 600; }
.day { text-align: center; font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .14em; padding: 10px 0 4px; border-bottom: 1px solid var(--rule); }
.log-status { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; font-family: var(--mono); font-size: 13.5px; color: var(--muted); }
.log-status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--green); box-shadow: 0 0 6px var(--green); }
.log-status .dot.out { background: var(--orange); box-shadow: 0 0 6px var(--orange); }
.log-status .dot.down { background: var(--k-danger); box-shadow: 0 0 6px var(--k-danger); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 26px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 7px; background: var(--c); vertical-align: 0; }

/* Crafting */
.chain { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; position: relative; }
.chain .frame > .in { padding: 18px 18px 20px; }
.chain .step { font-family: var(--mono); font-size: 13px; color: var(--muted); letter-spacing: .12em; }
.chain h3 { margin: 6px 0 4px; }
.chain .makes { font-family: var(--mono); font-size: 13px; color: var(--orange-hi); margin-bottom: 10px; letter-spacing: .04em; }
.chain p { color: var(--muted); font-size: 15.5px; margin: 0; }
.chain .frame { position: relative; }
.chain-ico { width: 44px; height: 39px; padding: 2px; background: var(--edge-dim); margin-bottom: 12px; }
.chain-ico > span { display: grid; place-items: center; width: 100%; height: 100%; background: var(--scan); }
.chain-ico svg { width: 20px; height: 20px; color: var(--orange-hi); }
.craft-notes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.craft-notes .hint > .in { font-weight: 600; color: var(--muted); font-size: 15.5px; }
.craft-notes .hint b { color: var(--text); font-weight: 800; display: block; margin-bottom: 2px; }

/* World */
.world-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: -2px; position: relative; z-index: 1; }
.world-tabs .tab { min-height: 34px; font-size: 15px; padding: 0 20px; }
.world-tabs button.tab:not(.on) > span { min-height: 32px; padding: 0 18px; }
.world-panel > .in { padding: 22px; }
.world-intro { color: var(--muted); margin: 0 0 18px; max-width: 46em; }
.lore-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.lore {
  background: rgba(3,6,15,.5); border: 1px solid var(--rule); padding: 16px 16px 14px; position: relative;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.lore::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--kc, var(--edge)); }
.lore h3 { font-size: 19px; }
.lore .tag { font-family: var(--mono); font-size: 12px; color: var(--kc, var(--muted)); letter-spacing: .12em; text-transform: uppercase; }
.lore q { display: block; color: var(--text); font-style: italic; font-weight: 700; margin: 4px 0 8px; quotes: "“" "”"; }
.lore p { color: var(--muted); font-size: 15px; margin: 0; line-height: 1.55; }
.lore.k-place { --kc: var(--cyan); }
.lore.k-creature { --kc: var(--green); }
.lore.k-enemy { --kc: var(--k-danger); }
.lore.k-group { --kc: #b69cff; }
.lore.unknown { --kc: var(--dim); background: transparent; border-style: dashed; display: flex; flex-direction: column; justify-content: center; }
.lore.unknown h3 { font-family: var(--mono); font-weight: 400; letter-spacing: .2em; color: var(--muted); }
.lore-grid[hidden] { display: none; }

/* Coming soon */
.soon > .in { padding: clamp(28px, 5vw, 56px); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: center; }
.soon h2 { margin-bottom: 12px; }
.soon p { color: var(--muted); font-size: 18px; max-width: 34em; margin: 0; }
.soon .con-mini { width: 190px; }
.build-tag { display: inline-flex; gap: 10px; align-items: center; font-family: var(--mono); font-size: 13.5px; color: var(--muted); letter-spacing: .1em; margin-bottom: 14px; }
.build-tag .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 8px var(--orange); }

/* Mailing list signup (Kit), on both pages' coming-soon panel */
.signup { width: min(400px, 100%); display: grid; gap: 8px; text-align: left; }
.soon p + .signup { margin-top: 24px; }
.signup-row { display: flex; gap: 10px; }
.signup .name-input { margin: 0; min-width: 0; flex: 1; font-size: 16px; }
.signup .btn { flex: none; }
.soon .signup-note { color: var(--muted); font-size: 14px; margin: 0; }
.soon .signup-note.ok { color: var(--green); }
.soon .signup-note.err { color: var(--k-danger); }
.signup.done .signup-row { display: none; }
@media (max-width: 859px) { .signup { margin-left: auto; margin-right: auto; } }
@media (max-width: 599px) { .signup-row { flex-direction: column; } }

footer.site-footer { border-top: 1px solid var(--edge-dim); padding: 32px 0 40px; color: var(--dim); font-family: var(--mono); font-size: 13.5px; }
footer.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
footer.site-footer a { color: var(--muted); text-decoration: none; }
footer.site-footer a:hover { color: var(--text); }
.foot-links { display: flex; gap: 20px; flex-wrap: wrap; }

/* Legal pages (privacy.html): long-form reading text */
.legal-back { margin-left: auto; white-space: nowrap; }
.legal-back .legal-back-long { display: inline; padding: 0; background: none; clip-path: none; font: inherit; }
.legal { padding-top: 56px; }
.legal h2 { margin-bottom: 6px; }
.legal-date { font-family: var(--mono); font-size: 14px; color: var(--muted); letter-spacing: .06em; margin-bottom: 28px; }
.legal-short { max-width: 46em; }
.legal-short > .in { padding: 18px 20px; }
.legal-short b { display: block; color: var(--orange-hi); font-weight: 800; margin-bottom: 6px; }
.legal-short ul, .legal-body ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.legal-body ul { margin-bottom: 14px; }
.legal-body { max-width: 46em; color: var(--muted); }
.legal-body b { color: var(--text); }
.legal-body h3 { color: var(--text); font-size: 23px; margin: 40px 0 10px; }
.legal-body h4 { color: var(--text); font-size: 17px; font-weight: 800; margin: 22px 0 6px; }
.legal-body a, .legal-short a { overflow-wrap: anywhere; }
@media (max-width: 479px) { .legal-back .legal-back-long { display: none; } }
@media (max-width: 719px) { .legal { padding-top: 36px; } .legal-body h3 { font-size: 21px; margin-top: 32px; } }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.seen { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }
.no-js .reveal { opacity: 1; transform: none; }

/* ---------- Tablet ---------- */
@media (max-width: 1023px) {
  .hero > .wrap { grid-template-columns: 1fr; gap: 44px; }
  .hero-copy { text-align: center; }
  .hero .lede { margin-left: auto; margin-right: auto; }
  .hero .cta { justify-content: center; }
  .split, .split.wide-right { grid-template-columns: 1fr; gap: 40px; }
  .send-wrap { margin: 0 auto; }
  .chain { grid-template-columns: 1fr 1fr; }
  .lore-grid { grid-template-columns: 1fr 1fr; }
  .top-nav a { padding: 8px 8px; font-size: 13px; }
  .log-scroll { height: 420px; }
}
@media (max-width: 859px) {
  .procs { gap: 12px; }
  .proc > .in { padding: 16px 14px 18px; }
  .proc .code { font-size: 22px; }
  .craft-notes { grid-template-columns: 1fr; }
  .band-track { grid-template-columns: 1fr 1fr; row-gap: 26px; }
  .soon > .in { grid-template-columns: 1fr; text-align: center; }
  .soon p { margin: 0 auto; }
  .soon .con-mini { margin: 0 auto; width: 150px; }
}

/* ---------- Phone ---------- */
@media (max-width: 719px) {
  :root { --header-h: 56px; --palette-h: calc(78px + env(safe-area-inset-bottom)); }
  .top-nav { display: none; }
  .palette { display: flex; }
  .site-header .wrap { justify-content: space-between; }
  .header-cta { display: inline-block; }
  .hero { padding: 36px 0 56px; }
  section.block { padding: 64px 0; }
  .section-lede { font-size: 17px; margin-bottom: 30px; }
  .acts { grid-template-columns: 1fr; }
  .procs { grid-template-columns: 1fr; }
  .chain { grid-template-columns: 1fr; }
  .lore-grid { grid-template-columns: 1fr; }
  .world-panel > .in { padding: 16px 14px; }
  .world-tabs .tab { padding: 0 14px; font-size: 14px; }
  .world-tabs button.tab:not(.on) > span { padding: 0 12px; }
  .log-scroll { height: 400px; }
  .le { grid-template-columns: 62px 1fr; font-size: 14.5px; }
  .inf { grid-template-columns: 92px 30px 1fr 30px; font-size: 14px; }
  .procs-head { margin-top: 56px; }
}
@media (min-width: 720px) { .header-cta { display: none; } }
@media (max-width: 719px) {
  .sky { height: 220px; }
  .sky .ln { opacity: .32; }
  .band { padding: 16px 12px 4px; }
  .band b { font-size: 19px; }
  .band p { font-size: 14px; }
}
@media (max-width: 400px) {
  .con-card { grid-template-columns: 96px 1fr; }
  .swatches { gap: 4px; }
}
