@font-face {
  font-family: "Imperial Cinzel";
  src: url("imperial-cinzel.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Mkhedruli Sans";
  src: url("mkhedruli-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0589, U+10A0-10FF, U+1C90-1CBA, U+1CBD-1CBF, U+205A, U+2D00-2D2F, U+2E31;
}

@font-face {
  font-family: "Mkhedruli Sans";
  src: url("numeral-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Mkhedruli Serif";
  src: url("mkhedruli-serif.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0589, U+10A0-10FF, U+1C90-1CBA, U+1CBD-1CBF, U+205A, U+2D00-2D2F, U+2E31;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}

html {
  height: 100%;
  color-scheme: dark;
  background: #0A1E3D;
}

body {
  min-height: 100%;
  height: 100%;
  overflow: hidden;
  color: #FFFFFF;
  font-family: "Mkhedruli Sans", sans-serif;
  font-weight: 400;
  background: #0A1E3D url("abyss-sparks.webp") center / cover no-repeat;
  display: grid;
  place-items: center;
  user-select: none;
  -webkit-user-select: none;
}

img {
  display: block;
  max-width: 100%;
  user-select: none;
  -webkit-user-drag: none;
}

button,
input {
  font: inherit;
  color: inherit;
  letter-spacing: 0;
}

button {
  background: rgba(8, 20, 44, 0.55);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 16px;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  opacity: 0.48;
  cursor: default;
}

button:focus {
  outline: none;
}

button:focus-visible,
input:focus-visible {
  outline: 1px solid #FFD700;
  outline-offset: 3px;
}

input {
  user-select: text;
  -webkit-user-select: text;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 12px;
  color: #FFFFFF;
  caret-color: #FFD700;
  font-size: 16px;
  padding: 10px 12px;
}

input::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

input:focus {
  outline: none;
  border-color: #FFD700;
}

input:-webkit-autofill {
  -webkit-text-fill-color: #FFFFFF;
  box-shadow: 0 0 0 1000px #0A1E3D inset;
  caret-color: #FFD700;
}

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

::selection {
  background: rgba(255, 215, 0, 0.28);
  color: #FFFFFF;
}

[hidden] {
  display: none !important;
}

.stage {
  width: min(100%, 480px);
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
  background: #0A1E3D;
  touch-action: manipulation;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
  min-height: 0;
}

.screen.is-on {
  display: flex;
  flex-direction: column;
  animation: arrive 0.38s ease;
}

.bg,
.bg-stack {
  position: absolute;
  inset: 0;
}

.bg {
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 16, 36, 0.42) 0%, rgba(10, 30, 61, 0.74) 46%, rgba(5, 12, 26, 0.9) 100%);
}

.sparks { background-image: url("abyss-sparks.webp"); }
.veilbg { background-image: url("meridian-veil.webp"); }
.coins { background-image: url("treasury-drift.webp"); }

.bg-stack .bg {
  opacity: 0;
  transition: opacity 0.8s ease;
}

#veil[data-page="0"] .sparks,
#veil[data-page="1"] .veilbg,
#veil[data-page="2"] .coins {
  opacity: 1;
}

#veil {
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 22px calc(16px + env(safe-area-inset-bottom));
  gap: 8px;
  text-align: center;
}

.text-btn {
  align-self: flex-end;
  position: relative;
  z-index: 1;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  min-height: 40px;
  padding: 0 4px;
}

.seal-wrap {
  position: relative;
  z-index: 1;
  width: min(230px, 52vw, 34vh);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  flex: 0 1 auto;
}

.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 215, 0, 0.78);
  border-right-color: transparent;
  animation: spin 12s linear infinite;
}

.ring-inner {
  inset: 16px;
  border-right-color: rgba(255, 215, 0, 0.78);
  border-left-color: transparent;
  animation-duration: 8s;
  animation-direction: reverse;
}

#seal-art {
  width: 46%;
  height: 46%;
  object-fit: contain;
  position: relative;
  z-index: 1;
}

