/* Phone gallery in the game panels' Arcade style (docs/panel-ui.md); prototype in tools/gallery-prototype.html. */
@font-face {
  font-family: "Press Start 2P";
  src: url("/fonts/PressStart2P-Regular.ttf");
  font-display: swap;
}
@font-face {
  font-family: "Monoton";
  src: url("/fonts/Monoton-Regular.ttf");
  font-display: swap;
}
@font-face {
  font-family: "Chakra Petch";
  src: url("/fonts/ChakraPetch-Regular.ttf");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Chakra Petch";
  src: url("/fonts/ChakraPetch-SemiBold.ttf");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Chakra Petch";
  src: url("/fonts/ChakraPetch-Bold.ttf");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #140a2e;
  --raised: #1f1247;
  --ink: #f3edff;
  --muted: #b9a9e6;
  --pink: #ff3fa4;
  --cyan: #2de2ff;
  --yellow: #ffe14d;
  --line: rgba(243, 237, 255, 0.16);
  --display: "Press Start 2P", ui-monospace, monospace;
  --body: "Chakra Petch", system-ui, sans-serif;
  --neon: "Monoton", "Press Start 2P", cursive;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { position: relative; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--body); }
body.viewing { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

/* ---------- Page ---------- */
.synth {
  position: absolute; left: 0; right: 0; bottom: 0; height: 240px; pointer-events: none; opacity: 0.5;
  background:
    linear-gradient(to bottom, var(--bg), transparent 45%),
    repeating-linear-gradient(to right, rgba(255, 63, 164, 0.35) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(to bottom, rgba(255, 63, 164, 0.35) 0 1px, transparent 1px 32px);
  transform: perspective(240px) rotateX(55deg); transform-origin: bottom;
}
.page { position: relative; max-width: 720px; min-height: 100vh; margin: 0 auto; padding: 0 16px 120px; }
.topbar { padding: 16px 0 14px; border-bottom: 1px solid var(--line); }
.brand { font: 10px/1.7 var(--display); color: var(--pink); text-shadow: 0 0 8px rgba(255, 63, 164, 0.7); letter-spacing: 0.02em; }
.brand small { display: block; color: var(--muted); text-shadow: none; font-size: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 4px; border: 2px solid var(--cyan); background: transparent; color: var(--cyan); font-weight: 700; letter-spacing: 0.02em;
  box-shadow: 0 0 12px rgba(45, 226, 255, 0.25), inset 0 0 12px rgba(45, 226, 255, 0.12);
}
.btn.solid { background: var(--cyan); color: var(--bg); }
.btn:disabled { opacity: 0.6; cursor: default; }
.hero { padding: 26px 0 18px; display: grid; gap: 10px; }
.hero .who { font: 13px/1.6 var(--display); color: var(--yellow); text-shadow: 0 0 10px rgba(255, 225, 77, 0.5); text-wrap: balance; }
.hero h1 { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 700; text-wrap: balance; }
.hero .count { display: inline-flex; width: max-content; align-items: center; font: 9px/1 var(--display); color: var(--cyan); border: 1px solid rgba(45, 226, 255, 0.5); border-radius: 4px; padding: 7px 9px; }
/* minmax(0, …) and absolute images keep a large photo from stretching its tile. */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { position: relative; padding: 0; border: 0; border-radius: 4px; background: var(--raised); aspect-ratio: 16 / 9; display: grid; place-items: center; }
/* Upright phone photos are cropped to 16:9; keep the upper part, where faces usually are. */
.tile img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; border-radius: 4px; outline: 1px solid var(--line); }
.tile:hover img { outline: 2px solid var(--cyan); box-shadow: 0 0 14px rgba(45, 226, 255, 0.4); }
.tile .ph { font-size: 13px; color: var(--muted); padding: 8px; text-align: center; }
.tile.feature { grid-column: 1 / -1; }
.tag { position: absolute; left: 8px; top: 8px; font: 8px/1 var(--display); padding: 6px 7px; border-radius: 3px; background: rgba(20, 10, 46, 0.85); color: var(--yellow); }
/* The closing-frame highlight (docs/panel-ui.md), played twice for a newly arrived photo. */
.tile.is-new::after {
  content: ""; position: absolute; inset: -16px; border: 2px solid var(--yellow); border-radius: 6px;
  box-shadow: 0 0 12px rgba(255, 225, 77, 0.7); animation: close-in 2s ease-in-out 2 forwards; pointer-events: none;
}
@keyframes close-in { 0% { inset: -16px; opacity: 0; } 20% { opacity: 1; } 85% { inset: 0; opacity: 1; } 100% { inset: 0; opacity: 0; } }
@keyframes blink { 50% { opacity: 0.25; } }
.more { margin-top: 18px; }

/* ---------- Full-screen messages ---------- */
.message { min-height: 640px; display: grid; align-content: center; justify-items: center; text-align: center; gap: 18px; padding: 24px 8px 60px; }
.message .big { font: 30px/1.15 var(--neon); color: var(--pink); text-shadow: 0 0 6px var(--pink), 0 0 22px rgba(255, 63, 164, 0.6); letter-spacing: 0.02em; word-spacing: 0.35em; }
.message .big.cyan { color: var(--cyan); text-shadow: 0 0 6px var(--cyan), 0 0 22px rgba(45, 226, 255, 0.6); }
.message .big.yellow { color: var(--yellow); text-shadow: 0 0 6px var(--yellow), 0 0 22px rgba(255, 225, 77, 0.5); }
.message h1 { margin: 0; font-size: 22px; line-height: 1.25; text-wrap: balance; max-width: 22ch; }
.message p { margin: 0; color: var(--muted); max-width: 30ch; }
.blinker { font: 11px/1.6 var(--display); color: var(--yellow); animation: blink 1.1s steps(2) infinite; }
.loadbar { width: 200px; height: 18px; border: 2px solid var(--cyan); border-radius: 3px; padding: 3px; box-shadow: 0 0 12px rgba(45, 226, 255, 0.35); }
.loadbar i { display: block; height: 100%; width: 30%; background: repeating-linear-gradient(to right, var(--cyan) 0 10px, transparent 10px 14px); animation: load 1.6s steps(8) infinite; }
@keyframes load { from { width: 8%; } to { width: 100%; } }
.card-icon { width: 92px; height: 60px; border: 3px solid var(--cyan); border-radius: 8px; position: relative; box-shadow: 0 0 14px rgba(45, 226, 255, 0.5); animation: breathe 2.4s ease-in-out infinite; }
.card-icon::before { content: ""; position: absolute; left: 12px; top: 12px; width: 18px; height: 14px; border-radius: 3px; background: var(--yellow); }
@keyframes breathe { 50% { transform: scale(1.05); box-shadow: 0 0 26px rgba(45, 226, 255, 0.75); } }

/* ---------- Viewer: full screen, swipe, double-tap zoom ---------- */
.viewer { position: fixed; inset: 0; z-index: 10; background: #000; touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden; }
.track { position: absolute; inset: 0; }
.slide { position: absolute; inset: 0; display: grid; place-items: center; will-change: transform; }
.slide img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; transform-origin: center; color: var(--muted); }
.vbar { position: absolute; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; transition: opacity 0.2s; z-index: 2; }
.vbar.top { top: 0; padding-top: max(12px, env(safe-area-inset-top)); background: linear-gradient(rgba(0, 0, 0, 0.7), transparent); }
.vbar.bottom { bottom: 0; padding-bottom: max(22px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0, 0, 0, 0.75)); flex-direction: column; }
.viewer.chrome-off .vbar, .viewer.zoomed .vbar, .viewer.zoomed .arrow { opacity: 0; pointer-events: none; }
.counter { font: 11px/1 var(--display); color: var(--yellow); }
.x { width: 44px; height: 44px; border-radius: 4px; border: 2px solid rgba(243, 237, 255, 0.6); background: rgba(0, 0, 0, 0.35); font-size: 22px; line-height: 1; }
.dots { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; max-width: 90%; }
.dots i { width: 7px; height: 7px; border-radius: 1px; background: rgba(243, 237, 255, 0.35); }
.dots i.on { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.vstatus { min-height: 20px; font-size: 14px; color: var(--muted); text-align: center; }
.swipe-hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 10px/1.8 var(--display); color: var(--ink);
  background: rgba(20, 10, 46, 0.85); border: 1px solid var(--cyan); border-radius: 4px; padding: 10px 14px; text-align: center;
  z-index: 3; pointer-events: none; transition: opacity 0.4s;
}
.swipe-hint.gone { opacity: 0; }
.arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; border-radius: 4px; background: rgba(0, 0, 0, 0.35); font-size: 26px; z-index: 2; display: none; }
.arrow.prev { left: 8px; }
.arrow.next { right: 8px; }
@media (hover: hover) and (pointer: fine) {
  .arrow { display: block; }
  .arrow:disabled { opacity: 0.25; cursor: default; }
}

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