/* ==========================================================================
   행운의 여섯 — 심야 복권 판매소 테마
   딥 인디고 배경 + 골드/바이올렛 액센트, 티켓형 결과 카드
   ========================================================================== */

:root {
  color-scheme: dark;

  --bg-0: #07060d;
  --bg-1: #100a1f;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);

  --ink: #f5f3ff;
  --muted: #a09cba;
  --faint: #6f6b8a;

  --gold: #f0c25a;
  --gold-soft: #ffdf9a;
  --violet: #8b5cf6;
  --violet-soft: #b79dff;
  --rose: #fb7185;

  --ball-1: #ffc93c;
  --ball-2: #4fb8f0;
  --ball-3: #ff6b7d;
  --ball-4: #9aa3b8;
  --ball-5: #8ed94f;

  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 11px;

  --shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.9);
}

* {
  box-sizing: border-box;
}

/* display 를 지정한 요소에서도 hidden 이 항상 이기도록 (UA 스타일보다 우선순위가 낮아서 필요) */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-0);
  color: var(--ink);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
    'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  overflow-x: hidden;
}

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

/* --- 배경 ---------------------------------------------------------------- */

.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(175deg, #120b24 0%, #0a0714 45%, #07060d 100%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(66px);
  opacity: 0.7;
}

.orb-1 {
  width: 60vw;
  height: 60vw;
  max-width: 520px;
  max-height: 520px;
  top: -18vw;
  left: -14vw;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.85), transparent 68%);
  animation: drift-a 26s ease-in-out infinite alternate;
}

.orb-2 {
  width: 55vw;
  height: 55vw;
  max-width: 460px;
  max-height: 460px;
  top: 12vh;
  right: -20vw;
  background: radial-gradient(circle, rgba(240, 194, 90, 0.5), transparent 70%);
  animation: drift-b 32s ease-in-out infinite alternate;
}

.orb-3 {
  width: 70vw;
  height: 70vw;
  max-width: 600px;
  max-height: 600px;
  bottom: -25vh;
  left: 20%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.28), transparent 70%);
  animation: drift-a 38s ease-in-out infinite alternate-reverse;
}

.aurora::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 50% 0%, transparent 35%, rgba(4, 3, 9, 0.72) 100%);
}

.grain {
  position: absolute;
  inset: -50%;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

@keyframes drift-a {
  to {
    transform: translate3d(8%, 6%, 0) scale(1.12);
  }
}

@keyframes drift-b {
  to {
    transform: translate3d(-10%, 8%, 0) scale(0.92);
  }
}

/* --- 레이아웃 ------------------------------------------------------------ */

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 18px calc(40px + env(safe-area-inset-bottom));
}

.layout {
  display: block;
}

.col {
  display: contents;
}

@media (min-width: 1000px) {
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
  }
  .col {
    display: block;
  }
  .col-b {
    position: sticky;
    top: 22px;
  }
  .cta {
    position: static;
  }
}

/* --- 헤더 ---------------------------------------------------------------- */

.masthead {
  padding: 6px 2px 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.brand-mark {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #2a1f04;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  border-radius: 999px;
  padding: 4px 11px;
}

.brand-name {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.32em;
  color: var(--muted);
}

.display {
  margin: 0 0 12px;
  font-size: clamp(2.3rem, 11vw, 3.6rem);
  line-height: 1.04;
  font-weight: 800;
  letter-spacing: -0.045em;
}

.display em {
  font-style: normal;
  background: linear-gradient(105deg, var(--gold-soft) 8%, var(--gold) 38%, var(--violet-soft) 88%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.97rem;
}

.fair-note {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 13px 15px;
  border-radius: var(--r-md);
  background: linear-gradient(120deg, rgba(139, 92, 246, 0.14), rgba(240, 194, 90, 0.08));
  border: 1px solid rgba(183, 157, 255, 0.24);
}

.fair-note svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  margin-top: 2px;
  fill: none;
  stroke: var(--violet-soft);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.fair-note p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.55;
  color: #cfc7ee;
}

.fair-note b {
  color: var(--gold-soft);
  font-weight: 700;
}

/* --- 패널 ---------------------------------------------------------------- */

.panel,
.ticket {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 18px;
  margin-bottom: 16px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 16px;
}

.panel-head.between {
  justify-content: space-between;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.step {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--gold);
  border: 1px solid rgba(240, 194, 90, 0.35);
  border-radius: 7px;
  padding: 2px 7px;
  background: rgba(240, 194, 90, 0.09);
}

h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 18px 0 9px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.hint {
  margin: 6px 0;
  color: var(--faint);
  font-size: 0.76rem;
}

/* --- 추천 방식 카드 ------------------------------------------------------ */

.modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: 9px;
}

.mode {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 13px 12px;
  text-align: left;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}

.mode:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.mode svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.18s;
}

.mode-name {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mode-desc {
  font-size: 0.71rem;
  line-height: 1.45;
  color: var(--faint);
}

.mode[aria-checked='true'] {
  border-color: rgba(240, 194, 90, 0.6);
  background: linear-gradient(150deg, rgba(240, 194, 90, 0.16), rgba(139, 92, 246, 0.1));
  box-shadow: 0 0 0 1px rgba(240, 194, 90, 0.25), 0 10px 30px -14px rgba(240, 194, 90, 0.7);
}

.mode[aria-checked='true'] svg {
  stroke: var(--gold);
}

.mode[aria-checked='true'] .mode-desc {
  color: #cdc4ea;
}

@media (max-width: 520px) {
  .mode:nth-child(5) {
    grid-column: span 2;
  }
}

/* --- 게임 수 ------------------------------------------------------------- */

.counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 4px 0 14px;
}

.counter-value {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-variant-numeric: tabular-nums;
}

