/* play.css — the skins for play.html. One layout, six worlds, chosen from the
   style words by play.js: fantasy, scifi, cozy, horror, military, minimal.
   No images: every backdrop is gradients, clip-paths and a few particles. */

/* ------------------------------------------------------------- base */
:root {
  --bg0: #0b0a14;
  --ink: #f4ecdc;
  --ink-dim: #b9ab90;
  --accent: #ffc56b;
  --on-accent: #1a1208;
  --err: #ff5a4e;
  --f-title: "Cinzel", Georgia, serif;
  --f-ui: "EB Garamond", Georgia, serif;
  --f-mono: "Martian Mono", ui-monospace, monospace;
  --chrome: rgba(255, 255, 255, .62);
  --chip-bg: rgba(255, 255, 255, .06);
  --chip-line: rgba(255, 255, 255, .14);
  --chip-ink: rgba(255, 255, 255, .7);
  --scrim: rgba(5, 4, 10, .58);
  --align: center;
  --menu-w: 340px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg0);
  color: var(--ink);
  font-family: var(--f-ui);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  transition: background-color .5s ease;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ------------------------------------------------------------ scene */
#scene { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
#scene > div { position: absolute; inset: 0; transition: opacity .6s ease, background .6s ease; }
#scene .fx { overflow: hidden; }
#scene .p { position: absolute; display: block; left: var(--x); top: var(--y); }

/* ---------------------------------------------------------- chrome */
#chrome {
  position: fixed; inset: 0 0 auto 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 22px 0;
  font: 400 11px/1 var(--f-mono); letter-spacing: .02em;
}
#chrome a { color: var(--chrome); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; transition: color .2s; }
#chrome a:hover, #chrome a:focus-visible { color: var(--ink); }
#chrome .mark { fill: currentColor; }
#chrome b { font-weight: 500; color: var(--ink); }
#chrome .make { border: 1px solid var(--chip-line); padding: 0 12px; border-radius: 999px; background: var(--chip-bg); }
.is-embed #chrome, .is-embed .embed-hide { display: none !important; }
.embed-back {
  position: fixed; z-index: 25; left: max(14px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top));
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--chip-line); background: var(--chip-bg); color: var(--ink);
  font: 400 12px/1 var(--f-mono); letter-spacing: .04em;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color .15s, color .15s;
}
.embed-back:hover, .embed-back:focus-visible { border-color: var(--accent); color: var(--accent); }

/* ----------------------------------------------------------- stage */
#stage {
  position: fixed; inset: 0; z-index: 2;
  display: flex; flex-direction: column; justify-content: center; align-items: var(--align);
  padding: 76px 7vw 200px;
  text-align: var(--align);
  transition: filter .3s ease, opacity .3s ease;
}
.has-panel #stage { filter: blur(3px) brightness(.7); }
.logo { max-width: min(900px, 92vw); }
.kicker {
  margin: 0 0 10px; font: 400 11px/1.4 var(--f-mono); letter-spacing: .28em; text-transform: uppercase;
  color: var(--ink-dim); opacity: .8;
}
#gameTitle {
  margin: 0; font-family: var(--f-title); font-weight: 700;
  font-size: clamp(2.7rem, 7.4vw, 6rem); line-height: .98; letter-spacing: .01em;
}
.subtitle {
  margin: 14px 0 0; font-family: var(--f-ui); font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  color: var(--accent); font-style: italic; letter-spacing: .01em;
}
.subtitle .q { opacity: .6; }

