:root {
  --deep: #041d14;
  --deep-2: #083423;
  --green: #19c878;
  --green-soft: #93f0bf;
  --paper1: #effff4;
  --paper2: #c8efd7;
  --ink: #123826;
  --ink-2: #426a51;
  --panel-top: #15a66a;
  --panel-mid: #102e24;
  --panel-bottom: #e4f1e7;
  --gold: #ffdc67;
  --white: #f8fff9;
  --danger: #ff6c7d;
  --ticket-width: 860px;
  --ticket-height: 521px;
  --flap-left: 86px;
  --flap-top: 52px;
  --flap-width: 688px;
  --flap-height: 417px;
  --answer-inset: 5px;
  --mobile-stage-top: clamp(72px, 10svh, 100px);
  --mobile-lift: 0px;
  --tear-shape: polygon(
    0 0,
    10% 0,
    14% 2.1%,
    20% 0,
    26% 2.1%,
    32% 0,
    38% 2.1%,
    44% 0,
    50% 2.1%,
    56% 0,
    62% 2.1%,
    68% 0,
    74% 2.1%,
    80% 0,
    86% 2.1%,
    92% 0,
    100% 0,
    100% 100%,
    90% 100%,
    86% 97.9%,
    80% 100%,
    74% 97.9%,
    68% 100%,
    62% 97.9%,
    56% 100%,
    50% 97.9%,
    44% 100%,
    38% 97.9%,
    32% 100%,
    26% 97.9%,
    20% 100%,
    14% 97.9%,
    8% 100%,
    0 100%
  );
}

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

