:root {
  --amber: #FF8A3D;
  --amber-soft: #FFB36F;
  --amber-pale: #FFD6AE;
  --ink: #F6EEE3;
  --ink-dim: #CBBEAD;
  --ink-mute: #948777;
  --void: #05070B;
  --panel: rgba(17, 23, 32, .9);
  --line: rgba(255, 178, 116, .17);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-ui: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --font-display: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--void);
  color: var(--ink);
}

body {
  overflow: hidden;
  overscroll-behavior: none;
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 2px solid var(--amber-soft);
  outline-offset: 3px;
}

img {
  display: block;
}

[hidden] {
  display: none !important;
}

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

/* ---------------- scene ---------------- */

.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(80% 60% at 50% 46%, #12202b 0%, #080c13 48%, #05070b 100%),
    linear-gradient(180deg, #0a1019 0%, #06090f 60%, #030407 100%);
  pointer-events: none;
}

.scene-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  object-position: 50% 46%;
  transform: scale(1.02);
  animation: sceneBreathe 26s ease-in-out infinite alternate;
}

.scene-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  mix-blend-mode: screen;
}

.scene-glow-warm {
  width: 82vw;
  height: 82vw;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 138, 61, .17), rgba(255, 122, 45, .05) 42%, transparent 68%);
  animation: warmPulse 9s ease-in-out infinite;
}

.scene-glow-teal {
  width: 62vw;
  height: 62vw;
  left: 18%;
  top: 20%;
  background: radial-gradient(circle, rgba(91, 224, 214, .08), transparent 66%);
  animation: glowPulse 13s ease-in-out infinite reverse;
}

.scene-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(3, 5, 9, .62) 0%, transparent 17%, transparent 72%, rgba(3, 5, 9, .72) 100%),
    radial-gradient(120% 72% at 50% 44%, transparent 42%, rgba(0, 0, 0, .42) 100%);
}

.dust {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.dust i {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(255, 221, 190, .85);
  box-shadow: 0 0 7px rgba(255, 175, 112, .7);
  opacity: 0;
  animation-name: dustDrift;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

/* ---------------- shell ---------------- */

.game {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: calc(9px + var(--safe-top)) 16px calc(10px + var(--safe-bottom));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
}

/* ---------------- HUD ---------------- */

.hud {
  position: relative;
  z-index: 30;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
}

.level-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 42px;
  min-width: 0;
  max-width: 54vw;
  padding: 0 15px 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(26, 34, 45, .86), rgba(9, 13, 20, .92));
  box-shadow: 0 8px 24px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .07);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.level-index {
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
  color: var(--amber-soft);
  text-shadow: 0 0 14px rgba(255, 138, 61, .4);
}

.level-divider {
  flex: 0 0 auto;
  width: 1px;
  height: 15px;
  background: linear-gradient(180deg, transparent, rgba(255, 190, 130, .38), transparent);
}

.level-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  letter-spacing: .13em;
  color: #D9CDBD;
}

.hud-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hint-btn,
.ad-btn {
  position: relative;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 999px;
  border: 1px solid rgba(255, 176, 112, .24);
  background: linear-gradient(180deg, rgba(36, 29, 25, .9), rgba(15, 12, 11, .94));
  box-shadow: 0 8px 24px rgba(0, 0, 0, .36), inset 0 1px 0 rgba(255, 255, 255, .07);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--amber-pale);
  transition: transform .16s ease, box-shadow .2s ease, border-color .2s ease;
}

.hint-btn {
  padding: 0 8px 0 12px;
  min-width: 88px;
}

.ad-btn {
  width: 52px;
  color: #FFC793;
}

.ad-btn:disabled {
  opacity: .55;
}

.hint-btn:active,
.ad-btn:active {
  transform: scale(.94);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .4), inset 0 2px 6px rgba(0, 0, 0, .4);
}

.hint-btn .mp-icon,
.ad-btn .mp-icon {
  width: 19px;
  height: 19px;
  filter: drop-shadow(0 0 6px rgba(255, 150, 70, .6));
}

.hint-label {
  font-size: 12px;
  letter-spacing: .08em;
  color: #E7D6C2;
}

.hint-count {
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFB063, #FF822F);
  color: #231307;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 12px rgba(255, 138, 61, .55), inset 0 1px 0 rgba(255, 255, 255, .5);
}

.hint-count.is-empty {
  background: linear-gradient(180deg, #4A4038, #2C2621);
  color: #9A8C7D;
  box-shadow: none;
}

.ad-plus {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  color: #FFC793;
}

/* ---------------- stage / altar ---------------- */

.stage {
  position: relative;
  z-index: 10;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 4px 0 2px;
}

.altar {
  position: relative;
  width: min(90vw, 52dvh, 420px);
  height: min(90vw, 52dvh, 420px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  opacity: 0;
  transform: scale(.94);
  animation: altarIn .55s cubic-bezier(.2, .8, .2, 1) .05s forwards;
}

.altar-halo {
  position: absolute;
  inset: -24%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 138, 61, .16), rgba(255, 120, 40, .04) 42%, transparent 66%);
  filter: blur(8px);
  animation: glowPulse 7s ease-in-out infinite;
  pointer-events: none;
}

