@font-face {
  font-family: 'MM Erinn';
  src: url('https://lwi.nexon.com/m_mabinogim/brand/snack/fortune/font/MM_inn.ttf') format('truetype');
  font-display: block;
}

:root {
  --bg: #120c08;
  --bg-2: #1d130b;
  --ink: #fdeee2;
  --ink-dim: #b39a86;
  --line: rgba(255, 255, 255, 0.12);
  --gold: #ffd88a;
  --accent: #ff7a2e;
  --accent-rgb: 255, 122, 46;
  --accent-hi: #ffb066;
  --luck: var(--accent);

  --paper: #f3e6c8;
  --paper-2: #e6d2a6;
  --paper-ink: #3b2a1a;
  --note: 'Gowun Batang', 'AppleMyungjo', 'Batang', serif;
  --note-w: 700;
  --display: 'Black Han Sans', 'Pretendard', 'Apple SD Gothic Neo', sans-serif;
  --display-w: 400;

  --radius: 16px;
  --maxw: 720px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  background: var(--bg);
  color: var(--ink);
  font-family:
    'Pretendard',
    'Apple SD Gothic Neo',
    'Malgun Gothic',
    system-ui,
    -apple-system,
    sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  word-break: keep-all;
  -webkit-tap-highlight-color: transparent;
}
h1,
p {
  margin: 0;
}
button {
  font-family: inherit;
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}
[hidden] {
  display: none !important;
}

.bg-stars,
.bg-fog {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.bg-stars {
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255, 255, 255, 0.7), transparent), radial-gradient(1.5px 1.5px at 70% 60%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1px 1px at 40% 80%, rgba(255, 255, 255, 0.6), transparent), radial-gradient(1px 1px at 85% 20%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 55% 15%, rgba(255, 255, 255, 0.45), transparent), radial-gradient(1px 1px at 10% 65%, rgba(255, 255, 255, 0.5), transparent);
  animation: starDrift 60s linear infinite;
  opacity: 0.7;
}
.bg-fog {
  background:
    radial-gradient(60% 45% at 25% 20%, rgba(var(--accent-rgb), 0.16), transparent 70%), radial-gradient(55% 45% at 80% 75%, color-mix(in srgb, var(--luck) 14%, transparent), transparent 70%),
    radial-gradient(50% 40% at 50% 100%, rgba(255, 180, 90, 0.1), transparent 70%), radial-gradient(70% 50% at 85% 10%, rgba(140, 80, 220, 0.16), transparent 70%);
  animation: fogShift 24s ease-in-out infinite alternate;
}
.bg-hw {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.bg-hw i {
  position: absolute;
  display: block;
  background: center / contain no-repeat;
}
.bg-hw .moon {
  top: -60px;
  right: -40px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 42%, #fff2c9 0 34%, rgba(255, 214, 140, 0.35) 36%, rgba(180, 120, 255, 0.1) 55%, transparent 70%);
  opacity: 0.55;
}
.bg-hw {
  --web: clamp(110px, 26vw, 230px);
}
.bg-hw .web {
  top: 0;
  width: var(--web);
  aspect-ratio: 1;
  background-image: url('https://lwi.nexon.com/m_mabinogim/brand/snack/fortune/deco/web.svg');
  opacity: 0.28;
}
.bg-hw .spider {
  top: 0;
  right: calc(var(--web) * 0.78 - 14px);
  width: 28px;
  aspect-ratio: 60 / 140;
  background-image: url('https://lwi.nexon.com/m_mabinogim/brand/snack/fortune/deco/spider.svg');
  transform-origin: 50% 0;
  animation: spiderBob 5s ease-in-out infinite alternate;
}
@keyframes spiderBob {
  from {
    translate: 0 -6px;
    rotate: -3deg;
  }
  to {
    translate: 0 10px;
    rotate: 3deg;
  }
}
.bg-hw .web.l {
  left: 0;
}
.bg-hw .web.r {
  right: 0;
  transform: scaleX(-1);
}
.bg-hw .pk {
  bottom: -4px;
  width: clamp(120px, min(34vw, 40vh), 340px);
  aspect-ratio: 26 / 15;
  background-image: url('https://lwi.nexon.com/m_mabinogim/brand/snack/fortune/deco/pumpkins.svg');
  opacity: 0.85;
}
.bg-hw .pk.l {
  left: -10px;
  transform: scaleX(-1);
}
.bg-hw .pk.r {
  right: -10px;
}
.bg-hw .bat {
  left: 0;
  width: 46px;
  aspect-ratio: 5 / 2;
  background-image: url('https://lwi.nexon.com/m_mabinogim/brand/snack/fortune/deco/bat.svg');
  opacity: 0.7;
  animation:
    batFly 26s linear infinite,
    batFlap 0.5s ease-in-out infinite alternate;
}
.bg-hw .b1 {
  top: 12%;
  animation-delay: 0s, 0s;
}
.bg-hw .b2 {
  top: 26%;
  width: 30px;
  animation-duration: 34s, 0.4s;
  animation-delay: -12s, 0s;
}
.bg-hw .b3 {
  top: 8%;
  width: 24px;
  animation-duration: 40s, 0.45s;
  animation-delay: -25s, 0s;
  opacity: 0.5;
}
@keyframes batFly {
  from {
    transform: translateX(-60px);
    translate: 0 0;
  }
  50% {
    translate: 0 40px;
  }
  to {
    transform: translateX(calc(100vw + 60px));
    translate: 0 0;
  }
}
@keyframes batFlap {
  from {
    scale: 1 1;
  }
  to {
    scale: 1 0.55;
  }
}
@keyframes starDrift {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-40px);
  }
}
@keyframes fogShift {
  from {
    transform: translate(-2%, 0) scale(1);
  }
  to {
    transform: translate(2%, -2%) scale(1.08);
  }
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#app {
  position: relative;
  z-index: 1;
  overflow-x: clip;
}
.screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
}
.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px max(20px, env(safe-area-inset-right, 0px)) 32px max(20px, env(safe-area-inset-left, 0px));
}