html,
body {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

html {
  background: var(--deep);
}

body {
  margin: 0;
  min-width: 320px;
  color: #f8fff9;
  font-family: "Noto Sans KR", sans-serif;
  background:
    radial-gradient(circle at 50% 26%, rgba(147, 240, 191, 0.24), transparent 24rem),
    radial-gradient(circle at 14% 22%, rgba(25, 200, 120, 0.26), transparent 19rem),
    radial-gradient(circle at 88% 12%, rgba(255, 255, 255, 0.12), transparent 18rem),
    linear-gradient(142deg, #03180f 0%, #083423 52%, #03160f 100%);
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at center, #000 0%, transparent 76%);
  pointer-events: none;
}

button {
  font: inherit;
}

.app {
  position: relative;
  display: grid;
  place-items: center;
  height: 100svh;
  min-height: 0;
  padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  isolation: isolate;
  overflow: hidden;
}

.logo-pattern {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.logo-pattern img {
  position: absolute;
  width: var(--logo-size);
  height: auto;
  left: var(--logo-x);
  top: var(--logo-y);
  opacity: var(--logo-opacity);
  filter: saturate(0.76) blur(0.15px);
  mix-blend-mode: screen;
  transform: translate(-50%, -50%) rotate(var(--logo-rotate));
  user-select: none;
}

.ambient {
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(2px);
  opacity: 0.9;
  z-index: -1;
}

.ambient-one {
  width: 340px;
  height: 340px;
  top: -150px;
  right: -120px;
  background: radial-gradient(circle, rgba(147, 240, 191, 0.48), transparent 68%);
  animation: float 7s ease-in-out infinite;
}

.ambient-two {
  width: 260px;
  height: 260px;
  left: -120px;
  bottom: 10%;
  background: radial-gradient(circle, rgba(25, 200, 120, 0.32), transparent 70%);
  animation: float 8s ease-in-out -2s infinite;
}

.ambient-three {
  width: 180px;
  height: 180px;
  left: 48%;
  top: 8%;
  background: radial-gradient(circle, rgba(255, 246, 188, 0.2), transparent 70%);
  animation: float 9s ease-in-out -4s infinite;
}

.brand {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  z-index: 5;
  transform: translateX(-50%);
  margin: 0;
}

.brand img {
  width: min(520px, 92vw);
  height: auto;
  display: block;
  filter:
    drop-shadow(0 0 20px rgba(47, 255, 134, 0.28))
    drop-shadow(0 18px 42px rgba(0, 0, 0, 0.28));
}

.record-menu-button {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(147, 240, 191, 0.26);
  border-radius: 999px;
  color: #ecfff1;
  background: rgba(4, 29, 20, 0.66);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 16px 38px rgba(0, 0, 0, 0.28);
  font: 900 13px/1 "Noto Sans KR", sans-serif;
  cursor: pointer;
  backdrop-filter: blur(16px);
}

.record-menu-lines {
  position: relative;
  width: 16px;
  height: 12px;
}

.record-menu-lines::before,
.record-menu-lines::after,
.record-menu-lines {
  border-top: 2px solid currentColor;
}

.record-menu-lines::before,
.record-menu-lines::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
}

.record-menu-lines::before {
  top: 3px;
}

.record-menu-lines::after {
  top: 8px;
}

.record-menu-button strong {
  display: inline-grid;
  min-width: 38px;
  min-height: 24px;
  place-items: center;
  border-radius: 999px;
  color: #07331f;
  background: var(--green-soft);
  font-size: 12px;
}

.record-drawer {
  position: absolute;
  top: max(64px, calc(env(safe-area-inset-top) + 58px));
  right: max(14px, env(safe-area-inset-right));
  z-index: 29;
  width: min(340px, calc(100vw - 28px));
  max-height: min(540px, calc(100svh - 92px));
  padding: 16px;
  overflow: auto;
  border: 1px solid rgba(147, 240, 191, 0.24);
  border-radius: 22px;
  color: #f3fff6;
  background: rgba(4, 24, 16, 0.9);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(20px);
}

.record-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.record-drawer-head div {
  display: grid;
  gap: 4px;
}

.record-drawer-head strong {
  font-size: 17px;
}

.record-drawer-head span {
  color: rgba(243, 255, 246, 0.66);
  font-size: 12px;
  font-weight: 900;
}

.record-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.record-drawer-head button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #f3fff6;
  background: rgba(255, 255, 255, 0.08);
  padding: 8px 10px;
  font: 900 12px/1 "Noto Sans KR", sans-serif;
  cursor: pointer;
}

.record-drawer-head button.record-download-button {
  border-color: rgba(147, 240, 191, 0.52);
  color: #06351f;
  background: var(--green-soft);
}

.record-drawer-head button.record-share-button {
  border-color: rgba(254, 229, 0, 0.62);
  color: #201600;
  background: linear-gradient(135deg, #fee500, #ffef75);
}

.record-drawer-head button:disabled {
  opacity: 0.62;
  cursor: progress;
}

.record-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.record-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(147, 240, 191, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
}

.record-list li.record-count-item {
  grid-template-columns: auto 1fr;
}

.record-list li.record-empty {
  display: block;
  color: rgba(243, 255, 246, 0.66);
  text-align: center;
}

.record-list li.record-day-heading {
  display: block;
  margin-top: 6px;
  color: var(--green-soft);
  background: rgba(147, 240, 191, 0.08);
  font-size: 13px;
  font-weight: 900;
}

.record-list li.record-day-heading:first-child {
  margin-top: 0;
}

.record-index {
  display: grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  color: #0b3522;
  background: rgba(147, 240, 191, 0.9);
  font-size: 12px;
  font-weight: 900;
}

.record-prize {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.record-prize strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.record-prize span {
  color: rgba(243, 255, 246, 0.62);
  font-size: 11px;
  font-weight: 900;
}

.test-badge {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid rgba(147, 240, 191, 0.26);
  border-radius: 999px;
  color: #ecfff1;
  background: rgba(4, 29, 20, 0.66);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 16px 38px rgba(0, 0, 0, 0.28);
  font: 900 13px/1 "Noto Sans KR", sans-serif;
  backdrop-filter: blur(16px);
}

.test-badge span {
  min-width: 70px;
  color: var(--green-soft);
  text-align: right;
}

.stage {
  position: relative;
  display: grid;
  align-items: center;
  justify-items: center;
  width: min(1080px, 100%);
  min-height: calc(100svh - 36px);
  padding-top: 138px;
}

.stage::before {
  content: "";
  position: absolute;
  inset: 8% 2% auto;
  height: 46%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 52%, rgba(255, 243, 166, 0.32), transparent 28%),
    radial-gradient(circle at 35% 42%, rgba(147, 240, 191, 0.28), transparent 34%),
    radial-gradient(circle at 68% 44%, rgba(255, 108, 125, 0.18), transparent 30%);
  filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.76);
  z-index: 1;
}

.stage.grand-hit::before {
  animation: grand-flash 1.3s ease-out both;
}

.stage.is-shuffling::before {
  animation: grand-flash 0.9s ease-out both;
}

#fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.ticket-shadow {
  position: absolute;
  bottom: clamp(40px, 8vw, 74px);
  width: min(820px, 90vw);
  height: min(190px, 24vw);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.34);
  filter: blur(28px);
  z-index: 0;
}

