/* ufoscene Pi — Amiga demo look on top of plain, readable HTML.
   Colours are 12-bit (#rgb) like the OCS palette. Motion stops under prefers-reduced-motion
   and with the "calm" toggle (body.calm). */

:root {
  --bg: #002;
  --panel: #113;
  --panel2: #224;
  --text: #eee;
  --dim: #aac;
  --orange: #f80;
  --yellow: #fd0;
  --blue: #05b;
  --cyan: #0cf;
  --magenta: #f0c;
  --green: #0f8;
  --red: #f44;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  font: 17px/1.55 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { width: min(1100px, 100% - 2rem); margin: 0 auto; flex: 1; padding: 1rem 0 3rem; position: relative; z-index: 1; }
a { color: var(--cyan); }
a:hover { color: var(--yellow); }
h1, h2, h3 { font-family: var(--mono); line-height: 1.2; letter-spacing: .02em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); color: var(--yellow); }
h2 { font-size: 1.3rem; color: var(--orange); }
img { max-width: 100%; }
.small { font-size: .9rem; color: var(--dim); }
.lead { font-size: 1.15rem; max-width: 60ch; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--yellow); color: #000; padding: .5rem; z-index: 10; }
.skip:focus { left: .5rem; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* ---------- background starfield ---------- */
#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: .7; }

/* ---------- header: copper bars, scroller, nav ---------- */
.top { position: relative; z-index: 2; background: #000; border-bottom: 2px solid var(--panel2); overflow: hidden; }
.copper { position: absolute; inset: 0; pointer-events: none; }
.copper i {
  position: absolute; left: 0; right: 0; height: 14px; top: 10px;
  background: linear-gradient(#300, #f40, #fd0, #f40, #300);
  animation: copper 4s ease-in-out infinite alternate;
  opacity: .55;
}
.copper i:nth-child(2) { background: linear-gradient(#003, #05b, #0cf, #05b, #003); animation-delay: -1.3s; }
.copper i:nth-child(3) { background: linear-gradient(#030, #0a4, #fd0, #0a4, #030); animation-delay: -2.6s; }
@keyframes copper { from { transform: translateY(0); } to { transform: translateY(34px); } }

#scroller { display: block; position: relative; width: 100%; height: 64px; image-rendering: pixelated; image-rendering: crisp-edges; }

.nav { position: relative; display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; align-items: center; padding: .6rem 1rem; background: rgba(0, 0, 34, .85); font-family: var(--mono); }
.nav a { color: var(--text); text-decoration: none; }
.nav a:hover, .nav a[aria-current] { color: var(--yellow); }
.brand { margin-right: auto; font-weight: 800; }
.logo { color: var(--orange); letter-spacing: .12em; text-shadow: 2px 2px 0 #800, 4px 4px 0 #300; }
.logo-pi { color: var(--cyan); margin-left: .35rem; text-shadow: 2px 2px 0 #036; }

/* ---------- hero ---------- */
.hero { padding: 2.5rem 0 1rem; }
.pixel { font-family: var(--mono); font-weight: 900; text-transform: uppercase; letter-spacing: .08em;
  background: linear-gradient(var(--yellow) 0 30%, var(--orange) 30% 55%, var(--magenta) 55% 80%, var(--cyan) 80%);
  -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; }
.hero h1 { font-size: clamp(2.2rem, 7vw, 4.5rem); margin: 0 0 .5rem; filter: drop-shadow(3px 3px 0 #000); }
.cta { display: flex; gap: 1rem; flex-wrap: wrap; }

/* the hero with a TV beside it, and the frames from the demos (drawn at 384×216, scaled up whole) */
.hero-tv { display: grid; grid-template-columns: 1.15fr 1fr; gap: 2rem; align-items: center; }
@media (max-width: 800px) { .hero-tv { grid-template-columns: 1fr; } }
.tv { margin: 0; background: #111; border: 3px solid #334; border-radius: 14px; padding: 12px 12px 24px; position: relative;
  box-shadow: 0 0 48px #05b8, 6px 6px 0 #000; }
.tv::after { content: ""; position: absolute; bottom: 8px; left: 50%; width: 7px; height: 7px; margin-left: -3px; border-radius: 50%; background: var(--red); }
.tv img, .shots img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.shots { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.shots img { border: 2px solid var(--panel2); }
.shots figure { margin: 0; }
.shots figcaption { font: .85rem var(--mono); color: var(--dim); margin-top: .3rem; }
.party-teaser { margin: 1rem 0 2.5rem; }
.setup { width: 100%; height: auto; max-width: 640px; }

/* Ukraine's blue and yellow down the side of what the money does */
.ukraine, .ukraine-box { border-left: 6px solid; border-image: linear-gradient(var(--blue) 50%, var(--yellow) 50%) 1; }
.ukraine-box { background: var(--panel); padding: .2rem 1.2rem 1.2rem; margin: 1.5rem 0; }
.ukraine-box h2 { color: var(--yellow); }
.ticks { padding-left: 1.3rem; }
.ticks li { margin: .4rem 0; }
.ticks li::marker { content: "▶  "; color: var(--orange); font-size: .8em; }
.split.even { grid-template-columns: 1fr 1fr; }
@media (max-width: 800px) { .split.even { grid-template-columns: 1fr; } }
.nopi { margin-top: 2rem; }
.nopi h2 { margin-top: .6rem; }

.btn, button.btn {
  display: inline-block; font: 700 1rem var(--mono); padding: .7rem 1.2rem; border: 0; cursor: pointer;
  color: #000; background: var(--yellow); text-decoration: none; box-shadow: 4px 4px 0 var(--blue);
}
.btn:hover { background: var(--orange); color: #000; }
.btn.alt { background: var(--panel2); color: var(--text); box-shadow: 4px 4px 0 #000; }
.btn.alt:hover { background: var(--blue); color: var(--yellow); }
.linkish { background: none; border: 0; color: var(--cyan); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
form.inline { display: inline; }

.steps ol { counter-reset: s; list-style: none; padding: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps li { counter-increment: s; background: var(--panel); padding: 1rem; border-left: 4px solid var(--orange); }
.steps li::before { content: counter(s); font: 900 1.6rem var(--mono); color: var(--yellow); display: block; }

.split { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; }
@media (max-width: 800px) { .split { grid-template-columns: 1fr; } }

/* ---------- listing cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.card { display: flex; flex-direction: column; background: var(--panel); color: var(--text); text-decoration: none; border: 2px solid var(--panel2); }
.card:hover { border-color: var(--yellow); color: var(--text); }
.card img, .nophoto { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; background: #000; }
.nophoto { display: grid; place-items: center; font: 900 4rem var(--mono); color: var(--panel2); }
.card-title { font-family: var(--mono); font-weight: 700; padding: .5rem .7rem 0; }
.card-meta { padding: 0 .7rem .6rem; color: var(--dim); font-size: .9rem; }
.tag { color: var(--green); font-weight: 600; }
.tag.warn { color: var(--yellow); }

/* ---------- hi-score: arcade attract screen ---------- */
.board { background: #000; border: 2px solid var(--blue); padding: 1rem 1.2rem; }
.board h1, .board h2.pixel { text-align: center; margin-top: 0; }
.hiscore { width: 100%; border-collapse: collapse; font: 700 1.05rem var(--mono); text-transform: uppercase; }
.hiscore th { color: var(--cyan); font-size: .8rem; text-align: left; padding: .2rem .4rem; }
.hiscore td { padding: .25rem .4rem; }
.hiscore .num { text-align: right; }
.hiscore .initials { letter-spacing: .3em; }
.hiscore tr:nth-child(5n+1) td { color: var(--yellow); }
.hiscore tr:nth-child(5n+2) td { color: var(--orange); }
.hiscore tr:nth-child(5n+3) td { color: var(--magenta); }
.hiscore tr:nth-child(5n+4) td { color: var(--cyan); }
.hiscore tr:nth-child(5n+5) td { color: var(--green); }
.hiscore tr.rank1 td { animation: blink 1.2s steps(2) infinite; }
.hiscore .empty { text-align: center; color: var(--dim); }
.hiscore .own { color: var(--dim); }
@keyframes blink { 50% { color: #fff; } }
.fund { font: 700 .8rem var(--mono); background: var(--blue); color: var(--yellow); padding: .05rem .35rem; }
.totals { list-style: none; padding: 0; font-family: var(--mono); }
.board.big { max-width: 640px; margin: 1rem auto; }
.tabs { display: flex; gap: 1rem; justify-content: center; font-family: var(--mono); margin-bottom: .8rem; }
.tabs a[aria-current] { color: var(--yellow); text-decoration: none; }

/* ---------- forms ---------- */
form label { display: block; margin: .7rem 0; }
form label.check { display: flex; gap: .5rem; align-items: baseline; }
input, select, textarea {
  font: inherit; color: var(--text); background: #001; border: 2px solid var(--panel2); padding: .45rem .55rem;
  width: 100%; max-width: 32rem; display: block; margin-top: .2rem;
}
input[type=checkbox], input[type=radio] { width: auto; display: inline; accent-color: var(--yellow); }
input[type=number] { max-width: 10rem; display: inline-block; }
input:focus, select:focus, textarea:focus { border-color: var(--yellow); outline: none; }
fieldset { border: 2px solid var(--panel2); margin: 1rem 0; max-width: 40rem; }
legend { font-family: var(--mono); color: var(--orange); padding: 0 .3rem; }
.fund-choice { display: block; margin: .5rem 0; }
.reserve, .give, .step { background: var(--panel); padding: 1rem 1.2rem; margin: 1.5rem 0; border-top: 4px solid var(--yellow); }
.notice { background: var(--panel2); padding: .7rem 1rem; border-left: 4px solid var(--cyan); }
.notice.pi2 { border-left-color: var(--yellow); margin: 1rem 0; }
.notice.pi2 ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.error { background: #300; padding: .7rem 1rem; border-left: 4px solid var(--red); }
.narrow { max-width: 34rem; }

/* arcade letter picker built by demo.js on top of the plain input */
.arcade { display: inline-flex; gap: .6rem; margin-top: .4rem; }
.arcade .slot { display: flex; flex-direction: column; align-items: center; }
.arcade .slot button { background: var(--panel2); color: var(--yellow); border: 0; width: 2.6rem; font: 700 1rem var(--mono); cursor: pointer; }
.arcade .slot button:hover { background: var(--blue); }
.arcade .slot output { font: 900 2rem/1.2 var(--mono); color: var(--yellow); width: 2.6rem; text-align: center; background: #000; border: 2px solid var(--blue); }

/* ---------- listing & purchase ---------- */
.photos { display: flex; gap: .5rem; flex-wrap: wrap; }
.photos img { max-height: 320px; border: 2px solid var(--panel2); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; }
.facts dt { color: var(--dim); }
.facts dd { margin: 0; }
.seller-text { border-left: 4px solid var(--panel2); margin: 1rem 0; padding: .3rem 1rem; font-style: italic; }
.status b { color: var(--yellow); font-family: var(--mono); }
.code { font-family: var(--mono); letter-spacing: .15em; color: var(--yellow); }
address { font-style: normal; background: #000; padding: .7rem 1rem; display: inline-block; font-family: var(--mono); }
.rows { padding-left: 1.2rem; }
.text { max-width: 62ch; }
.flash ol li { margin: .6rem 0; }
.flash code.copy, .flash pre { display: inline-block; max-width: 100%; overflow-x: auto; background: #000; color: var(--cyan); font-family: var(--mono); font-size: .85rem; padding: .4rem .7rem; margin-top: .3rem; user-select: all; }
.flash pre { display: block; white-space: pre; }
.help-toc { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin: 1rem 0 1.5rem; }
.help section { margin-top: 1.5rem; }
.help details { border-left: 4px solid var(--panel2); padding: .3rem 0 .3rem .8rem; margin: .4rem 0; }
.help details[open] { border-left-color: var(--cyan); }
.help summary { cursor: pointer; font-weight: bold; }
.help pre { background: #000; color: var(--cyan); font-family: var(--mono); font-size: .85rem; padding: .4rem .7rem; overflow-x: auto; white-space: pre; }
.guides section { background: var(--panel); padding: .2rem 1.2rem .8rem; margin-top: 1.5rem; }
.guides .needs { color: var(--dim); font-size: .95rem; margin-top: 0; }
.guide-steps { counter-reset: g; list-style: none; padding: 0; margin: .5rem 0; }
.guide-steps > li { counter-increment: g; position: relative; padding: .5rem 0 .5rem 2.6rem; border-top: 1px dashed var(--panel2); }
.guide-steps > li:first-child { border-top: 0; }
.guide-steps > li::before { content: counter(g); position: absolute; left: 0; top: .55rem; width: 1.9rem; text-align: center; background: var(--orange); color: #000; font: bold .95rem/1.6 var(--mono); }
.guide-steps p { margin: 0; }
.guide-steps pre { margin: .4rem 0 0; user-select: all; white-space: pre-wrap; word-break: break-all; }
.guides .more { margin: .2rem 0 0; font-size: .95rem; }
.fund-card { background: var(--panel); padding: .5rem 1.2rem 1rem; margin: 1rem 0; }

/* ---------- admin ---------- */
table.admin { width: 100%; border-collapse: collapse; font-size: .9rem; margin-bottom: 2rem; }
table.admin th, table.admin td { text-align: left; padding: .3rem .4rem; border-bottom: 1px solid var(--panel2); vertical-align: top; }
table.admin tr.overdue td { background: #310; }
table.admin tr.muted td { opacity: .5; }
table.admin input { display: inline; width: 4.5rem; padding: .1rem .3rem; }
.fund-edit { background: var(--panel); padding: .5rem 1rem 1rem; margin: 1rem 0; }

/* ---------- footer ---------- */
.foot { position: relative; z-index: 1; background: #000; border-top: 2px solid var(--panel2); padding: 1rem; text-align: center; font-size: .9rem; }
.langs { display: flex; flex-wrap: wrap; gap: .4rem 1rem; justify-content: center; font-family: var(--mono); }
.langs a[aria-current] { color: var(--yellow); text-decoration: none; }

.guru { margin: 3rem auto; max-width: 40rem; border: 4px solid var(--red); padding: 1rem 1.5rem; font-family: var(--mono); color: var(--red); background: #000; animation: blink 1s steps(2) infinite; }

/* ---------- calm: no motion at all ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body.calm *, body.calm *::before, body.calm *::after { animation: none !important; transition: none !important; }