.counter-value span {
  font-size: 2.7rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  background: linear-gradient(120deg, var(--gold-soft), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.counter-value small {
  font-size: 0.85rem;
  color: var(--muted);
}

.round {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.round:hover {
  background: rgba(255, 255, 255, 0.14);
}

.round:active {
  transform: scale(0.94);
}

.round:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* --- 세그먼트 칩 --------------------------------------------------------- */

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seg.scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

/* 실제로 넘칠 때만 오른쪽 끝을 흐리게 잘라 더 있다는 신호를 준다 */
.seg.scroll.is-scrollable {
  mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent);
}

.seg.scroll::-webkit-scrollbar {
  display: none;
}

.seg button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.seg button:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.seg button[aria-checked='true'] {
  color: #241a02;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  border-color: transparent;
  font-weight: 800;
}

.seg.quick {
  justify-content: center;
}

.seg.quick button {
  min-width: 52px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* --- 번호 고르기 (details) ---------------------------------------------- */

.picker {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.025);
  margin-bottom: 10px;
  overflow: hidden;
}

.picker summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  cursor: pointer;
  list-style: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.picker summary::-webkit-details-marker {
  display: none;
}

.picker-value {
  margin-left: auto;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.chev {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--faint);
  stroke-width: 2;
  stroke-linecap: round;
  transition: transform 0.2s;
}

.picker[open] .chev {
  transform: rotate(180deg);
}

.picker-body {
  padding: 0 15px 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
  margin: 10px 0 12px;
}

.grid button {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s, background 0.15s;
}

.grid button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.11);
  color: var(--ink);
}

.grid button[aria-pressed='true'] {
  color: #1b1405;
  border-color: transparent;
  background: radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.7), transparent 46%),
    var(--tone, var(--gold));
  box-shadow: 0 4px 12px -3px rgba(0, 0, 0, 0.6);
  transform: scale(1.04);
}

.grid button:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--faint);
  font-family: inherit;
  font-size: 0.76rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link:hover {
  color: var(--ink);
}

/* --- 조건 --------------------------------------------------------------- */

.cond {
  margin-top: 16px;
}

.cond-label {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}

.cond-label small {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--faint);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.switch-row .cond-label {
  margin: 0;
}