.altar::before {
  content: "";
  position: absolute;
  inset: 7%;
  z-index: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, rgba(38, 51, 65, .42), rgba(10, 14, 21, .84) 58%, rgba(4, 6, 10, .95) 100%);
  border: 1px solid rgba(255, 182, 122, .12);
  box-shadow:
    inset 0 0 54px rgba(0, 0, 0, .92),
    inset 0 2px 0 rgba(255, 255, 255, .045),
    0 26px 60px rgba(0, 0, 0, .55),
    0 0 0 6px rgba(5, 8, 13, .55),
    0 0 0 7px rgba(255, 176, 112, .055);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.altar::after {
  content: "";
  position: absolute;
  inset: 15%;
  z-index: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 190, 136, .09);
  box-shadow:
    inset 0 0 32px rgba(0, 0, 0, .6),
    0 0 40px rgba(255, 138, 61, .05);
  pointer-events: none;
}

.altar-ring {
  position: absolute;
  inset: -4%;
  z-index: 1;
  width: 108%;
  height: 108%;
  pointer-events: none;
  opacity: .9;
}

.ring-spin-slow {
  transform-box: view-box;
  transform-origin: 200px 200px;
  animation: spin 140s linear infinite;
}

.ring-spin-rev {
  transform-box: view-box;
  transform-origin: 200px 200px;
  animation: spin 200s linear infinite reverse;
}

.beams {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.progress-ring {
  fill: none;
  stroke: rgba(255, 161, 86, .76);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-dasharray: 1231.5;
  stroke-dashoffset: 1231.5;
  filter: drop-shadow(0 0 4px rgba(255, 150, 80, .55));
  transition: stroke-dashoffset .55s cubic-bezier(.2, .8, .2, 1);
}

.beam {
  stroke: rgba(255, 153, 76, .2);
  stroke-width: .45;
  stroke-dasharray: 2.4 3.4;
  fill: none;
  vector-effect: non-scaling-stroke;
  transition: stroke .3s ease, opacity .3s ease;
}

.beam.is-live {
  stroke: rgba(255, 176, 106, .9);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  opacity: 1;
  filter: url(#beamGlow);
  animation: beamFlow 1.6s linear infinite;
}

.sockets {
  position: absolute;
  inset: 0;
  z-index: 6;
}

.altar-core {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 58px;
  height: 58px;
  margin: -29px 0 0 -29px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 148, 72, .16), rgba(10, 14, 21, .55) 62%, transparent 74%);
  border: 1px solid rgba(255, 186, 130, .16);
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, .8),
    0 0 22px rgba(255, 138, 61, .1);
  opacity: .82;
  animation: corePulse 5.5s ease-in-out infinite;
}

.altar-core::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 190, 130, .2);
}

.altar-core::after {
  content: "";
  position: absolute;
  inset: 17px;
  border-radius: 50%;
  border: 1px solid rgba(109, 228, 221, .12);
}

.core-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FFC089;
  box-shadow: 0 0 12px rgba(255, 160, 90, .95), 0 0 28px rgba(255, 120, 50, .5);
}

/* ---------------- sockets ---------------- */

.socket {
  position: absolute;
  width: clamp(58px, 18.5vw, 78px);
  height: clamp(58px, 18.5vw, 78px);
  transform: translate(-50%, -50%) scale(.72);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 32%, #25313F 0%, #121A25 40%, #070A10 76%);
  border: 1px solid rgba(224, 198, 166, .18);
  box-shadow:
    inset 0 3px 8px rgba(255, 255, 255, .07),
    inset 0 -12px 22px rgba(0, 0, 0, .92),
    0 8px 16px rgba(0, 0, 0, .5),
    0 0 0 5px rgba(8, 12, 18, .66),
    0 0 0 6px rgba(255, 188, 130, .055);
  display: grid;
  place-items: center;
  touch-action: none;
  opacity: 0;
  animation: socketIn .48s cubic-bezier(.2, .85, .25, 1) forwards;
  transition: box-shadow .28s ease, border-color .28s ease, transform .18s ease;
}

.socket::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 190, 130, .14);
  pointer-events: none;
  transition: border-color .25s ease;
}

.socket::after {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, .075), transparent 58%);
  pointer-events: none;
}

.socket:active {
  transform: translate(-50%, -50%) scale(.96);
}

.socket-rim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .6), inset 0 0 18px rgba(0, 0, 0, .7);
  pointer-events: none;
}

