@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fraunces-roman.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fraunces-bold.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("fraunces-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("sora-plain.woff2") format("woff2");
}
@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("sora-strong.woff2") format("woff2");
}

:root {
  --ink: #4A0E4E;
  --silver: #C0C0C0;
  --white: #FFFFFF;
  --display: "Fraunces", "Palatino Linotype", Palatino, serif;
  --body: "Sora", "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: var(--ink);
  color-scheme: dark;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  visibility: hidden;
  background: var(--ink);
  color: var(--white);
  font-family: var(--body);
  font-weight: 400;
  overscroll-behavior: none;
  user-select: none;
  text-decoration: none;
}

html.ready body {
  visibility: visible;
}

img {
  -webkit-user-drag: none;
  user-select: none;
}

button, input {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

a, a:any-link, a:hover, a:visited {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: rgba(192, 192, 192, 0.35);
  color: var(--white);
}

::spelling-error,
::grammar-error {
  text-decoration: none;
  background: none;
  color: inherit;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 1px solid var(--silver);
  outline-offset: 3px;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--white);
  caret-color: var(--white);
  box-shadow: 0 0 0 1000px #3a0c3e inset;
}

.scene-art {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(74, 14, 78, 0.58), rgba(74, 14, 78, 0.8));
}

.scrim.air {
  background: radial-gradient(ellipse at 50% 42%, rgba(74, 14, 78, 0.22), rgba(74, 14, 78, 0.74) 78%);
}

.scrim.heavy {
  background: rgba(74, 14, 78, 0.84);
}

.scrim.grove {
  background: linear-gradient(180deg, rgba(74, 14, 78, 0.72) 0%, rgba(74, 14, 78, 0.5) 46%, rgba(74, 14, 78, 0.82) 100%);
}

.stage {
  position: relative;
  z-index: 2;
  width: min(520px, 100%);
  height: 100svh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
}

.screen {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  overflow: hidden;
  padding: calc(14px + env(safe-area-inset-top)) 18px calc(14px + env(safe-area-inset-bottom));
}

.screen.on {
  display: flex;
  animation: enter-screen 0.45s ease both;
}

@keyframes enter-screen {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--silver);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.primary, .ghost, .back, .texty, .price, .switch, .cell {
  appearance: none;
  -webkit-appearance: none;
}

.primary {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.primary:disabled {
  opacity: 0.45;
}

.primary:active {
  background: var(--silver);
}

.ghost, .back {
  border: 1px solid rgba(192, 192, 192, 0.5);
  background: transparent;
  color: var(--white);
  border-radius: 999px;
}

.back {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.ghost.wide {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  font-size: 15px;
  font-weight: 600;
}

.texty {
  width: 100%;
  min-height: 40px;
  margin-top: 4px;
  border: 0;
  background: none;
  color: var(--silver);
  font-size: 13px;
  font-weight: 600;
}

.bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  flex: 0 0 auto;
}

.bar-title {
  margin: 0;
  text-align: center;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(22px, 6vw, 28px);
}

.bar-side {
  margin: 0;
  min-width: 64px;
  text-align: right;
  color: var(--silver);
  font-size: 12px;
}

.sheet {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.sheet::-webkit-scrollbar {
  display: none;
}

.filament {
  position: absolute;
  left: 22px;
  top: 14%;
  bottom: 30%;
  width: 1px;
  background: linear-gradient(var(--white), rgba(192, 192, 192, 0));
  transform-origin: top center;
  animation: grow 1.5s ease both;
}

.filament i {
  position: absolute;
  left: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 0 12px var(--white);
  animation: travel 3s ease-in-out infinite;
}

@keyframes grow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

@keyframes travel {
  0% { top: 0; }
  50% { top: calc(100% - 7px); }
  100% { top: 0; }
}

.gate-body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  padding-left: 24px;
}

.gate-body.arrive {
  animation: rise-copy 0.8s ease both;
}

@keyframes rise-copy {
  from { opacity: 0; transform: translateY(16px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

#gate h1 {
  margin: 0;
  max-width: 10ch;
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(42px, 12vw, 74px);
  line-height: 0.9;
}

.lead {
  max-width: 34ch;
  margin: 14px 0 0;
  color: var(--silver);
  font-size: 15px;
  line-height: 1.45;
}

.gate-scene {
  margin-top: 18px;
  min-height: 0;
}

.portal {
  width: min(132px, 32vw);
  height: min(132px, 32vw);
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  box-shadow: inset 0 0 28px rgba(255, 255, 255, 0.2);
  animation: breathe 3.4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(0.94); opacity: 0.75; }
  50% { transform: scale(1); opacity: 1; }
}

.drops {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  max-width: 280px;
  height: 112px;
}

.drops img {
  width: 28%;
  height: 96px;
  object-fit: contain;
  animation: drop 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.drops img:nth-child(2) { animation-delay: 0.12s; }
.drops img:nth-child(3) { animation-delay: 0.24s; }

@keyframes drop {
  0% { transform: translateY(-36px); opacity: 0; }
  70% { transform: translateY(6px); opacity: 1; }
  100% { transform: none; opacity: 1; }
}

.win-art {
  position: relative;
  display: grid;
  place-items: center;
  width: min(180px, 48vw);
  height: 150px;
}

.win-art .halo {
  position: absolute;
  width: 110px;
  height: 110px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: halo 1.8s ease-out infinite;
}

.win-art img {
  position: relative;
  width: 92px;
  height: 120px;
  object-fit: contain;
}

@keyframes halo {
  from { transform: scale(0.55); opacity: 0.85; }
  to { transform: scale(1.55); opacity: 0; }
}

.gate-foot {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
}

.beads {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.beads b {
  display: block;
  width: 7px;
  height: 7px;
  border: 1px solid var(--silver);
  border-radius: 50%;
}

.beads b.on {
  background: var(--white);
  border-color: var(--white);
}

.iris {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: var(--ink);
  pointer-events: none;
  opacity: 0;
}

.iris.run {
  animation: blink 0.7s linear forwards;
}

@keyframes blink {
  0% { opacity: 1; clip-path: circle(130% at 50% 42%); }
  42% { opacity: 1; clip-path: circle(0% at 50% 42%); }
  58% { opacity: 1; clip-path: circle(0% at 50% 42%); }
  100% { opacity: 0; clip-path: circle(130% at 50% 42%); }
}

#hall {
  justify-content: space-between;
}

.brand {
  margin-top: 4vh;
  text-align: center;
}

.brand-mark {
  width: 74px;
  height: 74px;
  object-fit: contain;
}

.brand h1 {
  margin: 8px 0 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(48px, 14vw, 78px);
  line-height: 0.88;
}

.brand p {
  max-width: 24ch;
  margin: 12px auto 0;
  color: var(--silver);
  font-size: 15px;
  line-height: 1.4;
}

.hall-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.menu-group {
  overflow: hidden;
  border: 1px solid rgba(192, 192, 192, 0.4);
  border-radius: 22px;
  background: rgba(32, 6, 36, 0.62);
}

.menu-group button {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-bottom: 1px solid rgba(192, 192, 192, 0.28);
  background: transparent;
  color: var(--white);
  font-family: var(--body);
  font-size: 16px;
  font-weight: 600;
}

.menu-group button:last-child {
  border-bottom: 0;
}

.menu-group button:active {
  background: rgba(255, 255, 255, 0.08);
}

.hall-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--silver);
  font-size: 13px;
}

#loom {
  gap: 8px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  flex: 0 0 auto;
}