.switch {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.switch .track {
  display: block;
  width: 46px;
  height: 27px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
  transition: background 0.2s;
}

.switch .track::after {
  content: '';
  display: block;
  width: 19px;
  height: 19px;
  margin: 3px;
  border-radius: 50%;
  background: #cfcadf;
  transition: transform 0.2s, background 0.2s;
}

.switch input:checked + .track {
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  border-color: transparent;
}

.switch input:checked + .track::after {
  transform: translateX(19px);
  background: #2a1f04;
}

.switch input:disabled + .track {
  opacity: 0.35;
}

.switch input:focus-visible + .track {
  outline: 2px solid var(--violet-soft);
  outline-offset: 2px;
}

.sum-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

input[type='number'] {
  width: 84px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-family: inherit;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.tilde {
  color: var(--faint);
}

.sum-presets {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.sum-presets button {
  border: 1px solid var(--line);
  background: none;
  color: var(--faint);
  border-radius: 999px;
  padding: 5px 10px;
  font-family: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.sum-presets button:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

/* --- CTA ---------------------------------------------------------------- */

.cta {
  position: sticky;
  bottom: 12px;
  z-index: 5;
  display: flex;
  gap: 9px;
  margin: 18px 0 24px;
}

.draw {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 17px 20px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #241a02;
  cursor: pointer;
  background: linear-gradient(120deg, #ffe6ab, var(--gold) 45%, #e0a326);
  box-shadow: 0 14px 34px -12px rgba(240, 194, 90, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transition: transform 0.14s, box-shadow 0.2s;
}

.draw:hover {
  box-shadow: 0 18px 40px -12px rgba(240, 194, 90, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.draw:active {
  transform: translateY(2px) scale(0.99);
}

.draw-count {
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(36, 26, 2, 0.16);
  border-radius: 999px;
  padding: 3px 10px;
  font-variant-numeric: tabular-nums;
}

.ghost {
  border: 1px solid var(--line-strong);
  background: rgba(18, 14, 30, 0.75);
  color: var(--ink);
  border-radius: 999px;
  padding: 13px 18px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background 0.15s;
}

.ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.ghost.small {
  padding: 8px 13px;
  font-size: 0.76rem;
}

.error {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: rgba(251, 113, 133, 0.12);
  border: 1px solid rgba(251, 113, 133, 0.35);
  color: #ffc2ca;
  font-size: 0.82rem;
}

/* --- 티켓 (결과) --------------------------------------------------------- */

.ticket {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.03));
  border-color: rgba(240, 194, 90, 0.28);
  padding: 0;
}

.ticket-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 18px 14px;
}

.kicker {
  display: block;
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--gold);
}

.ticket-head h2 {
  margin: 3px 0 0;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.ticket-actions {
  display: flex;
  gap: 7px;
}

.perforation {
  position: relative;
  height: 18px;
  border-top: 1px dashed rgba(240, 194, 90, 0.4);
}

.perforation::before,
.perforation::after {
  content: '';
  position: absolute;
  top: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0a0714;
  box-shadow: inset -1px 0 0 rgba(240, 194, 90, 0.3), inset 1px 0 0 rgba(240, 194, 90, 0.3);
}

.perforation::before {
  left: -11px;
}

.perforation::after {
  right: -11px;
}

.games {
  list-style: none;
  margin: 0;
  padding: 0 18px;
}

.game {
  padding: 12px 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.09);
}

.game:first-child {
  border-top: 0;
  padding-top: 0;
}

.game-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-label {
  flex-shrink: 0;
  width: 26px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.balls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.ball {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.86rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #1c1408;
  background: radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.85), transparent 44%),
    var(--tone);
  box-shadow: inset 0 -3px 7px rgba(0, 0, 0, 0.22), 0 5px 12px -4px rgba(0, 0, 0, 0.8);
}

.ball.s0 { --tone: var(--ball-1); }
.ball.s1 { --tone: var(--ball-2); }
.ball.s2 { --tone: var(--ball-3); }
.ball.s3 { --tone: var(--ball-4); }
.ball.s4 { --tone: var(--ball-5); }

.ball.small {
  width: 29px;
  height: 29px;
  font-size: 0.74rem;
}

.ball.pop {
  animation: pop 0.42s cubic-bezier(0.18, 1.3, 0.4, 1) both;
}

@keyframes pop {
  from {
    transform: scale(0.3) translateY(10px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.game-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
}

.game-meta {
  flex: 1;
  min-width: 0;
  font-size: 0.7rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.game .copy {
  flex-shrink: 0;
  white-space: nowrap;
  background: none;
  border: 0;
  padding: 3px 5px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.game .copy:hover {
  color: var(--gold);
}

.ticket-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 18px;
  margin-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.09);
}

.ticket-foot p {
  margin: 0;
  font-size: 0.7rem;
  color: var(--faint);
}

.barcode {
  flex-shrink: 0;
  width: 84px;
  height: 26px;
  opacity: 0.5;
  background-image: repeating-linear-gradient(
    90deg,
    var(--muted) 0 2px,
    transparent 2px 4px,
    var(--muted) 4px 5px,
    transparent 5px 9px,
    var(--muted) 9px 12px,
    transparent 12px 14px
  );
}

/* --- 저장함 -------------------------------------------------------------- */

.saved {
  list-style: none;
  margin: 0;
  padding: 0;
}

.saved li {
  padding: 12px 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.09);
}

.saved li:first-child {
  border-top: 0;
  padding-top: 0;
}

.saved-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.71rem;
  color: var(--faint);
}

.saved-head span + span {
  display: flex;
  gap: 4px;
}

.saved-head button {
  background: none;
  border: 0;
  padding: 2px 5px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.71rem;
  cursor: pointer;
}

.saved-head button:hover {
  color: var(--gold);
}

.saved .balls {
  margin-bottom: 5px;
}

.empty {
  color: var(--faint);
  font-size: 0.78rem;
}

/* --- 통계 ---------------------------------------------------------------- */

.latest {
  margin: 12px 0 4px;
  padding: 11px 13px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  font-size: 0.76rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.rank {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

@media (min-width: 560px) {
  .rank {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.dot.hot {
  background: var(--gold);
  box-shadow: 0 0 9px var(--gold);
}

.dot.cold {
  background: #6ea8ff;
  box-shadow: 0 0 9px #6ea8ff;
}

.rank-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.66rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.heat-title {
  margin-top: 22px;
}

.heat {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 5px;
  margin-top: 10px;
}

.heat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(240, 194, 90, calc(var(--heat) * 0.72));
  font-variant-numeric: tabular-nums;
}

.heat-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
}

.heat-count {
  font-size: 0.6rem;
  color: var(--muted);
}

.heat-cell[data-strong='true'] .heat-num,
.heat-cell[data-strong='true'] .heat-count {
  color: #2a1f04;
}

.heat-cell[data-strong='true'] .heat-count {
  opacity: 0.75;
}

/* --- 푸터 / 토스트 -------------------------------------------------------- */

footer {
  padding: 14px 4px 0;
  color: var(--faint);
  font-size: 0.71rem;
}

footer p {
  margin: 0 0 6px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  padding: 11px 18px;
  border-radius: 999px;
  background: rgba(24, 18, 40, 0.94);
  border: 1px solid rgba(240, 194, 90, 0.35);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.95);
  animation: rise 0.24s ease-out both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
}

/* --- 포커스 / 접근성 ------------------------------------------------------ */

button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--violet-soft);
  outline-offset: 2px;
}

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

@media (max-width: 370px) {
  .grid {
    grid-template-columns: repeat(7, 1fr);
  }
  .ball {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }
}

/* ==========================================================================
   가챠 연출 (overlay + stage + reveal)
   ========================================================================== */

.switch.push {
  margin-left: auto;
}

.ghost.wide {
  display: block;
  width: 100%;
  margin-top: 16px;
}

.grade-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #120c22;
  background: var(--badge, var(--gold));
  vertical-align: middle;
}

/* --- 오버레이 ------------------------------------------------------------ */

body.fx-locked {
  overflow: hidden;
}

.fx-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* 뒤 페이지가 비쳐 보이지 않게 거의 불투명하게 (blur 없이도 무대에 집중된다) */
  background: radial-gradient(120% 90% at 50% 40%, rgba(9, 6, 20, 0.988), rgba(2, 1, 6, 1));
  opacity: 0;
  transition: opacity 0.22s ease;
  --g-color: #c8cde0;
  --g-accent: #8e97b5;
  --shake: 8px;
}

.fx-overlay.is-open {
  opacity: 1;
}

.fx-overlay::before {
  /* 등급 색으로 물드는 배경 광원 */
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 45% at 50% 42%, color-mix(in srgb, var(--g-color) 30%, transparent), transparent 70%);
  transition: background 0.35s ease;
}

.fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.fx-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform-origin: 50% 42%;
  will-change: transform;
}

.fx-stage.is-blown {
  animation: stage-blow 0.4s ease-out both;
}

@keyframes stage-blow {
  to {
    opacity: 0;
    transform: scale(1.25);
  }
}