.socket-rune {
  position: relative;
  z-index: 2;
  width: 42%;
  height: 42%;
  color: rgba(219, 194, 165, .7);
  filter: drop-shadow(0 0 5px rgba(255, 176, 116, .18));
  transition: color .3s ease, opacity .25s ease, transform .3s ease;
  pointer-events: none;
}

.rune-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.socket-gem {
  position: absolute;
  inset: 6%;
  z-index: 3;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(.45);
  pointer-events: none;
  transition: opacity .3s ease, transform .45s cubic-bezier(.2, 1.5, .4, 1);
}

/* switch socket */

.socket.is-switch {
  border-color: rgba(255, 160, 86, .46);
  box-shadow:
    inset 0 3px 8px rgba(255, 200, 150, .09),
    inset 0 -12px 22px rgba(0, 0, 0, .9),
    0 8px 16px rgba(0, 0, 0, .5),
    0 0 0 5px rgba(8, 12, 18, .66),
    0 0 0 6px rgba(255, 146, 60, .18),
    0 0 22px rgba(255, 138, 61, .18);
}

.socket.is-switch::before {
  border-color: rgba(255, 160, 86, .36);
  animation: spin 26s linear infinite;
}

.socket.is-switch .socket-rune {
  color: rgba(255, 196, 142, .92);
  filter: drop-shadow(0 0 9px rgba(255, 140, 56, .75));
}

.switch-badge {
  position: absolute;
  z-index: 5;
  top: -4px;
  right: -4px;
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #FFB36F, #E76F22);
  color: #241306;
  border: 1px solid rgba(255, 223, 190, .6);
  box-shadow: 0 0 14px rgba(255, 138, 61, .62);
  pointer-events: none;
}

.switch-badge .mp-icon {
  width: 13px;
  height: 13px;
}

/* gate */

.gate {
  position: absolute;
  inset: -3px;
  z-index: 4;
  border-radius: 50%;
  transform-origin: 50% 96%;
  transition: transform .62s cubic-bezier(.22, .8, .24, 1), opacity .48s ease;
  pointer-events: none;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.gate-plate {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 24%, #33404F 0%, #1B2431 38%, #0C1119 78%);
  border: 2px solid rgba(70, 86, 104, .9);
  box-shadow:
    inset 0 3px 5px rgba(255, 255, 255, .09),
    inset 0 -10px 18px rgba(0, 0, 0, .92),
    0 7px 15px rgba(0, 0, 0, .62);
  overflow: hidden;
}

.gate-plate::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .035) 0 2px, transparent 2px 7px);
  opacity: .75;
}

.gate-plate::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 64% 70%, rgba(0, 0, 0, .55), transparent 52%);
}

.gate-rune {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: 38%;
  height: 38%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, .32);
  filter: drop-shadow(0 0 5px rgba(0, 0, 0, .8));
}

.gate-lock {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 5%;
  width: 15px;
  height: 15px;
  transform: translateX(-50%);
  color: rgba(255, 196, 142, .52);
}

.gate-lock .mp-icon {
  width: 15px;
  height: 15px;
}

.socket.is-gated .socket-rune {
  opacity: .2;
}

.socket.gate-open .gate {
  transform: translateY(24%) rotateX(74deg) scale(.9);
  opacity: 0;
}

.socket.is-gated.gate-open .socket-rune {
  opacity: 1;
}

/* filled */