.ticket-frame {
  position: relative;
  z-index: 2;
  width: var(--ticket-width);
  height: var(--ticket-height);
  display: grid;
  place-items: center;
  filter: drop-shadow(0 28px 34px rgba(0, 0, 0, 0.26));
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overscroll-behavior: none;
  transform: translateY(var(--ticket-lift, 0px));
}

.fortune-download-cta {
  position: absolute;
  top: var(--fortune-cta-top, calc(50% + var(--ticket-height) / 2 + 28px));
  left: var(--fortune-cta-left, 50%);
  z-index: 14;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: min(380px, calc(100vw - 42px));
  min-height: 62px;
  padding: 10px 18px 10px 12px;
  border: 1px solid rgba(147, 240, 191, 0.58);
  border-radius: 999px;
  color: #f8fff9;
  background:
    linear-gradient(135deg, rgba(147, 240, 191, 0.22), rgba(25, 200, 120, 0.1)),
    rgba(4, 29, 20, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 18px 42px rgba(0, 0, 0, 0.32),
    0 0 32px rgba(25, 200, 120, 0.18);
  cursor: pointer;
  transform: translateX(-50%);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
  backdrop-filter: blur(18px);
}

.shuffle-hint {
  position: absolute;
  top: var(--shuffle-hint-top, 154px);
  left: var(--shuffle-hint-left, 50%);
  z-index: 15;
  margin: 0;
  padding: 7px 12px;
  border: 1px solid rgba(147, 240, 191, 0.28);
  border-radius: 999px;
  color: rgba(243, 255, 246, 0.84);
  background: rgba(4, 24, 16, 0.7);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
  font: 900 12px/1 "Noto Sans KR", sans-serif;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition:
    opacity 0.24s ease,
    transform 0.24s ease;
  backdrop-filter: blur(14px);
}

.shuffle-hint[hidden] {
  display: block;
}

.stage.shuffle-ready .shuffle-hint {
  opacity: 1;
  transform: translate(-50%, 0);
}

.stage.is-shuffling .shuffle-hint,
.stage.is-shuffle-hidden .shuffle-hint,
.stage.is-shuffle-loading .shuffle-hint,
.stage.is-shuffle-fading-in .shuffle-hint {
  opacity: 0;
}

.stage.shuffle-dragging .ticket {
  cursor: grabbing;
  transform:
    translate3d(var(--shuffle-drag-x, 0px), var(--shuffle-drag-y, 0px), 0)
    rotate(var(--shuffle-drag-rotate, 0deg));
  transition: none;
  will-change: transform;
}

.stage.is-shuffling .ticket {
  animation: kuji-shuffle-reset 1.72s cubic-bezier(0.18, 1, 0.3, 1) both;
  will-change: transform, filter;
}

.stage.is-shuffle-hidden .ticket {
  opacity: 0;
  filter: saturate(0.82) blur(2px);
  transform: translate3d(0, 0, 0) scale(0.96);
  transition: none;
  will-change: opacity, transform, filter;
}

.stage.is-shuffle-loading::after {
  content: "";
  position: absolute;
  top: var(--shuffle-spinner-top, 50%);
  left: var(--shuffle-spinner-left, 50%);
  z-index: 18;
  width: clamp(48px, 8vw, 72px);
  aspect-ratio: 1;
  border: 5px solid rgba(147, 240, 191, 0.18);
  border-top-color: #93f0bf;
  border-right-color: rgba(255, 243, 166, 0.82);
  border-radius: 999px;
  box-shadow:
    0 0 24px rgba(147, 240, 191, 0.28),
    inset 0 0 18px rgba(147, 240, 191, 0.12);
  transform: translate(-50%, -50%);
  animation: kuji-progress-spin 0.72s linear infinite;
  pointer-events: none;
}

.stage.is-shuffle-fading-in .ticket {
  animation: kuji-shuffle-fade-in 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: opacity, transform, filter;
}

.fortune-download-cta:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 22px 48px rgba(0, 0, 0, 0.36),
    0 0 42px rgba(147, 240, 191, 0.28);
  transform: translateX(-50%) translateY(-2px);
}

.fortune-download-cta:disabled {
  opacity: 0.68;
  cursor: progress;
  transform: translateX(-50%);
}