.fx-overlay.is-shaking {
  animation: fx-shake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes fx-shake {
  10%, 90% { transform: translate3d(calc(var(--shake) * -0.2), 0, 0); }
  20%, 80% { transform: translate3d(calc(var(--shake) * 0.4), calc(var(--shake) * -0.2), 0); }
  30%, 50%, 70% { transform: translate3d(calc(var(--shake) * -0.8), calc(var(--shake) * 0.2), 0); }
  40%, 60% { transform: translate3d(var(--shake), 0, 0); }
}

.fx-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  animation: fx-flash 0.42s ease-out both;
}

@keyframes fx-flash {
  0% { opacity: 0.95; }
  100% { opacity: 0; }
}

.fx-skip {
  position: absolute;
  right: 16px;
  /* 레터박스 바 위로 올려 가려지지 않게 한다 */
  bottom: calc(7vh + 14px + env(safe-area-inset-bottom));
  z-index: 4;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(10, 8, 20, 0.6);
  color: rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* --- 무대 공통 ----------------------------------------------------------- */

/* 무대 요소는 여기서만 중앙 정렬하고, 움직임은 항상 자식 요소에 준다.
   (translate 속성과 애니메이션 transform 이 겹치면 중심이 어긋난다) */
.fx-circle,
.fx-capsule,
.fx-card,
.fx-drum {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
}

/* --- 소환진 -------------------------------------------------------------- */

.fx-circle {
  width: min(74vw, 340px);
  aspect-ratio: 1;
  /* 룬을 올려놓을 반지름 */
  --r: calc(min(74vw, 340px) * 0.44);
}

.fx-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--g-color) 75%, transparent);
  box-shadow: 0 0 26px color-mix(in srgb, var(--g-color) 45%, transparent),
    inset 0 0 26px color-mix(in srgb, var(--g-color) 30%, transparent);
  animation: spin 3.6s linear infinite;
}

.fx-ring.r1 {
  border-style: dashed;
  border-width: 3px;
}

.fx-ring.r2 {
  inset: 13%;
  border-style: dotted;
  animation-direction: reverse;
  animation-duration: 2.6s;
}

.fx-ring.r3 {
  inset: 27%;
  border-style: double;
  border-width: 6px;
}

.fx-core {
  position: absolute;
  inset: 40%;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, color-mix(in srgb, var(--g-color) 80%, transparent) 60%, transparent 72%);
  animation: core-pulse 0.9s ease-in-out infinite alternate;
}

@keyframes spin {
  to { rotate: 360deg; }
}

@keyframes core-pulse {
  from { transform: scale(0.7); opacity: 0.65; }
  to { transform: scale(1.25); opacity: 1; }
}

/* --- 별똥별 -------------------------------------------------------------- */

.fx-star {
  position: absolute;
  left: -14%;
  top: -14%;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 25%, #ffe9a8 55%, transparent 72%);
  box-shadow: 0 0 40px 12px rgba(255, 233, 168, 0.55);
  animation: shoot 0.9s cubic-bezier(0.25, 0.6, 0.4, 1) both;
}

/* 꼬리: 진행 방향 반대쪽으로 길게 늘어지는 빛줄기 */
.fx-star::after {
  content: '';
  position: absolute;
  right: 50%;
  top: 50%;
  width: 190px;
  height: 5px;
  translate: 0 -50%;
  transform: rotate(-38deg);
  transform-origin: right center;
  border-radius: 999px;
  background: linear-gradient(270deg, rgba(255, 240, 200, 0.95), rgba(255, 220, 150, 0.35) 45%, transparent);
  filter: blur(1.5px);
}

@keyframes shoot {
  to {
    left: calc(50% - 13px);
    top: calc(42% - 13px);
    transform: scale(1.7);
  }
}

/* --- 캡슐 ---------------------------------------------------------------- */

.fx-capsule {
  width: 152px;
  height: 152px;
}

/* 뒤에 깔리는 등급 색 후광 (흔들리는 본체가 아니라 정지한 부모에 둔다) */
.fx-capsule::before {
  content: '';
  position: absolute;
  inset: -52%;
  border-radius: 50%;
  background: radial-gradient(circle,
    color-mix(in srgb, var(--g-color) 46%, transparent),
    color-mix(in srgb, var(--g-color) 14%, transparent) 38%,
    transparent 64%);
  animation: core-pulse 1.4s ease-in-out infinite alternate;
}

/* 본체 자체의 그림자는 값싼 box-shadow 로 */
.cap-top,
.cap-bottom {
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.55);
}

.cap-body {
  position: relative;
  width: 100%;
  height: 100%;
  animation: drop 0.76s cubic-bezier(0.45, 0, 0.35, 1.5) both;
}

.cap-body.is-wobbling {
  animation: wobble 0.34s ease-in-out infinite;
}

.cap-top,
.cap-bottom {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  transition: transform 0.34s cubic-bezier(0.4, 0, 0.9, 0.6), opacity 0.34s;
}

.cap-top {
  top: 0;
  border-radius: 999px 999px 4px 4px;
  background: radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.9), transparent 46%),
    linear-gradient(165deg, color-mix(in srgb, var(--g-color) 88%, white), var(--g-accent));
}

.cap-bottom {
  bottom: 0;
  border-radius: 4px 4px 999px 999px;
  background: linear-gradient(20deg, rgba(226, 232, 255, 0.42), rgba(120, 132, 175, 0.5));
  box-shadow: inset 0 -10px 20px rgba(0, 0, 0, 0.35), inset 0 4px 10px rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.cap-seam {
  position: absolute;
  left: -3%;
  top: calc(50% - 4px);
  width: 106%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(255, 255, 255, 0.5));
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.35);
}

.cap-shine {
  position: absolute;
  left: 21%;
  top: 13%;
  width: 24%;
  height: 20%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  filter: blur(3px);
}

.cap-body.is-cracking .cap-top {
  transform: translateY(-150px) rotate(-34deg);
  opacity: 0;
}