.socket.is-filled {
  border-color: var(--gem, #FFA45A);
  box-shadow:
    inset 0 3px 8px rgba(255, 255, 255, .07),
    inset 0 -12px 22px rgba(0, 0, 0, .84),
    0 8px 16px rgba(0, 0, 0, .5),
    0 0 0 5px rgba(8, 12, 18, .62),
    0 0 0 6px rgba(255, 255, 255, .07),
    0 0 26px var(--gem-soft, rgba(255, 160, 90, .35));
}

.socket.is-filled .socket-rune {
  opacity: 0;
  transform: scale(.6);
}

.socket.is-filled .socket-gem {
  opacity: 1;
  transform: scale(1);
}

.socket.is-filled.just-placed {
  animation: socketPop .55s cubic-bezier(.2, 1.4, .4, 1);
}

.socket.is-filled::before {
  border-color: var(--gem, #FFA45A);
  opacity: .6;
  animation: none;
}

.socket.is-filled .gate {
  opacity: 0;
  pointer-events: none;
}

/* interaction states */

.socket.drag-over .socket-rune {
  color: #FFE1BC;
}

.socket.drag-over.match {
  border-color: #FFD2A0;
  box-shadow:
    inset 0 0 18px rgba(255, 180, 110, .26),
    0 0 0 5px rgba(8, 12, 18, .62),
    0 0 0 7px rgba(255, 176, 102, .45),
    0 0 32px rgba(255, 150, 70, .6);
}

.socket.drag-over.mismatch {
  border-color: rgba(255, 112, 96, .7);
  box-shadow:
    inset 0 0 18px rgba(255, 80, 64, .18),
    0 0 0 5px rgba(8, 12, 18, .62),
    0 0 0 7px rgba(255, 92, 76, .32),
    0 0 28px rgba(255, 70, 54, .4);
}

.socket.drag-over.locked {
  border-color: rgba(255, 160, 86, .5);
  box-shadow: 0 0 0 5px rgba(8, 12, 18, .62), 0 0 0 7px rgba(255, 160, 86, .28);
}

.socket.is-wrong {
  animation: socketShake .42s cubic-bezier(.36, .07, .19, .97);
}

.socket.is-call {
  border-color: rgba(255, 198, 148, .48);
  box-shadow:
    inset 0 0 16px rgba(255, 190, 130, .12),
    0 0 0 5px rgba(8, 12, 18, .62),
    0 0 0 7px rgba(255, 180, 112, .22),
    0 0 26px rgba(255, 150, 70, .24);
}

.socket.is-call::before {
  border-color: rgba(255, 200, 150, .36);
}

.socket.is-call .socket-rune {
  color: rgba(255, 220, 182, .92);
}

.socket.hint-glow {
  border-color: #FFE0B8;
  box-shadow:
    inset 0 0 20px rgba(255, 210, 160, .3),
    0 0 0 5px rgba(8, 12, 18, .62),
    0 0 0 7px rgba(255, 208, 150, .5),
    0 0 38px rgba(255, 174, 96, .75);
}

.socket.hint-glow::before {
  border-color: rgba(255, 220, 180, .8);
  animation: spin 9s linear infinite;
}

.socket.hint-glow .socket-rune {
  color: #FFF0D9;
}

/* ---------------- gem art ---------------- */

.gem-shape {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  color: var(--c1, #FFA24A);
  filter: drop-shadow(0 0 9px var(--glow, rgba(255, 150, 70, .6)));
}

.gem-body {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.gem-body .gf {
  stroke: rgba(255, 255, 255, .34);
  stroke-width: .7;
  stroke-linejoin: round;
}

.gem-body .gf-main {
  fill: var(--c2, #D96722);
}

.gem-body .gf-left {
  fill: var(--c1, #FFA24A);
  fill-opacity: .94;
}

.gem-body .gf-right {
  fill: var(--c2, #D96722);
  fill-opacity: .96;
}

.gem-body .gf-core {
  fill: var(--c1, #FFA24A);
  fill-opacity: .58;
}

.gem-body .gf-crown {
  fill: #FFFFFF;
  fill-opacity: .19;
  stroke: rgba(255, 255, 255, .3);
}

.gem-body .gf-shine {
  fill: none;
  stroke: rgba(255, 255, 255, .62);
  stroke-width: 1.4;
  stroke-linecap: round;
}

.gem-body .gf-glint {
  fill: #FFFFFF;
  fill-opacity: .72;
  stroke: none;
}

.gem-rune {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 48%;
  width: 34%;
  height: 34%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, .94);
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, .9)) drop-shadow(0 0 9px var(--glow, rgba(255, 160, 90, .7)));
  pointer-events: none;
}

/* ---------------- tray ---------------- */

.tray {
  position: relative;
  z-index: 25;
  flex: 0 0 auto;
  padding: 11px 13px 9px;
  border-radius: 22px;
  border: 1px solid rgba(255, 180, 120, .15);
  background:
    radial-gradient(120% 90% at 50% -18%, rgba(255, 150, 80, .09), transparent 55%),
    linear-gradient(180deg, rgba(23, 30, 40, .92), rgba(8, 11, 17, .96));
  box-shadow:
    0 -12px 40px rgba(0, 0, 0, .38),
    0 10px 30px rgba(0, 0, 0, .34),
    inset 0 1px 0 rgba(255, 255, 255, .07);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.tray::before {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 196, 144, .55), transparent);
}

.tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px 6px;
}

.tray-tip {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.35;
  letter-spacing: .07em;
  color: #A1937F;
}

.tray-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.mini-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #8D8172;
  transition: color .2s ease, background .2s ease, transform .16s ease;
}

.mini-btn:active {
  transform: scale(.9);
  background: rgba(255, 255, 255, .05);
}

.mini-btn .mp-icon {
  width: 16px;
  height: 16px;
}

.mini-btn.is-off {
  color: #554C42;
}

.tray-stones {
  min-height: clamp(58px, 15vw, 74px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(3px, 1.9vw, 12px);
  padding: 3px 0 3px;
}

.crystal {
  position: relative;
  flex: 0 0 auto;
  width: clamp(38px, 11.4vw, 56px);
  height: clamp(50px, 15vw, 74px);
  border-radius: 14px;
  touch-action: none;
  transform-origin: 50% 80%;
  animation: crystalFloat 4.6s ease-in-out infinite;
  transition: opacity .2s ease, transform .2s ease;
  will-change: transform;
}

.crystal::after {
  content: "";
  position: absolute;
  left: 24%;
  right: 24%;
  bottom: -1px;
  height: 5px;
  border-radius: 50%;
  background: var(--glow, rgba(255, 160, 90, .5));
  filter: blur(4px);
  opacity: .5;
  transition: opacity .2s ease;
}

.crystal .gem-shape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: transform .18s ease;
}

.crystal.is-selected {
  transform: translateY(-7px) scale(1.06);
  animation: none;
}

.crystal.is-selected::after {
  opacity: .95;
}

.crystal.is-selected .gem-shape {
  filter: drop-shadow(0 0 14px var(--glow, rgba(255, 160, 90, .8))) drop-shadow(0 0 26px var(--glow, rgba(255, 160, 90, .4)));
}

.crystal:active .gem-shape {
  transform: scale(.94);
}

.crystal.is-dragging {
  opacity: .16;
  animation: none;
}

.crystal.is-hint {
  animation: crystalHint 1.15s ease-in-out infinite;
}

.crystal.is-hint .gem-shape {
  filter: drop-shadow(0 0 16px #FFE0B8) drop-shadow(0 0 30px rgba(255, 174, 96, .8));
}

.crystal.is-tapped .gem-shape {
  transform: scale(.9);
}

.crystal.is-gone {
  opacity: 0;
  transform: translateY(-14px) scale(.6);
  animation: none;
  pointer-events: none;
}

.gem-ghost {
  position: fixed;
  z-index: 120;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.12);
  filter: drop-shadow(0 0 18px var(--glow, rgba(255, 160, 90, .8)));
  animation: ghostIn .16s ease-out;
}

.tray-stones.count-3 .crystal {
  width: clamp(52px, 15.5vw, 70px);
  height: clamp(68px, 20vw, 94px);
}

.tray-stones.count-4 .crystal {
  width: clamp(46px, 13.5vw, 62px);
  height: clamp(60px, 18vw, 82px);
}

.tray-stones.count-5 .crystal {
  width: clamp(40px, 12vw, 54px);
  height: clamp(52px, 16vw, 72px);
}

.tray-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 2px 0;
}

.level-dots {
  display: flex;
  align-items: center;
  gap: 0;
}

.dot {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: transform .16s ease;
}

.dot:active {
  transform: scale(.88);
}

.dot i {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: #343D4A;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .08);
  transition: width .25s ease, background .25s ease, box-shadow .25s ease;
}

.dot.is-done i {
  background: #C77A3E;
}

.dot.is-current i {
  width: 17px;
  background: linear-gradient(90deg, #FF8A3D, #FFC48C);
  box-shadow: 0 0 10px rgba(255, 138, 61, .8);
}

.dot.is-locked {
  opacity: .34;
}

.dot.is-locked:active {
  transform: none;
}

.count-pill {
  display: flex;
  align-items: baseline;
  gap: 1px;
  font-size: 11px;
  letter-spacing: .06em;
  color: #9E9080;
  font-variant-numeric: tabular-nums;
}

.count-pill b {
  font-size: 16px;
  font-weight: 700;
  color: var(--amber-soft);
  text-shadow: 0 0 12px rgba(255, 138, 61, .4);
}

.count-sep {
  color: #5F554A;
  margin: 0 1px;
}

.count-word {
  margin-left: 4px;
}

/* ---------------- toast ---------------- */

.toast {
  position: absolute;
  z-index: 90;
  left: 50%;
  bottom: calc(196px + var(--safe-bottom));
  max-width: 86%;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(13, 18, 26, .95);
  border: 1px solid rgba(255, 176, 112, .26);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .06);
  color: #FFE5CC;
  font-size: 12.5px;
  line-height: 1.3;
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}

.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------------- hint link ---------------- */

.hint-link {
  position: fixed;
  inset: 0;
  z-index: 85;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity .22s ease;
  overflow: visible;
}

.hint-link.is-show {
  opacity: 1;
}

.hint-link line {
  stroke: rgba(255, 209, 158, .88);
  stroke-width: 2;
  stroke-dasharray: 4 8;
  stroke-linecap: round;
  filter: drop-shadow(0 0 7px rgba(255, 160, 90, .9));
  animation: linkFlow 1s linear infinite;
}

.hint-link circle {
  fill: #FFE3C2;
  filter: drop-shadow(0 0 8px rgba(255, 180, 110, 1));
}

/* ---------------- fx ---------------- */

.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 88;
  pointer-events: none;
  overflow: hidden;
}