.fortune-download-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  color: #06351f;
  background: var(--green-soft);
  font: 900 12px/1 "Space Grotesk", sans-serif;
  letter-spacing: 0.08em;
  box-shadow: 0 0 20px rgba(147, 240, 191, 0.26);
}

.fortune-download-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
  text-align: left;
}

.fortune-download-copy strong {
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.fortune-download-copy small {
  color: rgba(243, 255, 246, 0.68);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.ticket {
  position: absolute;
  inset: 0;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  -webkit-touch-callout: none;
}

.ticket-base {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(147, 240, 191, 0.28);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.16) 18%, rgba(255, 255, 255, 0.05) 24%),
    linear-gradient(180deg, var(--paper1), var(--paper2));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    inset 0 -18px 34px rgba(25, 200, 120, 0.13);
}

.ticket.is-opening .ticket-base {
  overflow: visible;
}

.ticket-base::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px dashed rgba(71, 140, 96, 0.34);
  border-radius: 17px;
  pointer-events: none;
}

.ticket-back-face {
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0.72), transparent 38%),
    linear-gradient(180deg, #edfff4, #c8efd7);
}

.left-strip {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: grid;
  width: 10%;
  place-items: center;
  border-right: 1px solid rgba(71, 140, 96, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.04));
}

.left-strip::after {
  content: "はがす向き";
  color: #265236;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  opacity: 0.86;
  writing-mode: vertical-rl;
}

.result-panel,
.tear-guide,
.flap-front {
  clip-path: var(--tear-shape);
  -webkit-clip-path: var(--tear-shape);
}

.result-panel {
  position: absolute;
  left: calc(var(--flap-left) + var(--answer-inset));
  top: calc(var(--flap-top) + var(--answer-inset));
  z-index: 1;
  width: calc(var(--flap-width) - var(--answer-inset) - var(--answer-inset));
  height: calc(var(--flap-height) - var(--answer-inset) - var(--answer-inset));
  overflow: hidden;
  border: 1px solid rgba(246, 255, 248, 0.08);
  background: linear-gradient(180deg, var(--panel-top) 0 16%, var(--panel-mid) 16% 83%, var(--panel-bottom) 83% 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.result-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 24%, rgba(255, 255, 255, 0.2), transparent 22%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 10px);
  opacity: 0.42;
}

.result-content {
  position: absolute;
  inset: 0;
  opacity: 0.84;
  filter: blur(24px) saturate(0.74);
  transform: scale(0.965);
  transition:
    filter 0.72s ease,
    opacity 0.52s ease,
    transform 0.7s ease;
}

.ticket.is-open .result-content {
  opacity: 1;
  filter: blur(0) saturate(1);
  transform: scale(1);
  transition:
    filter 0.18s ease,
    opacity 0.18s ease,
    transform 0.18s ease;
}

.result-panel.revealed .result-content {
  opacity: 1;
  filter: blur(0) saturate(1);
  transform: scale(1);
}

