@font-face {
  font-family: Chakra;
  src: url(assets/fonts/ChakraPetch-600.woff2);
}
@font-face {
  font-family: Chakra;
  src: url(assets/fonts/ChakraPetch-700i.woff2);
  font-style: italic;
  font-weight: 700;
}
@font-face {
  font-family: Russo;
  src: url(assets/fonts/RussoOne-400.woff2);
}
@font-face {
  font-family: Fraunces;
  src: url(assets/fonts/Fraunces-600.woff2);
}
:root {
  --navy: #141a3f;
  --navy-hi: #2a3470;
  --navy-lo: #0b0e27;
  --gold: #f6c85f;
  --berry: #c3213d;
  --cream: #fff3d6;
  --led: #8dffae;
  color: var(--cream);
  font-family: Chakra, system-ui, sans-serif;
  color-scheme: dark;
  background: #100c22;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
  min-height: 100dvh;
  background: #100c22;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible {
  outline: 3px solid #80fff5;
  outline-offset: 4px;
}
button:disabled {
  cursor: default;
}
[hidden] {
  display: none !important;
}
h1,
h2,
p {
  margin: 0;
}
#workshop,
#scene {
  position: absolute;
  inset: 0;
}
#workshop {
  background:
    linear-gradient(0deg, #170e2490, transparent 36%, #0e183417),
    url(assets/workshop.webp) center/cover no-repeat;
  pointer-events: none;
}
#stage {
  height: 100%;
  width: 100%;
  display: block;
  touch-action: none;
}
body[data-screen='play'] #stage {
  cursor: crosshair;
}
.dpad,
#stage {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* ---------- shared pieces: coin, chips, pills ---------- */
.coin {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #fffbe0 0 12%, transparent 30%),
    conic-gradient(from 200deg, #ffe48c, #d39a32, #fff0a8, #b97b22, #ffe48c);
  box-shadow:
    inset 0 0 0 2px #fff0b0,
    inset 0 0 0 4px #a8701f,
    0 2px 4px #0008;
  font-style: normal;
}
.coin b {
  font: 17px/1 Georgia, serif;
  color: #8a5718;
  text-shadow: 0 1px #ffeaa0;
}
.coin.mini {
  width: 30px;
  height: 30px;
}
.coin.mini b {
  font-size: 15px;
}
.chip,
.wallet,
.mode-plaque,
.brand {
  position: relative;
  border: 0;
  border-radius: 999px;
  background:
    linear-gradient(#ffffff1c, transparent 48%, #0000002e 52%, #ffffff0a),
    linear-gradient(var(--navy-hi), var(--navy) 60%, var(--navy-lo));
  box-shadow:
    inset 0 0 0 1.5px #e7b65e,
    inset 0 0 0 3px #4b2d0e80,
    inset 0 2px 0 3px #ffffff22,
    0 4px 12px #07061aa0;
  color: #fff2cf;
  text-shadow: 0 2px 2px #0a0718;
  font: italic 700 15px Chakra;
}
.chip {
  min-height: 40px;
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition:
    transform 0.12s,
    filter 0.12s,
    opacity 0.2s;
}
.chip:hover:not(:disabled) {
  filter: brightness(1.18);
  transform: translateY(-1px);
}
.chip:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}
.chip:disabled {
  opacity: 0.45;
}
.chip.icon {
  width: 42px;
  height: 42px;
  padding: 0;
  justify-content: center;
  font: 21px/1 Georgia, serif;
}
.meter {
  width: 38px;
  height: 6px;
  border-radius: 9px;
  background: #0a0c22;
  box-shadow: inset 0 0 0 1px #e7b65e66;
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  width: var(--fill, 0%);
  background: linear-gradient(90deg, #f6c85f, #fff1b0);
  box-shadow: 0 0 6px #ffd76b;
  transition: width 0.6s cubic-bezier(0.3, 1.4, 0.5, 1);
}
#bookCount {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 999px;
  padding: 10px 26px 10px 12px;
  min-height: 60px;
  text-align: left;
  overflow: hidden;
  transition:
    transform 0.14s cubic-bezier(0.3, 1.6, 0.5, 1),
    filter 0.14s;
}
.pill > span b {
  display: block;
  font: italic 700 22px/1 Chakra;
}
.pill > span small {
  display: block;
  margin-top: 4px;
  font: 600 12px/1.1 Chakra;
  letter-spacing: 0.04em;
  opacity: 0.86;
}
.pill.gold {
  color: #3a210c;
  background:
    linear-gradient(#ffffff70, transparent 46%, #00000012 54%, #ffffff30),
    linear-gradient(#fff0a4, #f7c552 52%, #e49b33);
  box-shadow:
    inset 0 0 0 2px #fff4c2,
    inset 0 -3px 0 2px #b7782655,
    0 4px 0 #8a5418,
    0 10px 24px #2a12008a;
  text-shadow: 0 1px #fff1b9;
}
.pill.navy {
  color: #fff2cf;
  background:
    linear-gradient(#ffffff26, transparent 46%, #00000030 54%, #ffffff0e),
    linear-gradient(#34418a, #1a2152 55%, #10143a);
  box-shadow:
    inset 0 0 0 2px #e7b65e,
    inset 0 0 0 4px #4b2d0e70,
    0 4px 0 #070823,
    0 10px 24px #0008;
  text-shadow: 0 2px 2px #050414;
}
.pill .star {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-style: normal;
  font-size: 18px;
  color: #ffe08e;
  background: radial-gradient(circle, #3f4ea8, #151a45);
  box-shadow: inset 0 0 0 2px #e7b65e;
}
.pill:after {
  /* the shine sweep */
  content: '';
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: -40%;
  width: 30%;
  transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, #ffffff70, transparent);
  animation: sweep 4.2s ease-in-out infinite;
  pointer-events: none;
}
.pill.navy:after {
  animation-delay: 0.5s;
  background: linear-gradient(90deg, transparent, #ffffff30, transparent);
}
.pill:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-2px);
}
.pill:active:not(:disabled) {
  transform: translateY(3px) scale(0.98);
}
.pill.small {
  min-height: 46px;
  padding: 8px 22px;
}
.pill.small > span b {
  font-size: 18px;
}
.pill.dim {
  filter: saturate(0.35) brightness(0.85);
}
@keyframes sweep {
  0%,
  62% {
    left: -40%;
  }
  86%,
  100% {
    left: 130%;
  }
}

/* ---------- top bar ---------- */
.top {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: clamp(12px, 2.4vw, 42px);
  right: clamp(12px, 2.4vw, 42px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 4;
  pointer-events: none;
}
.top > * {
  pointer-events: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 18px 7px 8px;
  letter-spacing: 0.16em;
  font-size: 13px;
}
.brand b {
  color: var(--gold);
}
.envelope {
  position: relative;
  width: 34px;
  height: 24px;
  border-radius: 3px;
  background: repeating-linear-gradient(
    135deg,
    #c3213d 0 5px,
    #fff3d6 5px 9px,
    #2b4a8a 9px 14px,
    #fff3d6 14px 18px
  );
  box-shadow: 0 2px 4px #0007;
  transform: rotate(-6deg);
}
.envelope i {
  position: absolute;
  inset: 3px;
  background: #fff3d6;
  border-radius: 1px;
}
.envelope i:after {
  content: '';
  position: absolute;
  right: 2px;
  top: 2px;
  width: 7px;
  height: 8px;
  background: var(--berry);
}
.tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wallet {
  display: flex;
  gap: 9px;
  align-items: center;
  height: 46px;
  padding: 4px 16px 4px 6px;
}
.wallet small,
.wallet strong {
  display: block;
  line-height: 1;
}
.wallet small {
  font: 600 9px Chakra;
  letter-spacing: 0.18em;
  color: #e9c98a;
}
.wallet strong {
  font: italic 700 23px/1 Chakra;
  color: #aff5ff;
  text-shadow: 0 0 10px #59e1ff88;
  font-variant-numeric: tabular-nums;
}
.wallet.bump .coin {
  animation: coin-bump 0.5s cubic-bezier(0.3, 1.8, 0.5, 1);
}
.wallet.spend strong {
  animation: spend 0.5s ease-out;
}
@keyframes coin-bump {
  40% {
    transform: scale(1.3) rotate(18deg);
  }
}
@keyframes spend {
  30% {
    color: #ffb3a8;
    transform: translateY(3px);
  }
}

/* ---------- loading curtain ---------- */
.curtain {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 38%, #2b2f78 0%, #151338 48%, #0a0819 100%);
  transition:
    opacity 0.8s ease,
    transform 0.9s cubic-bezier(0.6, 0, 0.3, 1);
}
.curtain:before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle, #ffffffcc 0 1px, transparent 1.6px) 0 0/90px 90px,
    radial-gradient(circle, #ffffff80 0 1px, transparent 1.4px) 45px 30px/120px 120px;
  opacity: 0.35;
  animation: drift 14s linear infinite;
}
.curtain.gone {
  opacity: 0;
  transform: scale(1.06);
  pointer-events: none;
}
.curtain-inner {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
}
.curtain p {
  max-width: 420px;
  font: 600 14px Chakra;
  letter-spacing: 0.06em;
  color: #e9d6b0;
}
@keyframes drift {
  to {
    background-position:
      0 90px,
      45px 150px;
  }
}
.logo {
  display: grid;
  justify-items: center;
}
.logo-word {
  position: relative;
  font: 600 clamp(46px, 8vw, 92px) / 1.05 Fraunces, Georgia, serif;
  color: transparent;
  background: linear-gradient(#fff6c8 0%, #f6cf6a 42%, #b77a24 52%, #ffe39a 78%, #fff3c4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 3px 0 #6b3a10) drop-shadow(0 10px 18px #000a);
}
.ribbon {
  position: relative;
  margin-top: 6px;
  padding: 6px 30px;
  font: italic 700 13px Chakra;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #fff3d6;
  background: linear-gradient(#e0354f, #9d1630);
  box-shadow: inset 0 1px #ff8a9a;
  clip-path: polygon(0 0, 100% 0, 96% 50%, 100% 100%, 0 100%, 4% 50%);
}
.spin-coin {
  perspective: 300px;
}
.spin-coin .coin {
  width: 54px;
  height: 54px;
  animation: spin-coin 1.4s linear infinite;
}
.spin-coin .coin b {
  font-size: 26px;
}
@keyframes spin-coin {
  to {
    transform: rotateY(360deg);
  }
}
.loadbar {
  width: min(280px, 70vw);
  height: 8px;
  border-radius: 9px;
  background: #07081c;
  box-shadow: inset 0 0 0 1px #e7b65e66;
  overflow: hidden;
}
.loadbar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 9px;
  background: linear-gradient(90deg, #c3213d, #f6c85f, #fff1b0);
  box-shadow: 0 0 10px #ffd76b;
  transition: width 0.25s;
}

/* ---------- home ---------- */
.home-footer {
  position: absolute;
  z-index: 3;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(18px, env(safe-area-inset-bottom));
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(720px, 94%);
}
.home-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
}
.home-meta {
  display: flex;
  align-items: center;
  gap: 6px 14px;
  padding: 5px 8px 5px 16px;
  border-radius: 999px;
  background: #0d0f2bcc;
  box-shadow: inset 0 0 0 1px #e7b65e55;
  backdrop-filter: blur(4px);
  font-size: 13px;
}
.ticket b {
  color: #ffe3a0;
  font: italic 700 13px Chakra;
}
.ticket small {
  color: #d9cbb4;
  font-size: 12px;
}
.text-btn {
  border: 0;
  background: transparent;
  color: #ffe4a4;
  font: italic 700 13px Chakra;
  padding: 6px 10px;
  border-radius: 99px;
}
.text-btn:hover {
  background: #ffffff12;
}
.text-btn span {
  color: #bfa789;
}

/* ---------- play: heading ---------- */
.play-heading {
  position: absolute;
  left: clamp(12px, 2.4vw, 42px);
  top: calc(max(12px, env(safe-area-inset-top)) + 58px);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 3;
}
.mode-plaque {
  padding: 8px 14px;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: #c9fff0;
  background:
    linear-gradient(#ffffff1c, transparent 48%, #0000002e 52%),
    linear-gradient(#1f6d63, #0f3f3c);
}

/* ---------- play: the control rail ---------- */
.desk {
  --pad: 104px;
  --drop: 88px;
  position: absolute;
  z-index: 3;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(14px, env(safe-area-inset-bottom));
  width: min(700px, 96%);
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 26px);
  padding: 10px 26px 14px 18px;
  border-radius: 26px;
  background:
    linear-gradient(#ffffff14, transparent 30%),
    radial-gradient(ellipse at 50% 0, #2b3780 0%, transparent 70%),
    linear-gradient(#1a2155, #0e1236);
  box-shadow:
    inset 0 0 0 2px #e7b65e,
    inset 0 0 0 4px #3d240a,
    inset 0 0 0 5px #e7b65e55,
    inset 0 3px 0 5px #ffffff18,
    0 8px 0 #06061a,
    0 16px 36px #04031299;
}
.desk:before,
.desk:after {
  /* brass rivets */
  content: '';
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3c2, #b37a28 70%);
  box-shadow: 0 1px 1px #000a;
}
.desk:before {
  left: 8px;
}
.desk:after {
  right: 8px;
}
.dpad {
  position: relative;
  flex: none;
  width: var(--pad);
  height: var(--pad);
  border-radius: 50%;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  background: radial-gradient(circle at 50% 30%, #3a3f5e, #15172a 70%);
  box-shadow:
    inset 0 0 0 3px #e7b65e,
    inset 0 0 0 5px #3d240a,
    inset 0 6px 12px #ffffff14,
    inset 0 -8px 14px #0008,
    0 4px 0 #05050f,
    0 6px 14px #000a;
}
.dpad button {
  position: relative;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  touch-action: none;
}
.dpad button i {
  width: 0;
  height: 0;
  border: calc(var(--pad) * 0.085) solid transparent;
  filter: drop-shadow(0 0 3px #ffd77a99);
  transition: transform 0.08s;
}
.dpad [data-dir='up'] {
  grid-area: 1 / 2;
}
.dpad [data-dir='left'] {
  grid-area: 2 / 1;
}
.dpad [data-dir='right'] {
  grid-area: 2 / 3;
}
.dpad [data-dir='down'] {
  grid-area: 3 / 2;
}
.dpad [data-dir='up'] i {
  border-bottom-color: #ffd77a;
  border-top-width: 0;
}
.dpad [data-dir='down'] i {
  border-top-color: #ffd77a;
  border-bottom-width: 0;
}
.dpad [data-dir='left'] i {
  border-right-color: #ffd77a;
  border-left-width: 0;
}
.dpad [data-dir='right'] i {
  border-left-color: #ffd77a;
  border-right-width: 0;
}
.dpad button[data-held] i {
  transform: scale(0.85);
  filter: drop-shadow(0 0 8px #fff3b0) brightness(1.3);
}
.dpad .hub {
  grid-area: 2 / 2;
  margin: 14%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #4a4f72, #121428);
  box-shadow:
    inset 0 0 0 2px #00000080,
    0 1px 0 #ffffff1a;
}
.dpad:has(button[data-held]) {
  box-shadow:
    inset 0 0 0 3px #ffe9a8,
    inset 0 0 0 5px #3d240a,
    inset 0 6px 12px #ffffff14,
    inset 0 -8px 14px #0008,
    0 4px 0 #05050f,
    0 0 18px #ffd77a66;
}
.readout {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 6px;
}
.led {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 6px 14px;
  border-radius: 10px;
  background:
    radial-gradient(circle, #183a24 0.9px, transparent 1.3px) 0 0 / 4px 4px,
    linear-gradient(#030a06, #071510);
  box-shadow:
    inset 0 0 0 2px #e7b65e,
    inset 0 0 0 4px #1d1206,
    inset 0 0 18px #000,
    0 1px 0 #ffffff18;
  overflow: hidden;
}
.led:after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(#ffffff12, transparent 40%);
  pointer-events: none;
}
.lamp {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #eaffef, var(--led) 50%, #1d8a45);
  box-shadow: 0 0 10px var(--led);
  animation: lamp 1.6s ease-in-out infinite;
}
@keyframes lamp {
  50% {
    opacity: 0.55;
  }
}
.led strong {
  min-width: 0;
  font: 400 clamp(15px, 1.75vw, 21px) / 1.1 Russo, Chakra, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--led);
  text-shadow:
    0 0 6px #6dff9c,
    0 0 16px #2fff7a66;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.led.flash strong {
  animation: led-flash 0.24s steps(2) 3;
}
@keyframes led-flash {
  50% {
    opacity: 0.2;
  }
}
.desk[data-tone='warn'] {
  --led: #ffcf6b;
}
.desk[data-tone='warn'] .led strong {
  color: #ffd27a;
  text-shadow:
    0 0 6px #ffc24d,
    0 0 16px #ff9d2a66;
}
.desk[data-tone='bad'] {
  --led: #ff6d6d;
}
.desk[data-tone='bad'] .led strong {
  color: #ff8a80;
  text-shadow:
    0 0 6px #ff5a5a,
    0 0 16px #ff2a2a66;
}
.readout small {
  padding-left: 4px;
  font-size: 12px;
  line-height: 1.25;
  color: #cfc6dc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drop {
  position: relative;
  flex: none;
  display: grid;
  justify-items: center;
  gap: 9px;
  border: 0;
  padding: 0;
  background: transparent;
}
.drop-cap {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--drop);
  height: var(--drop);
  border-radius: 50%;
  background:
    radial-gradient(ellipse 60% 38% at 50% 24%, #ffffffb0, #ffffff00 70%),
    radial-gradient(circle at 50% 62%, #ff4b5e, #c3122c 58%, #7a0616);
  box-shadow:
    0 0 0 4px #7a0616,
    0 0 0 7px #e7b65e,
    0 0 0 9px #3d240a,
    0 7px 0 7px #05050f,
    0 12px 20px 6px #000a;
  transition:
    transform 0.08s,
    filter 0.2s,
    box-shadow 0.2s;
}
.drop-cap b {
  font: 400 calc(var(--drop) * 0.22) / 1 Russo, Chakra, sans-serif;
  letter-spacing: 0.04em;
  color: #fff4ec;
  text-shadow:
    0 2px 0 #7a0616,
    0 0 10px #ff9aa6aa;
}
.drop small {
  font: 600 10px Chakra;
  letter-spacing: 0.12em;
  color: #e9c98a;
  white-space: nowrap;
}
.drop:not(:disabled) .drop-cap {
  animation: ready 1.5s ease-in-out infinite;
}
.drop:hover:not(:disabled) .drop-cap {
  filter: brightness(1.1);
}
.drop:active:not(:disabled) .drop-cap,
.drop.pressed .drop-cap {
  transform: translateY(5px);
  box-shadow:
    0 0 0 4px #7a0616,
    0 0 0 7px #e7b65e,
    0 0 0 9px #3d240a,
    0 2px 0 7px #05050f,
    0 4px 10px 6px #000a;
}
.drop:disabled .drop-cap {
  filter: saturate(0.45) brightness(0.62);
}
.drop:disabled small {
  opacity: 0.5;
}
@keyframes ready {
  50% {
    box-shadow:
      0 0 0 4px #7a0616,
      0 0 0 7px #ffe3a0,
      0 0 0 9px #3d240a,
      0 7px 0 7px #05050f,
      0 12px 20px 6px #000a,
      0 0 30px 12px #ff4b5e55;
  }
}

/* ---------- callouts: airmail tags, top right, away from the chute ---------- */
#callout {
  position: absolute;
  z-index: 5;
  right: clamp(12px, 2.4vw, 42px);
  top: calc(max(12px, env(safe-area-inset-top)) + 64px);
  display: grid;
  justify-items: end;
  gap: 8px;
  pointer-events: none;
}
.tag {
  position: relative;
  padding: 8px 16px 8px 24px;
  font: 400 clamp(17px, 2vw, 24px) / 1 Russo, Chakra, sans-serif;
  letter-spacing: 0.06em;
  color: #3a1a10;
  background: #fff3d6;
  border-radius: 4px;
  border: 5px solid transparent;
  border-image: repeating-linear-gradient(
      135deg,
      #c3213d 0 8px,
      #fff3d6 8px 13px,
      #2b4a8a 13px 21px,
      #fff3d6 21px 26px
    )
    5;
  box-shadow: 0 6px 16px #000a;
  transform-origin: 90% 50%;
  animation:
    tag-in 0.42s cubic-bezier(0.25, 1.7, 0.45, 1) both,
    tag-out 0.35s ease-in 1.9s forwards;
}
.tag:before {
  /* the punched hole */
  content: '';
  position: absolute;
  left: 7px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: #1a1430;
  box-shadow: 0 0 0 2px #e7b65e;
}
.tag small {
  display: block;
  margin-top: 3px;
  font: 600 11px Chakra;
  letter-spacing: 0.1em;
  color: #8b5a38;
}
.tag.gold {
  background: linear-gradient(#fff6c8, #f6cf6a);
}
.tag.cool {
  color: #0f2d4a;
}
@keyframes tag-in {
  from {
    opacity: 0;
    transform: translateX(30px) rotate(8deg) scale(0.6);
  }
  to {
    opacity: 1;
    transform: rotate(-3deg);
  }
}
@keyframes tag-out {
  to {
    opacity: 0;
    transform: translateY(-14px) rotate(-6deg) scale(0.9);
  }
}

/* ---------- coin ritual ---------- */
#coinFly {
  position: fixed;
  z-index: 15;
  left: 0;
  top: 0;
  pointer-events: none;
  opacity: 0;
  perspective: 300px;
}
#coinFly .coin {
  width: 40px;
  height: 40px;
}
#coinFly.go {
  animation: coin-fly 0.62s cubic-bezier(0.45, 0, 0.6, 1) forwards;
}
@keyframes coin-fly {
  0% {
    opacity: 1;
    transform: translate(var(--x0), var(--y0)) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(var(--xm), var(--ym)) scale(1.3);
  }
  100% {
    opacity: 0;
    transform: translate(var(--x1), var(--y1)) scale(0.45);
  }
}
#coinFly.go .coin {
  animation: spin-coin 0.3s linear infinite;
}

/* ---------- overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 6;
  overflow: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(ellipse at 50% 0, #2a2f7aee, #14112ef2 60%),
    url(assets/workshop.webp) center/cover;
  animation: fade 0.25s ease-out;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.gallery-shell {
  width: min(1160px, 95vw);
  margin: 0 auto;
  padding: max(clamp(14px, 3.2vh, 36px), env(safe-area-inset-top)) 0 24px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.section-head h1 {
  font: 600 clamp(30px, 4vw, 56px) / 1.1 Fraunces, Georgia, serif;
  color: transparent;
  background: linear-gradient(#fff6c8, #f6cf6a 50%, #d39a3a);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 2px 0 #4b250c);
}
.eyebrow {
  font: italic 700 12px/1.3 Chakra;
  letter-spacing: 0.13em;
  color: #d5b678;
  text-transform: uppercase;
}
.gallery-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 2px;
  margin-bottom: 12px;
  border-bottom: 1px solid #ac884c55;
  color: #ffe3a0;
  font-size: 14px;
}
.gallery-bar .bar {
  flex: 1;
  max-width: 320px;
  height: 8px;
  border-radius: 9px;
  background: #07081c;
  box-shadow: inset 0 0 0 1px #e7b65e66;
  overflow: hidden;
}
.gallery-bar .bar i {
  display: block;
  height: 100%;
  width: var(--fill, 0%);
  background: linear-gradient(90deg, #c3213d, #f6c85f, #fff1b0);
  box-shadow: 0 0 10px #ffd76b;
  transition: width 0.8s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.gallery-bar .hint {
  margin-left: auto;
  font-size: 12px;
  color: #cdbead;
}
.shelves {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px 12px;
}
.slot {
  position: relative;
  border: 0;
  border-radius: 10px;
  padding: 0;
  background: #1b1730;
  overflow: hidden;
  color: var(--cream);
  text-align: center;
  box-shadow:
    inset 0 0 0 1.5px #8a6a3c,
    0 6px 14px #0b091b99;
  transition:
    transform 0.16s cubic-bezier(0.3, 1.6, 0.5, 1),
    box-shadow 0.16s;
  animation: slot-in 0.4s cubic-bezier(0.3, 1.4, 0.5, 1) both;
  animation-delay: calc(var(--i, 0) * 35ms);
}
@keyframes slot-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
}
.slot:hover,
.slot:focus-visible {
  transform: translateY(-3px);
  box-shadow:
    inset 0 0 0 2px #ffdc8e,
    0 10px 20px #0b091bcc;
}
.slot:after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 40%;
  transform: skewX(-18deg);
  background: linear-gradient(90deg, transparent, #ffffff30, transparent);
  transition: left 0.5s;
  pointer-events: none;
}
.slot:hover:after {
  left: 130%;
}
.slot.rare.got:before {
  /* holo frame */
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 10px;
  padding: 2.5px;
  background: conic-gradient(from var(--a, 0deg), #ffe08e, #ff9ad5, #9ad8ff, #a4ffcf, #ffe08e);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: holo 4s linear infinite;
  pointer-events: none;
  z-index: 2;
}
@property --a {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes holo {
  to {
    --a: 360deg;
  }
}
.new-ribbon {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: -28px;
  width: 100px;
  padding: 3px 0;
  transform: rotate(38deg);
  font: 400 11px Russo;
  letter-spacing: 0.12em;
  color: #fff;
  background: linear-gradient(#e0354f, #9d1630);
  box-shadow: 0 2px 6px #0008;
}
.niche,
.specimen {
  position: relative;
  background: url(assets/niche.webp) center/100% 100% no-repeat;
  overflow: hidden;
}
.niche {
  display: block;
  aspect-ratio: 1.32;
}
.niche img,
.specimen img {
  position: absolute;
  object-fit: contain;
  width: 89%;
  height: 84%;
  bottom: 9%;
  left: 5.5%;
  filter: drop-shadow(0 5px 3px #160d2699);
}
.missing img {
  filter: brightness(0) saturate(100%) invert(11%) sepia(34%) saturate(670%) hue-rotate(202deg)
    brightness(76%) drop-shadow(1px 1px 0 var(--rim, #b5c5e1))
    drop-shadow(-1px -1px 0 var(--rim, #b5c5e1));
  opacity: 0.95;
}
.slot-info {
  display: block;
  padding: 7px 4px 8px;
  background: linear-gradient(#2c2754, #17143a);
  box-shadow: inset 0 1px #e7b65e66;
}
.slot strong,
.slot small {
  display: block;
  line-height: 1.3;
}
.slot strong {
  font: italic 700 clamp(12px, 1.2vw, 17px) Chakra;
}
.slot small {
  font-size: 11px;
  color: #c9bfd9;
}
.slot .caught {
  color: #ffdb8b;
}
.dialog {
  display: grid;
  place-items: center;
  padding: 16px;
  background: #0b0c22c4;
  backdrop-filter: blur(6px);
}
.postcard {
  color: #302640;
  position: relative;
  background:
    radial-gradient(ellipse at 20% 0, #fffaf0, transparent 60%),
    #fff1d4;
  border: 8px solid transparent;
  border-image: repeating-linear-gradient(
      132deg,
      #b42b44 0 14px,
      #fff1d4 14px 25px,
      #365377 25px 39px,
      #fff1d4 39px 50px
    )
    8;
  padding: clamp(18px, 3vw, 36px);
  width: min(760px, 95vw);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  box-shadow: 0 24px 80px #050414c0;
}
.result-card,
.detail {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) 1.1fr;
  align-items: center;
  gap: clamp(18px, 3vw, 36px);
}
.result-card {
  overflow: hidden auto;
}
.reveal {
  position: relative;
  display: grid;
  place-items: center;
}
.rays {
  position: absolute;
  inset: -30%;
  background: repeating-conic-gradient(from 0deg, #ffc93f66 0 7deg, transparent 7deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 0, #000 22%, transparent 62%);
  mask: radial-gradient(circle, #000 0, #000 22%, transparent 62%);
  animation: rays 18s linear infinite;
  pointer-events: none;
}
.rare .rays {
  background: repeating-conic-gradient(
    from 0deg,
    #ffc93f88 0 6deg,
    transparent 6deg 12deg,
    #c58cff77 12deg 18deg,
    transparent 18deg 24deg
  );
}
@keyframes rays {
  to {
    transform: rotate(360deg);
  }
}
.specimen {
  width: 100%;
  aspect-ratio: 0.9;
  border-radius: 47% 47% 8px 8px;
  box-shadow:
    0 0 0 2px #846132,
    0 0 0 5px #f6dca0,
    0 0 0 6px #846132,
    0 12px 28px #3a1d0a55;
}
.paper-copy h1,
.orders h1 {
  font: 600 clamp(29px, 3.7vw, 48px) / 1.05 Fraunces, Georgia, serif;
  color: #35273e;
}
.paper-copy p,
.orders > p {
  margin: 12px 0;
  color: #534557;
  line-height: 1.45;
}
.paper-copy .eyebrow,
.orders .eyebrow {
  color: #78613e;
  font-size: 11px;
}
.postmark {
  display: inline-block;
  color: #ac3348;
  border: 3px double #b94050;
  border-radius: 6px;
  transform: rotate(-5deg);
  font: 400 17px Russo;
  padding: 5px 11px;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.rare .postmark {
  color: #7a4c08;
  border-color: #c4902c;
  background: linear-gradient(#fff6c8, #f6cf6a);
  box-shadow: 0 0 18px #ffd76b88;
}
.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.paper-copy dl {
  font-size: 14px;
  border-top: 1px solid #bba889;
  margin: 12px 0;
}
.paper-copy dt {
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #6f5d5a;
  margin-top: 7px;
}
.paper-copy dd {
  margin: 2px 0;
}
.postcard .chip {
  margin-top: 6px;
}
.order {
  border-top: 1px solid #bea783;
  padding: 12px 0;
}
.order b,
.order small {
  display: block;
}
.order small {
  color: #6d5863;
}
.order progress {
  width: 100%;
  height: 7px;
  margin-top: 7px;
  accent-color: #c3213d;
}
.order-award {
  font-size: 14px;
  font-weight: bold;
  color: #167166;
  margin: 7px 0;
}
#toast {
  position: fixed;
  z-index: 12;
  bottom: 160px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(#232b66, #121640);
  box-shadow:
    inset 0 0 0 1.5px #e7b65e,
    0 8px 24px #000a;
  font-size: 14px;
  text-align: center;
  width: max-content;
  max-width: 88vw;
  animation: fade 0.2s;
}
.specimen #stage {
  position: absolute;
  inset: 8% 5% 9%;
  width: 90%;
  height: 83%;
  cursor: grab;
  outline: none;
}
.specimen #stage:active {
  cursor: grabbing;
}
.specimen:has(#stage) img {
  visibility: hidden;
}
#scene #stage:focus {
  outline: none;
}
.result-card {
  animation: card-in 0.45s cubic-bezier(0.25, 1.5, 0.45, 1);
}
.result-card .postmark {
  animation: stamp-in 0.38s cubic-bezier(0.3, 1.8, 0.5, 1) 0.35s both;
}
@keyframes stamp-in {
  from {
    transform: rotate(-16deg) scale(1.8);
    opacity: 0;
  }
  to {
    transform: rotate(-5deg) scale(1);
    opacity: 1;
  }
}
@keyframes card-in {
  from {
    transform: translateY(26px) scale(0.92);
    opacity: 0;
  }
}

/* ---------- smaller screens ---------- */
@media (max-width: 780px) {
  .shelves {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .gallery-shell {
    width: 94vw;
  }
  .brand {
    font-size: 10px;
    letter-spacing: 0.1em;
    padding: 6px 12px 6px 6px;
  }
  .tools {
    gap: 6px;
  }
  .chip {
    font-size: 13px;
    padding: 6px 12px;
    min-height: 36px;
  }
  .chip.icon {
    width: 38px;
    height: 38px;
  }
}
@media (max-aspect-ratio: 4/5) {
  .top {
    left: 10px;
    right: 10px;
  }
  .brand > span:last-child {
    display: none;
  }
  .brand {
    padding: 6px 8px;
  }
  .chip-label {
    display: none;
  }
  .wallet {
    height: 38px;
    padding: 3px 12px 3px 4px;
    gap: 6px;
  }
  .wallet .coin {
    width: 30px;
    height: 30px;
  }
  .wallet strong {
    font-size: 19px;
  }
  .wallet small {
    font-size: 7px;
  }
  .home-footer {
    width: calc(100% - 20px);
    bottom: max(14px, env(safe-area-inset-bottom));
  }
  .home-actions {
    width: 100%;
    gap: 10px;
  }
  .home-actions .pill {
    flex: 1;
    padding: 9px 12px 9px 9px;
    min-height: 58px;
    gap: 9px;
  }
  .pill > span b {
    font-size: 19px;
  }
  .pill > span small {
    font-size: 11px;
  }
  .home-meta {
    font-size: 12px;
    padding: 4px 4px 4px 12px;
    gap: 4px 8px;
  }
  .ticket small {
    font-size: 11px;
  }
  .play-heading {
    left: 10px;
    right: 10px;
    top: calc(max(12px, env(safe-area-inset-top)) + 50px);
  }
  .play-heading #view {
    margin-left: auto;
  }
  #callout {
    right: 12px;
    top: calc(max(12px, env(safe-area-inset-top)) + 100px);
  }
  .desk {
    --pad: 100px;
    --drop: 70px;
    width: calc(100% - 16px);
    padding: 10px 14px 14px 10px;
    gap: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    border-radius: 24px;
  }
  .desk:before,
  .desk:after {
    display: none;
  }
  .led {
    min-height: 40px;
    padding: 6px 9px;
  }
  .led strong {
    font-size: min(14px, 3.5vw);
    letter-spacing: 0.03em;
  }
  .lamp {
    display: none;
  }
  .text-btn {
    white-space: nowrap;
  }
  .readout small {
    font-size: 10.5px;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .drop small {
    font-size: 9px;
    letter-spacing: 0.06em;
  }
  .shelves {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .gallery-bar .hint {
    display: none;
  }
  .postcard {
    padding: 16px 16px 18px;
  }
  .result-card,
  .detail {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 10px;
  }
  .reveal {
    width: min(48vw, 190px);
    margin: 8px auto 0;
  }
  .detail .specimen {
    width: min(48vw, 190px);
    margin: auto;
  }
  .specimen {
    aspect-ratio: 1.05;
  }
  .paper-copy p {
    margin: 8px 0;
    font-size: 14px;
  }
  .paper-copy h1 {
    font-size: 30px;
  }
  .result-actions {
    justify-content: center;
    margin-top: 12px;
  }
  .paper-copy dl {
    text-align: left;
  }
}
@media (max-height: 540px) and (min-aspect-ratio: 4/5) {
  .top {
    top: max(6px, env(safe-area-inset-top));
  }
  .brand {
    padding: 4px 12px 4px 5px;
  }
  .envelope {
    width: 26px;
    height: 19px;
  }
  .wallet {
    height: 36px;
  }
  .wallet .coin {
    width: 28px;
    height: 28px;
  }
  .chip {
    min-height: 32px;
    padding: 4px 12px;
  }
  .chip.icon {
    width: 34px;
    height: 34px;
  }
  /* one header row in play: the controls take the brand's place */
  body[data-screen='play'] .brand {
    visibility: hidden;
  }
  .play-heading {
    top: max(6px, env(safe-area-inset-top));
  }
  #callout {
    top: calc(max(6px, env(safe-area-inset-top)) + 46px);
  }
  .readout small {
    display: none;
  }
  .home-footer {
    bottom: max(6px, env(safe-area-inset-bottom));
    gap: 6px;
  }
  .pill {
    min-height: 46px;
    padding: 6px 20px 6px 8px;
  }
  .pill > span b {
    font-size: 17px;
  }
  .home-meta {
    padding: 2px 4px 2px 12px;
  }
  .desk {
    --pad: 78px;
    --drop: 58px;
    bottom: max(6px, env(safe-area-inset-bottom));
    padding: 6px 22px 10px 14px;
    width: min(640px, 92%);
  }
  .led {
    min-height: 34px;
  }
  .drop small {
    display: none;
  }
  .shelves {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .section-head h1 {
    font-size: 27px;
  }
  .section-head .eyebrow {
    display: none;
  }
  .gallery-shell {
    padding-top: 9px;
  }
  .niche {
    aspect-ratio: 1.7;
  }
  .gallery-bar {
    margin: 0;
    padding: 4px;
  }
  .slot-info {
    padding: 3px;
  }
  .result-card,
  .detail {
    max-width: 640px;
  }
  .specimen {
    max-height: 210px;
  }
  .reveal .rays {
    inset: -15%;
  }
  .postcard {
    padding: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
  }
}

/* =====================================================================================================
   Calendar kit (facelift, 30 Nov 2026). The Magic Mailroom's gold-rimmed indigo panels and Russo One
   controls, the toy shop's Fraunces titles and plum cards. Russo One = controls and numbers,
   Fraunces = names and titles, Chakra Petch = everything you read.
   ===================================================================================================== */
:root {
  --gold1: #fff6c4;
  --gold2: #ffd45a;
  --gold3: #e8962a;
  --ink: #14204a;
  --ink2: #0b1233;
  --plum: #2a1030;
  --rim: linear-gradient(150deg, var(--gold1), var(--gold2) 35%, var(--gold3) 65%, var(--gold1));
  --lift: 0 4px 0 rgba(40, 20, 0, 0.55), 0 8px 18px rgba(0, 0, 0, 0.45);
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
button:focus-visible {
  outline: 3px solid #fff6c4;
  outline-offset: 4px;
}

/* ---- chips, the purse and round icons: gold rim on indigo ---- */
.chip,
.wallet,
.mode-plaque,
.brand {
  border: 3px solid transparent;
  background:
    linear-gradient(#ffffff18, transparent 50%) padding-box,
    linear-gradient(#1b2a64, var(--ink2)) padding-box,
    var(--rim) border-box;
  box-shadow: var(--lift), inset 0 2px 6px rgba(255, 255, 255, 0.14);
  color: #fff2cf;
  font: 400 15px/1 Russo, Chakra, sans-serif;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 0 #050714;
}
.chip {
  min-height: 46px;
  padding: 8px 18px;
  white-space: nowrap;
}
#shelves:focus,
#orderList:focus {
  outline: none;
}
.chip:hover:not(:disabled) {
  filter: brightness(1.12);
  transform: translateY(-2px);
}
.chip:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 rgba(40, 20, 0, 0.55),
    0 3px 8px rgba(0, 0, 0, 0.45),
    inset 0 2px 6px rgba(255, 255, 255, 0.14);
}
.chip.round {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  padding: 0;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 35%, #2e3f86, #101a46 70%) padding-box,
    var(--rim) border-box;
  color: var(--gold2);
  font: 22px/1 Georgia, serif;
}
.gallery-chip {
  padding-left: 6px;
  gap: 9px;
}
.gem {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #fff3c4, #f3c04e 45%, #a8670f);
  box-shadow:
    inset 0 -2px 3px rgba(90, 40, 0, 0.45),
    0 0 10px rgba(255, 200, 90, 0.35);
}
.gem svg {
  width: 20px;
  height: 20px;
  fill: #7a3a00;
}
#bookCount {
  font: 400 16px Russo;
  color: var(--gold2);
}
.meter {
  width: 46px;
  height: 7px;
}
.wallet {
  height: 52px;
  padding: 4px 18px 4px 5px;
}
.wallet .coin {
  width: 38px;
  height: 38px;
}
.wallet small {
  font: 700 9px Chakra;
  color: #f4dfa8;
}
.wallet strong {
  font: 400 26px/1 Russo;
  color: var(--gold2);
  text-shadow:
    0 2px 0 #3a1c00,
    0 0 12px #ffcf5a66;
}
.brand {
  font: 400 13px Russo;
  letter-spacing: 0.14em;
  padding: 6px 18px 6px 8px;
  min-height: 46px;
}
.brand b {
  font-weight: 400;
  color: var(--gold2);
}
.mode-plaque {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  font: 400 14px Russo;
  color: #c9fff0;
  background:
    linear-gradient(#ffffff18, transparent 50%) padding-box,
    linear-gradient(#1f6d63, #0c3a36) padding-box,
    var(--rim) border-box;
}

/* ---- home: the painted lockup and the two big buttons ---- */
body[data-screen='home'] .brand {
  visibility: hidden;
}
.home-logo {
  position: absolute;
  z-index: 3;
  margin: 0;
  left: max(clamp(10px, 2vw, 34px), env(safe-area-inset-left));
  top: max(clamp(4px, 1vh, 14px), env(safe-area-inset-top));
  width: clamp(190px, 24vw, 400px);
  aspect-ratio: 2;
  background: url(assets/logo.webp) center/contain no-repeat;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5));
  transform-origin: 20% 30%;
  animation: logo-in 1.1s cubic-bezier(0.2, 1.4, 0.4, 1) both 0.15s;
  pointer-events: none;
}
@keyframes logo-in {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.88) rotate(-3deg);
  }
}
.home-actions {
  gap: 16px;
}
.pill {
  min-height: 68px;
  padding: 10px 28px 10px 12px;
}
.pill > span b {
  font: 400 24px/1 Russo, sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.pill > span small {
  font: 700 12px/1.1 Chakra;
  letter-spacing: 0.06em;
  margin-top: 5px;
}
.pill.gold {
  color: #3a1c00;
  border: 3px solid #fff2b0;
  background: linear-gradient(180deg, #fffbe0 0%, #ffe46a 30%, #ffc21e 52%, #f09a10 53%, #ffcf3a 100%);
  box-shadow:
    0 6px 0 #9a5200,
    0 12px 24px rgba(0, 0, 0, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 0 #fff3b8;
}
.pill.navy {
  color: var(--gold2);
  border: 3px solid transparent;
  background:
    linear-gradient(#ffffff1c, transparent 50%) padding-box,
    linear-gradient(#2e3f86, #13204e 60%, #0a1236) padding-box,
    var(--rim) border-box;
  box-shadow:
    0 6px 0 #070a24,
    0 12px 24px rgba(0, 0, 0, 0.45),
    inset 0 2px 6px rgba(255, 255, 255, 0.16);
  text-shadow: 0 2px 0 #050714;
}
.pill.navy small {
  color: #f4e6c4;
}
.pill:active:not(:disabled) {
  transform: translateY(5px);
}
.pill.gold:active:not(:disabled) {
  box-shadow:
    0 1px 0 #9a5200,
    0 4px 10px rgba(0, 0, 0, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.9);
}
.pill.navy:active:not(:disabled) {
  box-shadow:
    0 1px 0 #070a24,
    0 4px 10px rgba(0, 0, 0, 0.45),
    inset 0 2px 6px rgba(255, 255, 255, 0.16);
}
.pill .star {
  width: 36px;
  height: 36px;
  font-size: 20px;
  color: var(--gold2);
  background: radial-gradient(circle, #3f4ea8, #121a48);
  box-shadow: inset 0 0 0 2px #e7b65e;
}
.pill .coin.mini {
  width: 36px;
  height: 36px;
}
.home-meta {
  border: 2px solid transparent;
  background:
    linear-gradient(#141c48ee, #0a1030ee) padding-box,
    linear-gradient(150deg, #fff6c488, #e8962a88) border-box;
  box-shadow: 0 4px 12px #0008;
}
.ticket b,
.text-btn {
  font: 400 13px Russo;
  letter-spacing: 0.03em;
}
.text-btn {
  color: var(--gold2);
}
/* gamepad prompts appear only once a pad is in use */
.pad-hint {
  display: none;
  margin-left: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  place-items: center;
  font: 400 13px/1 Russo;
  color: #fff;
  background: radial-gradient(circle at 40% 35%, #5c6ad0, #1c2464);
  box-shadow:
    inset 0 0 0 2px #ffffff55,
    0 2px 0 #0008;
}
body[data-pad] .pad-hint {
  display: grid;
}
.pill.gold .pad-hint {
  background: radial-gradient(circle at 40% 35%, #ffe17a, #c77a10);
  color: #3a1c00;
  box-shadow:
    inset 0 0 0 2px #fff4c2,
    0 2px 0 #8a4a00;
}

/* ---- play: the control console ---- */
.desk {
  --pad: 164px;
  --drop: 112px;
  width: min(820px, 96%);
  padding: 12px 30px 14px 16px;
  border-radius: 30px;
  border: 3px solid transparent;
  background:
    radial-gradient(ellipse at 50% -20%, #33449a 0%, transparent 60%) padding-box,
    linear-gradient(#1a2560, #0c1238) padding-box,
    var(--rim) border-box;
  box-shadow:
    0 7px 0 #070a24,
    0 18px 40px #04031299,
    inset 0 2px 8px rgba(255, 255, 255, 0.14);
}
.desk:before,
.desk:after {
  top: 14px;
  margin: 0;
}
.pad-well {
  flex: none;
  display: grid;
  justify-items: center;
  gap: 6px;
}
.keys,
.drop > small {
  font: 400 10px/1 Russo;
  letter-spacing: 0.12em;
  color: #f4dfa8;
  white-space: nowrap;
}
.keys .k-pad,
body[data-pad] .keys .k-kb {
  display: none;
}
body[data-pad] .keys .k-pad {
  display: inline;
}
.dpad {
  grid-template: 1fr 0.62fr 1fr / 1fr 0.62fr 1fr;
  width: var(--pad);
  height: var(--pad);
  padding: calc(var(--pad) * 0.035);
  gap: calc(var(--pad) * 0.006);
  border-radius: 50%;
  border: 3px solid transparent;
  background:
    radial-gradient(circle at 50% 38%, #2a2f58, #0c0e22 72%) padding-box,
    var(--rim) border-box;
  box-shadow:
    0 5px 0 #05050f,
    0 10px 20px #000a,
    inset 0 -10px 18px #0009,
    inset 0 6px 12px #ffffff10;
}
.dpad:has(button[data-held]),
.dpad:has(button[data-key]) {
  box-shadow:
    0 5px 0 #05050f,
    0 0 22px #ffd45a66,
    inset 0 -10px 18px #0009,
    inset 0 6px 12px #ffffff10;
}
.dpad button {
  border-radius: 14px;
  border: 2px solid #f0c36a;
  background:
    linear-gradient(#ffffff26, transparent 46%),
    linear-gradient(#3a4aa6, #1c2668 60%, #121a4c);
  box-shadow:
    0 5px 0 #070a24,
    0 7px 8px #0008,
    inset 0 2px 0 #ffffff38;
  transition:
    transform 0.06s,
    box-shadow 0.06s,
    background 0.06s;
}
.dpad button i {
  display: block;
  width: 60%;
  height: 60%;
  border: 0 !important;
  filter: drop-shadow(0 1px 0 #000a);
}
.dpad button svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--gold2);
  stroke-width: 3.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dpad button i,
.dpad button[data-held] i,
.dpad button[data-key] i {
  transform: none;
}
.dpad [data-dir='down'] svg {
  transform: rotate(180deg);
}
.dpad [data-dir='left'] svg {
  transform: rotate(-90deg);
}
.dpad [data-dir='right'] svg {
  transform: rotate(90deg);
}
.dpad button:hover:not(:disabled) {
  filter: brightness(1.15);
}
.dpad button[data-held],
.dpad button[data-key],
.dpad button:active {
  transform: translateY(4px);
  background:
    linear-gradient(#ffffff60, transparent 50%),
    linear-gradient(180deg, #fffbe0 0%, #ffe46a 35%, #ffc21e 60%, #f09a10 100%);
  border-color: #fff4c2;
  box-shadow:
    0 1px 0 #070a24,
    0 0 16px #ffd45aaa,
    inset 0 2px 0 #ffffff88;
}
.dpad button[data-held] svg,
.dpad button[data-key] svg,
.dpad button:active svg {
  stroke: #4a2200;
}
.dpad button[data-held] i,
.dpad button[data-key] i {
  filter: none;
}
.dpad .hub {
  margin: 12%;
  background: radial-gradient(circle at 38% 32%, #fff3c4, #f3c04e 45%, #a8670f);
  box-shadow:
    0 2px 0 #0009,
    inset 0 -2px 3px rgba(90, 40, 0, 0.45);
}
.led {
  min-height: 54px;
  border-radius: 12px;
}
.led strong {
  font-size: clamp(16px, 1.9vw, 23px);
}
.readout small {
  font: 600 13px/1.3 Chakra;
  color: #d9d6f2;
}
.drop {
  position: relative;
  gap: 14px;
}
.drop-ring {
  position: absolute;
  top: calc(var(--drop) * -0.1);
  left: 50%;
  width: calc(var(--drop) * 1.2);
  height: calc(var(--drop) * 1.2);
  margin-left: calc(var(--drop) * -0.6);
  border-radius: 50%;
  background:
    radial-gradient(circle, #1a0208 0 57%, transparent 58%),
    conic-gradient(from 210deg, #fff6c4, #e8962a, #ffd45a, #a8670f, #fff6c4, #e8962a, #fff6c4);
  box-shadow:
    0 6px 0 #05050f,
    0 12px 22px #000a;
}
.drop-cap {
  z-index: 1;
  background:
    radial-gradient(ellipse 58% 36% at 50% 22%, #ffffffc8, #ffffff00 72%),
    radial-gradient(circle at 50% 64%, #ff5a6c, #d0142f 56%, #7a0616);
  box-shadow:
    0 calc(var(--drop) * 0.08) 0 #6a0412,
    0 calc(var(--drop) * 0.1) 10px #000c,
    inset 0 -6px 12px #5a0010aa;
  transform: translateY(calc(var(--drop) * -0.04));
  transition:
    transform 0.07s,
    box-shadow 0.07s,
    filter 0.2s;
}
.drop-cap b {
  font: 400 calc(var(--drop) * 0.25) / 1 Russo, sans-serif;
  letter-spacing: 0.05em;
}
.drop > small {
  position: relative;
  z-index: 1;
  padding: 4px 9px;
  border-radius: 6px;
  background: #0a0f2c;
  box-shadow:
    inset 0 0 0 1px #e7b65e88,
    0 1px 0 #ffffff14;
}
.drop:not(:disabled) .drop-cap {
  animation: ready2 1.5s ease-in-out infinite;
}
@keyframes ready2 {
  50% {
    filter: brightness(1.15);
    box-shadow:
      0 calc(var(--drop) * 0.08) 0 #6a0412,
      0 calc(var(--drop) * 0.1) 10px #000c,
      inset 0 -6px 12px #5a0010aa,
      0 0 34px 10px #ff4b5e66;
  }
}
.drop:active:not(:disabled) .drop-cap,
.drop.pressed .drop-cap {
  animation: none;
  transform: translateY(calc(var(--drop) * 0.06)) scale(0.95);
  filter: brightness(1.35) saturate(1.2);
  background:
    radial-gradient(ellipse 50% 30% at 50% 30%, #ffffff80, #ffffff00 72%),
    radial-gradient(circle at 50% 60%, #ff8a96, #e41d3a 52%, #8a0a1c);
  box-shadow:
    0 0 0 #6a0412,
    inset 0 8px 16px #5a0010dd,
    0 0 46px 18px #ff4b5ecc;
}
.drop:active:not(:disabled) .drop-ring,
.drop.pressed .drop-ring {
  box-shadow:
    0 6px 0 #05050f,
    0 0 30px 6px #ffd45a88;
}
.drop-cap b {
  transition: transform 0.07s;
}
.drop:disabled .drop-cap {
  animation: none;
  filter: saturate(0.4) brightness(0.55);
}

/* ---- gallery, cards and toast: toy-shop plum, Fraunces titles ---- */
.overlay {
  background:
    radial-gradient(ellipse at 50% 0, #3a1a5aee, #160a26f4 62%),
    url(assets/workshop.webp) center/cover;
}
.section-head h1 {
  font: italic 600 clamp(32px, 4.2vw, 60px) / 1.1 Fraunces, Georgia, serif;
  background: linear-gradient(#fff6c8, #ffd45a 50%, #e8962a);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 3px 0 #4b1a0c);
}
.eyebrow {
  font: 400 12px/1.3 Russo;
  letter-spacing: 0.16em;
  color: #ffd98a;
}
.slot {
  border: 2px solid transparent;
  background:
    linear-gradient(#24123a, #160a26) padding-box,
    var(--rim) border-box;
  box-shadow: var(--lift);
  border-radius: 14px;
}
.slot-info {
  background: linear-gradient(#3a1640, #1e0c28);
  box-shadow: inset 0 2px #ffd45a55;
}
.slot strong {
  font: italic 600 clamp(13px, 1.25vw, 18px) / 1.25 Fraunces, Georgia, serif;
}
.slot .caught {
  color: var(--gold2);
}
.gallery-bar strong {
  font: 400 15px Russo;
  color: var(--gold2);
}
.paper-copy h1,
.orders h1 {
  font: italic 600 clamp(30px, 3.8vw, 50px) / 1.05 Fraunces, Georgia, serif;
  color: #14204a;
}
.paper-copy .eyebrow,
.orders .eyebrow {
  font: 400 11px Russo;
  color: #8a1a14;
}
.postcard {
  border-width: 12px;
  border-image: repeating-linear-gradient(-45deg, #c8232f 0 16px, #fbf3e1 16px 24px, #2a4fb0 24px 40px, #fbf3e1 40px 48px) 14;
  background:
    radial-gradient(ellipse at 20% 0, #fffdf6, transparent 60%),
    #fbf3e1;
}
.result-actions .pill {
  min-height: 52px;
}
.result-actions .pill > span b {
  font-size: 18px;
}
.order b {
  font: 400 15px Russo;
  color: #14204a;
}
#toast {
  border: 3px solid transparent;
  background:
    linear-gradient(#1b2a64, #0b1233) padding-box,
    var(--rim) border-box;
  box-shadow: var(--lift);
  font: 600 15px Chakra;
  color: #ffe9b8;
}
.curtain {
  background: radial-gradient(ellipse at 50% 40%, #1b2560, #070920 70%);
}
.curtain .logo {
  width: min(72vw, 520px);
  aspect-ratio: 2;
  background: url(assets/logo.webp) center/contain no-repeat;
  animation: logo-pulse 1.6s ease-in-out infinite;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5));
}
.curtain .logo > * {
  visibility: hidden;
}
@keyframes logo-pulse {
  50% {
    transform: scale(1.03);
    filter: drop-shadow(0 8px 30px rgba(255, 200, 90, 0.35));
  }
}
.loadbar {
  height: 12px;
  border: 2px solid transparent;
  background:
    linear-gradient(#07081c, #07081c) padding-box,
    var(--rim) border-box;
}

/* ---- phones and small windows ---- */
@media (max-width: 780px) {
  .chip {
    font-size: 13px;
    min-height: 42px;
    padding: 6px 14px;
  }
  .chip.round {
    width: 46px;
    height: 46px;
  }
  .wallet {
    height: 46px;
  }
  .brand {
    min-height: 42px;
  }
}
@media (max-aspect-ratio: 4/5) {
  .gallery-chip {
    padding: 4px 12px 4px 4px;
  }
  .gallery-chip .meter {
    display: none;
  }
  .home-logo {
    left: 50%;
    width: min(74vw, 340px);
    top: calc(max(10px, env(safe-area-inset-top)) + 52px);
    animation-name: logo-in-c;
    transform: translateX(-50%);
  }
  .wallet {
    padding: 3px 14px 3px 4px;
  }
  .wallet .coin {
    width: 34px;
    height: 34px;
  }
  .wallet strong {
    font-size: 22px;
  }
  .home-actions .pill {
    min-height: 64px;
    padding: 8px 10px 8px 8px;
  }
  .pill > span b {
    font-size: min(18px, 4.4vw);
    letter-spacing: 0.02em;
    white-space: nowrap;
  }
  .desk {
    --pad: 158px;
    --drop: 104px;
    width: calc(100% - 12px);
    padding: 10px 18px 12px 10px;
    gap: 10px;
    border-radius: 26px;
  }
  .desk {
    justify-content: space-between;
  }
  .readout {
    position: absolute;
    left: 50%;
    bottom: calc(100% - 2px);
    width: min(78%, 330px);
    transform: translateX(-50%);
  }
  .readout small {
    display: none;
  }
  .led {
    min-height: 40px;
    justify-content: center;
    border-radius: 12px 12px 4px 4px;
    box-shadow:
      inset 0 0 0 2px #e7b65e,
      inset 0 0 0 4px #1d1206,
      inset 0 0 18px #000,
      0 -4px 12px #0008;
  }
  .led strong {
    font-size: min(17px, 4.4vw);
  }
  .lamp {
    display: block;
  }
  .keys {
    display: none;
  }
  .drop > small {
    font-size: 9px;
    padding: 3px 6px;
  }
}
@keyframes logo-in-c {
  from {
    opacity: 0;
    transform: translate(-50%, -14px) scale(0.88);
  }
  to {
    transform: translateX(-50%);
  }
}
@media (max-height: 540px) and (min-aspect-ratio: 4/5) {
  .chip {
    min-height: 38px;
  }
  .chip.round {
    width: 40px;
    height: 40px;
  }
  .wallet {
    height: 40px;
  }
  .home-logo {
    width: clamp(150px, 22vw, 240px);
  }
  .desk {
    --pad: 120px;
    --drop: 78px;
    width: min(700px, 94%);
    padding: 6px 26px 8px 12px;
  }
  .keys {
    display: none;
  }
  .pill {
    min-height: 54px;
  }
  .pill > span b {
    font-size: 18px;
  }
}
@media (pointer: coarse) {
  .keys .k-kb {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .home-logo,
  .curtain .logo {
    animation: none !important;
  }
}

/* ---- sideways phones: the desk splits into two floating clusters so the toy bed and chute stay clear ---- */
@media (max-height: 500px) and (min-aspect-ratio: 4/5) {
  .desk {
    --pad: 86px;
    --drop: 70px;
    left: 0;
    width: 100%;
    transform: none;
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
    justify-content: space-between;
    align-items: flex-end;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    pointer-events: none;
  }
  .desk:before,
  .desk:after,
  .keys,
  .readout small,
  .drop > small {
    display: none;
  }
  .pad-well,
  .drop,
  .readout {
    pointer-events: auto;
  }
  .drop {
    margin: 0 6px 6px 0;
  }
  .readout {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: min(34%, 260px);
    transform: translateX(-50%);
  }
  .led {
    min-height: 28px;
    padding: 3px 10px;
    gap: 7px;
    justify-content: center;
    border-radius: 14px;
    box-shadow:
      inset 0 0 0 2px #e7b65e,
      inset 0 0 0 4px #1d1206,
      inset 0 0 12px #000,
      0 4px 10px #000a;
  }
  .led strong {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .lamp {
    display: block;
  }
}
@media (max-height: 500px) and (min-aspect-ratio: 4/5) and (max-width: 760px) {
  body[data-screen='play'] .gallery-chip .meter,
  body[data-screen='play'] .gallery-chip .chip-label {
    display: none;
  }
  body[data-screen='play'] .gallery-chip {
    padding: 4px 12px 4px 4px;
  }
}

/* The way home (index.html): the calendar's gold house button, then the NORTH POLE POST badge, which goes home too. */
.homeGroup {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
  --u: clamp(9.6px, 1vw, 12px);
}
.homeGroup .brand {
  cursor: pointer;
}
.homeGroup .brand:hover {
  filter: brightness(1.12);
}
.homeGroup .brand:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}
.homeFallback {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 9px;
  border: 2px solid #ffc83a;
  background: linear-gradient(180deg, #4c5180, #181a3a);
  color: #ffe58a;
  font-size: 26px;
  text-decoration: none;
}
/* make room for the house button: the painted logo on the title screen; on short landscape phones in play it drops a row */
body:has(.homeGroup) .home-logo {
  margin-left: calc(var(--u, 10px) * 4.6 + 14px);
}
@media (max-height: 540px) and (min-aspect-ratio: 4/5) {
  /* in play the heading row is full, so the house sits just under it, over the gift pile */
  body[data-screen='play'] .homeGroup {
    position: absolute;
    left: 0;
    top: 50px;
  }
}
.top > .tools {
  margin-left: auto;
}
@media (max-aspect-ratio: 4/5) {
  /* portrait phones: the house takes the little envelope badge's place, so the top row still fits */
  .homeGroup .brand {
    display: none;
  }
}