.fx-layer.is-front {
  z-index: 110;
}

.spark {
  position: absolute;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: var(--spark, #FFD09A);
  box-shadow: 0 0 8px var(--spark, #FFD09A);
  animation: sparkFly var(--dur, .8s) cubic-bezier(.1, .7, .3, 1) forwards;
}

.spark.star {
  border-radius: 1px;
  transform: rotate(45deg);
}

/* ---------------- overlays ---------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 18px calc(22px + var(--safe-bottom));
  background: rgba(3, 5, 9, .72);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  animation: overlayIn .24s ease-out;
}

#adSheet {
  align-items: flex-end;
  padding-left: 14px;
  padding-right: 14px;
}

.sheet {
  position: relative;
  width: 100%;
  max-width: 430px;
  max-height: calc(100dvh - 24px - var(--safe-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 20px calc(16px + var(--safe-bottom));
  border-radius: 28px;
  border: 1px solid rgba(255, 178, 116, .22);
  background:
    radial-gradient(120% 90% at 50% -18%, rgba(255, 150, 80, .16), transparent 58%),
    linear-gradient(180deg, rgba(27, 34, 44, .99), rgba(8, 11, 17, 1));
  box-shadow: 0 -24px 70px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .08);
  text-align: center;
  animation: sheetUp .38s cubic-bezier(.2, .85, .25, 1);
}

.sheet-grab {
  width: 38px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .14);
}

.sheet-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #2A1607;
  background: linear-gradient(160deg, #FFC489, #FF8A3D 56%, #EC6B1F);
  box-shadow: 0 10px 26px rgba(255, 122, 45, .3), inset 0 1px 0 rgba(255, 255, 255, .6);
}

.sheet-icon .mp-icon {
  width: 28px;
  height: 28px;
}

.eyebrow {
  margin: 0;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .34em;
  text-indent: .34em;
  color: #D89158;
  text-transform: uppercase;
}

.sheet h3 {
  margin: 7px 0 0;
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: .1em;
  color: #F8EADA;
}

.sheet-copy {
  margin: 9px auto 18px;
  max-width: 300px;
  font-size: 13px;
  line-height: 1.72;
  color: #A99B89;
}

.sheet-copy b {
  color: var(--amber-soft);
  font-weight: 700;
}

.primary-btn {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 16px;
  background: linear-gradient(180deg, #FFAE68 0%, #FF8A3D 52%, #F27322 100%);
  color: #2A1507;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .05em;
  box-shadow:
    0 12px 26px rgba(255, 122, 45, .32),
    inset 0 1px 0 rgba(255, 255, 255, .55),
    inset 0 -2px 0 rgba(150, 60, 10, .25);
  transition: transform .16s ease, box-shadow .2s ease, filter .2s ease;
}

.primary-btn:active {
  transform: translateY(1px) scale(.985);
  filter: brightness(.97);
  box-shadow: 0 5px 14px rgba(255, 122, 45, .28), inset 0 2px 4px rgba(120, 50, 10, .18);
}

.primary-btn .mp-icon {
  width: 20px;
  height: 20px;
}

.primary-btn:disabled {
  filter: grayscale(.65) brightness(.7);
  cursor: default;
}

.ghost-btn {
  width: 100%;
  min-height: 46px;
  margin-top: 6px;
  border-radius: 14px;
  color: #A99A88;
  font-size: 13px;
  letter-spacing: .06em;
  transition: color .2s ease, background .2s ease;
}

.ghost-btn:active {
  color: #E5D3BE;
  background: rgba(255, 255, 255, .04);
}

/* ---------------- simulated ad ---------------- */

.ad-playing {
  background: rgba(3, 5, 9, .9);
}

.ad-player {
  position: relative;
  width: 100%;
  max-width: 380px;
  max-height: 74dvh;
  aspect-ratio: 3 / 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 22px;
  border-radius: 26px;
  border: 1px solid rgba(255, 178, 116, .18);
  background: linear-gradient(180deg, #111925 0%, #070A10 100%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .07);
  overflow: hidden;
  animation: winIn .36s cubic-bezier(.2, .9, .3, 1);
}

.ad-bg {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 28% 22%, rgba(91, 224, 214, .14), transparent 42%),
    radial-gradient(circle at 76% 74%, rgba(255, 138, 61, .18), transparent 46%),
    repeating-linear-gradient(115deg, transparent 0 18px, rgba(255, 255, 255, .016) 18px 20px);
  animation: adSweep 6s ease-in-out infinite alternate;
}

.ad-topline {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  letter-spacing: .14em;
  color: #D9C7B2;
}

.ad-topline .mp-icon {
  width: 19px;
  height: 19px;
  color: var(--amber-soft);
}

.ad-badge {
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .12);
  color: #8B7F70;
  font-size: 9.5px;
  letter-spacing: .1em;
}

.ad-ring {
  position: relative;
  z-index: 1;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
}

.ad-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ad-ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, .08);
  stroke-width: 5;
}

