@font-face {
  font-family: "Gothic Condensed";
  src: url("/assets/fonts/gothic-condensed.ttf") format("truetype");
  font-display: swap;
}

:root { color-scheme: light; --pink: #ff0062; --ink: #171414; }
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: #eee5d5 url("/assets/cream-plaster.webp") center / 700px auto;
  font-family: "Gothic Condensed", Impact, sans-serif;
}
.game {
  --page-padding: clamp(18px, 3vmin, 40px);
  isolation: isolate;
  overflow: clip;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 100svh;
  margin: auto;
  padding: var(--page-padding);
  gap: clamp(12px, 2svh, 24px);
}
.game::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("/assets/page-frame.webp") center / 100% 100% no-repeat;
  pointer-events: none;
}
.heading { text-align: center; width: 100%; }
.brand { display: block; width: min(60%, 24svh, 285px); height: auto; margin: 0 auto 12px; transform: rotate(-4deg); }
h1 { margin: 0; font-size: clamp(30px, min(9.6vw, 6svh), 66px); font-weight: 400; line-height: 1; letter-spacing: -1px; }
.subtitle { margin: 8px 0 5px; font-size: clamp(18px, min(5.7vw, 3.5svh), 35px); line-height: 1.1; color: var(--pink); }
.brush { width: min(63%, 400px); height: 10px; margin: 9px auto 12px; background: var(--pink); transform: rotate(-2deg); clip-path: polygon(2% 30%, 100% 0, 96% 50%, 99% 75%, 0 100%, 4% 62%); }
.wheel {
  position: relative;
  width: min(100%, max(200px, calc(65svh - 185px)), 660px);
  flex: none;
  aspect-ratio: 1;
  border: clamp(10px, 2.8vw, 16px) solid #211b19;
  border-radius: 50%;
  background: #211b19;
  box-shadow: 0 0 0 3px #090909, 0 3px 0 5px #746457, 0 12px 18px #211b193b;
}
.disc { position: absolute; inset: 0; overflow: hidden; border: 5px solid var(--pink); border-radius: 50%; background: #efe6d6; }
.disc::before { content: ""; position: absolute; inset: 0; background: url("/assets/cream-plaster.webp") center / cover; opacity: .45; pointer-events: none; }
.gadget { position: absolute; width: var(--size); height: var(--size); transform: translate(-50%, -50%); margin: 0; display: grid; place-items: center; }
.gadget img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 2px #211b1929); }
.gadget figcaption { display: none; text-align: center; font-size: clamp(12px, 3vw, 19px); overflow-wrap: anywhere; line-height: 1; }
.gadget.image-missing img { display: none; }
.gadget.image-missing figcaption { display: block; }
.hub { position: absolute; inset: 39%; display: grid; place-items: center; border: 4px solid #302926; border-radius: 50%; background: radial-gradient(circle at 35% 25%, #37302c, #100d0c 70%); color: #eee5d5; box-shadow: 0 4px 5px #211b1955; }
.hub span { font-size: clamp(13px, 3vw, 21px); transform: rotate(-9deg); }
.pointer { position: absolute; z-index: 2; top: -24px; left: 50%; width: 36px; height: 48px; transform: translateX(-50%); background: var(--pink); clip-path: polygon(0 0, 100% 0, 50% 100%); filter: drop-shadow(0 2px 1px #000); }
.rim-studs { position: absolute; inset: -8px; pointer-events: none; }
.rim-studs i { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #ab9070; box-shadow: inset 1px 1px 1px #e4d6bd, 0 1px 2px #000; transform: translate(-50%, -50%); }
.wheel::before {
  content: "";
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  box-shadow: 0 0 35px 12px #ff006280, inset 0 0 25px #ff006255;
  opacity: 0;
  pointer-events: none;
}
.is-spinning::before { animation: wheel-glow 1.1s ease-in-out infinite alternate; }
.is-spinning .rim-studs i { background: #fff4e4; box-shadow: 0 0 8px 2px #ff0062; }
.pointer { transform-origin: 50% 12%; }
.is-finished::before { animation: finish-glow 1s ease-out both; }
.is-finished .hub { animation: hub-pop .55s ease-out; }
.confetti { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.confetti i { position: absolute; left: 50%; top: 50%; width: 7px; height: 12px; border-radius: 2px; }
@keyframes wheel-glow { from { opacity: .35; } to { opacity: .85; } }
@keyframes finish-glow { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(1.15); } }
@keyframes hub-pop { 40% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) {
  .wheel::before, .hub { animation: none !important; }
  .confetti { display: none; }
}
.controls { position: relative; width: 100%; text-align: center; }
.spin-button {
  appearance: none;
  padding: 10px 36px 12px;
  min-height: 48px;
  border: 3px solid var(--ink);
  background: var(--pink);
  color: #fff4e4;
  font: inherit;
  font-size: clamp(26px, min(7vw, 4.5svh), 42px);
  line-height: 1;
  box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-2deg);
  cursor: pointer;
  touch-action: manipulation;
}
.spin-button:enabled:hover { background: #e80057; }
.spin-button:enabled:active { transform: translate(3px, 3px) rotate(-2deg); box-shadow: 1px 1px 0 var(--ink); }
.spin-button:focus-visible { outline: 3px solid var(--ink); outline-offset: 7px; }
.spin-button:disabled { opacity: .65; cursor: default; }
.status { min-height: 20px; margin: 12px 0 0; font: 14px/20px Arial, sans-serif; }
footer { margin-top: auto; font-size: 13px; letter-spacing: 1px; }
noscript { padding: 12px; text-align: center; }
.settings-toggle {
  position: absolute;
  z-index: 4;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  background: #fff4e4;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}
.settings-toggle:enabled:hover { background: #ffd4e2; }
.settings-toggle:disabled, .settings-dialog button:disabled { opacity: .5; cursor: default; }
.settings-toggle:focus-visible, .settings-dialog button:focus-visible { outline: 3px solid var(--pink); outline-offset: 4px; }
body:has(.settings-dialog[open]) { overflow: hidden; }
.settings-dialog {
  width: min(580px, calc(100% - 32px));
  max-height: calc(100svh - 32px);
  padding: 24px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  color: var(--ink);
  background: #f5eddf;
  box-shadow: 8px 8px 0 #ff0062;
  font: 15px/1.4 Arial, sans-serif;
}
.settings-dialog::backdrop { background: #171414b3; }
.settings-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-header h2 { margin: 0; font: 34px/1.1 "Gothic Condensed", Impact, sans-serif; }
.settings-dialog button { min-height: 44px; padding: 10px 16px; border: 2px solid var(--ink); border-radius: 6px; background: transparent; color: var(--ink); font: bold 15px Arial, sans-serif; cursor: pointer; }
.settings-dialog .settings-close { flex: none; width: 44px; padding: 0; font-size: 28px; }
.settings-gadgets { display: grid; gap: 8px; max-height: 45svh; overflow-y: auto; padding: 4px; }
.settings-gadgets label { display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 8px 12px; border: 2px solid #d8cebf; border-radius: 8px; background: #fff8ed; cursor: pointer; }
.settings-gadgets label:has(input:checked) { border-color: var(--pink); background: #ffe8ef; }
.settings-gadgets label:focus-within { outline: 2px solid var(--ink); }
.settings-gadgets input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: #d50050; }
.settings-gadgets img { width: 54px; height: 54px; object-fit: contain; }
.settings-gadgets span { overflow-wrap: anywhere; min-width: 0; }
.settings-error { color: #a00030; }
.settings-error:empty { display: none; }
.settings-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
#settings-save { background: var(--pink); color: white; }
@media (min-width: 480px) and (orientation: landscape) {
  .game {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    grid-template-rows: auto auto auto;
    grid-template-areas: "heading wheel" "controls wheel" "footer wheel";
    column-gap: clamp(24px, 4vw, 80px);
    align-content: center;
    padding-inline: max(var(--page-padding), 5vw);
  }
  .heading { grid-area: heading; align-self: end; }
  .wheel {
    grid-area: wheel;
    justify-self: center;
    width: min(100%, calc(100svh - 2 * var(--page-padding) - 32px), 800px);
    border-width: clamp(9px, 1.8vmin, 16px);
  }
  .controls { grid-area: controls; }
  footer { grid-area: footer; justify-self: center; align-self: end; margin: 0; }
  .brand { width: min(65%, 28svh, 320px); }
  h1 { font-size: clamp(28px, min(5vw, 7svh), 76px); }
  .subtitle { font-size: clamp(18px, min(3vw, 4svh), 40px); }
  .brush { margin-bottom: 0; }
  .spin-button { font-size: clamp(24px, 5svh, 42px); }
  noscript { grid-column: 1 / -1; }
}
