/* pls: the sky is the page; small retro windows float over it */
:root {
  --face: #d9d5cc;
  --hi: #ffffff;
  --lo: #85827b;
  --dk: #1c1a17;
  --mid: #e9e6df;
  --ink: #1c1a2e;
  --bar-a: #2b56c9;
  --bar-b: #8ec5f3;
  --sun: #ffc83d;
  --ui: Tahoma, Verdana, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #f2d9c6; color: var(--ink); font: 13px/1.35 var(--ui); -webkit-font-smoothing: antialiased; }
body { background: linear-gradient(180deg, #86b6ec 0%, #c4dcf6 40%, #f7e2d2 78%, #f2d9c6 100%); }
img { max-width: 100%; }
a { color: inherit; }
p { margin: 0; }
[hidden] { display: none !important; }
canvas#sky { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; z-index: 0; opacity: 0; transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1); }
canvas#sky.on { opacity: 1; }
canvas#sky:active { cursor: grabbing; }
/* the name over a creature under the pointer: a 98 tooltip */
.tip { position: fixed; left: 0; top: 0; z-index: 6; padding: 2px 6px; background: #ffffe1; color: var(--ink); font: 12px/1.3 var(--ui); white-space: nowrap; pointer-events: none; box-shadow: inset 0 0 0 1px var(--dk), 2px 2px 0 rgba(28, 26, 46, 0.22); }

/* ── a window ── */
.win {
  position: fixed; z-index: 10; background: var(--face); padding: 3px;
  box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--mid), inset -2px -2px var(--lo), inset 2px 2px var(--hi), 0 14px 40px -12px rgba(40, 30, 80, 0.45);
}
.bar {
  display: flex; align-items: center; gap: 6px; height: 24px; padding: 0 3px 0 5px; color: #fff; user-select: none;
  background: linear-gradient(90deg, var(--bar-a), var(--bar-b));
}
.bar img { width: 16px; height: 16px; }
.bar b { flex: 1; font-size: 13px; letter-spacing: 0.01em; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
.bar-btns { display: flex; gap: 2px; }
.bar-btns button {
  width: 18px; height: 16px; padding: 0; border: 0; background: var(--face); color: var(--ink); font: bold 12px/1 var(--ui); cursor: pointer;
  box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--hi), inset -2px -2px var(--lo), inset 2px 2px var(--mid);
}
.bar-btns button:active { box-shadow: inset 1px 1px var(--dk), inset -1px -1px var(--hi), inset 2px 2px var(--lo), inset -2px -2px var(--mid); }
.bar-btns .snd { width: 22px; }
.bar-btns .snd img { display: block; width: 12px; height: 12px; margin: 0 auto; }
.win .body { padding: 10px 9px 9px; }
.pop .bar { cursor: move; }

/* ── controls ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-width: 72px; height: 28px; padding: 0 12px; border: 0;
  background: var(--face); color: var(--ink); font: 13px/1 var(--ui); text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--hi), inset -2px -2px var(--lo), inset 2px 2px var(--mid);
}
.btn:active { box-shadow: inset 1px 1px var(--dk), inset -1px -1px var(--hi), inset 2px 2px var(--lo), inset -2px -2px var(--mid); padding-top: 2px; }
.btn[disabled], .btn.off { color: var(--lo); text-shadow: 1px 1px var(--hi); cursor: default; pointer-events: none; }
.btn:focus-visible { outline: 1px dotted var(--ink); outline-offset: -5px; }
.field {
  height: 26px; min-width: 0; padding: 0 6px; border: 0; background: #fff; color: var(--ink); font: 13px/1 var(--ui); outline: none;
  box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--lo), inset -2px -2px var(--mid), inset 2px 2px var(--dk);
}
.field.wide, .btn.wide { width: 100%; }
.meter { height: 20px; padding: 3px; background: #fff; box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--lo), inset -2px -2px var(--mid), inset 2px 2px var(--dk); }
.meter i {
  display: block; height: 100%; width: 3%; transition: width 0.6s linear;
  background: repeating-linear-gradient(90deg, var(--bar-a) 0 10px, transparent 10px 12px);
}
.row3 { display: flex; gap: 6px; }
.row3 .btn { flex: 1; min-width: 0; }

/* ── the coin window ── */
.main { left: 14px; top: 14px; width: 304px; }
.main.folded .body { display: none; }
.banner { display: flex; align-items: center; gap: 10px; padding: 8px; margin-bottom: 9px; background: linear-gradient(180deg, #7fb4ee, #cfe6fb 70%, #f7e3d2); box-shadow: inset 1px 1px var(--lo), inset -1px -1px var(--hi); }
.banner img { width: 58px; height: 58px; }
.banner .name { font: 900 38px/0.95 "Arial Black", "Arial Bold", Gadget, sans-serif; color: #fff; letter-spacing: -0.02em; text-shadow: 2px 2px 0 var(--bar-a), 3px 3px 0 rgba(28, 26, 46, 0.35); }
.banner .tag { margin-top: 4px; font-size: 11.5px; line-height: 1.25; color: #23305f; }
.ca { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.ca-k { font-weight: bold; min-width: 18px; }
.ca .field { flex: 1; font-family: Consolas, "Lucida Console", Monaco, monospace; font-size: 12px; }
.main .ca.soon .field { font-family: var(--ui); color: var(--lo); }
.status { margin-top: 8px; font-size: 12px; color: #3b3a48; }
.status span { font-weight: bold; color: var(--ink); }

/* ── icons ── */
.icons { position: fixed; z-index: 5; left: 14px; top: 330px; display: grid; gap: 14px; }
.icons > * {
  display: grid; justify-items: center; gap: 4px; width: 78px; padding: 4px 2px; border: 0; background: none; cursor: pointer;
  color: #fff; font: 12px/1.15 var(--ui); text-align: center; text-decoration: none; text-shadow: 0 1px 2px rgba(20, 20, 60, 0.85), 0 0 1px rgba(20, 20, 60, 0.9);
}
.icons img { width: 40px; height: 40px; filter: drop-shadow(0 2px 3px rgba(30, 30, 80, 0.35)); }
.icons > *:focus-visible span, .icons > *:hover span { background: var(--bar-a); outline: 1px dotted #fff; }

/* ── pop-up windows ── */
.pop { left: auto; right: max(24px, 5vw); top: 50%; transform: translateY(-50%); max-height: calc(100svh - 40px); display: flex; flex-direction: column; }
.pop .body { overflow: auto; }
.make { width: min(640px, calc(100vw - 24px)); }
@media (min-width: 701px) { .make { left: 108px; right: auto; top: auto; bottom: 28px; transform: none; } }   /* beside the icons */
.manifesto { width: min(470px, calc(100vw - 24px)); }
.cult { width: min(620px, calc(100vw - 24px)); }
.meme { width: min(400px, calc(100vw - 24px)); }

.booth { display: grid; grid-template-columns: 240px 1fr; gap: 14px; }
.booth .side > div { display: none; }
.booth[data-state="pick"] .pick, .booth[data-state="run"] .busy, .booth[data-state="done"] .done, .booth[data-state="error"] .fail { display: block; }
.shot img { display: block; width: 240px; height: 240px; object-fit: cover; box-shadow: inset 0 0 0 1px var(--dk); background: #fff; }
.make.run .shot img { filter: blur(3px) saturate(0.6); }
.shot-cap { margin-top: 6px; text-align: center; font-size: 12px; color: #3b3a48; }
.pick { display: grid; gap: 7px; }
.pick label { font-size: 12px; color: #3b3a48; }
.pick label small { color: var(--lo); }
.lede { margin-bottom: 2px; }
.handle .ca { margin: 3px 0 0; }
.tick { display: flex; align-items: center; gap: 6px; }
.go { height: 38px; margin-top: 4px; font-weight: bold; font-size: 15px; }
.note { font-size: 11.5px; color: #4b4a58; }
.say { font: bold 17px/1.25 var(--ui); margin-bottom: 9px; }
.busy .note, .done .note { margin: 8px 0 10px; }

.paper { background: #fff; margin: 0 4px 4px; box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--lo), inset -2px -2px var(--mid), inset 2px 2px var(--dk); font: 13px/1.55 "Lucida Console", Monaco, Consolas, monospace; padding: 12px 14px !important; }
.paper p + p, .paper .lines + p { margin-top: 10px; }
.lines { margin: 12px 0 0; padding-left: 26px; }

.count { margin-bottom: 9px; }
.faces { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px 8px; }
.faces figure { margin: 0; text-align: center; min-width: 0; }
.faces img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; box-shadow: inset 0 0 0 1px var(--dk); }
.faces figcaption { margin-top: 3px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { display: grid; gap: 8px; justify-items: start; }
.cult [data-more] { margin-top: 10px; }

.meme-img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.meme-line { margin: 8px 0 9px; font-weight: bold; text-align: center; }

.hint { position: fixed; right: 14px; bottom: 12px; z-index: 5; padding: 4px 8px; font-size: 12px; color: #fff; background: rgba(28, 26, 60, 0.35); }

/* ── phones ── */
@media (max-width: 700px) {
  .main { left: 8px; right: 8px; top: max(8px, env(safe-area-inset-top)); width: auto; }
  .banner { padding: 6px 8px; margin-bottom: 7px; }
  .banner img { width: 44px; height: 44px; }
  .banner .name { font-size: 30px; }
  .icons { left: 0; right: 0; top: auto; bottom: 0; grid-auto-flow: column; justify-content: space-around; gap: 0; padding: 6px 4px max(8px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(40, 50, 110, 0), rgba(40, 50, 110, 0.35)); }
  .icons > * { width: 70px; font-size: 11px; }
  .icons img { width: 34px; height: 34px; }
  .pop { left: 6px; right: 6px; top: auto; bottom: max(6px, env(safe-area-inset-bottom)); transform: none; width: auto !important; max-height: calc(100svh - 70px); }
  .pop .bar { cursor: default; }
  .booth { grid-template-columns: 1fr; }
  .shot { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 10px; }
  .shot img { width: 110px; height: 110px; }
  .shot-cap { text-align: left; margin: 0; }
  .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