.btn {
  display: inline-block;
  border: 0;
  border-radius: 999px;
  padding: 14px 26px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  transition:
    transform 0.15s var(--ease),
    box-shadow 0.2s,
    background 0.2s;
}
.btn:active {
  transform: scale(0.96);
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hi));
  color: #1a0f07;
  box-shadow:
    0 0 24px rgba(var(--accent-rgb), 0.5),
    0 8px 24px rgba(0, 0, 0, 0.4);
}
.btn-primary:hover {
  box-shadow: 0 0 40px rgba(var(--accent-rgb), 0.7);
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}
.btn-link {
  background: transparent;
  color: var(--ink-dim);
  font-weight: 600;
  padding: 10px;
}
.btn-link:hover {
  color: var(--ink);
}
.btn-lg {
  padding: 18px 40px;
  font-size: 18px;
}

.ph {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10px;
  border: 1.5px dashed rgba(255, 216, 138, 0.45);
  border-radius: 14px;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0 10px, rgba(255, 255, 255, 0.06) 10px 20px);
  color: var(--gold);
  font-weight: 800;
  font-size: 15px;
  line-height: 1.35;
}

.intro-inner {
  width: 100%;
  max-width: var(--maxw);
  text-align: center;
  animation: fadeUp 0.8s var(--ease) both;
}
.oracle-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
}
.intro-home {
  display: inline-block;
  vertical-align: top;
}
.intro-logo {
  display: block;
  width: 150px;
  height: auto;
  margin: 0 auto 14px;
  opacity: 0.92;
}
.intro-title {
  font-family: var(--display);
  font-weight: var(--display-w);
  font-size: clamp(44px, 13vw, 68px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--gold);
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.45);
}
.intro-sub {
  margin: 16px auto 0;
  max-width: 28em;
  color: #e6d3bf;
  font-family: var(--note);
  font-weight: var(--note-w);
  font-size: 17px;
  line-height: 1.7;
  text-wrap: balance;
}
.oracle.intro-oracle {
  margin-top: clamp(22px, 3.6vh, 40px);
  margin-bottom: 22px;
}
#screen-intro.active {
  padding-top: 20px;
  padding-bottom: 20px;
}

