@font-face {
  font-family: "Coil Sans";
  src: url("glyphs/jakarta_regular.ttf") format("truetype");
  font-weight: 400;
}
@font-face {
  font-family: "Coil Sans";
  src: url("glyphs/jakarta_semibold.ttf") format("truetype");
  font-weight: 600;
}
@font-face {
  font-family: "Coil Sans";
  src: url("glyphs/jakarta_bold.ttf") format("truetype");
  font-weight: 700;
}

:root {
  color-scheme: dark;
  --ink: #090b12;
  --indigo: #151a38;
  --cyan: #29d9ff;
  --violet: #8958ff;
  --lime: #a9f95b;
  --pink: #ff4fa3;
  --snow: #f7faff;
  --mist: #c8cee1;
  --warn: #ffb45a;
  --glass: rgba(14, 19, 40, 0.8);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--ink); }
body {
  font-family: "Coil Sans", sans-serif;
  color: var(--snow);
}

#coil-app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(9, 11, 18, 0.2), rgba(9, 11, 18, 0.72)),
    url("plates/bg_vanta_core.webp") center / cover no-repeat;
}
#coil-app[data-chamber="pulse"] {
  background:
    linear-gradient(180deg, rgba(9, 11, 18, 0.15), rgba(9, 11, 18, 0.7)),
    url("plates/bg_vanta_core_pulse_spins.webp") center / cover no-repeat;
}
#coil-app[data-chamber="vault"] {
  background:
    linear-gradient(180deg, rgba(9, 11, 18, 0.2), rgba(9, 11, 18, 0.75)),
    url("plates/bg_vanta_core_vault.webp") center / cover no-repeat;
}

#coil-scroll {
  flex: 1;
  width: min(430px, 100%);
  margin: 0 auto;
  overflow: auto;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
}
#coil-scroll[data-face="game"] { overflow: hidden; }

.coil-face { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.coil-face[hidden] { display: none; }
.coil-mark { width: min(280px, 78vw); height: auto; align-self: center; }
.coil-mark-slim { width: min(210px, 62vw); }

.coil-slab {
  background: var(--glass);
  border: 1px solid rgba(41, 217, 255, 0.28);
  border-radius: 18px;
  padding: 12px 14px;
  backdrop-filter: blur(8px);
}
.coil-pair { display: flex; gap: 10px; }
.coil-pair > * { flex: 1; }
.coil-kicker { color: var(--mist); font-size: 13px; margin: 0; }
.coil-figure { margin: 2px 0 0; font-size: 22px; font-weight: 600; }
.coil-figure-lg { font-size: 28px; }
.coil-quiet { color: var(--mist); font-size: 13px; line-height: 18px; margin: 6px 0 0; }
.coil-center { text-align: center; }

.coil-pill, .coil-ghost {
  appearance: none;
  border-radius: 999px;
  min-height: 46px;
  padding: 10px 16px;
  font: 600 15px/1 "Coil Sans", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--cyan), #1497c4);
  border: 0;
}
.coil-ghost {
  color: var(--snow);
  background: transparent;
  border: 1px solid rgba(247, 250, 255, 0.35);
}
.coil-row { display: flex; gap: 10px; }
.coil-row > * { flex: 1; }

.coil-meter { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.coil-cell {
  height: 14px;
  border-radius: 4px;
  background: rgba(200, 206, 225, 0.18);
  border: 1px solid rgba(41, 217, 255, 0.25);
}
.coil-cell.coil-filled { background: var(--cyan); }

.coil-reels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  min-height: 210px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(9, 11, 18, 0.55) url("plates/ui_reel_frame.webp") center / 100% 100% no-repeat;
}
.coil-reels.coil-pulseframe {
  background-image: url("plates/ui_reel_frame_pulse.webp");
}
.coil-reel { display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.coil-glyph { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 8px; }
.coil-glyph.coil-hot { outline: 2px solid var(--lime); outline-offset: 1px; }

.coil-controls { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.coil-betbar {
  width: 100%;
  height: 64px;
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  align-items: center;
  background: url("plates/ui_bet_bar.webp") center / 100% 100% no-repeat;
}
.coil-betbar button, .coil-iconbtn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--snow);
  font: 700 22px/1 "Coil Sans", sans-serif;
  min-height: 48px;
}
.coil-stake { text-align: center; font-weight: 600; font-size: 18px; }
.coil-actions { display: grid; grid-template-columns: 72px 96px 72px; gap: 12px; align-items: center; justify-content: center; }
.coil-actions button { appearance: none; border: 0; background: transparent; color: var(--snow); padding: 0; }
.coil-actions img { width: 64px; height: 64px; object-fit: contain; }
.coil-reactor img { width: 92px; height: 92px; }
.coil-counter { margin: 0; min-height: 18px; color: var(--cyan); font-size: 13px; }
.coil-alert { color: var(--warn); text-align: center; margin: 0; }
.coil-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--cyan);
  font: 600 14px/1 "Coil Sans", sans-serif;
  min-height: 36px;
}

.coil-back {
  align-self: flex-start;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--snow);
  font: 600 16px/1 "Coil Sans", sans-serif;
  min-height: 40px;
  padding: 0;
}
.coil-heading { margin: 0; font-size: 22px; }
.coil-hero { width: 140px; height: 140px; object-fit: contain; align-self: center; }
.coil-symbol { display: flex; gap: 12px; align-items: center; }
.coil-symbol img { width: 56px; height: 56px; object-fit: contain; }
.coil-symbol p { margin: 4px 0 0; color: var(--mist); }

.coil-switch {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}
.coil-switch button {
  min-width: 64px;
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid var(--cyan);
  background: transparent;
  color: var(--snow);
  font: 600 13px/1 "Coil Sans", sans-serif;
}
.coil-switch button[aria-pressed="true"] { background: var(--cyan); color: var(--ink); }
.coil-stat { display: flex; justify-content: space-between; gap: 12px; }
.coil-stat span { color: var(--mist); }
.coil-award { margin: 0 0 8px; }
.coil-award small { display: block; color: var(--mist); }

#coil-dock {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
  background: rgba(9, 11, 18, 0.92);
  border-top: 1px solid rgba(41, 217, 255, 0.2);
}
.coil-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--mist);
  font: 600 10px/1.1 "Coil Sans", sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 52px;
  padding: 4px 0;
}
.coil-tab img { width: 24px; height: 24px; object-fit: contain; }
.coil-tab.coil-lit { color: var(--cyan); }

#coil-gate, #coil-veil {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(9, 11, 18, 0.78);
}
#coil-gate[hidden], #coil-veil[hidden] { display: none; }
.coil-sheet { width: min(420px, 100%); display: flex; flex-direction: column; gap: 12px; }
.coil-age { margin: 0; text-align: center; font-size: 28px; font-weight: 600; }
.coil-winlabel { margin: 0; text-align: center; font-size: 26px; font-weight: 600; }
.coil-winfigure { margin: 0; text-align: center; color: var(--lime); font-size: 36px; font-weight: 700; }
.coil-capsules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.coil-capsules button { appearance: none; border: 0; background: transparent; color: var(--lime); padding: 0; }
.coil-capsules img { width: 100%; height: 96px; object-fit: contain; }
.coil-capsules p { margin: 4px 0 0; font-size: 12px; min-height: 32px; }
#coil-save {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  margin: 0;
  z-index: 4;
}
#coil-save[hidden] { display: none; }