.cap-body.is-cracking .cap-bottom {
  transform: translateY(150px) rotate(24deg);
  opacity: 0;
}

.cap-body.is-cracking .cap-seam,
.cap-body.is-cracking .cap-shine {
  opacity: 0;
  transition: opacity 0.2s;
}

@keyframes drop {
  from { transform: translateY(-70vh) scaleY(1.3); }
  60% { transform: translateY(0) scaleY(0.82) scaleX(1.14); }
  to { transform: translateY(0) scaleY(1); }
}

@keyframes wobble {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}

/* --- 카드 플립 ------------------------------------------------------------ */

.fx-card {
  width: min(46vw, 190px);
  aspect-ratio: 0.68;
  perspective: 900px;
}

.fx-card-fly {
  width: 100%;
  height: 100%;
  animation: card-in 0.62s cubic-bezier(0.2, 1.1, 0.3, 1) both;
}

.fx-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.62s cubic-bezier(0.4, 0, 0.2, 1);
}

.fx-card.is-flipping .fx-card-inner {
  transform: rotateY(180deg);
}

.fx-card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 16px;
  backface-visibility: hidden;
  font-size: 2.4rem;
  font-weight: 900;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.fx-card-face.back {
  background: repeating-linear-gradient(45deg, #241a45, #241a45 8px, #2e2154 8px, #2e2154 16px);
  color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.fx-card-face.front {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, color-mix(in srgb, var(--g-color) 80%, white), var(--g-accent));
  color: #1a1230;
  box-shadow: 0 0 60px color-mix(in srgb, var(--g-color) 65%, transparent);
  overflow: hidden;
}

.fx-card-face.front span {
  display: grid;
  place-items: center;
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid rgba(26, 18, 48, 0.25);
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.35);
  font-size: 1.9rem;
}

/* 뒤집힌 뒤 표면을 훑고 지나가는 빛 */
.fx-card-face.front::after {
  content: '';
  position: absolute;
  inset: -40% -120%;
  background: linear-gradient(72deg, transparent 42%, rgba(255, 255, 255, 0.75) 50%, transparent 58%);
  translate: -60% 0;
}

.fx-card.is-flipping .fx-card-face.front::after {
  animation: card-shine 0.9s ease-out 0.45s 2 both;
}

@keyframes card-shine {
  from { translate: -60% 0; }
  to { translate: 60% 0; }
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(130px) rotate(-16deg) scale(0.7); }
  to { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}

/* --- 추첨기 -------------------------------------------------------------- */

.fx-drum {
  width: min(70vw, 290px);
  aspect-ratio: 1;
}

.fx-drum-body {
  position: relative;
  width: 100%;
  height: 100%;
  animation: card-in 0.5s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}

.fx-drum-glass {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.22);
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.03) 60%);
  box-shadow: inset 0 0 60px rgba(255, 255, 255, 0.08),
    0 0 50px color-mix(in srgb, var(--g-color) 40%, transparent);
  overflow: hidden;
  animation: drum-spin 2.4s ease-in-out infinite;
}

.fx-drum-balls {
  position: absolute;
  inset: 6%;
}

.fx-mini {
  position: absolute;
  width: 19%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.85), transparent 44%), var(--tone);
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.25);
  animation: tumble 1s ease-in-out infinite alternate;
}

.fx-mini.s0 { --tone: var(--ball-1); }
.fx-mini.s1 { --tone: var(--ball-2); }
.fx-mini.s2 { --tone: var(--ball-3); }
.fx-mini.s3 { --tone: var(--ball-4); }
.fx-mini.s4 { --tone: var(--ball-5); }

@keyframes tumble {
  from { transform: translate(0, 0) rotate(0); }
  to { transform: translate(var(--dx, 14px), var(--dy, -18px)) rotate(140deg); }
}

@keyframes drum-spin {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}

.fx-drum-base {
  position: absolute;
  left: 22%;
  bottom: -13%;
  width: 56%;
  height: 16%;
  border-radius: 6px 6px 14px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06));
  border: 2px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55);
}

.fx-drum-tube {
  position: absolute;
  right: -16%;
  top: 44%;
  width: 30%;
  height: 16%;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.14));
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-left: 0;
  box-shadow: inset 0 -4px 10px rgba(0, 0, 0, 0.3);
}

.fx-drum-body.is-ejecting .fx-drum-tube {
  animation: tube-glow 0.4s ease-out 3;
}

@keyframes tube-glow {
  50% { box-shadow: 0 0 30px 6px var(--g-color); }
}

/* --- 레전드 빛기둥 -------------------------------------------------------- */

.fx-beam {
  position: absolute;
  left: 50%;
  top: 0;
  translate: -50% 0;
  width: min(60vw, 260px);
  height: 100%;
  background: linear-gradient(
    180deg,
    transparent,
    color-mix(in srgb, var(--g-color) 55%, transparent) 30%,
    color-mix(in srgb, var(--g-accent) 60%, transparent) 60%,
    transparent
  );
  filter: blur(8px);
  animation: beam 1.4s ease-out both;
}

@keyframes beam {
  0% { opacity: 0; transform: translateX(-50%) scaleX(0.2); }
  25% { opacity: 1; transform: translateX(-50%) scaleX(1.15); }
  100% { opacity: 0; transform: translateX(-50%) scaleX(0.8); }
}

/* --- 공개 --------------------------------------------------------------- */

.fx-reveal {
  --fxb: 40px;
  position: relative;
  z-index: 2;
  width: min(92vw, 560px);
  max-height: 86vh;
  overflow-y: auto;
  text-align: center;
  padding: 10px 0;
}

.fx-grade {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 18px;
}

.fx-grade.is-in {
  animation: grade-slam 0.44s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}

