
:root {
  --ink: #08070b;
  --plum: #170913;
  --ruby: #7d0f38;
  --ruby-bright: #b52657;
  --cream: #f1e6da;
  --milk: #fffaf2;
  --gold: #c99b55;
  --gold-light: #f0d59a;
  --background: #08070b;
  --foreground: #f8ead9;
  --card: #160b12;
  --card-foreground: #f8ead9;
  --popover: #160b12;
  --popover-foreground: #f8ead9;
  --primary: #8b163f;
  --primary-foreground: #fff8ee;
  --secondary: #f1e6da;
  --secondary-foreground: #211116;
  --muted: #2b1822;
  --muted-foreground: #d8c0b4;
  --accent: #c99b55;
  --accent-foreground: #10080c;
  --destructive: #b42346;
  --border: #9c713b;
  --input: #4f3441;
  --ring: #f0d59a;
  --radius: 0.75rem;
  --font-gothic: "Copperplate Gothic Light", Copperplate, "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-reading: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

* { box-sizing: border-box; }
html { background: var(--ink); color-scheme: dark; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--ink);
  color: var(--foreground);
  font-family: var(--font-gothic);
}
button, a { font: inherit; }
button { color: inherit; }
h1, h2, h3, strong, .ritual-heading { font-family: var(--font-gothic); }

.cei-page {
  position: relative;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 10%, rgba(126, 20, 62, 0.2), transparent 44%),
    #08070b;
}

.milk-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 58%, rgba(255, 247, 232, 0.09), transparent 38%);
  mix-blend-mode: screen;
  z-index: 0;
}

.desktop-stage {
  position: relative;
  z-index: 1;
  width: min(100vw, 1536px);
  margin: 0 auto;
  overflow: hidden;
  background: #060509;
}

.artboard {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: url("images/cei-milk-casino-reference.png") center / 100% 100% no-repeat;
  isolation: isolate;
}

.wheel-spinner {
  position: absolute;
  z-index: 2;
  left: 31.25%;
  top: 5.66%;
  width: 37.76%;
  aspect-ratio: 1;
  border-radius: 50%;
  clip-path: circle(48.15% at 50% 50%);
  overflow: hidden;
  transform-origin: center;
  transition: transform 3.05s cubic-bezier(0.12, 0.67, 0.08, 1);
  will-change: transform;
  pointer-events: none;
}

.wheel-spinner img {
  position: absolute;
  width: 264.83%;
  max-width: none;
  height: auto;
  left: -82.76%;
  top: -10%;
  user-select: none;
}

.wheel-spinner.is-spinning {
  filter: drop-shadow(0 0 1.3vw rgba(255, 244, 226, 0.55));
}

.spin-core-art {
  position: absolute;
  z-index: 4;
  left: 41.02%;
  top: 22.36%;
  width: 17.9%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
}

.spin-core-art img {
  position: absolute;
  width: 558.5%;
  max-width: none;
  height: auto;
  left: -229.1%;
  top: -83.3%;
  user-select: none;
}

.art-nav,
.nav-hit,
.hotspot {
  position: absolute;
  z-index: 9;
}

.art-nav { inset: 0; pointer-events: none; }
.nav-hit { top: 0.7%; height: 5.5%; pointer-events: auto; border-radius: 999px; }
.nav-hit.home { left: 20.8%; width: 7.3%; }
.nav-hit.games { left: 29.1%; width: 8.5%; }
.nav-hit.rituals { left: 38.1%; width: 8.4%; }
.nav-hit.rankings { left: 55.6%; width: 10%; }
.nav-hit.treasury { left: 66.2%; width: 10.4%; }
.nav-hit.lounge { left: 76.8%; width: 7.9%; }

.nav-hit:focus-visible,
.hotspot:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: -4px;
  background: rgba(255, 246, 228, 0.06);
  box-shadow: 0 0 1vw rgba(238, 205, 139, 0.45);
}