.result-top,
.result-foot {
  position: absolute;
  left: 0;
  right: 0;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.result-top {
  top: 0;
  height: 16%;
  color: #f6fff8;
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
  letter-spacing: 0.12em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}

.result-body {
  position: absolute;
  inset: 16% 0 17%;
  display: grid;
  place-items: center;
  padding: 14px 18px;
  text-align: center;
}

.prize-rank {
  margin: 0;
  color: #d8e0da;
  font-family: "Black Han Sans", "Noto Sans KR", sans-serif;
  font-size: clamp(58px, 11vw, 118px);
  font-weight: 900;
  letter-spacing: -0.08em;
  line-height: 0.9;
  text-shadow: 0 18px 30px rgba(0, 0, 0, 0.34);
}

.result-panel.win .prize-rank {
  color: var(--gold);
  text-shadow:
    0 0 24px rgba(255, 220, 103, 0.38),
    0 18px 30px rgba(0, 0, 0, 0.34);
}

.result-panel.grand.revealed .prize-rank {
  color: #fff3a6;
  text-shadow:
    0 0 12px rgba(255, 255, 255, 0.96),
    0 0 34px rgba(255, 220, 103, 0.86),
    0 0 62px rgba(25, 200, 120, 0.62),
    0 18px 30px rgba(0, 0, 0, 0.34);
  animation: grand-prize-pop 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.result-panel.lose .prize-rank {
  color: #d8e0da;
  text-shadow: 0 18px 30px rgba(0, 0, 0, 0.34);
}

.result-panel.limit .prize-rank {
  max-width: 96%;
  margin-inline: auto;
  color: #e6eee8;
  font-family: "Noto Sans KR", sans-serif;
  font-size: clamp(24px, 4.1vw, 52px);
  letter-spacing: -0.08em;
  line-height: 1.06;
}

.result-panel.limit .prize-rank span {
  display: block;
  white-space: nowrap;
}

.result-panel.limit .prize-name {
  color: rgba(255, 255, 255, 0.74);
  font-size: clamp(13px, 2.2vw, 18px);
}

.prize-name {
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(18px, 3vw, 30px);
  font-weight: 900;
  line-height: 1.24;
}

.result-foot {
  bottom: 0;
  height: 17%;
  color: #173323;
  background: linear-gradient(180deg, #edf8ef, #cce0d1);
  font-size: 17px;
}

.opened-stamp {
  position: absolute;
  top: 42%;
  right: 16px;
  padding: 8px 11px;
  border: 3px solid rgba(255, 108, 125, 0.88);
  border-radius: 10px;
  color: var(--danger);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.12em;
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
  transform: rotate(-10deg) scale(0.84);
  transition:
    opacity 0.36s ease,
    transform 0.38s ease;
}

.ticket.is-open .opened-stamp {
  opacity: 1;
  transform: rotate(-10deg) scale(1);
}

.tear-guide {
  position: absolute;
  left: var(--flap-left);
  top: var(--flap-top);
  z-index: 0;
  width: var(--flap-width);
  height: var(--flap-height);
  border: 2px dashed rgba(66, 126, 86, 0.44);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.13) 18%, transparent 24%),
    linear-gradient(180deg, var(--paper1), var(--paper2));
  box-shadow:
    inset 0 0 0 var(--answer-inset) rgba(255, 255, 255, 0.12),
    inset 0 -10px 24px rgba(25, 200, 120, 0.1);
  opacity: 0.96;
  pointer-events: none;
}

.flap-front {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(82, 151, 105, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.17) 18%, transparent 22%),
    linear-gradient(180deg, var(--paper1), var(--paper2));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.76),
    inset 0 -12px 22px rgba(25, 200, 120, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

.flap-front::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(108deg, rgba(255, 255, 255, 0.16), transparent 28%, transparent 72%, rgba(255, 255, 255, 0.06));
  pointer-events: none;
}

.flap-zone {
  position: absolute;
  left: var(--flap-left);
  top: var(--flap-top);
  z-index: 4;
  width: var(--flap-width);
  height: var(--flap-height);
  perspective: 2000px;
  overflow: visible;
  touch-action: none;
  isolation: isolate;
}

.ticket.is-opening .flap-zone {
  z-index: 80;
}

.flap-turn-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: visible;
  transition: opacity 0.16s ease;
  touch-action: none;
}

.ticket.is-opening .flap-turn-layer {
  z-index: 90;
}

.ticket.is-resizing .result-panel {
  opacity: 0;
}

.ticket.is-resizing .flap-turn-layer {
  opacity: 1;
}

.ticket.is-resizing .flap-book {
  opacity: 0;
}

.ticket.is-open .flap-turn-layer {
  opacity: 0;
  pointer-events: none;
}