.fx-grade-key {
  font-size: clamp(2.6rem, 15vw, 4.4rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  background: linear-gradient(120deg, #fff 5%, var(--g-color) 45%, var(--g-accent) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px color-mix(in srgb, var(--g-color) 55%, transparent));
}

.fx-grade-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.34em;
  color: color-mix(in srgb, var(--g-color) 85%, white);
}

.fx-grade-note {
  margin-top: 6px;
  font-size: 0.66rem;
  color: rgba(255, 255, 255, 0.42);
}

.fx-grade.g-LEGEND .fx-grade-key {
  background: linear-gradient(120deg, #fff, #ff77d9 30%, #ffd76a 55%, #7ce7ff 80%, #fff);
  -webkit-background-clip: text;
  background-clip: text;
  animation: hue 2.4s linear infinite;
}

@keyframes hue {
  to { filter: hue-rotate(360deg) drop-shadow(0 0 26px rgba(255, 200, 120, 0.6)); }
}

@keyframes grade-slam {
  from { opacity: 0; transform: scale(2.2); filter: blur(10px); }
  to { opacity: 1; transform: scale(1); filter: blur(0); }
}

.fx-games {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.fx-game {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.fx-game-tag {
  width: 24px;
  flex-shrink: 0;
  font-size: 0.66rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.4);
  text-align: right;
}

.fx-balls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-start;
  width: calc(var(--fxb) * 6 + 30px);
}

.fx-ball {
  width: var(--fxb);
  height: var(--fxb);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #1c1408;
  background: radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.9), transparent 44%), var(--tone);
  box-shadow: inset 0 -3px 8px rgba(0, 0, 0, 0.25), 0 0 22px color-mix(in srgb, var(--tone) 45%, transparent);
}

/* 폭발 지점에서 제자리로 날아와 앉는다 */
.fx-ball.is-flying {
  animation: ball-fly 0.44s cubic-bezier(0.16, 1.25, 0.36, 1) both;
}

@keyframes ball-fly {
  0% {
    transform: translate(var(--fx-dx, 0), var(--fx-dy, 0)) scale(0.35);
    opacity: 0;
    filter: blur(7px);
  }
  55% { opacity: 1; }
  100% { transform: translate(0, 0) scale(1); opacity: 1; filter: blur(0); }
}

.fx-ball.s0 { --tone: var(--ball-1); }
.fx-ball.s1 { --tone: var(--ball-2); }
.fx-ball.s2 { --tone: var(--ball-3); }
.fx-ball.s3 { --tone: var(--ball-4); }
.fx-ball.s4 { --tone: var(--ball-5); }

@media (max-width: 400px) {
  .fx-reveal {
    --fxb: 36px;
  }
  .fx-ball {
    font-size: 0.85rem;
  }
}

/* --- 연출 강화: 레터박스 · 집중선 · 충격파 · 줌 펀치 ---------------------- */

.fx-bar {
  position: absolute;
  left: 0;
  width: 100%;
  height: 7vh;
  background: #040309;
  z-index: 3;
  pointer-events: none;
}