#veil[data-page="0"] #seal-art { animation: sway 3.4s ease-in-out infinite; }
#veil[data-page="1"] #seal-art { animation: bloom 1.15s ease-in-out infinite; }
#veil[data-page="2"] #seal-art { animation: lift 1.5s ease; }

#seal-count {
  position: absolute;
  z-index: 1;
  bottom: 14%;
  font-family: "Imperial Cinzel", serif;
  color: #FFD700;
  font-size: 22px;
  letter-spacing: 0.08em;
}

.veil-copy {
  position: relative;
  z-index: 1;
  max-width: 34em;
}

.veil-copy h1 {
  font-family: "Mkhedruli Serif", serif;
  font-weight: 700;
  color: #FFD700;
  font-size: clamp(30px, 8vw, 42px);
  line-height: 1.15;
}

.veil-copy p {
  margin-top: 8px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(14px, 3.6vw, 16px);
}

.veil-copy.is-in h1,
.veil-copy.is-in p {
  animation: rise-copy 0.7s ease;
}

.constellation-draw {
  position: relative;
  z-index: 1;
  width: min(230px, 68%);
  height: 36px;
  flex: 0 0 auto;
}

.constellation-draw path {
  fill: none;
  stroke: #FFD700;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 340;
  stroke-dashoffset: 340;
}

.constellation-draw.is-drawing path {
  animation: draw 1.35s ease forwards;
}

.filaments {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  height: 32px;
}

.filaments i {
  width: 3px;
  height: 28px;
  display: block;
  background: rgba(255, 215, 0, 0.18);
  position: relative;
  overflow: hidden;
}

.filaments i::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: #FFD700;
  transition: height 0.45s ease;
}

#veil[data-page="0"] .filaments i:nth-child(-n+1)::after,
#veil[data-page="1"] .filaments i:nth-child(-n+2)::after,
#veil[data-page="2"] .filaments i::after {
  height: 100%;
}

#veil-next {
  position: relative;
  z-index: 1;
  width: min(100%, 340px);
}

.gold-btn {
  min-height: 52px;
  padding: 0 18px;
  color: #FFD700;
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.22), rgba(255, 215, 0, 0.05));
  border-color: rgba(255, 215, 0, 0.72);
  isolation: isolate;
  font-size: 17px;
}

.gold-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 28%, rgba(255, 215, 0, 0.28), transparent 72%);
  transform: translateX(-130%);
  animation: sheen 3.8s ease-in-out infinite;
  pointer-events: none;
}

.gold-btn {
  position: relative;
}

.home-scroll,
.scroll {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
  scrollbar-width: none;
}

.home-scroll::-webkit-scrollbar,
.scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.wordmark {
  text-align: center;
  padding-top: 8px;
}

.wordmark h1 {
  font-family: "Imperial Cinzel", serif;
  font-weight: 700;
  font-size: clamp(38px, 11vw, 60px);
  letter-spacing: 0.12em;
  color: #FFD700;
  line-height: 1;
}

.wordmark p {
  margin-top: 8px;
  font-family: "Mkhedruli Serif", serif;
  color: #FFFFFF;
  font-size: 16px;
}

.orbit {
  width: min(210px, 52vw);
  aspect-ratio: 1;
  margin: 18px auto 8px;
  position: relative;
}

.orbit-spin {
  position: absolute;
  inset: 0;
  animation: spin 16s linear infinite;
}

.orbit-core {
  position: absolute;
  left: 22%;
  top: 22%;
  width: 56%;
  height: 56%;
  object-fit: contain;
  animation: sway 4.6s ease-in-out infinite;
}

.sat {
  position: absolute;
  width: 30%;
  height: 30%;
  object-fit: contain;
  animation: spin 16s linear infinite reverse;
}

.sat.star { top: 0; left: 35%; }
.sat.cup { right: 0; bottom: 4%; width: 34%; height: 34%; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0 16px;
}