.stats span {
  color: var(--silver);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.stats strong {
  display: block;
  overflow: hidden;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(22px, 6.4vw, 32px);
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  text-overflow: ellipsis;
}

.pulse-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
  color: var(--silver);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.meter {
  height: 2px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(192, 192, 192, 0.28);
  flex: 0 0 auto;
}

.meter span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--white);
}

.pool-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  flex: 0 0 auto;
}

.pool-row > span {
  color: var(--silver);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.pool {
  display: flex;
  gap: 6px;
  align-items: center;
}

.pool img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.whisper {
  margin: 0;
  min-height: 1.25em;
  flex: 0 0 auto;
  text-align: center;
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(16px, 4.5vw, 22px);
  line-height: 1.2;
}

.whisper.done {
  color: var(--silver);
}

.frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  container-type: size;
}

.lattice {
  width: min(100%, 64dvh);
  width: min(100cqw, 100cqh);
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(6px, 1.6vw, 12px);
}

.cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(192, 192, 192, 0.38);
  border-radius: clamp(12px, 3vw, 20px);
  background: rgba(22, 4, 26, 0.78);
  color: var(--silver);
}

.glyph {
  position: absolute;
  inset: 8% 10% 18%;
  display: grid;
  place-items: center;
}

.glyph img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cell .tag {
  position: absolute;
  right: 4px;
  bottom: 4px;
  left: 4px;
  overflow: hidden;
  font-size: clamp(8px, 2.1vw, 11px);
  letter-spacing: 0.12em;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.cell.heart::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 5px;
  height: 5px;
  margin-left: -3px;
  border: 1px solid var(--silver);
  transform: rotate(45deg);
}

.cell.pinned {
  border-color: var(--white);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75);
}

.cell.pinned .tag {
  color: var(--white);
}

.cell.hot {
  border-color: var(--white);
  background: rgba(255, 255, 255, 0.16);
}

.cell.falling .glyph {
  animation: descend 0.52s cubic-bezier(0.16, 0.84, 0.3, 1) both;
}

@keyframes descend {
  from { transform: translateY(-125%); opacity: 0.15; }
  to { transform: none; opacity: 1; }
}

.floater {
  position: absolute;
  top: 6px;
  left: 50%;
  z-index: 3;
  margin: 0;
  color: var(--white);
  font-family: var(--display);
  font-size: clamp(18px, 5vw, 26px);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
}

.floater.on {
  animation: lift 1s ease forwards;
}

@keyframes lift {
  0% { opacity: 0; transform: translate(-50%, 8px); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -26px); }
}