.hotspot {
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 999px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.hotspot:hover:not(:disabled) {
  background: radial-gradient(circle, rgba(255, 244, 224, 0.08), transparent 67%);
  box-shadow: inset 0 0 0.9vw rgba(251, 222, 165, 0.16), 0 0 1vw rgba(151, 20, 66, 0.22);
}

.hotspot:disabled { cursor: not-allowed; opacity: 0.45; }
.left-spin { left: 5.7%; top: 31.5%; width: 22.5%; height: 8.2%; overflow: hidden; }
.left-spin-count {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: 5%;
  min-height: 27%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-light);
  background: linear-gradient(90deg, rgba(75, 8, 35, 0), rgba(75, 8, 35, 0.98) 12%, rgba(75, 8, 35, 0.98) 88%, rgba(75, 8, 35, 0));
  font-family: var(--font-gothic);
  font-size: clamp(7px, 0.62vw, 10px);
  font-weight: 700;
  letter-spacing: 0.035em;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 2px #180710, 0 0 0.35vw rgba(238, 205, 139, 0.35);
  pointer-events: none;
}
.centre-spin {
  left: 40.75%;
  top: 23.2%;
  z-index: 60;
  width: 18.5%;
  height: 26.4%;
  pointer-events: auto;
  touch-action: manipulation;
}
.done-hit { left: 66.2%; top: 67.3%; width: 15.5%; height: 6.1%; }
.skip-hit { left: 66%; top: 73.5%; width: 15.8%; height: 5.9%; }
.restart-hit { left: 59.8%; top: 81.5%; width: 18.9%; height: 14.8%; border-radius: 0.5vw; }
.safe-exit-hit { left: 79%; top: 81.5%; width: 20.8%; height: 14.8%; border-radius: 0.5vw; }

.stat-patch {
  position: absolute;
  z-index: 7;
  left: 82.15%;
  width: 3.65%;
  height: 4.3%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.2%;
  overflow: hidden;
  color: #25171a;
  background: linear-gradient(90deg, rgba(239, 231, 220, 0.74), #eee5db 20%, #f4ece3 78%, rgba(237, 227, 215, 0.88));
  font-size: clamp(6px, 0.83vw, 13px);
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 0 #fff;
}
.stat-patch.completed { top: 29.8%; }
.stat-patch.rank { top: 34.8%; left: 80.25%; width: 5.55%; font-size: clamp(5px, 0.68vw, 10.5px); }
.stat-patch.spins { top: 39.75%; }
.stat-patch.marks { top: 44.75%; }
.stat-patch.skipped { top: 49.75%; }
.stat-patch.available { top: 54.75%; }

.winning-patch {
  position: absolute;
  z-index: 8;
  left: 22.05%;
  top: 71.7%;
  width: 6.6%;
  height: 5.8%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--milk);
  font-size: clamp(12px, 2.1vw, 32px);
  font-weight: 700;
  text-shadow: 0 0 0.7vw rgba(255, 245, 225, 0.7);
}