.stats div,
.offer,
.record,
.rules,
.result-card,
.modal-card,
.pulse-box,
.omen-chip,
.combo-chip {
  background: rgba(6, 16, 36, 0.62);
  border: 1px solid rgba(255, 215, 0, 0.28);
}

.stats div {
  padding: 10px 12px;
  border-radius: 16px;
}

.stats span,
.hud span,
.bar span,
.eyebrow {
  display: block;
  color: rgba(255, 215, 0, 0.82);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.stats strong {
  display: block;
  margin-top: 2px;
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 600;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu button {
  width: 100%;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  text-align: left;
  background: rgba(8, 20, 44, 0.7);
}

.menu button:active,
.offer button:active,
.gold-btn:active {
  transform: translateY(1px);
}

.menu img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex: 0 0 auto;
}

.menu span {
  font-family: "Mkhedruli Serif", serif;
  font-size: clamp(20px, 5.4vw, 26px);
  color: #FFFFFF;
}

.bar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 6px;
  flex: 0 0 auto;
}

.bar h2 {
  flex: 1;
  text-align: center;
  font-family: "Mkhedruli Serif", serif;
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 700;
  color: #FFD700;
}

.bar-spacer,
.icon-btn {
  width: 42px;
  flex: 0 0 42px;
}

.icon-btn {
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 0;
}

.icon-btn i {
  width: 10px;
  height: 10px;
  border-left: 2px solid #FFD700;
  border-bottom: 2px solid #FFD700;
  transform: rotate(45deg);
  margin-left: 4px;
}

.bar-level,
.bar-score {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.bar-score {
  margin-left: auto;
  align-items: flex-end;
}

.bar strong {
  font-size: clamp(18px, 5vw, 26px);
  font-weight: 600;
  line-height: 1.1;
}

.treasury-pill {
  min-width: 72px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  color: #FFD700;
  font-weight: 600;
}

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

.level-line {
  position: relative;
  z-index: 1;
  height: 2px;
  margin: 0 14px 8px;
  background: rgba(255, 215, 0, 0.16);
  flex: 0 0 auto;
}

.level-line i,
.pulse-track i {
  display: block;
  height: 100%;
  width: 0;
  background: #FFD700;
}

.hud {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.15fr) minmax(0, 0.7fr);
  gap: 8px;
  padding: 0 14px 8px;
  flex: 0 0 auto;
}

.pulse-box,
.omen-chip,
.combo-chip {
  border-radius: 14px;
  padding: 7px 8px;
  min-width: 0;
}

.pulse-track {
  height: 4px;
  margin: 6px 0 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  overflow: hidden;
}

.hud em,
.hud strong {
  font-style: normal;
  font-weight: 600;
  font-size: 14px;
}

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

.omen-chip img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex: 0 0 auto;
}

.omen-chip strong,
.combo-chip strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-wrap {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 14px;
  container-type: size;
}

.board {
  position: relative;
  width: min(100%, 100cqh);
  height: auto;
  aspect-ratio: 1;
  max-height: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(6px, 1.6vw, 10px);
}

@supports (width: 1cqh) {
  .board {
    width: min(100cqw, 100cqh);
    height: min(100cqw, 100cqh);
    max-height: none;
  }
}

.cell {
  min-width: 0;
  min-height: 0;
  border-radius: 16px;
  border: 1px solid rgba(255, 215, 0, 0.34);
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 215, 0, 0.1), rgba(8, 22, 48, 0.15) 58%),
    rgba(7, 20, 44, 0.82);
  display: grid;
  place-items: center;
  padding: 6px;
  position: relative;
}

.cell img {
  width: 78%;
  height: 78%;
  object-fit: contain;
  transition: transform 0.32s ease, opacity 0.32s ease;
}

.cell.is-fold img {
  transform: rotateY(88deg) scale(0.72);
  opacity: 0;
}

