/* tinyrisks.art — Xeno Portal
   Y2K web-portal chrome (bevels, gradient title bars, 88x31 badges, sub-nav)
   on a modern responsive grid. */

:root {
  --space-1: #05071c;
  --space-2: #0b1030;
  --space-3: #1a2466;
  --panel: #eef2fb;
  --panel-2: #dfe6f7;
  --ink: #1a2140;
  --muted: #56608a;
  --link: #0033aa;
  --link-hover: #cc3300;
  --bar-1: #1d3c94;
  --bar-2: #5f86d9;
  --bar-ink: #ffffff;
  --bevel-hi: #ffffff;
  --bevel-lo: #8a95b8;
  --accent: #ff9f1c;
  --cyan: #7ff5ff;
  --shadow: rgba(0, 0, 0, .45);
  --ui: Tahoma, Verdana, "Segoe UI", system-ui, sans-serif;
  --pixel: "VT323", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --panel: #151c44;
    --panel-2: #1d2658;
    --ink: #e4e9ff;
    --muted: #9aa5d6;
    --link: #8fb4ff;
    --link-hover: #ffb35c;
    --bevel-hi: #3a4690;
    --bevel-lo: #070a22;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 12px; scrollbar-gutter: stable; }

body {
  margin: 0;
  font: 13px/1.5 var(--ui);
  color: var(--ink);
  background-color: var(--space-1);
  background-image:
    radial-gradient(1px 1px at 20px 30px, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 140px 80px, #cfe0ff 50%, transparent 51%),
    radial-gradient(1px 1px at 90px 160px, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 210px 120px, #ffe7b0 50%, transparent 51%),
    radial-gradient(1px 1px at 250px 20px, #fff 50%, transparent 51%),
    linear-gradient(180deg, var(--space-2), var(--space-1) 60%);
  background-size: 280px 200px, 280px 200px, 280px 200px, 280px 200px, 280px 200px, 100% 100%;
  background-attachment: fixed;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--link); }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

kbd {
  font: 11px var(--ui);
  padding: 0 4px;
  background: var(--panel-2);
  border: 1px solid;
  border-color: var(--bevel-hi) var(--bevel-lo) var(--bevel-lo) var(--bevel-hi);
}

.shell { max-width: 820px; margin: 0 auto; padding-inline: 16px; }
.shell--wide { max-width: 1040px; }

.skip {
  position: absolute; left: -9999px; top: 8px;
  background: var(--accent); color: #000; padding: 6px 10px; z-index: 10;
}
.skip:focus { left: 8px; }

/* ── Masthead: the logo and one row of tabs ──────── */
.masthead {
  color: #fff; border-bottom: 2px solid #000;
  background-color: #060920;
  background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 75px 95px, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 140px 20px, #dfe8ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 190px 120px, #ffe9c4 50%, transparent 51%),
    linear-gradient(180deg, #050718, #0d1240 70%, #1a1d5c);
  background-size: 230px 150px, 230px 150px, 230px 150px, 230px 150px, 100% 100%;
}
.masthead__row { padding-block: 10px 8px; }

.logo { display: inline-grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; color: #fff; text-decoration: none; min-height: 40px; }
.logo:hover { color: #fff; }
.logo__mark {
  width: 32px; height: 32px; border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, #fff8e0 0 18%, transparent 19%),
    radial-gradient(circle at 60% 62%, rgba(0,0,0,.18) 0 12%, transparent 13%),
    radial-gradient(circle at 40% 40%, #ffd98a, #f08a5d 60%, #7a2a6b);
  box-shadow: 0 0 14px rgba(255, 190, 120, .55), inset -5px -5px 0 rgba(0,0,0,.18);
  position: relative;
}
.logo__mark::after {
  content: ""; position: absolute; inset: 12px -7px;
  border: 2px solid rgba(255, 230, 190, .75); border-radius: 50%;
  transform: rotate(-18deg);
}
.logo__text {
  font: 30px/1 var(--pixel);
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 #000, 0 0 10px rgba(127, 245, 255, .4);
}
.logo__text b { color: var(--cyan); font-weight: normal; }
.logo__text i { color: var(--accent); font-style: normal; font-size: .7em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 3px 14px;
  font: bold 12px var(--ui);
  color: #000;
  background: linear-gradient(#fdfdfd, #d4d8e4);
  border: 2px solid; border-color: #fff #555 #555 #fff;
  cursor: pointer; white-space: nowrap;
}
.btn:active { border-color: #555 #fff #fff #555; }
a.btn, a.btn:hover { color: #000; text-decoration: none; }

/* phones: the six tabs sit in two rows of three, each a full-size tap target */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.tab {
  display: flex; align-items: center; justify-content: center;
  min-height: 40px;
  font: bold 12px var(--ui);
  color: #dfe6ff; text-decoration: none;
  background: linear-gradient(#3f55b8, #26378a);
  border: 1px solid #000;
}
.tab:hover { color: #fff; background: linear-gradient(#5a70d4, #33469e); }
.tab.is-active { color: var(--ink); background: var(--panel); }

/* second row inside Worlds and Arcade: one link per item */
.locbar { background: linear-gradient(180deg, #eef1fa, #c8d0e6); border-bottom: 1px solid #000; font-size: 12px; }
.subnav { display: flex; flex-wrap: wrap; font-weight: bold; }
.subnav a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 10px;
  color: #0033aa; text-decoration: none; border-right: 1px solid #8a95b8;
}
.subnav a:last-child { border-right: 0; }
.subnav a:hover { color: #cc3300; text-decoration: underline; }
.subnav a[aria-current="page"] { color: #000; background: #fff; box-shadow: inset 1px 1px 0 #8a95b8; }

@keyframes blink { 50% { opacity: .35; } }

@media (min-width: 600px) {
  .tabs { display: flex; gap: 2px; padding-top: 0; }
  .tab { min-height: 30px; padding: 0 16px; border-bottom: 0; border-radius: 6px 6px 0 0; }
  .subnav a { min-height: 30px; }
  .logo__text { font-size: 34px; }
}

/* ── Layout: one centred column; viewer pages get a second column on wide windows ── */
.page { padding-block: 14px 28px; }
.col { display: grid; gap: 14px; min-width: 0; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding-block: 14px 28px; align-items: start; }
.intro { margin: 0; color: #cfd8ff; font-size: 14px; }
.section-title { margin: 6px 0 -4px; font: 24px/1 var(--pixel); letter-spacing: 1px; color: var(--accent); font-weight: normal; }

/* ── Module (portal box) ───────────────────────── */
.module {
  background: var(--panel);
  border: 1px solid; border-color: var(--bevel-hi) var(--bevel-lo) var(--bevel-lo) var(--bevel-hi);
  box-shadow: 3px 3px 0 var(--shadow);
  min-width: 0;
}
.module > p, .module > ul, .module > ol, .module > dl, .module > table { margin: 10px 12px; }
.module__bar {
  margin: 0;
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  font: bold 12px/1.3 var(--ui);
  color: var(--bar-ink);
  background: linear-gradient(180deg, var(--bar-2), var(--bar-1));
  border-bottom: 1px solid #000;
  text-shadow: 1px 1px 0 rgba(0,0,0,.4);
}
.module--plain { background: transparent; border: 0; box-shadow: none; color: #cfd8ff; }
.module--plain .module__bar { background: none; border: 0; padding-inline: 0; color: var(--accent); }
.module--plain > p { margin-inline: 0; }
.module--plain a { color: var(--cyan); }

.fine { font-size: 11px; color: var(--muted); }
.module--plain .fine { color: #9aa5d6; }

.dot {
  display: inline-block; width: 8px; height: 8px; margin-right: 6px;
  background: var(--dot, #fff); box-shadow: 0 0 6px var(--dot, #fff);
  vertical-align: 1px;
}


/* ── Worlds ────────────────────────────────────── */
.world[hidden] { display: none; }
.world--compact .world__bar { font-size: 11px; }
.world--compact .world__rec { font-size: 13px; top: 4px; right: 6px; }
.world--compact .world__meta { padding: 5px 8px 7px; gap: 0; }
.world--compact .world__sector { font-size: 15px; }

.more { font-size: 11px; font-weight: bold; }
.symbol-day {
  margin: 10px 12px 4px; padding: 10px; display: grid; place-items: center;
  font: 12px/1.15 ui-monospace, Consolas, "Courier New", monospace;
  background: var(--panel-2); border: 1px solid; border-color: var(--bevel-lo) var(--bevel-hi) var(--bevel-hi) var(--bevel-lo);
}
.symbol-day__name { text-align: center; text-transform: uppercase; letter-spacing: 1px; margin-top: 0 !important; }

.world__bar { justify-content: space-between; padding-right: 4px; }
.world__title { margin: 0; font: inherit; display: flex; align-items: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.winbtns { display: flex; gap: 2px; flex: none; }
.winbtns button {
  width: 24px; height: 20px; padding: 0;
  font: bold 10px/1 var(--ui); color: #000;
  background: linear-gradient(#fdfdfd, #cfd4e2);
  border: 1px solid; border-color: #fff #333 #333 #fff;
  cursor: pointer;
}
.winbtns button:active, .winbtns button[aria-pressed="true"] { border-color: #333 #fff #fff #333; background: #bfc6da; }

.world__title a { color: inherit; text-decoration: none; }
.world__title a:hover { text-decoration: underline; color: #fff; }
.world--big .world__title { font-size: 14px; }

.world__screen { position: relative; background: #000; border-bottom: 1px solid #000; }
.world canvas {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 9;
  image-rendering: pixelated; image-rendering: crisp-edges;
}
.world__rec {
  position: absolute; top: 6px; right: 8px;
  font: 16px/1 var(--pixel); color: #ff5a5a;
  text-shadow: 1px 1px 0 #000;
  animation: blink 1.6s steps(2) infinite;
}
.world.is-paused .world__rec { color: #cfd8ff; animation: none; }
.world.is-paused .world__rec::after { content: " (paused)"; }

.world__meta { padding: 8px 10px 10px; display: grid; gap: 2px; }
.world__meta p { margin: 0; }
.world__sector { font: 17px/1.1 var(--pixel); color: var(--muted); letter-spacing: .5px; }


.pager { margin: 10px 12px; font-weight: bold; }

/* ── Plain layout + text pages ─────────────────── */
.plain { max-width: 820px; padding-block: 10px 24px; }
.prose { margin: 10px 12px; max-width: 65ch; }
.prose p { margin: 0 0 10px; }
.prose code { font: 12px ui-monospace, Consolas, monospace; background: var(--panel-2); padding: 0 3px; }
.plain .btn { text-decoration: none; }

/* ── Atlas table ───────────────────────────────── */
.table-scroll { overflow-x: auto; margin: 0 12px 12px; }
.atlas { width: 100%; border-collapse: collapse; font-size: 12px; }
.atlas th, .atlas td { padding: 6px 8px; text-align: left; border-bottom: 1px dotted var(--bevel-lo); white-space: nowrap; }
.atlas thead th { background: var(--panel-2); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.atlas tbody tr:hover { background: var(--panel-2); }
.atlas__ch { font: 18px var(--pixel); color: var(--accent); }

/* ── Journal ───────────────────────────────────── */
.entries { margin: 10px 12px; padding-left: 24px; }
.entries li { padding: 6px 0; border-bottom: 1px dotted var(--bevel-lo); }
.entries li:last-child { border-bottom: 0; }
.entries a { font-weight: bold; }
.entries p { margin: 2px 0 0; }
.entries--compact { list-style: square; }
.entries--compact li { padding: 3px 0; }

.prose--essay { font: 15px/1.7 Georgia, "Times New Roman", serif; max-width: 68ch; }
.prose--essay h2, .prose--essay h3 { font: bold 16px/1.3 var(--ui); margin: 20px 0 8px; }
.prose--essay hr { border: 0; border-top: 1px dashed var(--bevel-lo); margin: 20px 0; }
.prose--essay blockquote { margin: 12px 0; padding: 4px 12px; border-left: 3px solid var(--accent); color: var(--muted); }
.prose--essay p { margin: 0 0 14px; }
.prose--essay pre { overflow-x: auto; }

/* ── Arcade ────────────────────────────────────── */
.interactive-frame {
  margin: 0 12px 10px; background: #0a0a0a; color: #eee;
  border: 2px solid; border-color: #333 #888 #888 #333;
  min-height: 260px; overflow: hidden;
}
.interactive-content { padding: 16px; }
.interactive-content canvas { max-width: 100%; margin-inline: auto; }

/* ── Symbols ───────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 12px 12px; }
.chip {
  font: 11px var(--ui); text-transform: uppercase; letter-spacing: .5px; text-decoration: none;
  padding: 3px 8px; color: var(--ink); background: var(--panel-2);
  border: 1px solid; border-color: var(--bevel-hi) var(--bevel-lo) var(--bevel-lo) var(--bevel-hi);
}
.chip:hover { color: var(--link-hover); }
.chip.is-active { color: #fff; background: var(--bar-1); border-color: #000; }

.symbols {
  list-style: none; margin: 0 12px 12px; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px;
}
.symbol {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px; cursor: pointer; color: var(--ink); background: var(--panel-2);
  border: 1px solid; border-color: var(--bevel-hi) var(--bevel-lo) var(--bevel-lo) var(--bevel-hi);
  position: relative;
}
.symbol:hover { border-color: var(--accent); }
.symbol:active { border-color: var(--bevel-lo) var(--bevel-hi) var(--bevel-hi) var(--bevel-lo); }
.symbol__art {
  margin: 0; flex: 1; display: grid; place-items: center; width: 100%;
  font: 11px/1.15 ui-monospace, Consolas, "Courier New", monospace; overflow: hidden;
}
.symbol__name { font: 10px var(--ui); text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.symbol.is-copied::after {
  content: "✓ copied"; position: absolute; inset: auto 6px 6px; padding: 2px 0;
  font: 16px var(--pixel); color: #000; background: #3dff6a;
}

.empty { color: #cfd8ff; text-align: center; font: 22px var(--pixel); }

/* ── Info panels (worlds, toys, visuals) ── */
.stats { display: grid; gap: 6px; }
.stats div { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stats dt { font-size: 11px; }
.stats dd { margin: 0; font: 18px/1 var(--pixel); }
.stats dd.fine { font: 11px/1.3 var(--ui); text-align: right; }

/* ── Footer ────────────────────────────────────── */
.footer { border-top: 1px solid #2a3470; background: #000; color: #9aa5d6; font-size: 11px; text-align: center; }
.footer p { margin: 0; padding-block: 4px; }
.footer a { color: var(--cyan); display: inline-block; padding: 12px 8px; }

/* ── Viewer pages (worlds, toys): screen + info panel ── */
.layout--sidebar .col--right { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
[data-weather] { white-space: nowrap; }

/* World page: the screen never pushes its title bar or the pager below the fold.
   240px = header + card title bar + pager + breathing room. */
.world--big .world__screen { display: flex; justify-content: center; }
.world--big canvas {
  width: min(100%, calc((100vh - 240px) * 16 / 9));
  width: min(100%, calc((100svh - 240px) * 16 / 9));
  min-width: min(100%, 320px);
}

/* prev / All / next under a world, toy or visual: 3 fixed columns so links never move */
.pager-strip {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  margin-top: 10px; padding: 0 12px; font-weight: bold;
  background: var(--panel); box-shadow: 3px 3px 0 var(--shadow);
  border: 1px solid; border-color: var(--bevel-hi) var(--bevel-lo) var(--bevel-lo) var(--bevel-hi);
}
.pager-strip a { display: flex; align-items: center; min-height: 40px; }
.pager-strip a[rel="prev"] { justify-self: start; }
.pager-strip a[rel="next"] { justify-self: end; }

/* Toy page: one fixed-height stage for every toy, sized so the pager stays on screen.
   Toys size themselves against --stage (see app/content/arcade/*.html). */
.toy { --stage: clamp(260px, calc(100vh - 250px), 520px); }
@supports (height: 100svh) { .toy { --stage: clamp(260px, calc(100svh - 250px), 520px); } }
.toy .module__bar { min-height: 29px; }
.toy .world__title { font-size: 14px; }
.toy .interactive-frame { margin: 0; height: var(--stage); min-height: 0; border: 0; border-top: 1px solid #000; display: flex; }
.toy .interactive-content { flex: 1; min-width: 0; padding: 16px; display: flex; flex-direction: column; justify-content: center; overflow: auto; }

/* ── Visuals ───────────────────────────────────── */
/* The video keeps its own shape: as wide as the box, never taller than the window leaves room for,
   never cropped (object-fit) and never wider than the screen. Phones stack video, caption, pager. */
.visual-page {
  display: grid; gap: 14px; align-items: start;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "video" "caption" "pager";
}
.visual-page > .visual { grid-area: video; }
.visual-page__caption { grid-area: caption; }
.visual-page__pager { grid-area: pager; margin-top: 0; }
.visual__screen { background: #000; border-top: 1px solid #000; }
.visual__screen video {
  display: block; margin-inline: auto; background: #000;
  width: auto; height: auto; max-width: 100%;
  max-height: calc(100vh - 150px);
  max-height: calc(100svh - 150px);
  aspect-ratio: auto 9 / 16; object-fit: contain;
}
.visual__caption { white-space: pre-line; font-style: italic; }
.visual-thumb { position: relative; display: block; background: #000; }
.visual-thumb img { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; object-fit: cover; }
.visual-thumb__length { position: absolute; right: 4px; bottom: 4px; padding: 1px 5px; background: #000; color: #fff; font-size: 11px; }

/* Home: the newest visual */
.hero__body { display: grid; gap: 12px; padding: 12px; grid-template-columns: minmax(0, 1fr); }
.hero__poster { width: min(100%, calc(60vh * 9 / 16)); width: min(100%, calc(60svh * 9 / 16)); margin-inline: auto; }
.hero__play {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 44px; color: #fff; background: rgba(0, 0, 0, .18); text-shadow: 0 0 12px #000;
}
.hero__title { margin: 0 0 6px; font: 28px/1.1 var(--pixel); letter-spacing: .5px; }
.hero__title a { text-decoration: none; }
.hero__text p { margin: 0 0 10px; }

.world-info__place { font: 26px/1 var(--pixel); letter-spacing: 1px; margin-bottom: 2px !important; }
.world-info__sector { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 0 !important; }
.world-info__note { font-style: italic; padding: 6px 10px; background: var(--panel-2); border-left: 3px solid var(--accent); }

/* ── Tap targets: 40px minimum on phones ───────── */
.chip { display: inline-flex; align-items: center; min-height: 40px; padding-inline: 12px; }
.entries a { display: inline-block; padding-block: 10px; }
.entries--compact li { padding: 0; }
.entries--compact a { display: block; }
.more a, .atlas a, .prose a { display: inline-block; padding-block: 10px; }
.cluster a:not(.btn) { display: inline-flex; align-items: center; min-height: 40px; }
@media (max-width: 599px) {
  .winbtns button { width: 40px; height: 40px; font-size: 12px; }
  .world__bar { min-height: 46px; }
  .world--compact .world__meta a { display: inline-block; padding-block: 10px; }
}

/* ── Wider windows ─────────────────────────────── */
@media (min-width: 600px) {
  .hero__body { grid-template-columns: 210px minmax(0, 1fr); }
  .hero__poster { width: 100%; margin: 0; }
  .chip { min-height: 32px; }
  .entries a { padding-block: 6px; }
  .entries--compact a { padding-block: 4px; }
}
@media (min-width: 900px) {
  .layout.layout--sidebar { grid-template-columns: minmax(0, 1fr) 300px; }
  .layout--sidebar .col--right { grid-template-columns: minmax(0, 1fr); }
  .visual-page {
    grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
    grid-template-areas: "video caption" "pager caption";
  }
}

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