.crack-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: var(--maxw);
}
.crack-line {
  min-height: 1.6em;
}
.fortune-btn {
  position: relative;
  width: min(78vw, 340px);
  aspect-ratio: 13 / 10;
  padding: 0;
  border: 0;
  background: none;
  touch-action: manipulation;
  filter: drop-shadow(0 0 30px rgba(var(--accent-rgb), 0.35));
  animation: float 3.2s ease-in-out infinite;
}
.fortune-btn svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.ck-shadow {
  fill: rgba(0, 0, 0, 0.45);
}
.ck-crease {
  fill: none;
  stroke: rgba(110, 58, 16, 0.55);
  stroke-width: 3;
  stroke-linecap: round;
  transition: opacity 0.2s;
}
.fortune-btn.broken .ck-crease {
  opacity: 0;
}
.ck-hi {
  fill: none;
  stroke: rgba(255, 250, 230, 0.55);
  stroke-width: 4;
  stroke-linecap: round;
}
.ck-slip {
  fill: var(--paper);
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}
.half {
  transform-box: fill-box;
  transition:
    transform 0.7s var(--ease),
    opacity 0.7s;
}
.half-l {
  transform-origin: 100% 80%;
}
.half-r {
  transform-origin: 0% 80%;
}
.crack {
  fill: none;
  stroke: #4a2508;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 120;
  stroke-dashoffset: 120;
  transition: stroke-dashoffset 0.35s var(--ease);
}
.fortune-btn.hit .crack.c1,
.fortune-btn.hit2 .crack.c1,
.fortune-btn.hit2 .crack.c2 {
  stroke-dashoffset: 0;
}
.fortune-btn.shake svg {
  animation: shake 0.32s;
}
.fortune-btn.broken {
  animation: none;
}
.fortune-btn.broken .crack {
  opacity: 0;
  transition: opacity 0.2s;
}
.fortune-btn.broken .half-l {
  transform: translate(-22%, 6%) rotate(-24deg);
}
.fortune-btn.broken .half-r {
  transform: translate(22%, 6%) rotate(24deg);
}
.fortune-btn.broken .ck-slip {
  animation: slipOut 0.9s var(--ease) 0.15s forwards;
}
@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-10px) rotate(2deg);
  }
}
@keyframes shake {
  0%,
  100% {
    transform: translate(0, 0) rotate(0);
  }
  25% {
    transform: translate(-6px, 2px) rotate(-4deg);
  }
  60% {
    transform: translate(6px, -2px) rotate(3deg);
  }
}
@keyframes slipOut {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 1;
    transform: translateY(-120%) scale(2.6, 2.2);
  }
}

.tap-dots {
  display: flex;
  gap: 10px;
}
.tap-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  transition:
    background 0.25s,
    box-shadow 0.25s;
}
.tap-dots i.on {
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.crumb {
  position: fixed;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: #c98a3a;
  pointer-events: none;
  z-index: 5;
  animation: crumb 0.8s var(--ease) forwards;
}
@keyframes crumb {
  to {
    transform: translate(var(--tx), var(--ty)) rotate(var(--r));
    opacity: 0;
  }
}

#screen-result.active {
  align-items: flex-start;
  padding-top: 40px;
  padding-bottom: 80px;
}
.result {
  width: 100%;
  max-width: var(--maxw);
}