.ad-ring-progress {
  fill: none;
  stroke: #FF9A4A;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 6px rgba(255, 138, 61, .8));
  transition: stroke-dashoffset 1s linear;
}

.ad-ring b {
  font-size: 44px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  color: #FFD9B4;
  text-shadow: 0 0 24px rgba(255, 150, 80, .5);
}

.ad-hint {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 12px;
  letter-spacing: .1em;
  color: #8E8273;
}

/* ---------------- victory ---------------- */

.win-card {
  position: relative;
  width: 100%;
  max-width: 376px;
  max-height: calc(100dvh - 34px - var(--safe-bottom));
  overflow: hidden;
  padding: 26px 22px 18px;
  border-radius: 28px;
  border: 1px solid rgba(255, 186, 128, .26);
  background:
    radial-gradient(120% 72% at 50% -6%, rgba(255, 154, 74, .21), transparent 58%),
    linear-gradient(180deg, rgba(25, 32, 42, .995), rgba(8, 11, 17, 1));
  box-shadow:
    0 30px 80px rgba(0, 0, 0, .72),
    inset 0 1px 0 rgba(255, 255, 255, .1);
  text-align: center;
  overflow: hidden;
  animation: winIn .5s cubic-bezier(.18, .9, .26, 1);
}

.win-rays {
  position: absolute;
  left: 50%;
  top: -46%;
  width: 190%;
  height: 120%;
  transform: translateX(-50%);
  background: conic-gradient(from 0deg, transparent 0 12deg, rgba(255, 180, 110, .13) 12deg 14deg, transparent 14deg 30deg);
  opacity: .55;
  animation: spinCentered 30s linear infinite;
  pointer-events: none;
}