.drag-guard {
  position: absolute;
  inset: 0;
  z-index: 120;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.drag-guard.is-dragging {
  cursor: grabbing;
}

.ticket.is-open .drag-guard {
  pointer-events: none;
}

.flap-book {
  position: relative;
  z-index: 20;
  width: 200%;
  height: 100%;
  overflow: visible;
}

.flap-book .page-wrapper {
  overflow: visible !important;
  perspective: 2000px;
  transform-style: preserve-3d;
}

.ticket.is-opening .flap-book .page,
.ticket.is-opening .flap-book .shadow {
  transform-style: preserve-3d;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flap-page {
  width: 100%;
  height: 100%;
  overflow: hidden;
  clip-path: var(--tear-shape);
  -webkit-clip-path: var(--tear-shape);
}

.flap-back-paper {
  border: 1px solid rgba(82, 151, 105, 0.22);
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0.78), transparent 36%),
    linear-gradient(180deg, #edfff4, #c8efd7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.84),
    inset 0 -8px 18px rgba(25, 200, 120, 0.1);
}

.flap-clear {
  background: transparent;
}

@keyframes grand-flash {
  0% {
    opacity: 0;
    transform: scale(0.72);
  }
  12% {
    opacity: 0.95;
    transform: scale(1);
  }
  36% {
    opacity: 0.48;
    transform: scale(1.08);
  }
  100% {
    opacity: 0;
    transform: scale(1.2);
  }
}

@keyframes grand-prize-pop {
  0% {
    transform: scale(0.72) rotate(-4deg);
  }
  56% {
    transform: scale(1.16) rotate(1.5deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

.peel-tab {
  position: absolute;
  left: 0;
  top: 50%;
  z-index: 12;
  width: 92px;
  height: 56px;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.12));
  pointer-events: none;
  transform: translateY(-50%);
}

.peel-tab::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(85, 143, 104, 0.38);
  border-radius: 0 10px 10px 0;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.peel-tab span {
  position: absolute;
  left: 50%;
  top: 48%;
  color: #159b60;
  font-size: 34px;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  transform: translate(-50%, -50%);
}

.flap-copy {
  position: absolute;
  top: 22px;
  right: 28px;
  bottom: 24px;
  left: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #173923;
  text-align: center;
}

.flap-head {
  max-width: 430px;
  margin-bottom: 10px;
  color: #315a3d;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.5;
}

.flap-line {
  max-width: 430px;
  margin-bottom: 8px;
  color: #4e765b;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.5;
}

.product-name {
  width: 100%;
  margin: clamp(16px, 4vw, 28px) 0 10px;
  color: #163822;
  font-family: "Space Grotesk", "Noto Sans KR", sans-serif;
  font-size: clamp(26px, 4.6vw, 39px);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.jp-detail {
  max-width: 440px;
  margin: 0 0 12px;
  color: #547660;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.55;
  text-align: center;
}

.flap-barcode {
  position: relative;
  z-index: 2;
  width: min(430px, 100%);
  margin-top: auto;
  padding: 8px 8px 6px;
  border: 1px solid rgba(47, 91, 60, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 12px rgba(47, 91, 60, 0.08);
}

.barcode {
  display: block;
  width: 100%;
  height: 52px;
  border-radius: 3px;
  background-color: #fff;
  background-image: linear-gradient(
    90deg,
    #000 0 2px,
    transparent 2px 5px,
    #000 5px 6px,
    transparent 6px 10px,
    #000 10px 14px,
    transparent 14px 16px,
    #000 16px 17px,
    transparent 17px 20px,
    #000 20px 24px,
    transparent 24px 27px,
    #000 27px 28px,
    transparent 28px 31px,
    #000 31px 35px,
    transparent 35px 39px,
    #000 39px 41px,
    transparent 41px 44px,
    #000 44px 47px,
    transparent 47px 49px,
    #000 49px 52px,
    transparent 52px 56px,
    #000 56px 58px,
    transparent 58px 63px,
    #000 63px 68px,
    transparent 68px 71px,
    #000 71px 74px,
    transparent 74px 79px,
    #000 79px 83px,
    transparent 83px 88px,
    #000 88px 89px,
    transparent 89px 94px,
    #000 94px 100px,
    transparent 100px 104px,
    #000 104px 106px,
    transparent 106px 110px,
    #000 110px 112px,
    transparent 112px 116px,
    #000 116px 121px,
    transparent 121px 124px,
    #000 124px 127px,
    transparent 127px 132px,
    #000 132px 134px,
    transparent 134px 139px,
    #000 139px 143px,
    transparent 143px 146px,
    #000 146px 149px,
    transparent 149px 154px,
    #000 154px 160px,
    transparent 160px 164px,
    #000 164px 165px,
    transparent 165px 170px,
    #000 170px 174px,
    transparent 174px 178px,
    #000 178px 181px,
    transparent 181px 185px,
    #000 185px 188px,
    transparent 188px 191px,
    #000 191px 194px,
    transparent 194px 197px,
    #000 197px 202px,
    transparent 202px 206px,
    #000 206px 210px,
    transparent 210px 214px,
    #000 214px 216px,
    transparent 216px 100%
  );
  background-position: center center;
  background-repeat: no-repeat;
  background-size: 220px 100%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.barcode-no {
  margin-top: 4px;
  color: #243f2d;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-align: center;
}

.fortune-modal[hidden] {
  display: none;
}

.fortune-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.fortune-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background:
    radial-gradient(circle at 50% 24%, rgba(147, 240, 191, 0.18), transparent 34rem),
    rgba(1, 10, 7, 0.72);
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.fortune-modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  width: min(520px, calc(100vw - 28px));
  max-height: calc(100svh - 36px);
  padding: 16px;
  border: 1px solid rgba(147, 240, 191, 0.38);
  border-radius: 26px;
  color: #f8fff9;
  background: rgba(4, 24, 16, 0.94);
  box-shadow:
    0 30px 86px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.fortune-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fortune-modal-head > div:first-child {
  display: grid;
  gap: 4px;
}

.fortune-modal-head strong {
  font-size: 18px;
  font-weight: 900;
}

.fortune-modal-head span {
  color: rgba(243, 255, 246, 0.66);
  font-size: 12px;
  font-weight: 900;
}

.fortune-modal-actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.fortune-modal-download,
.fortune-modal-share,
.fortune-modal-close {
  flex: 0 0 auto;
  border: 1px solid rgba(147, 240, 191, 0.42);
  border-radius: 999px;
  color: #06351f;
  background: var(--green-soft);
  padding: 9px 14px;
  font: 900 13px/1 "Noto Sans KR", sans-serif;
  cursor: pointer;
}

.fortune-modal-download {
  border-color: rgba(147, 240, 191, 0.62);
  color: #042415;
  background: linear-gradient(135deg, #93f0bf, #d8ffe6);
}

.fortune-modal-share {
  border-color: rgba(254, 229, 0, 0.68);
  color: #201600;
  background: linear-gradient(135deg, #fee500, #ffef75);
}

.fortune-modal-actions button:disabled {
  opacity: 0.62;
  cursor: progress;
}

.fortune-preview-wrap {
  position: relative;
  display: grid;
  place-items: center;
  overflow: auto;
  min-height: 280px;
  max-height: min(72svh, 760px);
  border: 1px solid rgba(147, 240, 191, 0.18);
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.22);
}

.fortune-modal.is-loading .fortune-preview-wrap::before {
  content: attr(data-loading-text);
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 126px;
  height: 126px;
  border: 1px solid rgba(147, 240, 191, 0.2);
  border-radius: 999px;
  color: rgba(243, 255, 246, 0.86);
  background:
    radial-gradient(circle, rgba(147, 240, 191, 0.16), transparent 58%),
    rgba(4, 24, 16, 0.92);
  box-shadow: 0 0 34px rgba(147, 240, 191, 0.2);
  font: 900 13px/1 "Noto Sans KR", sans-serif;
}

.fortune-modal.is-loading .fortune-preview-wrap::after {
  content: "";
  position: absolute;
  z-index: 3;
  width: 94px;
  height: 94px;
  border: 4px solid rgba(147, 240, 191, 0.2);
  border-top-color: #93f0bf;
  border-radius: 999px;
  animation: fortune-preview-spin 0.82s linear infinite;
}

.fortune-preview-wrap img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
}

.fortune-preview-wrap img:not([src]),
.fortune-preview-wrap img[src=""],
.fortune-preview-wrap img.is-broken {
  display: none;
}

.fortune-modal.is-loading .fortune-preview-wrap img:not([src]) {
  min-height: 280px;
}

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

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

.test-actions {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 12;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
}

.test-actions button {
  border: 1px solid rgba(147, 240, 191, 0.24);
  border-radius: 999px;
  color: #f5fff7;
  background: rgba(4, 29, 20, 0.68);
  padding: 10px 14px;
  font-weight: 900;
  cursor: pointer;
  backdrop-filter: blur(14px);
}

@keyframes float {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, -14px, 0) scale(1.04);
  }
}

@keyframes kuji-shuffle-reset {
  0% {
    filter: saturate(1);
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
  }
  7% {
    transform: translate3d(-34px, 8px, 0) rotate(-4.8deg) scale(1.018);
  }
  15% {
    transform: translate3d(38px, -10px, 0) rotate(5.4deg) scale(1.026);
  }
  24% {
    transform: translate3d(-46px, 12px, 0) rotate(-6.2deg) scale(1.032);
  }
  34% {
    filter: saturate(1.18);
    transform: translate3d(50px, -7px, 0) rotate(6.4deg) scale(1.036);
  }
  45% {
    transform: translate3d(-42px, 6px, 0) rotate(-5.2deg) scale(1.028);
  }
  57% {
    filter: saturate(1.26) blur(0.2px);
    transform: translate3d(42px, -12px, 0) rotate(4.8deg) scale(1.032);
  }
  69% {
    transform: translate3d(-26px, 8px, 0) rotate(-3.2deg) scale(1.018);
  }
  80% {
    filter: saturate(0.94) blur(0.5px);
    opacity: 0.82;
    transform: translate3d(16px, -3px, 0) rotate(1.4deg) scale(0.992);
  }
  90% {
    filter: saturate(0.9) blur(1.2px);
    opacity: 0.34;
    transform: translate3d(-8px, 2px, 0) rotate(-0.8deg) scale(0.976);
  }
  100% {
    filter: saturate(0.82) blur(2px);
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.96);
  }
}

@keyframes kuji-shuffle-fade-in {
  0% {
    filter: saturate(0.9) blur(1.6px);
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.965);
  }
  100% {
    filter: saturate(1) blur(0);
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes kuji-progress-spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@media (max-width: 900px) {
  .app {
    padding-inline: 10px;
  }

  .stage {
    padding-top: 112px;
  }

  .peel-tab {
    width: 68px;
    height: 42px;
  }

  .peel-tab span {
    font-size: 28px;
  }

  .flap-copy {
    top: 18px;
    right: 18px;
    bottom: 14px;
    left: 46px;
  }

  .flap-head,
  .flap-line {
    font-size: 10px;
  }

  .product-name {
    margin-top: 12px;
    font-size: 23px;
  }

  .jp-detail {
    display: block;
    margin-bottom: 8px;
    font-size: 9px;
  }

  .flap-barcode {
    padding: 6px;
  }

  .barcode {
    height: 42px;
  }

  .barcode-no {
    font-size: 10px;
  }

  .result-top,
  .result-foot {
    font-size: 13px;
  }
}

@media (max-width: 560px) {
  :root {
    --answer-inset: 4px;
    --mobile-lift: -100px;
  }

  .record-menu-button {
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
    min-height: 38px;
    padding: 7px 9px;
    font-size: 12px;
  }

  .record-menu-button > span:not(.record-menu-lines) {
    display: none;
  }

  .record-menu-button strong {
    min-width: 34px;
    min-height: 22px;
    font-size: 11px;
  }

  .record-drawer {
    top: max(56px, calc(env(safe-area-inset-top) + 50px));
  }

  .brand img {
    width: min(430px, 96vw);
  }

  .test-badge {
    top: auto;
    right: 50%;
    bottom: max(66px, calc(env(safe-area-inset-bottom) + 60px));
    min-height: 34px;
    padding: 7px 10px;
    font-size: 11px;
    transform: translateX(50%);
  }

  .test-badge span {
    min-width: 50px;
  }

  .stage {
    align-content: center;
    min-height: calc(100svh - 20px);
    padding-top: var(--mobile-stage-top);
    padding-inline: 16px 36px;
  }

  .ticket-frame {
    aspect-ratio: auto;
    transform: translateY(calc(var(--mobile-lift) + var(--ticket-lift, 0px)));
  }

  .fortune-download-cta {
    min-width: min(330px, calc(100vw - 46px));
    min-height: 54px;
    gap: 9px;
    padding: 8px 14px 8px 9px;
  }

  .fortune-download-mark {
    width: 36px;
    height: 36px;
    font-size: 10px;
  }

  .fortune-download-copy strong {
    font-size: 14px;
  }

  .fortune-download-copy small {
    font-size: 11px;
  }

  .ticket {
    inset: 0;
    width: 100%;
    height: 100%;
    transform: none;
  }

  .ticket-shadow {
    bottom: auto;
    top: calc(var(--mobile-stage-top) + var(--ticket-height) - 34px + var(--mobile-lift));
    width: min(74vw, var(--ticket-width));
    height: 92px;
  }

  .result-panel.limit .prize-rank {
    max-width: 99%;
    font-size: clamp(20px, 5.3vw, 27px);
    letter-spacing: -0.11em;
  }

  .jp-detail {
    display: none;
  }

  .flap-copy {
    top: 12px;
    right: 14px;
    bottom: 10px;
    left: 54px;
  }

  .flap-head,
  .flap-line {
    max-width: 230px;
    margin-bottom: 4px;
    font-size: 8px;
    line-height: 1.35;
  }

  .product-name {
    margin-top: 12%;
    font-size: 26px;
  }

  .flap-barcode {
    width: min(176px, 90%);
    padding: 4px;
  }

  .barcode {
    height: 26px;
    background-size: 146px 100%;
  }

  .barcode-no {
    margin-top: 2px;
    font-size: 9px;
  }

  .test-actions {
    bottom: max(16px, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
