/* ------------------------------------------------------------------ themes */
:root {
  --fg: #f2f2f2;
  --bg: #050505;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --disp: "Major Mono Display", "JetBrains Mono", ui-monospace, monospace;
  --bad: #ff6b6b;
}
[data-theme="amber"] { --fg: #ffb547; --bg: #0a0703; }
[data-theme="green"] { --fg: #62ff94; --bg: #020a05; }
:root {
  --muted: color-mix(in srgb, var(--fg) 60%, var(--bg));
  --dim: color-mix(in srgb, var(--fg) 38%, var(--bg));
  --line: color-mix(in srgb, var(--fg) 15%, var(--bg));
  --line2: color-mix(in srgb, var(--fg) 30%, var(--bg));
  --card: color-mix(in srgb, var(--fg) 4%, var(--bg));
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
html {
  color-scheme: dark; scroll-behavior: smooth; scroll-padding-top: 72px;
  background: var(--bg); scrollbar-color: var(--line2) var(--bg);
}
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg);
  font: 13.5px/1.65 var(--mono); font-feature-settings: "calt" 0;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
/* faint monitor scanlines + vignette */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 100; pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, .022) 0 1px, transparent 1px 3px),
    radial-gradient(120% 90% at 50% 40%, transparent 60%, rgba(0, 0, 0, .55));
}
::selection { background: var(--fg); color: var(--bg); }
a { color: inherit; text-decoration: none; }
code { font: 12px var(--mono); color: var(--fg); border: 1px solid var(--line2); padding: 0 5px; }
.u { border-bottom: 1px dashed var(--muted); }
.u:hover { border-bottom-style: solid; border-color: var(--fg); }
.dim { color: var(--dim); }
:focus-visible { outline: 1px dashed var(--fg); outline-offset: 3px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }
main.wrap { flex: 1; }

@keyframes blink { 50% { opacity: 0; } }
@keyframes type { from { width: 0; } }

/* ------------------------------------------------------------------ header */
header.top {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
header.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand svg { width: 24px; height: 24px; display: block; }
.logo { font: 19px/1 var(--disp); letter-spacing: .02em; }
.cur { animation: blink 1.1s steps(1) infinite; margin-left: 2px; }
nav a { color: var(--muted); margin-left: 24px; font-size: 12.5px; transition: color .15s; }
nav a:hover { color: var(--fg); }

/* ------------------------------------------------------------------ catalog */
.bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 56px 0 22px; }
.prompt { margin: 0 0 14px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 0; }
.ps { color: var(--dim); margin-right: 1ch; }
.typed {
  display: inline-block; overflow: hidden; white-space: nowrap; vertical-align: bottom;
  width: calc(var(--n) * 1ch); animation: type .9s steps(var(--n)) .25s backwards;
  border-right: 1ch solid transparent;
}
.prompt::after { content: ""; width: .6ch; height: 1.15em; background: var(--muted); animation: blink 1.1s steps(1) infinite; }
h1 { margin: 0; font: 34px/1.1 var(--disp); letter-spacing: .01em; }
.sub { margin: 10px 0 0; color: var(--muted); font-size: 12.5px; }

.search {
  display: flex; align-items: center; gap: 10px; width: 280px; height: 40px; padding: 0 10px 0 12px;
  border: 1px solid var(--line2); background: var(--bg); transition: border-color .15s;
}
.search:focus-within { border-color: var(--fg); }
.search > span { color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--fg); font: 13px var(--mono); }
.search input::placeholder { color: var(--dim); }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }
kbd { font: 11px var(--mono); color: var(--dim); border: 1px solid var(--line2); padding: 0 6px; }
.search:focus-within kbd { visibility: hidden; }