.oracle {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  margin: 0 auto 18px;
  text-align: left;
  animation: fadeUp 0.6s var(--ease) both;
}
@media (max-width: 600px) {
  .oracle {
    width: calc(100% + 40px);
    max-width: none;
    margin-inline: -20px;
  }
  .oracle .oracle-art {
    border-radius: 0;
    border-inline: 0;
  }
}
.oracle-art {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(var(--accent-rgb), 0.45);
  background: #0d0906;
  box-shadow:
    0 0 30px rgba(var(--accent-rgb), 0.22),
    0 14px 30px rgba(0, 0, 0, 0.45);
}
.oracle-art .ph {
  width: 100%;
  height: 100%;
  border-radius: 0;
  border: 0;
  font-size: 18px;
}
.oracle-bubble {
  position: relative;
  z-index: 1;
  margin: -40px 10px 0;
  padding: 10px 14px 12px;
  border-radius: 12px;
  min-height: 95px;
  background: rgba(14, 9, 6, 0.82);
  border: 1px solid rgba(var(--accent-rgb), 0.4);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.oracle-name {
  display: block;
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 2px;
}
.oracle-line {
  font-family: var(--note);
  font-weight: var(--note-w);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
}

.slip {
  position: relative;
  overflow: hidden;
  padding: 34px 28px 26px;
  border-radius: 6px;
  background: radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, 0.45), transparent 60%), linear-gradient(180deg, var(--paper), var(--paper-2));
  color: var(--paper-ink);
  box-shadow:
    0 0 60px color-mix(in srgb, var(--luck) 28%, transparent),
    0 24px 50px rgba(0, 0, 0, 0.55);
  transform-origin: top center;
}
.slip::before,
.slip::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.12), transparent);
}
.slip::before {
  top: 0;
  border-radius: 6px 6px 0 0;
}
.slip::after {
  bottom: 0;
  transform: scaleY(-1);
  border-radius: 0 0 6px 6px;
}
.slip.unroll {
  animation: unroll 0.8s var(--ease) both;
}
@keyframes unroll {
  from {
    opacity: 0;
    transform: scaleY(0.08);
  }
  60% {
    opacity: 1;
  }
  to {
    transform: scaleY(1);
  }
}
.slip.special {
  background: radial-gradient(120% 80% at 50% 0%, rgba(255, 240, 190, 0.7), transparent 60%), linear-gradient(180deg, #f9eac0, #e8c97c);
  box-shadow:
    0 0 0 2px #d9a520,
    0 0 70px rgba(255, 200, 80, 0.55),
    0 24px 50px rgba(0, 0, 0, 0.55);
}
.slip.special::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  height: 2px;
  animation: shine 2.6s linear infinite;
}
@keyframes shine {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}
.slip-badge {
  text-align: center;
  margin: -8px 0 12px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.3em;
  color: #a8740a;
}
.slip-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: -6px 0 22px;
  color: #6b4524;
}
.score-k {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.24em;
}
.slip-score b {
  font-family: var(--display);
  font-weight: var(--display-w);
  font-size: clamp(62px, 18vw, 80px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #b06a08;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.55);
}
.slip.special .slip-score b {
  color: #c98a00;
}
.stars {
  position: relative;
  color: rgba(90, 55, 25, 0.2);
  letter-spacing: 4px;
  font-size: 22px;
  line-height: 1.2;
}
.stars i {
  position: absolute;
  inset: 0 auto 0 0;
  overflow: hidden;
  white-space: nowrap;
  color: #e0a000;
  font-style: normal;
  text-shadow: 0 0 8px rgba(224, 160, 0, 0.55);
}

.slip-eyebrow {
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.32em;
  font-weight: 800;
  color: #8a5a2b;
  margin-bottom: 18px;
}
.slip-text {
  font-family: var(--note);
  font-weight: var(--note-w);
  font-size: clamp(19px, 5.2vw, 23px);
  line-height: 1.7;
  min-height: 9em;
}
.slip-text p {
  margin: 0 0 6px;
}
.slip-text p:first-child {
  font-size: 1.22em;
  line-height: 1.55;
  margin-bottom: 14px;
  color: #2a1c0f;
}
.erinn {
  font-family: 'MM Erinn', var(--note);
  font-size: 1.05em;
  line-height: 1.55;
  color: #3e2610;
  word-break: normal;
  margin-bottom: 10px !important;
}
.slip-text p.erinn:first-child {
  font-size: 1.15em;
  color: #2e1b09;
}
.slip-text.has-hint p:first-child {
  font-size: 0.92em;
  line-height: 1.6;
  color: #7a5532;
  margin-bottom: 10px;
}
.slip-text.has-hint p:nth-child(2) {
  font-size: 1.22em;
  line-height: 1.55;
  margin-bottom: 14px;
  color: #2a1c0f;
}
.slip-text.has-hint p.erinn:nth-child(2) {
  font-size: 1.15em;
}
.es {
  display: inline-block;
  white-space: nowrap;
  animation: inscribe 0.5s var(--ease) both;
}
.erinn.still .es {
  animation: none;
}
.slip-text .ew,
.owner-erinn .ew {
  display: inline-block;
  max-width: 100%;
}
.es.raw.plain {
  font-family: var(--note);
  font-weight: var(--note-w);
}
@keyframes inscribe {
  from {
    opacity: 0;
    filter: blur(3px);
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    filter: none;
    transform: none;
  }
}

.slip-foot {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}
.slip-translate {
  border: 1px solid rgba(90, 55, 25, 0.45);
  background: rgba(255, 250, 235, 0.55);
  color: #5a3416;
  border-radius: 999px;
  padding: 9px 22px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 0 rgba(90, 55, 25, 0.18);
  animation: fadeUp 0.5s var(--ease) both;
}
.slip-translate:hover {
  background: rgba(255, 250, 235, 0.85);
}
.slip-translate:disabled {
  opacity: 0.5;
  cursor: default;
}

.slip-sign {
  margin-top: 14px;
  text-align: right;
  font-family: var(--note);
  font-weight: var(--note-w);
  color: #7a5532;
  font-size: 16px;
}

.parts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}
.parts.reveal {
  animation: fadeUp 0.6s var(--ease) both;
}
.part {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(30, 20, 13, 0.92);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.part-target {
  grid-column: 1 / -1;
  padding: 0;
  gap: 0;
  overflow: hidden;
}
.part-art {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: rgba(0, 0, 0, 0.25);
}
.part-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.part-art:not(.is-place) {
  aspect-ratio: 4 / 3;
  background: radial-gradient(70% 90% at 50% 20%, rgba(var(--accent-rgb), 0.22), rgba(0, 0, 0, 0.25));
}
.part-art:not(.is-place) img {
  object-fit: cover;
  object-position: center 4%;
}
.part-art .ph {
  width: 100%;
  height: 100%;
  border-radius: 0;
  border-width: 0 0 1.5px;
  font-size: 22px;
}
.part-body {
  padding: 14px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.part-say {
  margin-top: 6px;
  font-family: var(--note);
  font-weight: var(--note-w);
  font-size: 16px;
  line-height: 1.6;
  color: var(--gold);
}
.part.timeup #part-time {
  color: var(--ink-dim);
}
.part-head {
  display: flex;
  align-items: center;
  gap: 16px;
}
.part-head-t {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.part-face {
  position: relative;
  flex: none;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(var(--accent-rgb), 0.55);
  background: radial-gradient(circle at 50% 35%, #4a2e1c, #1d130b);
  box-shadow: 0 0 22px rgba(var(--accent-rgb), 0.3);
}
.part-face img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.part-face .ph {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 50%;
  font-size: 11px;
}
.part-target:has(.part-face:not([hidden])) .part-v {
  font-size: 24px;
}
.part-k {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
  font-weight: 700;
}
.part-v {
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
#part-time {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  font-variant-numeric: tabular-nums;
}
.part-v .time-left {
  display: block;
  margin-top: 2px;
  color: var(--ink-dim);
  font-size: 12px;
  font-weight: 600;
}
.part-v small {
  color: var(--ink-dim);
  font-weight: 600;
  font-size: 13px;
}
.swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--luck);
  flex: none;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.25),
    0 0 14px var(--luck);
}

.actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 30px;
}
.actions.reveal {
  animation: fadeUp 0.6s var(--ease) 0.1s both;
}
.actions > .btn-primary {
  width: 100%;
  max-width: 340px;
}
.sns-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 340px;
}
.btn-sns {
  padding: 12px 8px;
  font-size: 14px;
}

.bgm-btn {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: calc(14px + env(safe-area-inset-right, 0px));
  z-index: 40;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(18, 12, 8, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
}
.bgm-ico {
  display: block;
  width: 52%;
  height: 52%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bgm-head {
  fill: currentColor;
}
.bgm-mute {
  display: none;
}
.bgm-btn.off .bgm-mute {
  display: block;
}
.bgm-btn.playing {
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.45);
  animation: bgmPulse 2.4s ease-in-out infinite;
}
.bgm-btn.off {
  color: var(--ink-dim);
  opacity: 0.7;
}
body:has(#screen-result.active) .bgm-btn {
  width: 34px;
  height: 34px;
  opacity: 0.5;
  transition: opacity 0.2s;
}
body:has(#screen-result.active) .bgm-btn:hover,
body:has(#screen-result.active) .bgm-btn:focus-visible {
  opacity: 1;
}
@keyframes bgmPulse {
  50% {
    box-shadow: 0 0 26px rgba(var(--accent-rgb), 0.7);
  }
}

.part-song {
  grid-column: 1 / -1;
  gap: 6px;
  border-color: rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.07);
}
.song-title {
  color: var(--gold);
}
.song-desc {
  color: var(--ink-dim);
  font-size: 13px;
}
.song-tabs {
  display: flex;
  gap: 6px;
  margin: 2px 0 4px;
}
.song-tab {
  flex: 1;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}
.song-tab.on {
  color: #1a0f07;
  background: linear-gradient(135deg, var(--accent), var(--accent-hi));
  border-color: transparent;
}
.song-btns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 4px;
}
.song-btns .btn {
  padding: 10px 6px;
  font-size: 13px;
}
.song-play {
  margin-top: 2px;
  padding: 10px;
  font-size: 14px;
}
.song-play.on {
  border-color: var(--accent);
  color: var(--accent);
}