.win-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 28px;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, .55);
  pointer-events: none;
}

.win-gem {
  position: relative;
  z-index: 1;
  width: 74px;
  height: 96px;
  margin: 0 auto 6px;
  filter: drop-shadow(0 0 22px rgba(255, 164, 88, .55));
  animation: winFloat 4.5s ease-in-out infinite;
}

.win-card .eyebrow,
.win-card h2,
.win-sub,
.win-stats,
.win-tag,
.win-card .primary-btn,
.win-card .ghost-btn {
  position: relative;
  z-index: 1;
}

.win-card h2 {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: .14em;
  text-indent: .14em;
  color: #FBEBDA;
  text-shadow: 0 0 30px rgba(255, 150, 80, .32);
}

.win-sub {
  margin: 6px 0 0;
  font-size: 12.5px;
  letter-spacing: .12em;
  color: #9B8C7B;
}

.win-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 18px auto 0;
  padding: 12px 16px;
  max-width: 250px;
  border-radius: 16px;
  border: 1px solid rgba(255, 178, 116, .12);
  background: rgba(255, 255, 255, .028);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 62px;
}

.stat-label {
  font-size: 10px;
  letter-spacing: .18em;
  color: #7E7264;
}

.stat b {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .05em;
  color: #EBDAC6;
  font-variant-numeric: tabular-nums;
}

.stat-line {
  width: 1px;
  height: 26px;
  background: linear-gradient(180deg, transparent, rgba(255, 190, 130, .24), transparent);
}

.win-tag {
  display: inline-block;
  margin: 10px 0 0;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 196, 144, .28);
  background: rgba(255, 150, 80, .09);
  color: #F1C08E;
  font-size: 10.5px;
  letter-spacing: .1em;
}

.win-card .primary-btn {
  margin-top: 18px;
}

.win-card .ghost-btn {
  margin-top: 4px;
}

/* ---------------- animations ---------------- */

@keyframes sceneBreathe {
  from { transform: scale(1.02) translateY(0); }
  to { transform: scale(1.055) translateY(-1.2%); }
}

@keyframes dustDrift {
  0% { transform: translate3d(0, 18px, 0); opacity: 0; }
  16% { opacity: .5; }
  72% { opacity: .3; }
  100% { transform: translate3d(18px, -110px, 0); opacity: 0; }
}

@keyframes glowPulse {
  0%, 100% { opacity: .62; }
  50% { opacity: 1; }
}