.command-patch {
  position: absolute;
  z-index: 7;
  left: 29.2%;
  top: 70.25%;
  width: 35.75%;
  height: 9.1%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(125, 15, 56, 0.72) rgba(139, 88, 41, 0.12);
  color: #22151a;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.55), transparent 70%),
    linear-gradient(90deg, rgba(239, 226, 213, 0.94), #f4eadf 14%, #f5ecdf 86%, rgba(237, 221, 208, 0.95));
  text-align: center;
  padding: 0.38% 1.05%;
  box-shadow: inset 0 0 1vw rgba(156, 109, 66, 0.12);
}

.command-patch p {
  width: 100%;
  margin: auto 0;
  color: #211218;
  font-family: var(--font-gothic);
  font-size: clamp(12px, 1.1vw, 17px);
  font-weight: 600;
  line-height: 1.34;
  letter-spacing: 0.006em;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.command-patch::-webkit-scrollbar { width: 5px; }
.command-patch::-webkit-scrollbar-track { background: rgba(139, 88, 41, 0.1); }
.command-patch::-webkit-scrollbar-thumb { border-radius: 99px; background: rgba(125, 15, 56, 0.72); }

.command-patch[data-status="completed"] { box-shadow: inset 0 0 1.5vw rgba(90, 118, 61, 0.22); }
.command-patch[data-status="skipped"] { opacity: 0.82; }

.recent-patches {
  position: absolute;
  z-index: 8;
  left: 22.25%;
  top: 87.15%;
  width: 19.3%;
  height: 5.4%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3.4%;
  align-items: center;
}

.recent-patches span {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--gold-light);
  background: rgba(8, 7, 11, 0.82);
  font-size: clamp(6px, 0.76vw, 12px);
  font-weight: 700;
  text-shadow: 0 0 0.5vw rgba(244, 209, 143, 0.55);
}

.mobile-game { display: none; }

.restart-dialog {
  border: 1px solid var(--gold);
  color: var(--cream);
  background:
    radial-gradient(circle at 50% 0, rgba(137, 21, 63, 0.46), transparent 55%),
    #130a10;
  box-shadow: 0 0 0 3px #3f2617, 0 24px 90px rgba(0, 0, 0, 0.7);
  font-family: var(--font-gothic);
}
.restart-dialog [data-slot="alert-dialog-description"] { color: #dcc8ba; }
.dialog-cancel { border-color: #a4773f; background: #170f14; color: #f5e8d7; }
.dialog-action { border: 1px solid #e1bb70; background: linear-gradient(#9f1c4d, #5f0d2c); color: #fff6e8; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 899px) {
  .desktop-stage { display: none; }
  .milk-glow { opacity: 0.75; }
  .mobile-game {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    min-height: 100dvh;
    padding-bottom: 32px;
    background:
      linear-gradient(rgba(8, 6, 10, 0.62), rgba(8, 6, 10, 0.92)),
      url("images/cei-milk-casino-reference.png") 50% 0 / auto 640px no-repeat,
      #08070b;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(229, 194, 125, 0.72);
    background: rgba(7, 6, 10, 0.94);
    backdrop-filter: blur(14px);
  }
  .mobile-brand { display: flex; align-items: center; gap: 10px; color: var(--gold-light); text-decoration: none; }
  .mobile-brand strong, .mobile-brand small { display: block; letter-spacing: 0.08em; }
  .mobile-brand strong { font-size: 15px; }
  .mobile-brand small { margin-top: 2px; font-size: 8px; }
  .brand-gem { display: grid; place-items: center; width: 39px; aspect-ratio: 1; border: 1px solid var(--gold); border-radius: 50%; color: #df326a; background: radial-gradient(circle, #721331, #11090f 70%); }
  .mobile-menu { display: grid; place-items: center; width: 42px; aspect-ratio: 1; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold-light); text-decoration: none; }

  .mobile-title-panel {
    position: relative;
    width: calc(100% - 24px);
    margin: 18px auto 12px;
    padding: 24px 18px 20px;
    overflow: hidden;
    border: 1px solid var(--gold);
    border-radius: 18px;
    text-align: center;
    background:
      linear-gradient(rgba(10, 7, 11, 0.78), rgba(10, 7, 11, 0.92)),
      url("images/cei-milk-casino-reference.png") 6% 15% / 165% auto no-repeat;
    box-shadow: inset 0 0 0 3px #2d1b12, 0 18px 44px rgba(0, 0, 0, 0.38);
  }
  .mini-crown { display: block; color: var(--gold-light); font-size: 24px; }
  .mobile-title-panel p { margin: 3px 0 6px; color: var(--cream); font-size: 13px; letter-spacing: 0.1em; }
  .mobile-title-panel h1 { margin: 0; color: #e14b75; font-size: clamp(25px, 8vw, 38px); line-height: 1; text-shadow: 0 0 16px rgba(181, 38, 87, 0.25); }
  .mobile-title-panel strong { display: inline-block; margin-top: 13px; color: var(--gold-light); font-size: 10px; letter-spacing: 0.13em; }

  .mobile-wheel-shell {
    position: relative;
    width: min(94vw, 470px);
    aspect-ratio: 1;
    margin: 0 auto;
    overflow: hidden;
    filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.48));
  }
  .mobile-wheel {
    position: absolute;
    inset: 2.5%;
    border-radius: 50%;
    background: url("images/cei-milk-casino-reference.png") 50% 14% / 272% auto no-repeat;
    transition: transform 3.05s cubic-bezier(0.12, 0.67, 0.08, 1);
    will-change: transform;
    pointer-events: none;
  }
  .mobile-wheel.is-spinning { filter: brightness(1.1) drop-shadow(0 0 14px rgba(255, 247, 231, 0.65)); }
  .mobile-spin {
    position: absolute;
    z-index: 60;
    left: 50%;
    top: 50%;
    width: 37%;
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    border: 3px double #e6c27c;
    border-radius: 50%;
    color: #fff2dc;
    background: radial-gradient(circle at 40% 30%, #a62b54, #650d31 58%, #1b0a12 100%);
    box-shadow: inset 0 0 0 5px #2b160f, inset 0 0 22px rgba(255, 202, 112, 0.2), 0 0 20px rgba(0, 0, 0, 0.62);
    text-shadow: 0 2px 2px #2c0715;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-spin strong, .mobile-spin span { display: block; }
  .mobile-spin strong { font-size: clamp(22px, 7.7vw, 38px); letter-spacing: 0.04em; }
  .mobile-spin span { margin-top: 4px; font-size: 8px; letter-spacing: 0.11em; }
  .mobile-spin:disabled { opacity: 0.75; }
  .milk-surface { position: absolute; z-index: 2; left: 2%; right: 2%; bottom: 0; height: 12%; background: linear-gradient(180deg, rgba(255, 251, 244, 0), rgba(255, 247, 235, 0.82)); border-radius: 50%; filter: blur(4px); pointer-events: none; }

  .mobile-stats,
  .mobile-ritual,
  .mobile-lower {
    width: calc(100% - 24px);
    max-width: 600px;
    margin: 14px auto 0;
  }
  .mobile-stats { padding: 18px; border: 1px solid var(--gold); border-radius: 18px; background: linear-gradient(145deg, rgba(22, 10, 18, 0.97), rgba(8, 7, 11, 0.96)); box-shadow: inset 0 0 0 3px #2e1a12; }
  .mobile-stats h2 { margin: 0 0 12px; color: var(--gold-light); text-align: center; font-size: 18px; letter-spacing: 0.08em; }
  .mobile-stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .mobile-stat-grid div { min-height: 58px; padding: 10px 12px; border: 1px solid rgba(184, 141, 82, 0.68); border-radius: 10px; color: #24151a; background: linear-gradient(#f6ede3, #e7dacd); box-shadow: inset 0 0 11px rgba(129, 86, 45, 0.12); }
  .mobile-stat-grid span, .mobile-stat-grid strong { display: block; }
  .mobile-stat-grid span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
  .mobile-stat-grid strong { margin-top: 5px; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .mobile-ritual { position: relative; padding: 36px 16px 16px; border: 2px solid #9a662d; border-radius: 18px; color: #24151a; background: radial-gradient(circle at center, #fffaf2, #eadbce); box-shadow: inset 0 0 0 4px #6f1637, 0 16px 40px rgba(0, 0, 0, 0.4); }
  .ritual-heading { position: absolute; left: 50%; top: -16px; transform: translateX(-50%); min-width: 220px; padding: 8px 20px; border: 2px solid var(--gold); border-radius: 999px; color: var(--gold-light); background: linear-gradient(#77143a, #3d0b22); text-align: center; letter-spacing: 0.08em; box-shadow: 0 0 0 3px #25140f; }
  .mobile-winning { display: flex; align-items: center; justify-content: center; gap: 11px; margin-bottom: 12px; }
  .mobile-winning span { font-size: 9px; letter-spacing: 0.09em; }
  .mobile-winning strong { display: grid; place-items: center; width: 48px; aspect-ratio: 1; border: 2px solid var(--gold); border-radius: 50%; color: var(--milk); background: #0b090d; font-size: 21px; }
  .mobile-ritual > p {
    min-height: 150px;
    max-height: 52vh;
    margin: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 18px 15px;
    border-block: 1px solid rgba(139, 88, 41, 0.35);
    font-family: var(--font-gothic);
    font-size: clamp(17px, 4.7vw, 21px);
    font-weight: 600;
    line-height: 1.55;
    overflow-wrap: anywhere;
    text-align: center;
    text-wrap: pretty;
  }
  .mobile-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 13px; }
  .mobile-actions button { min-height: 48px; border: 1px solid var(--gold); border-radius: 999px; background: linear-gradient(#8c1b46, #510d2a); color: var(--milk); font-weight: 700; letter-spacing: 0.09em; }
  .mobile-actions button:last-child { background: linear-gradient(#151218, #08070a); }
  .mobile-actions button:disabled { opacity: 0.38; }

  .mobile-lower { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .mobile-lower article, .mobile-lower button, .mobile-lower a { display: flex; min-height: 84px; flex-direction: column; justify-content: center; align-items: flex-start; padding: 13px; border: 1px solid rgba(202, 155, 83, 0.76); border-radius: 12px; color: var(--cream); background: linear-gradient(145deg, rgba(24, 12, 20, 0.97), rgba(8, 7, 11, 0.98)); text-decoration: none; text-align: left; }
  .mobile-lower button { width: 100%; }
  .mobile-lower span { color: var(--gold-light); font-size: 12px; letter-spacing: 0.07em; }
  .mobile-lower strong { margin-top: 7px; font-size: 11px; font-weight: 400; color: #d9c5b8; }
}

@media (max-width: 350px) {
  .mobile-header { padding-inline: 10px; }
  .mobile-brand strong { font-size: 13px; }
  .mobile-title-panel,
  .mobile-stats,
  .mobile-ritual,
  .mobile-lower { width: calc(100% - 16px); }
  .mobile-stat-grid { grid-template-columns: 1fr; }
  .mobile-actions { grid-template-columns: 1fr; }
  .mobile-ritual > p { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}


[hidden] { display: none !important; }
.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 2, 5, 0.78);
  backdrop-filter: blur(8px);
}
.restart-modal {
  width: min(520px, 100%);
  padding: 26px;
  border: 1px solid var(--gold);
  border-radius: 14px;
  color: var(--cream);
  background: radial-gradient(circle at 50% 0, rgba(137, 21, 63, 0.46), transparent 55%), #130a10;
  box-shadow: 0 0 0 3px #3f2617, 0 24px 90px rgba(0, 0, 0, 0.7);
}
.restart-modal h2 { margin: 0 0 10px; color: var(--gold-light); font-size: 25px; }
.restart-modal p { margin: 0; color: #dcc8ba; line-height: 1.55; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.dialog-buttons button { min-height: 44px; padding: 0 18px; border: 1px solid #a4773f; border-radius: 8px; cursor: pointer; background: #170f14; color: #f5e8d7; }
.dialog-buttons .confirm-restart { border-color: #e1bb70; background: linear-gradient(#9f1c4d, #5f0d2c); color: #fff6e8; }
@media (max-width: 520px) { .dialog-buttons { flex-direction: column-reverse; } .dialog-buttons button { width: 100%; } }