.press {
  margin-top: 7vh; min-height: 48px; padding: 0 22px;
  font: 400 12px/1 var(--f-mono); letter-spacing: .32em; text-transform: uppercase; color: var(--ink);
}
.press-label { animation: blink 1.6s ease-in-out infinite; }
.is-loading .press-label { animation: none; opacity: .45; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.menu {
  margin-top: 5vh; width: min(var(--menu-w), 88vw);
  display: flex; flex-direction: column; gap: 4px; align-items: stretch;
  touch-action: none;
}
.is-started .menu { animation: menuIn .55s cubic-bezier(.2, .8, .2, 1) both; }
.is-started .menu .item { animation: itemIn .5s cubic-bezier(.2, .8, .2, 1) both; }
.menu .item:nth-child(2) { animation-delay: .04s; }
.menu .item:nth-child(3) { animation-delay: .08s; }
.menu .item:nth-child(4) { animation-delay: .12s; }
.menu .item:nth-child(5) { animation-delay: .16s; }
.menu .item:nth-child(6) { animation-delay: .2s; }
@keyframes menuIn { from { opacity: 0; } }
@keyframes itemIn { from { opacity: 0; transform: translateY(10px); } }

.item {
  position: relative; display: flex; align-items: center; justify-content: var(--align); gap: 14px;
  min-height: 48px; padding: 0 18px;
  font-family: var(--f-ui); font-size: 1.3rem; color: var(--ink-dim);
  transition: color .15s ease, background .2s ease, transform .15s ease, box-shadow .2s ease;
}
.item:hover, .item:focus-visible { color: var(--ink); outline: none; }
.item .mk { display: none; }

/* --------------------------------------------------------- panels */
.panel {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center; padding: 70px 16px 150px;
  background: var(--scrim);
  opacity: 0; transition: opacity .22s ease;
}
.panel.open { opacity: 1; }
.frame {
  position: relative; width: min(560px, 100%); max-height: 100%;
  overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  padding: 26px 26px 22px;
  transform: translateY(14px) scale(.97); transition: transform .28s cubic-bezier(.2, .9, .25, 1.15);
}
.panel.open .frame { transform: none; }
.frame h2 { margin: 0 0 18px; font-family: var(--f-title); font-weight: 700; font-size: 1.6rem; letter-spacing: .02em; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 20px; }
.back, .cta {
  min-height: 46px; padding: 0 22px; display: inline-flex; align-items: center; justify-content: center;
  font: 500 12px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; text-decoration: none;
  border: 1px solid var(--chip-line); color: var(--ink);
  transition: background .15s, color .15s, border-color .15s;
}
.back:hover, .back:focus-visible { border-color: var(--accent); color: var(--accent); }
.cta { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.choices { display: grid; gap: 10px; }
.choice {
  position: relative; text-align: left; padding: 14px 16px; min-height: 56px;
  border: 1px solid var(--chip-line); background: var(--chip-bg);
  display: grid; gap: 3px; transition: border-color .15s, background .15s, transform .15s;
}
.choice b { font-family: var(--f-title); font-size: 1.15rem; font-weight: 700; }
.choice small { color: var(--ink-dim); font-size: .95rem; }
.choice:hover, .choice:focus-visible { border-color: var(--accent); background: rgba(255, 255, 255, .08); }
.choice.locked { opacity: .55; }
.lock, .choice .lock { position: absolute; right: 14px; top: 50%; width: 16px; height: 16px; margin-top: -8px; }
.lock::before {
  content: ""; position: absolute; left: 2px; right: 2px; bottom: 0; height: 9px; border-radius: 2px;
  background: currentColor;
}
.lock::after {
  content: ""; position: absolute; left: 4px; right: 4px; top: 0; height: 9px;
  border: 2px solid currentColor; border-bottom: 0; border-radius: 6px 6px 0 0;
}

.loading { padding: 18px 0 6px; }
.loading-label { margin: 0 0 12px; font: 400 12px/1 var(--f-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-dim); }
.bar { height: 6px; background: var(--chip-bg); border: 1px solid var(--chip-line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.bar i.run { animation: load 1.45s cubic-bezier(.6, .05, .3, 1) forwards; }
@keyframes load { 30% { width: 22%; } 55% { width: 48%; } 72% { width: 61%; } to { width: 100%; } }
.reveal { animation: itemIn .5s ease both; }
.reveal-big { margin: 4px 0 8px; font-family: var(--f-title); font-size: 1.45rem; line-height: 1.2; }
.reveal-small { margin: 0; color: var(--ink-dim); font-size: 1.05rem; line-height: 1.5; }
.reveal-small b { color: var(--accent); font-weight: 500; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.slot {
  position: relative; aspect-ratio: 1; display: grid; place-items: center;
  border: 1px solid var(--chip-line); background: var(--chip-bg); color: var(--accent);
  transition: border-color .15s, background .15s, transform .12s;
}
.slot svg { width: 46%; height: 46%; }
.slot:hover, .slot:focus-visible { border-color: var(--accent); transform: translateY(-2px); }
.slot.picked { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.slot.locked { color: var(--ink-dim); opacity: .45; }
.detail { margin: 14px 0 0; min-height: 3em; color: var(--ink-dim); font-size: 1.05rem; line-height: 1.45; }

.settings { display: grid; gap: 8px; }
.setting {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: 52px; padding: 0 16px; text-align: left;
  border: 1px solid var(--chip-line); background: var(--chip-bg); font-size: 1.1rem;
  transition: border-color .15s;
}
.setting:hover, .setting:focus-visible, .setting:focus-within { border-color: var(--accent); }
.setting em { font-style: normal; color: var(--ink-dim); font-size: .95rem; margin-right: 26px; }
.setting.danger em { margin-right: 0; }
.setting.locked { opacity: .6; }
.sw { position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--chip-line); transition: background .2s; flex: none; }
.sw::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--ink); transition: transform .2s cubic-bezier(.3, 1.4, .5, 1);
}
.toggle[aria-pressed="true"] .sw { background: var(--accent); }
.toggle[aria-pressed="true"] .sw::after { transform: translateX(18px); background: var(--on-accent); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 46%; height: 24px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: var(--chip-line); border-radius: 4px; }
input[type="range"]::-moz-range-track { height: 4px; background: var(--chip-line); border-radius: 4px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: var(--accent); border: 0; }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); border: 0; }

.credits { height: 230px; overflow: hidden; position: relative; mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent); -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent); }
.roll { text-align: center; animation: roll 14s linear infinite; padding-top: 230px; }
.roll p { margin: 0 0 26px; display: grid; gap: 4px; }
.roll small { font: 400 10.5px/1.4 var(--f-mono); letter-spacing: .24em; text-transform: uppercase; color: var(--ink-dim); }
.roll b { font-family: var(--f-title); font-size: 1.25rem; font-weight: 700; }
@keyframes roll { to { transform: translateY(-100%); } }
/* The name is always lowercase, and several title faces are capitals-only
   (Cinzel, IM Fell SC) or set in uppercase, so it gets a face that has a small r. */
.roll b.brand-name { font-family: var(--f-mono); font-weight: 500; text-transform: none; letter-spacing: .02em; font-size: 1.1rem; }

