@font-face {
  font-family: "Berkeley Mono";
  src: url("/fonts/BerkeleyMonoVariable.woff2") format("woff2");
  font-weight: 400;
  font-display: block;
}

/* the(os) hive red on a near-black, red-HUD terminal */
:root {
  --black: #0d0b10;
  --panel: #131017;
  --line: #2a1418;
  --text: #c2c2c2;
  --muted: #8e8e8e;
  --red: #8a3233;
  --red-hi: #d0474a;
  --dock-h: 52px;
  --nav-h: 44px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--black); color: var(--text); }
body {
  font: 400 15px/1.5 "Berkeley Mono", ui-monospace, monospace;
  -webkit-font-smoothing: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, a { font: inherit; color: inherit; background: none; border: 0; text-decoration: none; }
button { cursor: pointer; }

#bg { position: fixed; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; z-index: 0; }

.screen {
  position: fixed; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(env(safe-area-inset-top) + var(--nav-h)) 16px calc(env(safe-area-inset-bottom) + var(--dock-h) + 28px);
}
.screen[hidden] { display: none; }

.term { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 16px; }
.line { min-height: 1.5em; white-space: pre; }
.line.cursor::after { content: "█"; color: var(--red-hi); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* HUD button: thin red frame with corner brackets, no 3D */
.hud {
  position: relative; align-self: flex-start;
  padding: 12px 20px; color: var(--red-hi);
  border: 1px solid rgba(208, 71, 74, 0.28);
  background: rgba(13, 11, 16, 0.85);
}
.hud::before, .hud::after {
  content: ""; position: absolute; width: 8px; height: 8px; border: 2px solid var(--red-hi);
}
.hud::before { top: -3px; left: -3px; border-right: 0; border-bottom: 0; }
.hud::after { bottom: -3px; right: -3px; border-left: 0; border-top: 0; }
.hud:active { background: var(--red); color: var(--text); }
.hud:disabled { color: var(--muted); }
.hud.wide { align-self: stretch; text-align: center; }

.link { color: var(--red-hi); padding: 8px 0; }

/* folder */
.folder { display: flex; flex-direction: column; align-items: center; gap: 12px; }
#folder-art svg { width: 140px; height: auto; image-rendering: pixelated; display: block; }
.folder:active #folder-art { transform: translateY(2px); }
.folder-name { font-size: 13px; }

/* gallery */
#s-gallery, #s-pay { justify-content: flex-start; padding-left: 0; padding-right: 0; }
#s-gallery { background: var(--black); }
.bar {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 4px 16px; min-height: 44px; font-size: 13px;
}
.views { display: flex; gap: 16px; }
.view { color: var(--muted); display: flex; align-items: center; gap: 6px; padding: 8px 0; }
.view i, .steps i { width: 6px; height: 6px; background: #3a2226; display: inline-block; flex: none; }
.view.on { color: var(--text); }
.view.on i { background: var(--red-hi); box-shadow: 0 0 6px var(--red-hi); }
.count { color: var(--muted); min-width: 5ch; text-align: right; }

.grid {
  flex: 1; width: 100%; overflow-y: auto; padding: 2px 2px 16px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; align-content: start;
}
.grid[hidden] { display: none; }
.grid button { aspect-ratio: 1; overflow: hidden; display: block; }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; }

.track {
  flex: 1; width: 100%; display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
}
.track[hidden] { display: none; }
.track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; display: flex; align-items: center; justify-content: center; padding: 0 8px; }
.slide img { max-width: 100%; max-height: 100%; object-fit: contain; -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; }

/* pay: calm, compact */
#s-pay { overflow-y: auto; background: var(--black); padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }
.pay { width: 100%; max-width: 420px; padding: 4px 16px 24px; display: flex; flex-direction: column; gap: 18px; }
.receipt { border: 1px dashed #3a2226; padding: 14px 14px 10px; font-size: 14px; }
.receipt-head { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.r-row { display: flex; justify-content: space-between; padding: 4px 0; }
.r-total { border-top: 1px dashed #3a2226; margin-top: 6px; padding-top: 8px; }
.tip { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); }
.tipwrap { display: flex; align-items: center; gap: 2px; color: var(--text); }
#tip { width: 7ch; text-align: right; border-bottom: 1px solid var(--red); padding: 2px 0; outline: none; font-size: 16px; }
#tip::placeholder { color: var(--muted); }
.err { color: var(--red-hi); font-size: 13px; }

/* paid */
.contact { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; font-size: 14px; }
.contact > label { color: var(--muted); }
#email { border-bottom: 1px solid var(--red); padding: 6px 0; outline: none; font-size: 16px; }
#email::placeholder { color: var(--muted); }
.check { display: flex; gap: 10px; align-items: center; }
.check input { width: 16px; height: 16px; accent-color: var(--red); }
.note { color: var(--muted); font-size: 13px; }

/* bottom dock */
.dock {
  position: fixed; z-index: 2; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  height: var(--dock-h); padding: 0 24px; white-space: nowrap;
}
.dock[hidden] { display: none; }

/* step header */
.steps {
  position: fixed; z-index: 3; top: 0; left: 0; right: 0;
  padding: env(safe-area-inset-top) 8px 0;
  height: calc(env(safe-area-inset-top) + var(--nav-h));
  display: flex; justify-content: space-between; align-items: center;
  background: var(--black); border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.steps button { color: var(--muted); padding: 12px 4px; cursor: default; display: flex; align-items: center; gap: 6px; }
.steps button.reached { color: var(--text); cursor: pointer; }
.steps button.reached i { background: var(--red); }
.steps button.here { color: var(--text); }
.steps button.here i { background: var(--red-hi); box-shadow: 0 0 6px var(--red-hi); }

/* positive feedback */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#fx svg, #fx b { position: absolute; image-rendering: pixelated; }
#fx b { width: 6px; height: 6px; background: #f4d35e; }

@media (prefers-reduced-motion: reduce) { .line.cursor::after { animation: none; } }