@keyframes warmPulse {
  0%, 100% { opacity: .62; transform: translate(-50%, -50%) scale(.96); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

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

@keyframes spinCentered {
  from { transform: translateX(-50%) rotate(0deg); }
  to { transform: translateX(-50%) rotate(360deg); }
}

@keyframes corePulse {
  0%, 100% { opacity: .7; transform: scale(.98); }
  50% { opacity: 1; transform: scale(1.04); }
}

@keyframes altarIn {
  to { opacity: 1; transform: scale(1); }
}

@keyframes socketIn {
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes socketPop {
  0% { transform: translate(-50%, -50%) scale(1); }
  35% { transform: translate(-50%, -50%) scale(1.12); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes socketShake {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  20% { transform: translate(calc(-50% - 5px), -50%) scale(1); }
  40% { transform: translate(calc(-50% + 5px), -50%) scale(1); }
  60% { transform: translate(calc(-50% - 3px), -50%) scale(1); }
  80% { transform: translate(calc(-50% + 3px), -50%) scale(1); }
}

@keyframes crystalFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes crystalHint {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-7px) scale(1.07); }
}

@keyframes ghostIn {
  from { transform: translate(-50%, -50%) scale(.85); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1.12); opacity: 1; }
}

@keyframes linkFlow {
  to { stroke-dashoffset: -24; }
}

@keyframes sparkFly {
  0% { transform: translate(0, 0) scale(1.15); opacity: 1; }
  100% { transform: translate(var(--dx, 0), var(--dy, -30px)) scale(.15); opacity: 0; }
}

@keyframes beamFlow {
  to { stroke-dashoffset: -18; }
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sheetUp {
  from { transform: translateY(36px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes winIn {
  from { transform: translateY(20px) scale(.94); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes winFloat {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-6px) rotate(1deg); }
}

@keyframes adSweep {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to { transform: translate3d(2%, 1%, 0) scale(1.08); }
}

/* ---------------- responsive ---------------- */

@media (max-width: 372px) {
  .game {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hint-label {
    display: none;
  }

  .hint-btn {
    min-width: 64px;
    padding: 0 7px 0 10px;
  }

  .level-pill {
    padding: 0 11px 0 10px;
    gap: 7px;
  }

  .level-name {
    font-size: 12px;
    letter-spacing: .08em;
  }

  .tray {
    padding-left: 10px;
    padding-right: 10px;
    border-radius: 20px;
  }

  .sheet {
    padding-left: 17px;
    padding-right: 17px;
  }
}

@media (max-width: 330px) {
  .socket {
    width: 52px;
    height: 52px;
  }

  .tray-stones {
    gap: 2px;
  }

  .crystal {
    width: 36px;
    height: 48px;
  }

  .hint-btn {
    min-width: 58px;
    padding: 0 6px 0 8px;
  }

  .ad-btn {
    width: 46px;
  }

  .level-name {
    font-size: 11.5px;
  }
}

@media (max-height: 700px) {
  .game {
    padding-top: calc(6px + var(--safe-top));
    padding-bottom: calc(6px + var(--safe-bottom));
  }

  .tray {
    padding-top: 8px;
    padding-bottom: 6px;
  }

  .tray-stones {
    min-height: 54px;
    padding-top: 0;
    padding-bottom: 1px;
  }

  .tray-head {
    padding-bottom: 3px;
  }

  .tray-foot {
    padding-top: 1px;
  }

  .toast {
    bottom: calc(164px + var(--safe-bottom));
  }

  .win-card {
    padding-top: 20px;
  }

  .win-gem {
    width: 62px;
    height: 80px;
    margin-bottom: 2px;
  }

  .win-stats {
    margin-top: 12px;
  }

  .win-card .primary-btn {
    margin-top: 12px;
  }
}

@media (max-height: 560px) {
  .win-card {
    padding: 15px 20px 11px;
  }

  .win-card .eyebrow {
    font-size: 9.5px;
  }

  .win-gem {
    width: 52px;
    height: 68px;
    margin-bottom: 0;
  }

  .win-card h2 {
    margin-top: 3px;
    font-size: 22px;
  }

  .win-sub {
    margin-top: 3px;
    font-size: 11.5px;
  }

  .win-stats {
    margin-top: 8px;
    padding: 8px 14px;
  }

  .stat b {
    font-size: 14px;
  }

  .win-tag {
    margin-top: 6px;
    padding: 3px 9px;
    font-size: 9.5px;
  }

  .win-card .primary-btn {
    min-height: 46px;
    margin-top: 9px;
  }

  .win-card .ghost-btn {
    min-height: 38px;
    margin-top: 1px;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .game {
    max-width: 760px;
    padding-top: calc(4px + var(--safe-top));
  }

  .hud {
    min-height: 38px;
  }

  .level-pill,
  .hint-btn,
  .ad-btn {
    height: 38px;
  }

  .stage {
    padding: 0;
  }

  .altar {
    width: min(58vh, 300px);
    height: min(58vh, 300px);
  }

  .tray {
    padding: 7px 14px 5px;
  }

  .tray-tip {
    display: none;
  }

  .tray-stones {
    min-height: 46px;
  }

  .crystal {
    width: 34px;
    height: 46px;
  }

  .tray-head {
    position: absolute;
    right: 10px;
    top: 6px;
    padding: 0;
  }

  .tray-foot {
    position: absolute;
    left: 12px;
    bottom: 8px;
  }
}

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

  .scene-img,
  .scene-glow,
  .altar-halo,
  .altar-ring,
  .ring-spin-slow,
  .ring-spin-rev,
  .win-rays {
    animation: none !important;
  }
}