/* --------------------------------------------- what just played */
#hud {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  padding: 0 14px max(14px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
#hud > * { pointer-events: auto; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 640px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px;
  border-radius: 999px; border: 1px solid var(--chip-line); background: var(--chip-bg); color: var(--chip-ink);
  font: 400 10.5px/1 var(--f-mono); letter-spacing: .04em; white-space: nowrap;
  transition: background .35s ease, color .35s ease, border-color .35s ease, transform .35s ease;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.chip i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; transition: opacity .3s; }
.chip.on {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent);
  transform: translateY(-2px) scale(1.06); transition-duration: .05s;
}
.chip.on i { opacity: 1; animation: ping .7s ease-out; }
.chip[data-s="error"].on { background: var(--err); border-color: var(--err); color: #fff; }
@keyframes ping { from { box-shadow: 0 0 0 0 currentColor; } to { box-shadow: 0 0 0 8px transparent; } }
.hint { margin: 0; font: 400 10px/1.3 var(--f-mono); letter-spacing: .12em; color: var(--chrome); text-transform: lowercase; text-align: center; }

.picker { display: flex; align-items: center; gap: 10px; max-width: min(1100px, 100%); margin-top: 2px; }
/* While a panel is open the panel is the only thing to touch. */
.has-panel .picker, .has-panel .hint { visibility: hidden; }
.picker-label { font: 400 10px/1 var(--f-mono); letter-spacing: .14em; color: var(--chrome); white-space: nowrap; text-transform: lowercase; }
.swatches {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px;
  touch-action: pan-x; overscroll-behavior: contain;
  mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
}
.swatches::-webkit-scrollbar { display: none; }
/* Wide screens show every style at once: hidden choices are never chosen. */
@media (min-width: 900px) {
  .picker { flex-direction: column; gap: 6px; }
  .swatches { flex-wrap: wrap; justify-content: center; overflow: visible; mask-image: none; -webkit-mask-image: none; max-width: 1080px; }
  .panel { padding-bottom: 190px; }
  .is-embed .panel { padding-bottom: 120px; }
}
.swatch {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--chip-line); background: var(--chip-bg); color: var(--chip-ink);
  font: 400 10.5px/1 var(--f-mono); white-space: nowrap; transition: border-color .15s, color .15s, background .15s;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.swatch:hover, .swatch:focus-visible { color: var(--ink); border-color: var(--accent); }
.swatch.on { color: var(--ink); border-color: var(--accent); background: rgba(255, 255, 255, .12); }
.swatch i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.sw-fantasy i { background: linear-gradient(135deg, #ffd27a, #9c4a1c); }
.sw-scifi i { background: linear-gradient(135deg, #3ef2ff, #ff3ec8); }
.sw-cozy i { background: linear-gradient(135deg, #ffb36b, #7cc16f); }
.sw-horror i { background: linear-gradient(135deg, #b3120f, #120606); }
.sw-military i { background: linear-gradient(135deg, #d4a72c, #4b5a37); }
.sw-minimal i { background: linear-gradient(135deg, #f6efe6, #c9c2ff); }

/* the floating name of the sound that just played */
#tag {
  position: fixed; left: 0; top: 0; z-index: 30; pointer-events: none;
  transform: translate(var(--x, -200px), var(--y, -200px));
  height: 26px; padding: 0 11px; display: inline-flex; align-items: center;
  border-radius: 999px; background: var(--accent); color: var(--on-accent);
  font: 500 11px/1 var(--f-mono); letter-spacing: .04em; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  opacity: 0;
}
#tag.show { animation: tag 1.1s cubic-bezier(.2, .9, .3, 1) forwards; }
#tag[data-s="error"] { background: var(--err); color: #fff; }
#tag[data-s="window_open"], #tag[data-s="window_close"] { background: var(--ink); color: var(--bg0); }
@keyframes tag {
  0% { opacity: 0; margin-top: 6px; }
  12% { opacity: 1; margin-top: 0; }
  75% { opacity: 1; }
  100% { opacity: 0; margin-top: -6px; }
}

#toast {
  position: fixed; left: 50%; top: 64px; z-index: 40; transform: translate(-50%, -8px);
  max-width: min(460px, calc(100vw - 32px)); padding: 12px 18px; text-align: center;
  background: rgba(10, 10, 14, .9); color: #fff; border: 1px solid rgba(255, 255, 255, .14);
  font: 400 12px/1.45 var(--f-mono); letter-spacing: .02em;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast[data-kind="error"] { border-color: var(--err); }

.shake { animation: shake .42s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  15%, 85% { transform: translateX(-2px); }
  30%, 70% { transform: translateX(5px); }
  45%, 60% { transform: translateX(-7px); }
}

/* ======================================================== FANTASY */
.t-fantasy {
  --bg0: #0b0912; --ink: #f6e9cc; --ink-dim: #b7a37c; --accent: #f3c46b; --on-accent: #1c1206;
  --f-title: "Cinzel", Georgia, serif; --f-ui: "EB Garamond", Georgia, serif;
  --chip-bg: rgba(20, 14, 26, .55); --chip-line: rgba(243, 196, 107, .22); --chip-ink: #d8c59c;
  --chrome: rgba(246, 233, 204, .6); --scrim: rgba(8, 5, 12, .62); --align: center;
}
.t-fantasy #scene .sky {
  background:
    radial-gradient(ellipse 70% 45% at 50% 100%, rgba(255, 128, 48, .42), transparent 70%),
    radial-gradient(ellipse 40% 30% at 80% 18%, rgba(160, 120, 255, .18), transparent 70%),
    linear-gradient(#080a1c 0%, #171034 46%, #3a1830 78%, #5a2224 100%);
}
.t-fantasy #scene .orb {
  inset: 7% 6% auto auto; width: 112px; height: 112px; border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, #fff6dc, #f3d38f 55%, #c99a52);
  box-shadow: 0 0 60px 18px rgba(255, 214, 140, .28), 0 0 160px 40px rgba(255, 170, 90, .12);
  opacity: .9;
}
.t-fantasy #scene .far {
  top: auto; height: 42%;
  background: linear-gradient(#1d1430, #120c1e);
  clip-path: polygon(0 62%, 8% 44%, 15% 52%, 24% 26%, 31% 40%, 38% 30%, 46% 8%, 53% 30%, 60% 22%, 68% 44%, 76% 30%, 84% 46%, 92% 34%, 100% 50%, 100% 100%, 0 100%);
}
.t-fantasy #scene .near {
  top: auto; height: 24%;
  background: linear-gradient(#0d0814, #050308);
  clip-path: polygon(0 40%, 10% 58%, 20% 34%, 27% 48%, 35% 30%, 40% 36%, 42% 18%, 44% 36%, 52% 50%, 63% 28%, 74% 52%, 86% 34%, 100% 56%, 100% 100%, 0 100%);
}
.t-fantasy #scene .veil { background: radial-gradient(ellipse at 50% 45%, transparent 45%, rgba(0, 0, 0, .55)); }
.t-fantasy #scene .p {
  top: auto; bottom: -10px; width: calc(4px * var(--s)); height: calc(4px * var(--s)); border-radius: 50%;
  background: #ffc066; box-shadow: 0 0 8px 2px rgba(255, 150, 60, .7); opacity: 0;
  animation: ember var(--t) linear var(--d) infinite;
}
@keyframes ember {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: var(--o); }
  50% { transform: translate(24px, -50vh); }
  90% { opacity: calc(var(--o) * .6); }
  100% { transform: translate(-16px, -105vh); opacity: 0; }
}
.t-fantasy #gameTitle {
  font-weight: 900; letter-spacing: .04em;
  background: linear-gradient(180deg, #fff3cf 0%, #f3c46b 48%, #b6732f 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(60, 25, 8, .9)) drop-shadow(0 0 26px rgba(255, 170, 80, .3));
}
.t-fantasy .kicker { font-family: var(--f-ui); font-style: italic; text-transform: none; letter-spacing: .12em; font-size: 15px; }
.t-fantasy .item { font-size: 1.42rem; letter-spacing: .04em; }
.t-fantasy .item .mk { display: block; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .2s; }
.t-fantasy .item .mk::before, .t-fantasy .item .mk::after {
  content: ""; position: absolute; top: 50%; width: 8px; height: 8px; margin-top: -4px;
  background: var(--accent); transform: rotate(45deg); box-shadow: 0 0 10px var(--accent);
}
.t-fantasy .item .mk::before { left: 16%; }
.t-fantasy .item .mk::after { right: 16%; }
.t-fantasy .item:hover, .t-fantasy .item:focus-visible {
  color: #ffe9b8; text-shadow: 0 0 18px rgba(255, 190, 100, .55);
  background: linear-gradient(90deg, transparent, rgba(243, 196, 107, .13), transparent);
}
.t-fantasy .item:hover .mk, .t-fantasy .item:focus-visible .mk { opacity: 1; }
.t-fantasy .frame {
  background: linear-gradient(#1c1426, #110b17);
  border: 1px solid #b38a4b; outline: 1px solid rgba(179, 138, 75, .35); outline-offset: 5px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6), inset 0 0 60px rgba(255, 170, 80, .05);
}
.t-fantasy .frame h2 { color: var(--accent); text-align: center; letter-spacing: .08em; }
.t-fantasy .frame h2::after { content: ""; display: block; width: 90px; height: 1px; margin: 12px auto 0; background: linear-gradient(90deg, transparent, var(--accent), transparent); }

/* ========================================================= SCI-FI */
.t-scifi {
  --bg0: #02050c; --ink: #e9fbff; --ink-dim: #7fa6b6; --accent: #39f0ff; --on-accent: #001318;
  --f-title: "Orbitron", system-ui, sans-serif; --f-ui: "Chakra Petch", system-ui, sans-serif;
  --chip-bg: rgba(6, 22, 34, .55); --chip-line: rgba(57, 240, 255, .25); --chip-ink: #9fd8e6;
  --chrome: rgba(200, 240, 255, .6); --scrim: rgba(0, 6, 12, .6); --align: flex-start;
}
.t-scifi #stage { text-align: left; }
.t-scifi #scene .sky {
  background:
    radial-gradient(ellipse 80% 40% at 50% 62%, rgba(255, 62, 200, .22), transparent 70%),
    radial-gradient(ellipse 90% 40% at 50% 64%, rgba(57, 240, 255, .2), transparent 70%),
    linear-gradient(#01030a 0%, #050b22 50%, #0b0f2e 62%, #02040b 63%);
}
.t-scifi #scene .orb {
  inset: 8% 8% auto auto; width: 210px; height: 210px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #8ff5ff, #2a6fb4 45%, #0b1a44 75%);
  box-shadow: inset -30px -24px 50px rgba(0, 0, 0, .65), 0 0 80px rgba(57, 240, 255, .25);
}
.t-scifi #scene .orb::after {
  content: ""; position: absolute; left: -46%; top: 38%; width: 192%; height: 26%;
  border-radius: 50%; border: 2px solid rgba(160, 240, 255, .45); transform: rotate(-16deg);
  box-shadow: 0 0 18px rgba(57, 240, 255, .3);
}
.t-scifi #scene .floor {
  top: 62%; height: 80%; left: -50%; right: -50%;
  background:
    linear-gradient(rgba(57, 240, 255, .55) 1px, transparent 1px) 0 0 / 100% 48px,
    linear-gradient(90deg, rgba(255, 62, 200, .45) 1px, transparent 1px) 0 0 / 64px 100%;
  transform: perspective(380px) rotateX(64deg); transform-origin: 50% 0;
  mask-image: linear-gradient(transparent, #000 40%); -webkit-mask-image: linear-gradient(transparent, #000 40%);
  animation: grid 2.4s linear infinite;
}
@keyframes grid { to { background-position: 0 48px, 0 0; } }
.t-scifi #scene .veil {
  background:
    repeating-linear-gradient(transparent 0 2px, rgba(0, 0, 0, .18) 2px 3px),
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0, 0, 0, .6));
}
.t-scifi #scene .p {
  width: calc(2px * var(--s)); height: calc(2px * var(--s)); border-radius: 50%; background: #fff;
  box-shadow: 0 0 6px #bff; opacity: var(--o); top: calc(var(--y) * .6);
  animation: twinkle calc(var(--t) / 3) ease-in-out var(--d) infinite;
}
@keyframes twinkle { 50% { opacity: .1; } }
.t-scifi #gameTitle {
  font-weight: 900; text-transform: uppercase; letter-spacing: .1em; font-size: clamp(2.2rem, 6.4vw, 5.2rem);
  color: #effcff; text-shadow: -2px 0 rgba(255, 62, 200, .75), 2px 0 rgba(57, 240, 255, .75), 0 0 30px rgba(57, 240, 255, .45);
}
.t-scifi .subtitle { font-style: normal; text-transform: lowercase; letter-spacing: .08em; }
.t-scifi .item { justify-content: flex-start; font-size: 1.12rem; text-transform: uppercase; letter-spacing: .2em; padding-left: 22px; }
.t-scifi .item::before {
  content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(57, 240, 255, .22), transparent 80%);
  transform: scaleX(0); transform-origin: left; transition: transform .22s cubic-bezier(.2, .9, .3, 1);
}
.t-scifi .item::after {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; background: var(--accent);
  box-shadow: 0 0 12px var(--accent); opacity: 0; transition: opacity .15s;
}
.t-scifi .item:hover, .t-scifi .item:focus-visible { color: #fff; text-shadow: 0 0 12px rgba(57, 240, 255, .8); }
.t-scifi .item:hover::before, .t-scifi .item:focus-visible::before { transform: scaleX(1); }
.t-scifi .item:hover::after, .t-scifi .item:focus-visible::after { opacity: 1; }
.t-scifi .item .lbl { position: relative; }
.t-scifi .frame {
  background: rgba(4, 16, 28, .86); border: 1px solid rgba(57, 240, 255, .5);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  clip-path: polygon(0 18px, 18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%);
  box-shadow: inset 0 0 40px rgba(57, 240, 255, .08);
}
.t-scifi .frame h2 { text-transform: uppercase; letter-spacing: .16em; font-size: 1.2rem; color: var(--accent); }
.t-scifi .frame h2::before { content: "// "; opacity: .5; }
.t-scifi .choice, .t-scifi .setting, .t-scifi .slot { clip-path: polygon(0 8px, 8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%); }

/* ========================================================== COZY */
.t-cozy {
  --bg0: #ffe9c7; --ink: #4b2f24; --ink-dim: #8a6552; --accent: #ff8a5c; --on-accent: #fff;
  --err: #e2483d;
  --f-title: "Fredoka", system-ui, sans-serif; --f-ui: "Nunito", system-ui, sans-serif;
  --chip-bg: rgba(255, 251, 242, .8); --chip-line: rgba(75, 47, 36, .18); --chip-ink: #6d4d3c;
  --chrome: rgba(75, 47, 36, .7); --scrim: rgba(90, 55, 30, .28); --align: center; --menu-w: 300px;
}
.t-cozy #scene .sky { background: linear-gradient(#ffc78f 0%, #ffe0b0 38%, #fff3dc 66%, #e9f5d2 100%); }
.t-cozy #scene .orb {
  inset: 10% auto auto 12%; width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, #fff5c9 0 40%, #ffd36b 41% 62%, rgba(255, 211, 107, 0) 63%);
  box-shadow: 0 0 0 26px rgba(255, 220, 140, .25), 0 0 0 56px rgba(255, 220, 140, .12);
  animation: sun 18s linear infinite;
}
@keyframes sun { to { transform: rotate(360deg); } }
.t-cozy #scene .far {
  top: auto; height: 46%;
  background:
    radial-gradient(ellipse 60% 70% at 18% 100%, #a8d58c 60%, transparent 61%),
    radial-gradient(ellipse 55% 60% at 70% 100%, #b9df98 60%, transparent 61%),
    radial-gradient(ellipse 45% 50% at 100% 100%, #9fd08a 60%, transparent 61%);
}
.t-cozy #scene .near {
  top: auto; height: 26%;
  background:
    radial-gradient(ellipse 70% 80% at 30% 100%, #7cc16f 60%, transparent 61%),
    radial-gradient(ellipse 60% 70% at 88% 100%, #6db463 60%, transparent 61%);
}
.t-cozy #scene .p {
  width: calc(90px * var(--s)); height: calc(30px * var(--s)); border-radius: 999px; background: #fff;
  opacity: calc(var(--o) * .85); top: calc(2% + var(--y) * .14); filter: blur(1px);
  box-shadow: calc(26px * var(--s)) calc(-10px * var(--s)) 0 calc(4px * var(--s)) #fff;
  animation: cloud calc(var(--t) * 3) linear var(--d) infinite;
}
@keyframes cloud { from { transform: translateX(-30vw); } to { transform: translateX(110vw); } }
.t-cozy #gameTitle {
  font-weight: 700; color: #ff7a52; letter-spacing: .01em;
  text-shadow: 0 4px 0 #c94f2e, 0 12px 26px rgba(120, 60, 20, .28);
}
.t-cozy .subtitle { color: #5f8f3e; font-weight: 700; }
.t-cozy .kicker { color: #8a6552; }
.t-cozy .menu { gap: 10px; }
.t-cozy .item {
  font-weight: 800; font-size: 1.15rem; color: var(--ink); background: #fffaf0;
  border: 3px solid #4b2f24; border-radius: 999px; box-shadow: 0 5px 0 #4b2f24;
  min-height: 50px;
}
.t-cozy .item:hover, .t-cozy .item:focus-visible { background: #ffd56b; transform: translateY(-2px); box-shadow: 0 7px 0 #4b2f24; }
.t-cozy .item:active { transform: translateY(3px); box-shadow: 0 2px 0 #4b2f24; }
.t-cozy .frame {
  background: #fffaf0; border: 4px solid #4b2f24; border-radius: 28px; box-shadow: 0 10px 0 #4b2f24;
}
.t-cozy .frame h2 { color: #ff7a52; text-align: center; }
.t-cozy .choice, .t-cozy .setting, .t-cozy .slot, .t-cozy .back, .t-cozy .cta { border-radius: 18px; border-width: 2px; }
.t-cozy .choice b, .t-cozy .roll b, .t-cozy .reveal-big { font-family: var(--f-title); }
.t-cozy .back, .t-cozy .cta { border-radius: 999px; }
.t-cozy .slot { color: #ff7a52; }
.t-cozy .chip.on { color: #fff; }
.t-cozy #toast { background: #4b2f24; border-radius: 999px; }

/* ======================================================== HORROR */
.t-horror {
  --bg0: #050404; --ink: #e2d6c8; --ink-dim: #857669; --accent: #d61f1f; --on-accent: #fff;
  --f-title: "IM Fell English SC", Georgia, serif; --f-ui: "Special Elite", "Courier New", monospace;
  --chip-bg: rgba(20, 8, 8, .6); --chip-line: rgba(214, 31, 31, .25); --chip-ink: #b9a99a;
  --chrome: rgba(226, 214, 200, .5); --scrim: rgba(0, 0, 0, .7); --align: flex-start; --err: #ff2b2b;
}
.t-horror #stage { text-align: left; }
.t-horror #scene .sky {
  background:
    radial-gradient(ellipse 50% 40% at 72% 20%, rgba(150, 10, 10, .32), transparent 70%),
    linear-gradient(#070505, #120707 60%, #050303);
}
.t-horror #scene .orb {
  inset: 12% 18% auto auto; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle at 45% 40%, #c9b8a8, #6d1414 70%);
  box-shadow: 0 0 80px 30px rgba(140, 10, 10, .35); filter: blur(.6px); opacity: .75;
}
.t-horror #scene .far {
  top: auto; height: 50%;
  background: radial-gradient(ellipse 60% 40% at 30% 80%, rgba(120, 110, 110, .18), transparent 70%),
              radial-gradient(ellipse 50% 30% at 80% 90%, rgba(120, 110, 110, .16), transparent 70%);
  filter: blur(18px); animation: fog 26s ease-in-out infinite alternate;
}
.t-horror #scene .near {
  top: auto; height: 34%;
  background: linear-gradient(transparent, #020101 60%);
  clip-path: polygon(0 70%, 6% 40%, 7% 70%, 14% 66%, 18% 20%, 19% 66%, 30% 72%, 52% 64%, 61% 30%, 62% 64%, 70% 70%, 84% 58%, 88% 10%, 89% 60%, 100% 66%, 100% 100%, 0 100%);
}
@keyframes fog { to { transform: translateX(-8%) scale(1.1); } }
.t-horror #scene .veil {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 40% 45%, transparent 30%, rgba(0, 0, 0, .85));
  mix-blend-mode: normal; opacity: .55; animation: flicker 6s steps(1) infinite;
}
@keyframes flicker { 0%, 100% { opacity: .55; } 41% { opacity: .75; } 42% { opacity: .5; } 77% { opacity: .9; } 78% { opacity: .55; } }
.t-horror #scene .p {
  width: calc(240px * var(--s)); height: calc(120px * var(--s)); border-radius: 50%;
  background: radial-gradient(rgba(140, 130, 130, .14), transparent 70%); top: calc(40% + var(--y) * .5);
  animation: cloud calc(var(--t) * 4) linear var(--d) infinite;
}
.t-horror #gameTitle {
  font-weight: 400; letter-spacing: .03em; color: #e8ddd0;
  text-shadow: 0 0 2px rgba(255, 255, 255, .3), 0 0 28px rgba(160, 0, 0, .55);
  animation: jitter 5s steps(1) infinite;
}
@keyframes jitter { 0%, 100% { transform: none; } 61% { transform: translate(1px, -1px) skewX(-1deg); } 62% { transform: none; } 63% { transform: translate(-2px, 0); opacity: .7; } 64% { transform: none; opacity: 1; } }
.t-horror .subtitle { color: #b51c1c; font-style: normal; font-family: var(--f-ui); }
.t-horror .item { justify-content: flex-start; font-size: 1.12rem; letter-spacing: .06em; padding-left: 26px; }
.t-horror .item::before {
  content: ""; position: absolute; left: 4px; top: 50%; width: 12px; height: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform .2s;
}
.t-horror .item:hover, .t-horror .item:focus-visible { color: #ff3a3a; text-shadow: 0 0 14px rgba(255, 0, 0, .5); animation: tremble .25s steps(2) infinite; }
.t-horror .item:hover::before, .t-horror .item:focus-visible::before { transform: scaleX(1); }
@keyframes tremble { 50% { transform: translate(1px, 0); } }
.t-horror .frame { background: #0c0807; border: 1px solid #3c1612; box-shadow: inset 0 0 60px rgba(120, 0, 0, .25), 0 30px 80px #000; }
.t-horror .frame h2 { font-weight: 400; color: #e33; }

/* ======================================================= MILITARY */
.t-military {
  --bg0: #0d100b; --ink: #ebe7cf; --ink-dim: #9b9d84; --accent: #e0b12e; --on-accent: #12130d;
  --f-title: "Black Ops One", Impact, sans-serif; --f-ui: "Barlow Condensed", "Arial Narrow", sans-serif;
  --chip-bg: rgba(20, 24, 16, .7); --chip-line: rgba(224, 177, 46, .25); --chip-ink: #c4c1a4;
  --chrome: rgba(235, 231, 207, .55); --scrim: rgba(5, 6, 4, .66); --align: flex-start;
}
.t-military #stage { text-align: left; }
.t-military #scene .sky {
  background:
    repeating-radial-gradient(circle at 18% 120%, transparent 0 34px, rgba(150, 165, 110, .1) 35px 36px),
    repeating-radial-gradient(circle at 92% -10%, transparent 0 46px, rgba(150, 165, 110, .08) 47px 48px),
    linear-gradient(#141a10, #0b0e09);
}
.t-military #scene .floor {
  background:
    linear-gradient(rgba(224, 177, 46, .06) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(90deg, rgba(224, 177, 46, .06) 1px, transparent 1px) 0 0 / 64px 64px;
}
.t-military #scene .orb {
  inset: auto 6% 22% auto; width: 300px; height: 300px; border-radius: 50%;
  background:
    repeating-radial-gradient(circle, transparent 0 48px, rgba(224, 177, 46, .22) 49px 50px),
    conic-gradient(from 0deg, rgba(224, 177, 46, .32), transparent 18%);
  border: 1px solid rgba(224, 177, 46, .3); animation: sweep 4s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }
.t-military #scene .veil { background: radial-gradient(ellipse at 30% 45%, transparent 40%, rgba(0, 0, 0, .6)); }
.t-military #gameTitle { text-transform: uppercase; letter-spacing: .05em; color: #ebe7cf; text-shadow: 0 4px 0 rgba(0, 0, 0, .5); }
.t-military .kicker { color: var(--accent); }
.t-military .kicker::before { content: "// "; }
.t-military .subtitle { font-style: normal; text-transform: uppercase; letter-spacing: .14em; font-size: 1rem; font-weight: 600; }
.t-military .item {
  justify-content: flex-start; font-weight: 600; font-size: 1.4rem; text-transform: uppercase; letter-spacing: .14em;
  padding-left: 30px;
}
.t-military .item::before {
  content: ">"; position: absolute; left: 10px; color: var(--on-accent); opacity: 0; font-weight: 700;
}
.t-military .item:hover, .t-military .item:focus-visible {
  background: var(--accent); color: var(--on-accent);
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
}
.t-military .item:hover::before, .t-military .item:focus-visible::before { opacity: 1; }
.t-military .frame { background: rgba(16, 20, 13, .95); border: 1px solid #4f5d3a; padding-top: 0; }
.t-military .frame h2 {
  margin: 0 -26px 20px; padding: 12px 26px; background: var(--accent); color: var(--on-accent);
  font-size: 1.15rem; text-transform: uppercase; letter-spacing: .14em;
}
.t-military .frame h2::before { content: "// "; }
.t-military .choice b, .t-military .roll b, .t-military .reveal-big { font-family: var(--f-ui); text-transform: uppercase; letter-spacing: .08em; }

/* ======================================================== MINIMAL */
.t-minimal {
  --bg0: #f2eee7; --ink: #1d1b18; --ink-dim: #8c867c; --accent: #1d1b18; --on-accent: #f7f4ef;
  --f-title: "Cormorant", Georgia, serif; --f-ui: "Manrope", system-ui, sans-serif;
  --chip-bg: rgba(255, 255, 255, .55); --chip-line: rgba(29, 27, 24, .12); --chip-ink: #5e594f;
  --chrome: rgba(29, 27, 24, .55); --scrim: rgba(242, 238, 231, .4); --align: flex-start; --err: #c4402f;
}
.t-minimal #stage { text-align: left; }
.t-minimal #scene .sky { background: linear-gradient(160deg, #f7f3ec, #ece6dc); }
.t-minimal #scene .orb {
  inset: 10% 8% auto auto; width: 46vmin; height: 46vmin; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffd9c4, #e8c9ff 55%, rgba(200, 230, 220, 0) 72%);
  filter: blur(30px); opacity: .85; animation: breathe 12s ease-in-out infinite alternate;
}
@keyframes breathe { to { transform: translate(-6vw, 4vh) scale(1.12); } }
.t-minimal #scene .far {
  inset: auto auto -10% -8%; width: 52vmin; height: 52vmin; border-radius: 50%;
  background: radial-gradient(circle, #c7eadf, rgba(199, 234, 223, 0) 70%); filter: blur(24px);
  animation: breathe 16s ease-in-out infinite alternate-reverse;
}
.t-minimal #scene .p {
  width: calc(10px * var(--s)); height: calc(10px * var(--s)); border-radius: 50%;
  background: rgba(255, 255, 255, .9); box-shadow: 0 0 20px rgba(255, 255, 255, .9);
  animation: drift calc(var(--t) * 2) ease-in-out var(--d) infinite alternate;
}
@keyframes drift { to { transform: translate(40px, -60px); } }
.t-minimal #gameTitle { font-weight: 300; font-size: clamp(3rem, 8.6vw, 7rem); letter-spacing: -.01em; }
.t-minimal .subtitle { color: var(--ink-dim); font-family: var(--f-title); font-size: clamp(1.15rem, 2vw, 1.5rem); }
.t-minimal .kicker { letter-spacing: .36em; }
.t-minimal .item { justify-content: flex-start; font-size: 1rem; letter-spacing: .14em; font-weight: 400; padding-left: 0; }
.t-minimal .item::before {
  content: ""; width: 0; height: 1px; background: var(--ink); transition: width .25s cubic-bezier(.2, .9, .3, 1);
}
.t-minimal .item:hover, .t-minimal .item:focus-visible { color: var(--ink); }
.t-minimal .item:hover::before, .t-minimal .item:focus-visible::before { width: 28px; }
.t-minimal .frame {
  background: rgba(255, 255, 255, .62); border: 1px solid rgba(255, 255, 255, .9); border-radius: 18px;
  backdrop-filter: blur(24px) saturate(1.3); -webkit-backdrop-filter: blur(24px) saturate(1.3);
  box-shadow: 0 30px 80px rgba(80, 60, 40, .12);
}
.t-minimal .frame h2 { font-weight: 400; font-size: 2rem; }
.t-minimal .choice, .t-minimal .setting, .t-minimal .slot { border-radius: 12px; background: rgba(255, 255, 255, .5); }
.t-minimal .back, .t-minimal .cta { border-radius: 999px; }
.t-minimal .chip.on { color: var(--on-accent); }
.t-minimal #toast { background: rgba(29, 27, 24, .92); border-radius: 12px; }

/* ----------------------------------------------------------- phone */
@media (max-width: 600px) {
  #chrome { padding-left: 14px; padding-right: 14px; }
  #chrome .brand span { display: none; }
  #chrome .brand::after { content: "resoundle"; font-weight: 500; color: var(--ink); }
  #stage { padding: 64px 22px 200px; justify-content: center; }
  .press { margin-top: 5vh; }
  .menu { margin-top: 3.5vh; gap: 2px; }
  .t-cozy .menu { gap: 8px; }
  .item { min-height: 46px; font-size: 1.15rem; }
  .t-fantasy .item { font-size: 1.25rem; }
  .t-fantasy .item .mk::before { left: 8%; }
  .t-fantasy .item .mk::after { right: 8%; }
  /* The sky's one big shape moves up into the corner, clear of the title. */
  .t-fantasy #scene .orb, .t-horror #scene .orb { inset: 52px 16px auto auto; width: 54px; height: 54px; }
  .t-scifi #scene .orb { inset: 50px 18px auto auto; width: 62px; height: 62px; }
  .t-cozy #scene .orb { inset: 50px auto auto 16px; width: 60px; height: 60px; box-shadow: 0 0 0 12px rgba(255, 220, 140, .25); }
  .t-military #scene .orb { width: 200px; height: 200px; right: -60px; bottom: 30%; }
  .t-minimal #scene .orb { inset: 40px -18% auto auto; }
  .chip { height: 26px; padding: 0 9px; font-size: 10px; }
  .legend { gap: 5px; }
  .picker { flex-direction: column; align-items: stretch; gap: 6px; width: 100%; }
  .picker-label { text-align: center; }
  .grid { gap: 7px; }
  .panel { padding: 64px 12px 150px; }
  .frame { padding: 22px 18px 18px; }
  .t-military .frame h2 { margin: 0 -18px 18px; padding: 12px 18px; }
}
@media (max-height: 640px) and (min-width: 601px) {
  #stage { padding-bottom: 170px; }
  .menu { margin-top: 2.5vh; }
  .item { min-height: 40px; }
}
/* a phone on its side: the menu does not fit, so it scrolls instead of being cut off */
@media (max-height: 450px) {
  #stage { overflow-y: auto; justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .roll { animation: none; padding-top: 0; }
}