.cell.is-rise img {
  animation: rise 0.42s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.cell.is-pinned {
  box-shadow: inset 0 0 0 2px #FFD700, 0 0 16px rgba(255, 215, 0, 0.28);
}

.cell.is-lit {
  box-shadow: inset 0 0 0 2px #FFD700, 0 0 20px rgba(255, 215, 0, 0.48);
}

.cell.is-deny {
  animation: shake 0.32s linear;
}

#threads {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

#threads line {
  stroke: #FFD700;
  stroke-width: 5;
  stroke-linecap: round;
  opacity: 0.9;
}

.legend {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: safe center;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 14px 0;
  flex: 0 0 auto;
  scrollbar-width: none;
}

.legend::-webkit-scrollbar { height: 0; }

.legend div {
  flex: 0 0 auto;
  width: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.legend img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.legend span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.82);
}

.hint {
  position: relative;
  z-index: 1;
  text-align: center;
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  line-height: 1.3;
  min-height: 16px;
  padding: 4px 16px 0;
  flex: 0 0 auto;
}

.dock {
  position: relative;
  z-index: 1;
  padding: 8px 14px calc(12px + env(safe-area-inset-bottom));
  flex: 0 0 auto;
}

.dock .gold-btn { width: 100%; }

.floater {
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: 3;
  transform: translateX(-50%);
  color: #FFD700;
  font-family: "Mkhedruli Serif", serif;
  font-size: clamp(26px, 7vw, 40px);
  pointer-events: none;
  text-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  animation: floatup 0.9s ease forwards;
}

.banner {
  position: absolute;
  z-index: 4;
  left: 18px;
  right: 18px;
  top: 28%;
  text-align: center;
  padding: 14px 12px;
  color: #FFD700;
  font-family: "Mkhedruli Serif", serif;
  background: rgba(10, 30, 61, 0.92);
  border: 1px solid rgba(255, 215, 0, 0.55);
  border-radius: 16px;
}

.result {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(4, 10, 22, 0.72);
}

.result-card {
  width: min(100%, 380px);
  max-height: 100%;
  overflow: auto;
  border-radius: 22px;
  padding: 22px 16px 16px;
  text-align: center;
}

.result-card h2 {
  font-family: "Imperial Cinzel", serif;
  color: #FFD700;
  font-size: clamp(40px, 12vw, 64px);
  line-height: 1;
  margin: 6px 0;
}

.result-card .field {
  margin-top: 14px;
  text-align: left;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.stack button { width: 100%; min-height: 48px; }

.offer {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 18px;
}

.offer img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.offer h3 {
  font-family: "Mkhedruli Serif", serif;
  color: #FFD700;
  font-size: 18px;
  font-weight: 700;
}

.offer p {
  margin: 4px 0 8px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  line-height: 1.4;
}

.offer button {
  min-height: 40px;
  padding: 0 10px;
  color: #FFD700;
  width: 100%;
}

.offer button.is-short { opacity: 0.55; }

.record {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 16px;
}

.record span,
.record b {
  color: #FFD700;
  font-weight: 600;
}

.record strong,
.record em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record em {
  font-style: normal;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  margin-top: 2px;
}

.record.is-best {
  border-color: rgba(255, 215, 0, 0.7);
  box-shadow: inset 0 0 0 1px rgba(255, 215, 0, 0.2);
}

.empty {
  text-align: center;
  padding: 48px 12px;
  color: rgba(255, 255, 255, 0.8);
}

.settings .field,
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 215, 0, 0.16);
}

.field span,
.field,
.toggle-row span {
  color: #FFFFFF;
}

.field input {
  width: min(58%, 220px);
  text-align: right;
}

.switch {
  width: 52px;
  height: 30px;
  border-radius: 999px;
  padding: 0;
  position: relative;
  flex: 0 0 auto;
}

.switch::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  background: #FFFFFF;
  transition: transform 0.22s ease, background 0.22s ease;
}

.switch.is-on {
  background: rgba(255, 215, 0, 0.24);
  border-color: #FFD700;
}