.slip-owner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: -6px 0 14px;
  color: #5a3416;
}
.owner-erinn {
  font-family: 'MM Erinn', var(--note);
  font-size: 24px;
  color: #3e2610;
}
.owner-ko {
  font-family: var(--note);
  font-weight: var(--note-w);
  font-size: 17px;
}
.score-top {
  margin-top: 4px;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(224, 160, 0, 0.16);
  color: #8a5a10;
  font-size: 13px;
  font-weight: 800;
}
.seal {
  position: absolute;
  right: 56px;
  bottom: 18px;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  border: 4px double #c0262d;
  color: #c0262d;
  background: rgba(255, 240, 230, 0.25);
  transform: rotate(-14deg);
  mix-blend-mode: multiply;
  pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(192, 38, 45, 0.25);
}
.slip:has(#seal:not([hidden])) {
  padding-bottom: 138px;
}
.seal-erinn {
  font-family: 'MM Erinn', var(--note);
  font-size: 30px;
  line-height: 1;
  white-space: nowrap;
}
.seal small {
  font-size: 10px;
  font-weight: 800;
  margin-top: 6px;
}
.seal.stamp {
  animation: stamp 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
@keyframes stamp {
  from {
    opacity: 0;
    transform: rotate(-14deg) scale(2.4);
  }
  to {
    opacity: 1;
    transform: rotate(-14deg) scale(1);
  }
}
.btn-done {
  width: 100%;
  max-width: 340px;
  background: linear-gradient(135deg, #c0262d, #e5484d);
  color: #fff;
  box-shadow:
    0 0 24px rgba(229, 72, 77, 0.45),
    0 8px 24px rgba(0, 0, 0, 0.4);
}
.name-opt {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.name-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-dim);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.name-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.name-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-size: 16px;
  font-family: inherit;
}
.name-input:focus {
  outline: none;
  border-color: var(--accent);
}
.name-input.bad {
  border-color: #e5484d;
}
.gift-box {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.btn-gift {
  width: 100%;
}
.btn-again {
  width: 100%;
  max-width: 340px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  padding: 14px 26px;
  color: var(--accent-hi);
  background: rgba(var(--accent-rgb), 0.08);
  border: 1.5px solid rgba(var(--accent-rgb), 0.55);
}
.btn-again:hover {
  background: rgba(var(--accent-rgb), 0.16);
  box-shadow: 0 0 22px rgba(var(--accent-rgb), 0.35);
}
.btn-again .ico {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.4s var(--ease);
}
.btn-again:hover .ico {
  transform: rotate(-90deg);
}
.gift-desc {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-dim);
  text-align: center;
  padding: 0 4px;
}
.intro-gift {
  margin: 14px auto 0;
  max-width: 26em;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: rgba(var(--accent-rgb), 0.12);
  border: 1px solid rgba(var(--accent-rgb), 0.35);
}
.ugc {
  margin-top: 6px;
  color: var(--ink-dim);
  font-size: 13px;
  text-align: center;
}
.ugc b {
  color: var(--gold);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(34px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px);
  z-index: 60;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  color: #1a0f07;
  background: linear-gradient(135deg, var(--accent), var(--accent-hi));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.35s var(--ease),
    transform 0.35s var(--ease);
  max-width: 86vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 720px) {
  .slip {
    padding: 44px 44px 30px;
  }
}

@media (min-width: 601px) {
  .oracle {
    max-width: min(560px, max(300px, calc(100dvh - 530px)));
  }
}
@media (min-width: 640px) and (orientation: landscape) {
  .intro-inner,
  .crack-stage,
  .result {
    --gap: clamp(24px, 4vw, 56px);
    --row: min(100vw - 40px, 1080px);
    --side: min(500px, calc(100dvh - 150px), calc((var(--row) - var(--gap)) * 0.52), calc(var(--row) - 320px - var(--gap)));
    display: grid;
    max-width: 1080px;
    column-gap: var(--gap);
    align-items: center;
    grid-template-columns: var(--side) minmax(0, 1fr);
  }
  .intro-inner {
    grid-template-rows: 1fr auto auto auto auto auto 1fr;
    grid-template-areas: 'art .' 'art logo' 'art title' 'art sub' 'art gift' 'art btn' 'art .';
  }
  .oracle.intro-oracle,
  .crack-stage > .oracle {
    grid-area: art;
    width: 100%;
    max-width: none;
    margin: 0;
  }
  .intro-logo {
    grid-area: logo;
  }
  .intro-title {
    grid-area: title;
    font-size: clamp(36px, 5.2vw, 68px);
  }
  .intro-sub {
    grid-area: sub;
    margin-top: 18px;
  }
  .intro-gift {
    grid-area: gift;
  }
  #start-btn {
    grid-area: btn;
    justify-self: center;
    margin-top: 28px;
  }
  .crack-stage {
    justify-items: center;
    grid-template-rows: 1fr auto auto 1fr;
    grid-template-areas: 'art .' 'art cookie' 'art dots' 'art .';
  }
  .fortune-btn {
    grid-area: cookie;
    width: min(100%, 340px);
  }
  .tap-dots {
    grid-area: dots;
  }
  .result {
    align-items: start;
  }
  .result > .oracle {
    grid-column: 1;
    grid-row: 1 / span 3;
    position: sticky;
    top: calc((100dvh - var(--side) - var(--bub-out, 55px)) / 2);
    width: 100%;
    max-width: none;
    margin: 0;
  }
  .result > .slip,
  .result > .parts,
  .result > .actions {
    grid-column: 2;
  }
  .result .slip-text {
    font-size: clamp(18px, 2.4vw, 23px);
  }
}
@media (orientation: landscape) and (max-height: 520px) {
  .screen.active,
  #screen-intro.active,
  #screen-result.active {
    padding-top: 16px;
    padding-bottom: 16px;
  }
  .intro-inner,
  .crack-stage,
  .result {
    --gap: 32px;
    --side: min(calc(100dvh - 86px), calc(100vw - 40px - 320px - 32px));
  }
  .intro-logo {
    width: 110px;
    margin-bottom: 6px;
  }
  .intro-title {
    font-size: 40px;
  }
  .intro-sub {
    margin-top: 10px;
    font-size: 14px;
  }
  #start-btn {
    margin-top: 16px;
  }
  .oracle-bubble {
    padding: 7px 11px 8px;
    min-height: 81px;
  }
  .result > .oracle {
    --bub-out: 41px;
  }
  .oracle-line {
    font-size: 14px;
  }
  .fortune-btn {
    width: min(100%, 300px);
  }
}
@media (orientation: landscape) and (max-height: 360px) {
  .intro-logo {
    width: 90px;
    margin-bottom: 4px;
  }
  .intro-title {
    font-size: 30px;
    line-height: 1.1;
  }
  .intro-sub {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.55;
  }
  #start-btn {
    margin-top: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .fortune-btn {
    width: min(100%, 230px);
  }
  .tap-dots {
    margin-top: -6px;
  }
  .intro-inner,
  .crack-stage,
  .result {
    --side: min(calc(100dvh - 104px), calc(100vw - 40px - 320px - 32px));
  }
  .oracle-line {
    font-size: 13px;
    line-height: 1.5;
  }
  .result > .oracle {
    --bub-out: 56px;
  }
  .oracle-bubble {
    min-height: 96px;
  }
}
@media (max-height: 780px) and (orientation: portrait) {
  .screen.active {
    padding-top: 20px;
    padding-bottom: 20px;
  }
  .intro-logo {
    width: 120px;
    margin-bottom: 8px;
  }
  .intro-title {
    font-size: clamp(36px, 11vw, 52px);
  }
  .intro-sub {
    margin-top: 10px;
    font-size: 15px;
  }
  .oracle.intro-oracle {
    margin-top: clamp(20px, 3.4vh, 30px);
    margin-bottom: 18px;
  }
  .oracle-art {
    aspect-ratio: 5 / 4;
  }
}
@media (max-width: 600px) and (orientation: portrait) {
  .oracle-art {
    aspect-ratio: 5 / 4;
  }
}
@media (max-height: 700px) and (orientation: portrait) {
  .oracle-art {
    aspect-ratio: 16 / 10;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg-stars,
  .bg-fog,
  .fortune-btn {
    animation: none !important;
  }
  .slip.special::before {
    animation: none;
  }
  .bg-hw .bat {
    display: none;
  }
  .bg-hw .spider {
    animation: none;
  }
  .slip.unroll,
  .parts.reveal,
  .actions.reveal,
  .intro-inner,
  .es,
  .oracle {
    animation: none !important;
  }
  .crumb {
    display: none;
  }
}