.chips { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 24px; }
.chips:empty { display: none; }
.chip, .themes button {
  font: 12px var(--mono); color: var(--muted); background: none; border: 0; padding: 1px 3px; cursor: pointer;
  text-transform: lowercase; transition: color .12s, background .12s;
}
.chip::before, .themes button::before { content: "["; color: var(--dim); }
.chip::after, .themes button::after { content: "]"; color: var(--dim); }
.chip:hover, .themes button:hover { color: var(--fg); }
.chip[aria-pressed="true"], .themes button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.chip[aria-pressed="true"]::before, .chip[aria-pressed="true"]::after,
.themes button[aria-pressed="true"]::before, .themes button[aria-pressed="true"]::after { color: var(--bg); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.card { position: relative; display: block; background: var(--bg); border: 1px solid var(--line); transition: border-color .15s; }
.card:hover { border-color: var(--fg); }
.card:hover .tag { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.card:hover .meta h3::after { content: " →"; }

.cover { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--card); border-bottom: 1px solid var(--line); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; filter: grayscale(1) contrast(1.1) brightness(.9); transition: filter .35s, transform .5s; }
.cover.img::after, .tint::after { content: ""; position: absolute; inset: 0; background: var(--fg); mix-blend-mode: multiply; pointer-events: none; transition: opacity .35s; }
.card:hover .cover img { filter: none; transform: scale(1.03); }
.card:hover .cover.img::after { opacity: 0; }

.ph {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 7px; padding: 16px;
  background: radial-gradient(circle at 1px 1px, var(--line2) 1px, transparent 1.3px) 0 0 / 7px 7px, var(--card);
}
.ph .rx { display: block; height: 7px; background: var(--line2); }
.ph span {
  align-self: flex-start; max-width: 92%; margin-top: 4px;
  font: 700 19px/1.15 var(--mono); text-transform: uppercase; letter-spacing: .02em;
  background: var(--bg); color: var(--fg); padding: 3px 8px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.tag, .num {
  position: absolute; top: 10px; z-index: 1; font: 500 10.5px/1.6 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  background: var(--bg); padding: 1px 7px; transition: background .15s, color .15s;
}
.tag { left: 10px; color: var(--fg); border: 1px solid var(--line2); }
.num { right: 10px; color: var(--muted); }
.meta { padding: 12px 14px 14px; }
.meta h3 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta p { margin: 3px 0 0; color: var(--muted); font-size: 11.5px; }
.empty { color: var(--muted); padding: 48px 0; text-align: center; }

/* new / updated / unsigned */
.badge {
  display: inline-block; margin-right: 8px; padding: 0 5px; vertical-align: 1px;
  font: 700 9.5px/1.6 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  background: var(--fg); color: var(--bg);
}
.badge.upd { background: none; color: var(--fg); box-shadow: inset 0 0 0 1px var(--line2); }
.badge.bad { background: var(--bad); color: #000; }

/* notice strip under the header */
.notice { border-bottom: 1px dashed var(--line2); color: var(--muted); font-size: 12px; }
.notice .wrap { display: flex; align-items: baseline; gap: 12px; padding-top: 8px; padding-bottom: 8px; }
.notice b { flex: none; background: var(--fg); color: var(--bg); padding: 0 6px; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.notice p { margin: 0; }
.notice.paused { color: var(--fg); border-bottom-color: var(--bad); }
.notice.paused b { background: var(--bad); }

/* ------------------------------------------------------------------ buttons */
.actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 24px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 18px;
  border: 1px solid var(--fg); border-radius: 0; background: var(--fg); color: var(--bg);
  font: 700 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; cursor: pointer;
  transition: background .12s, color .12s;
}
.btn::before { content: "↓"; font-weight: 400; }
.btn:hover { background: transparent; color: var(--fg); }
.btn:active { transform: translateY(1px); }
.btn small { font: 400 11px var(--mono); letter-spacing: 0; text-transform: none; opacity: .6; }
.btn small:empty { display: none; }
.btn:disabled, .link:disabled { opacity: .35; cursor: not-allowed; }
.btn:disabled:hover { background: var(--fg); color: var(--bg); }
.link { color: var(--muted); font: 12px var(--mono); background: none; border: 0; border-bottom: 1px dashed var(--line2); padding: 0; cursor: pointer; transition: color .12s, border-color .12s; }
.link:hover { color: var(--fg); border-color: var(--fg); }
.note { color: var(--dim); font-size: 11.5px; text-transform: lowercase; }
.hint { margin: 16px 0 0; color: var(--dim); font-size: 11.5px; line-height: 1.6; }
.hint code { font-size: 11px; color: var(--muted); border-color: var(--line); }

/* ------------------------------------------------------------------ app */
.app { display: grid; grid-template-columns: 1.05fr 1fr; margin: 96px 0 56px; border: 1px solid var(--line2); position: relative; }
.app::before { content: "keyport.exe"; position: absolute; top: -9px; left: 16px; padding: 0 8px; background: var(--bg); color: var(--dim); font-size: 11px; line-height: 16px; }
.app .txt { padding: 38px 38px 34px; }
.kicker { margin: 0 0 10px; color: var(--dim); font-size: 12px; }
.app h2 { margin: 0; font: 28px/1.1 var(--disp); }
.lead { margin: 14px 0 0; color: var(--muted); max-width: 48ch; }
.steps { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; }
.steps li { display: flex; gap: 14px; color: var(--muted); }
.steps b { color: var(--fg); font-weight: 500; }
.steps b::before { content: "["; color: var(--dim); }
.steps b::after { content: "]"; color: var(--dim); }
.steps em { font-style: normal; color: var(--fg); text-transform: uppercase; font-size: 12px; letter-spacing: .06em; }
.app .shot {
  display: flex; align-items: center; justify-content: center; padding: 30px;
  border-left: 1px solid var(--line);
  background: radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 1.3px) 0 0 / 9px 9px;
}
.tint { position: relative; margin: 0; width: 100%; max-width: 440px; border: 1px solid var(--line2); box-shadow: 10px 10px 0 color-mix(in srgb, var(--fg) 8%, transparent); }
.tint img { display: block; width: 100%; height: auto; filter: grayscale(1) contrast(1.05); }

/* ------------------------------------------------------------------ footer */
footer.wrap {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-top: 20px; padding-bottom: 28px; border-top: 1px dashed var(--line2);
  color: var(--muted); font-size: 11.5px;
}
.themes { display: flex; align-items: center; gap: 10px; }
.signed { margin-left: 10px; color: var(--dim); letter-spacing: .03em; }
.signed::before { content: "✓ "; color: var(--muted); }

/* ------------------------------------------------------------------ detail */
dialog {
  padding: 0; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  background: var(--bg); color: var(--fg); border: 1px solid var(--line2); border-radius: 0;
  box-shadow: 14px 14px 0 color-mix(in srgb, var(--fg) 7%, transparent);
}
dialog::backdrop { background: rgba(0, 0, 0, .78); }
dialog[open] { animation: pop .16s steps(4); }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
.d-bar {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between;
  height: 38px; padding: 0 6px 0 14px; background: var(--bg); border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 11.5px;
}
.d-close { font: 12px var(--mono); color: var(--muted); background: none; border: 0; padding: 6px 8px; cursor: pointer; }
.d-close:hover { color: var(--bg); background: var(--fg); }
.d-cover { aspect-ratio: 21 / 8; }
.d-cover .ph span { font-size: 26px; }
.stamp {
  position: absolute; right: 22px; bottom: 18px; z-index: 2;
  font: 700 12px var(--mono); letter-spacing: .22em; text-transform: uppercase;
  color: var(--fg); border: 2px solid var(--fg); padding: 4px 10px 4px 12px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  transform: rotate(-7deg); opacity: .9;
}
dialog[open] .stamp { animation: stamp .35s cubic-bezier(.2, 1.6, .4, 1) .15s backwards; }
@keyframes stamp { from { opacity: 0; transform: rotate(-7deg) scale(1.8); } }
.d-body { padding: 22px 26px 26px; }
.d-origin { margin: 0 0 6px; color: var(--muted); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; }
.d-body h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.d-desc { margin: 12px 0 0; color: var(--muted); }
.d-desc:empty { display: none; }
.d-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 26px; margin: 20px 0 0; padding: 16px 0 0; border-top: 1px dashed var(--line2); }
.d-facts dt { color: var(--dim); font-size: 11px; line-height: 1.95; letter-spacing: .08em; text-transform: uppercase; }
.d-facts dd { margin: 0; font-size: 12.5px; }
.d-notes { list-style: none; margin: 14px 0 0; padding: 0; color: var(--muted); font-size: 12.5px; }
.d-notes:empty { display: none; }
.d-notes li::before { content: "> "; color: var(--dim); }
.d-notes li + li { margin-top: 3px; }
.d-facts .sig-ok::before { content: "✓ "; }
.d-facts .sig-bad { color: var(--bad); }
.d-log { margin: 18px 0 0; padding: 14px 0 0; border-top: 1px dashed var(--line2); }
.d-log:empty { display: none; }
.d-log h4 { margin: 0 0 8px; color: var(--dim); font-size: 11px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; }
.d-log ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.d-log ol > li > span { font-size: 12.5px; font-weight: 500; }
.d-log i { font-style: normal; font-weight: 400; color: var(--dim); }
.d-log ul { list-style: none; margin: 2px 0 0; padding: 0; color: var(--muted); font-size: 12px; }
.d-log ul li::before { content: "+ "; color: var(--dim); }

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%);
  background: var(--bg); color: var(--fg); border: 1px solid var(--fg);
  padding: 9px 16px; font-size: 12.5px; white-space: nowrap;
  box-shadow: 6px 6px 0 color-mix(in srgb, var(--fg) 12%, transparent);
  animation: up .2s steps(3);
}
.toast b { font-weight: 700; }
@keyframes up { from { opacity: 0; transform: translate(-50%, 6px); } }

/* ------------------------------------------------------------------ mobile */
@media (max-width: 760px) {
  .bar { flex-direction: column; align-items: stretch; padding-top: 38px; }
  h1 { font-size: 26px; }
  .search { width: 100%; }
  .app { grid-template-columns: 1fr; margin-top: 72px; }
  .app .txt { padding: 28px 22px; }
  .app .shot { border-left: 0; border-top: 1px solid var(--line); padding: 22px; }
  .d-body { padding: 18px 18px 22px; }
  .d-cover { aspect-ratio: 16 / 8; }
  .toast { white-space: normal; width: calc(100vw - 32px); }
}

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

/* game pages (web/g/*.html, written by the studio for search engines) */
.gp { max-width: 820px; padding-top: 28px; padding-bottom: 60px; }
.gp .prompt a { color: var(--muted); }
.gp .prompt a:hover { color: var(--fg); }
.gp article { margin-top: 18px; }
.gp .d-cover { position: relative; aspect-ratio: 16 / 9; margin-bottom: 22px; border: 1px solid var(--line2); }
.gp .d-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gp h1 { margin: 0; font-size: clamp(22px, 4vw, 34px); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