.fx-bar.top {
  top: 0;
  animation: bar-in-top 0.5s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

.fx-bar.bottom {
  bottom: 0;
  animation: bar-in-bottom 0.5s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

@keyframes bar-in-top {
  from { transform: translateY(-100%); }
}

@keyframes bar-in-bottom {
  from { transform: translateY(100%); }
}

/* 집중선: 승급·폭발 순간에만 번쩍인다 */
.fx-lines {
  position: absolute;
  inset: -25%;
  pointer-events: none;
  opacity: 0;
  background: repeating-conic-gradient(
    from 0deg at 50% 50%,
    color-mix(in srgb, var(--g-color) 85%, white) 0deg 0.5deg,
    transparent 0.5deg 3.6deg
  );
  mask-image: radial-gradient(circle at 50% 50%, transparent 26%, #000 60%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent 26%, #000 60%);
}

.fx-lines.is-hit {
  animation: lines-hit 0.5s cubic-bezier(0.1, 0.8, 0.3, 1) both;
}

@keyframes lines-hit {
  0% { opacity: 0.85; transform: scale(0.55) rotate(-3deg); }
  100% { opacity: 0; transform: scale(1.3) rotate(3deg); }
}

/* 충격파 링 */
.fx-wave {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  border: 3px solid var(--g-color);
  box-shadow: 0 0 24px color-mix(in srgb, var(--g-color) 70%, transparent);
  animation: wave 0.7s cubic-bezier(0.12, 0.7, 0.25, 1) both;
}

@keyframes wave {
  from { transform: scale(0.2); opacity: 0.95; }
  to { transform: scale(24); opacity: 0; border-width: 1px; }
}

/* 공개 순간의 줌 펀치 */
.fx-reveal.is-punch {
  animation: punch 0.5s cubic-bezier(0.15, 1.2, 0.35, 1) both;
}

@keyframes punch {
  from { transform: scale(1.18); opacity: 0; filter: blur(8px); }
  to { transform: scale(1); opacity: 1; filter: blur(0); }
}

/* 소환진 코어가 충전될수록 밝아진다 */
.fx-circle {
  --charge: 0.2;
}

.fx-circle .fx-core {
  transform: scale(calc(0.7 + var(--charge) * 0.6));
  filter: drop-shadow(0 0 calc(10px + var(--charge) * 40px) var(--g-color));
  transition: transform 0.25s ease-out, filter 0.25s ease-out;
}

/* 빛기둥: LEGEND 는 더 넓고 진하게 */
.fx-beam.is-legend {
  width: min(85vw, 380px);
  filter: blur(12px);
}

/* 등급 배너 뒤로 퍼지는 빛살 */
.fx-grade.is-in::before {
  content: '';
  position: absolute;
  width: min(120vw, 620px);
  aspect-ratio: 1;
  z-index: -1;
  background: repeating-conic-gradient(
    from 0deg at 50% 50%,
    color-mix(in srgb, var(--g-color) 55%, transparent) 0deg 2deg,
    transparent 2deg 12deg
  );
  mask-image: radial-gradient(circle, #000 5%, transparent 62%);
  -webkit-mask-image: radial-gradient(circle, #000 5%, transparent 62%);
  opacity: 0.5;
  animation: rays 26s linear infinite;
}

.fx-grade {
  position: relative;
  isolation: isolate;
}

@keyframes rays {
  to { rotate: 360deg; }
}

/* ==========================================================================
   연출 고도화: 안개 · 플레어 · 룬 · 유성 · 스포트라이트 · 홀로그램 · 송풍
   ========================================================================== */

/* 등급 색으로 물드는 볼류메트릭 안개 */
.fx-fog {
  position: absolute;
  inset: -10%;
  pointer-events: none;
  opacity: 0.55;
  background:
    radial-gradient(46% 36% at 22% 30%,
      color-mix(in srgb, var(--g-color) 26%, transparent),
      color-mix(in srgb, var(--g-color) 9%, transparent) 45%,
      transparent 72%),
    radial-gradient(52% 40% at 78% 62%,
      color-mix(in srgb, var(--g-accent) 22%, transparent),
      color-mix(in srgb, var(--g-accent) 8%, transparent) 48%,
      transparent 74%);
  will-change: transform;
  animation: fog-drift 14s ease-in-out infinite alternate;
  transition: background 0.4s ease;
}

@keyframes fog-drift {
  to { transform: translate3d(4%, -3%, 0) scale(1.12); }
}

/* 폭발 순간 가로로 길게 늘어지는 아나모픽 플레어 */
.fx-flare {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 190vw;
  height: 6px;
  translate: -50% -50%;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--g-color) 60%, transparent) 28%,
    #ffffff 50%,
    color-mix(in srgb, var(--g-color) 60%, transparent) 72%,
    transparent
  );
  filter: blur(3px);
  animation: flare 0.76s cubic-bezier(0.1, 0.8, 0.3, 1) both;
}

@keyframes flare {
  0% { opacity: 0; transform: scaleX(0.2) scaleY(3); }
  18% { opacity: 1; transform: scaleX(1) scaleY(1.6); }
  100% { opacity: 0; transform: scaleX(1.1) scaleY(0.4); }
}

/* --- 소환진: 룬 고리 + 육망성 --------------------------------------------- */

.fx-runes {
  position: absolute;
  inset: 4%;
  animation: spin 9s linear infinite reverse;
}

.fx-runes b {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -8px 0 0 -7px;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1;
  color: color-mix(in srgb, var(--g-color) 60%, white);
  text-shadow: 0 0 12px var(--g-color), 0 0 4px #fff;
}

.fx-runes b:nth-child(1) { transform: translateY(calc(var(--r) * -1)); }
.fx-runes b:nth-child(2) { transform: rotate(30deg) translateY(calc(var(--r) * -1)) rotate(-30deg); }
.fx-runes b:nth-child(3) { transform: rotate(60deg) translateY(calc(var(--r) * -1)) rotate(-60deg); }
.fx-runes b:nth-child(4) { transform: rotate(90deg) translateY(calc(var(--r) * -1)) rotate(-90deg); }
.fx-runes b:nth-child(5) { transform: rotate(120deg) translateY(calc(var(--r) * -1)) rotate(-120deg); }
.fx-runes b:nth-child(6) { transform: rotate(150deg) translateY(calc(var(--r) * -1)) rotate(-150deg); }
.fx-runes b:nth-child(7) { transform: rotate(180deg) translateY(calc(var(--r) * -1)) rotate(-180deg); }
.fx-runes b:nth-child(8) { transform: rotate(210deg) translateY(calc(var(--r) * -1)) rotate(-210deg); }
.fx-runes b:nth-child(9) { transform: rotate(240deg) translateY(calc(var(--r) * -1)) rotate(-240deg); }
.fx-runes b:nth-child(10) { transform: rotate(270deg) translateY(calc(var(--r) * -1)) rotate(-270deg); }
.fx-runes b:nth-child(11) { transform: rotate(300deg) translateY(calc(var(--r) * -1)) rotate(-300deg); }
.fx-runes b:nth-child(12) { transform: rotate(330deg) translateY(calc(var(--r) * -1)) rotate(-330deg); }

.fx-glyph {
  position: absolute;
  inset: 24%;
  background:
    conic-gradient(from 0deg,
      transparent 0deg 58deg, color-mix(in srgb, var(--g-color) 70%, transparent) 59deg 61deg,
      transparent 62deg 118deg, color-mix(in srgb, var(--g-color) 70%, transparent) 119deg 121deg,
      transparent 122deg 178deg, color-mix(in srgb, var(--g-color) 70%, transparent) 179deg 181deg,
      transparent 182deg 238deg, color-mix(in srgb, var(--g-color) 70%, transparent) 239deg 241deg,
      transparent 242deg 298deg, color-mix(in srgb, var(--g-color) 70%, transparent) 299deg 301deg,
      transparent 302deg 358deg, color-mix(in srgb, var(--g-color) 70%, transparent) 359deg 360deg);
  mask-image: radial-gradient(circle, transparent 32%, #000 34%, #000 92%, transparent 94%);
  -webkit-mask-image: radial-gradient(circle, transparent 32%, #000 34%, #000 92%, transparent 94%);
  opacity: calc(0.45 + var(--charge, 0.2) * 0.55);
  filter: drop-shadow(0 0 8px var(--g-color));
  animation: spin 6s linear infinite;
  transition: opacity 0.3s ease;
}

/* --- 별똥별: 배경 유성 + 착탄 빛기둥 -------------------------------------- */

.fx-meteor {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 12px 3px rgba(220, 232, 255, 0.8);
  animation: meteor 0.9s linear both;
}

.fx-meteor::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  width: 120px;
  height: 2px;
  translate: 0 -50%;
  transform: rotate(-40deg);
  transform-origin: right center;
  background: linear-gradient(270deg, rgba(255, 255, 255, 0.85), transparent);
}

@keyframes meteor {
  from { opacity: 0; transform: translate(0, 0); }
  15% { opacity: 1; }
  to { opacity: 0; transform: translate(46vw, 38vh); }
}

.fx-pillar {
  position: absolute;
  left: 50%;
  top: 42%;
  width: min(46vw, 200px);
  height: 78vh;
  translate: -50% -100%;
  background: linear-gradient(
    0deg,
    color-mix(in srgb, var(--g-color) 75%, white) 0%,
    color-mix(in srgb, var(--g-color) 45%, transparent) 26%,
    transparent 78%
  );
  mask-image: linear-gradient(0deg, #000 0%, transparent 85%);
  -webkit-mask-image: linear-gradient(0deg, #000 0%, transparent 85%);
  filter: blur(7px);
  animation: pillar 0.9s cubic-bezier(0.1, 0.8, 0.3, 1) both;
}

@keyframes pillar {
  0% { opacity: 0; transform: scaleX(0.15) scaleY(0.5); }
  22% { opacity: 1; transform: scaleX(1.1) scaleY(1); }
  100% { opacity: 0; transform: scaleX(0.7) scaleY(1.05); }
}

/* --- 캡슐: 스포트라이트 · 그림자 · 이음새 빛샘 ----------------------------- */

.fx-spot {
  position: absolute;
  left: 50%;
  top: -6%;
  width: min(90vw, 380px);
  height: 74vh;
  translate: -50% 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 72%);
  clip-path: polygon(38% 0, 62% 0, 100% 100%, 0 100%);
  filter: blur(12px);
  pointer-events: none;
}

.cap-shadow {
  position: absolute;
  left: 50%;
  top: calc(100% + 26px);
  width: 74%;
  height: 14px;
  translate: -50% 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  filter: blur(7px);
  animation: shadow-drop 0.78s cubic-bezier(0.45, 0, 0.35, 1.5) both;
}

@keyframes shadow-drop {
  from { transform: scale(2.1); opacity: 0.15; }
  60% { transform: scale(0.8); opacity: 0.6; }
  to { transform: scale(1); opacity: 0.45; }
}

/* 갈라지기 직전, 이음새 틈으로 빛이 샌다 */
.cap-leak {
  position: absolute;
  left: -4%;
  top: calc(50% - 3px);
  width: 108%;
  height: 6px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 18px 6px var(--g-color);
  opacity: 0;
}

.cap-body.is-leaking .cap-leak {
  animation: leak 0.44s ease-in infinite alternate;
}

.cap-body.is-leaking {
  animation: shiver 0.09s linear infinite;
}

@keyframes leak {
  from { opacity: 0.15; transform: scaleY(0.6); }
  to { opacity: 1; transform: scaleY(1.6); }
}

@keyframes shiver {
  0%, 100% { transform: translate(0.8px, 0); }
  50% { transform: translate(-0.8px, 0); }
}

/* --- 카드: 뒤에 깔리는 부채 + 홀로그램 -------------------------------------- */

.fx-card-fan i {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  background: repeating-linear-gradient(45deg, #1d1637, #1d1637 8px, #251c47 8px, #251c47 16px);
  border: 2px solid rgba(255, 255, 255, 0.14);
  opacity: 0.55;
}

.fx-card-fan i:nth-child(1) { transform: rotate(-9deg) translateY(6px) scale(0.97); }
.fx-card-fan i:nth-child(2) { transform: rotate(8deg) translateY(6px) scale(0.97); }

.fx-card-face.front span {
  position: relative;
  z-index: 1;
}

/* --- 추첨기: 소용돌이 바람 + 관을 지나는 공 -------------------------------- */

.fx-drum-swirl {
  position: absolute;
  inset: -20%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg 70deg,
    rgba(255, 255, 255, 0.13) 90deg 130deg,
    transparent 150deg 250deg,
    rgba(255, 255, 255, 0.1) 270deg 310deg,
    transparent 330deg 360deg
  );
  animation: spin 1.6s linear infinite;
}

.fx-tube-ball {
  position: absolute;
  left: 6%;
  top: 50%;
  width: 46%;
  aspect-ratio: 1;
  translate: 0 -50%;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.9), transparent 44%), var(--g-color);
  opacity: 0;
}

.fx-drum-body.is-ejecting .fx-tube-ball {
  animation: tube-travel 0.42s cubic-bezier(0.3, 0, 0.5, 1) both;
}

@keyframes tube-travel {
  0% { opacity: 0; transform: translateX(-70px) scale(0.6); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translateX(90px) scale(1.15); }
}

/* --- 등급 배너: 색수차(RGB 분리) 슬램 -------------------------------------- */

.fx-grade-key {
  position: relative;
}

.fx-grade.is-in .fx-grade-key::before,
.fx-grade.is-in .fx-grade-key::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  mix-blend-mode: screen;
  pointer-events: none;
}

.fx-grade.is-in .fx-grade-key::before {
  color: rgba(255, 60, 90, 0.85);
  animation: chroma-l 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.fx-grade.is-in .fx-grade-key::after {
  color: rgba(60, 200, 255, 0.85);
  animation: chroma-r 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes chroma-l {
  from { transform: translate(-14px, 4px); opacity: 0.9; }
  to { transform: translate(0, 0); opacity: 0; }
}

@keyframes chroma-r {
  from { transform: translate(14px, -4px); opacity: 0.9; }
  to { transform: translate(0, 0); opacity: 0; }
}