.hint {
  margin: 0;
  flex: 0 0 auto;
  overflow: hidden;
  color: var(--silver);
  font-size: 12px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weave {
  flex: 0 0 auto;
}

.craft {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(192, 192, 192, 0.22);
}

.craft img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.craft h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(20px, 5.4vw, 26px);
}

.craft p {
  margin: 2px 0 0;
  color: var(--silver);
  font-size: 12px;
  line-height: 1.35;
}

.pips {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.pip {
  width: 7px;
  height: 7px;
  border: 1px solid var(--silver);
  border-radius: 50%;
}

.pip.on {
  background: var(--white);
  border-color: var(--white);
}

.price {
  min-width: 64px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--silver);
  border-radius: 999px;
  background: transparent;
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
}

.price:disabled {
  opacity: 0.4;
}

.rec {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(192, 192, 192, 0.22);
}

.rank {
  color: var(--silver);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.rec strong {
  display: block;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rec p {
  margin: 2px 0 0;
  color: var(--silver);
  font-size: 12px;
}

.rec b {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(22px, 6vw, 28px);
  font-variant-numeric: tabular-nums;
}

.empty {
  margin: 16vh 12px 0;
  color: var(--silver);
  font-size: 15px;
  line-height: 1.45;
  text-align: center;
}

.field {
  display: block;
  padding: 6px 0 12px;
}

.field span {
  display: block;
  margin-bottom: 8px;
  color: var(--silver);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid rgba(192, 192, 192, 0.5);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
  font-size: 16px;
  user-select: text;
}

.field input::placeholder {
  color: rgba(192, 192, 192, 0.7);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(192, 192, 192, 0.22);
}

.switch-row strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.switch-row p {
  margin: 3px 0 0;
  color: var(--silver);
  font-size: 12px;
  line-height: 1.35;
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--silver);
  border-radius: 999px;
  background: transparent;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--silver);
}

.switch.on {
  border-color: var(--white);
  background: var(--white);
}

.switch.on::after {
  transform: translateX(20px);
  background: var(--ink);
}

.guide {
  padding-top: 18px;
}

.guide h2 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(26px, 7vw, 34px);
}

.guide p {
  margin: 0;
  color: var(--silver);
  font-size: 14px;
  line-height: 1.5;
}

.toast {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  z-index: 5;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 8px 14px;
  border: 1px solid rgba(192, 192, 192, 0.5);
  border-radius: 999px;
  background: rgba(28, 6, 32, 0.92);
  color: var(--white);
  font-size: 13px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
}

.toast.on {
  animation: toast-in 1.6s ease forwards;
}

@keyframes toast-in {
  0% { opacity: 0; transform: translate(-50%, -8px); }
  12% { opacity: 1; transform: translate(-50%, 0); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -6px); }
}

.veil {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: end center;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  background: rgba(22, 4, 26, 0.62);
}

.veil[hidden] {
  display: none;
}

.veil-card {
  width: min(100%, 380px);
  padding: 22px 18px 16px;
  border: 1px solid rgba(192, 192, 192, 0.5);
  border-radius: 26px;
  background: rgba(74, 14, 78, 0.96);
}

.veil-card h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(34px, 9vw, 48px);
  line-height: 0.95;
}

.veil-card p {
  margin: 10px 0 0;
  color: var(--silver);
  font-size: 15px;
  line-height: 1.4;
}

.veil-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

#veil-no[hidden] {
  display: none;
}

@media (hover: hover) {
  .menu-group button:hover,
  .back:hover,
  .ghost:hover,
  .price:hover,
  .texty:hover {
    background: rgba(255, 255, 255, 0.06);
  }
  .primary:hover {
    background: var(--silver);
  }
}

@media (max-height: 700px) {
  .brand { margin-top: 0; }
  .brand-mark { width: 52px; height: 52px; }
  .brand h1 { font-size: clamp(36px, 11vw, 56px); }
  .brand p { margin-top: 8px; }
  .hint { display: none; }
  #gate h1 { font-size: clamp(34px, 10vw, 52px); }
  .gate-scene { margin-top: 8px; }
  .drops { height: 84px; }
  .drops img { height: 72px; }
  .win-art { height: 112px; }
  .menu-group button { min-height: 46px; }
  .hall-actions { gap: 10px; }
}

@media (max-height: 460px) {
  .brand-mark, .brand p, .whisper, .gate-scene { display: none; }
  .brand h1 { font-size: clamp(28px, 8vw, 40px); }
  .menu-group button, .primary { min-height: 40px; }
  #hall { justify-content: safe center; gap: 10px; }
  #loom { gap: 4px; }
  .screen {
    padding-top: calc(8px + env(safe-area-inset-top));
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .lead { margin-top: 8px; font-size: 13px; }
  .stats strong { font-size: 20px; }
}

@media (max-height: 580px) {
  .gate-scene, .pool-row { display: none; }
  .whisper { font-size: 15px; }
  .filament { display: none; }
  .gate-body { padding-left: 0; }
}

html.reduce *,
html.reduce *::before,
html.reduce *::after {
  animation: none !important;
  transition: none !important;
}