.switch.is-on::after {
  transform: translateX(20px);
  background: #FFD700;
}

.rules {
  margin-top: 16px;
  padding: 14px;
  border-radius: 18px;
}

.rules h3 {
  font-family: "Mkhedruli Serif", serif;
  color: #FFD700;
  margin-bottom: 8px;
  font-size: 18px;
}

.rules p {
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
}

.ghost,
.danger {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
}

.ghost { color: #FFD700; }
.danger { color: #FFFFFF; border-color: rgba(255, 255, 255, 0.28); }

.toast {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  text-align: center;
  color: #FFD700;
  background: rgba(10, 30, 61, 0.94);
  border: 1px solid rgba(255, 215, 0, 0.55);
  border-radius: 14px;
  pointer-events: none;
}

.modal {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 10, 22, 0.74);
}

.modal-card {
  width: min(100%, 360px);
  border-radius: 20px;
  padding: 20px 16px 16px;
}

.modal-card h2 {
  font-family: "Mkhedruli Serif", serif;
  color: #FFD700;
  font-size: 24px;
  margin-bottom: 8px;
}

.modal-card p {
  line-height: 1.45;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 8px;
}

.modal-actions button {
  flex: 1;
  min-height: 46px;
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes sway {
  50% { transform: translateY(-6px) rotate(-6deg); }
}

@keyframes bloom {
  50% { transform: scale(1.08); }
}

@keyframes lift {
  from { transform: translateY(18px) scale(0.82); opacity: 0; }
  to { transform: none; opacity: 1; }
}

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

@keyframes draw { to { stroke-dashoffset: 0; } }

@keyframes sheen {
  0%, 62% { transform: translateX(-130%); }
  100% { transform: translateX(130%); }
}

@keyframes arrive {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes rise {
  from { transform: rotateY(-86deg) scale(0.76); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes shake {
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

@keyframes floatup {
  to { transform: translate(-50%, -34px); opacity: 0; }
}

@media (min-width: 540px) {
  .stage {
    height: min(920px, calc(100dvh - 32px));
    border-radius: 32px;
    border: 1px solid rgba(255, 215, 0, 0.32);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.48);
  }
}

@media (max-height: 700px) {
  .orbit { width: min(150px, 34vh); margin: 8px auto; }
  .wordmark h1 { font-size: 36px; }
  .menu button { min-height: 52px; }
  .seal-wrap { width: min(168px, 30vh); }
  .veil-copy h1 { font-size: 28px; }
  .hud { gap: 6px; }
  .cell { border-radius: 12px; padding: 4px; }
}

@media (max-height: 640px) {
  #veil {
    gap: 4px;
    padding: 8px 16px 10px;
    overflow-y: auto;
  }
  .seal-wrap { width: min(108px, 22vh); }
  .ring-inner { inset: 8px; }
  .veil-copy h1 { font-size: 24px; }
  .veil-copy p { margin-top: 4px; font-size: 13px; }
  .constellation-draw { height: 22px; }
  .filaments { height: 16px; }
  .filaments i { height: 16px; }
  .gold-btn { min-height: 44px; }
  .orbit { width: 96px; margin: 4px auto; }
  .wordmark { padding-top: 0; }
  .wordmark h1 { font-size: 30px; }
  .wordmark p { margin-top: 4px; }
  .stats { margin: 6px 0 8px; }
  .menu { gap: 6px; }
  .menu button { min-height: 46px; }
  .home-scroll { padding-top: 8px; padding-bottom: 8px; }
  .hud { padding-bottom: 4px; }
  .dock { padding-top: 4px; padding-bottom: 8px; }
}

@media (max-width: 340px) {
  .hud { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.72fr); gap: 6px; padding-left: 10px; padding-right: 10px; }
  .menu span { font-size: 18px; }
  .offer { grid-template-columns: 56px minmax(0, 1fr); }
  .offer img { width: 56px; height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
