/* LUCKY 45 — 가상 로또 추천기 */
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

:root {
  --bg: #07040f;
  --ink: #f7f2ff;
  --muted: #a99fc9;
  --dim: #6f6690;
  --gold: #ffd36b;
  --gold-2: #ffb13b;
  --pink: #ff4fb4;
  --cyan: #40e8ff;
  --violet: #8f5cff;
  --glass: rgba(17, 12, 36, 0.66);
  --glass-2: rgba(28, 20, 56, 0.72);
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --pw: 400px;
  --display: "Black Han Sans", "Pretendard Variable", Pretendard, sans-serif;
  --ui: "Pretendard Variable", Pretendard, "Malgun Gothic", system-ui, sans-serif;
  --b1: #ffc21a; --b2: #3eaef4; --b3: #ff5a64; --b4: #9aa2b4; --b5: #8fd43a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  min-height: 100vh;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 10px; }

#gl {
  position: fixed; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: pan-y; z-index: 0;
}
#scrim {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background:
    radial-gradient(130% 100% at 36% 46%, transparent 58%, rgba(5, 3, 12, 0.7) 100%),
    linear-gradient(90deg, transparent 55%, rgba(5, 3, 12, 0.55) 100%);
}

/* ── 로딩 ───────────────────────────── */
#loader {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-content: center; justify-items: center; gap: 18px;
  background: radial-gradient(80% 70% at 50% 45%, #1a0f35 0%, var(--bg) 70%);
  transition: opacity 0.9s ease, visibility 0.9s;
}
#loader.done { opacity: 0; visibility: hidden; }
.ld-balls { display: flex; gap: 12px; height: 70px; align-items: flex-end; }
.ld-balls i {
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff8 0 12%, transparent 30%), var(--c);
  box-shadow: inset -3px -5px 8px rgba(0, 0, 0, 0.3), 0 0 18px color-mix(in srgb, var(--c) 60%, transparent);
  animation: hop 0.9s cubic-bezier(0.3, 0, 0.5, 1) infinite alternate;
}
.ld-balls i:nth-child(1) { --c: var(--b1); }
.ld-balls i:nth-child(2) { --c: var(--b2); animation-delay: 0.12s; }
.ld-balls i:nth-child(3) { --c: var(--b3); animation-delay: 0.24s; }
.ld-balls i:nth-child(4) { --c: var(--b4); animation-delay: 0.36s; }
.ld-balls i:nth-child(5) { --c: var(--b5); animation-delay: 0.48s; }
@keyframes hop { from { transform: translateY(0) scale(1.08, 0.9); } to { transform: translateY(-40px) scale(1); } }
.ld-logo { font-family: var(--display); font-size: 54px; letter-spacing: 0.04em; line-height: 1; }
.ld-logo b { color: var(--pink); margin-left: 8px; font-weight: 400; }
.ld-text { margin: 0; color: var(--muted); font-size: 14px; letter-spacing: 0.06em; }

/* ── 로고 ───────────────────────────── */
.brand { position: fixed; top: 22px; left: 28px; z-index: 5; pointer-events: none; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-word {
  font-family: var(--display); font-size: 40px; line-height: 1; letter-spacing: 0.03em;
  background: linear-gradient(180deg, #fff8dc 0%, #ffd36b 46%, #ff9a3c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #b2457a) drop-shadow(0 4px 0 #5a1a59) drop-shadow(0 0 18px rgba(255, 140, 90, 0.45));
}
.logo-ball {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--ui); font-weight: 900; font-size: 18px; color: #2a0b2e;
  background:
    radial-gradient(circle at 50% 54%, #fff 0 38%, transparent 40%),
    radial-gradient(circle at 34% 28%, #ffd0ea, var(--pink) 48%, #8a1257 100%);
  box-shadow: inset -4px -6px 10px rgba(0, 0, 0, 0.3), 0 0 26px rgba(255, 79, 180, 0.65);
  animation: logoSpin 6s ease-in-out infinite;
}
@keyframes logoSpin { 0%, 70% { transform: rotate(0); } 85% { transform: rotate(-14deg) scale(1.06); } 100% { transform: rotate(0); } }
.tagline { margin: 6px 0 0 2px; font-size: 13px; font-weight: 600; letter-spacing: 0.22em; color: var(--muted); }

/* ── 큰 안내 글씨 ─────────────────────── */
#announce {
  position: fixed; z-index: 6; pointer-events: none;
  left: 0; right: calc(var(--pw) + 32px); top: 15vh;
  text-align: center;
}
#announce span {
  display: inline-block; opacity: 0;
  font-family: var(--display); font-size: clamp(34px, 5vw, 78px); line-height: 1.05;
  background: linear-gradient(180deg, #fffbe8 0%, #ffd36b 48%, #ff8f3c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #b2457a) drop-shadow(0 6px 0 #5a1a59) drop-shadow(0 0 30px rgba(255, 110, 190, 0.6));
}
#announce span.show { animation: annIn 0.85s cubic-bezier(0.2, 1.5, 0.4, 1) both, annOut 0.45s ease 1.55s forwards; }
#announce span.stay { animation: annIn 0.85s cubic-bezier(0.2, 1.5, 0.4, 1) both, annOut 0.6s ease 3.2s forwards; }
@keyframes annIn {
  from { opacity: 0; transform: perspective(700px) rotateX(-85deg) translateY(40px) scale(0.6); }
  to { opacity: 1; transform: perspective(700px) rotateX(0) translateY(0) scale(1); }
}
@keyframes annOut { to { opacity: 0; transform: perspective(700px) translateY(-24px) scale(1.06); filter: blur(6px); } }

.hint {
  position: fixed; z-index: 5; left: 28px; top: 112px; margin: 0;
  padding: 7px 14px; border-radius: 999px;
  font-size: 12.5px; color: var(--muted);
  background: rgba(17, 12, 36, 0.55); border: 1px solid var(--line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.6s, transform 0.6s; pointer-events: none;
}
.hint.gone { opacity: 0; transform: translateY(-6px); }

/* ── 레이아웃 ─────────────────────────── */
#ui { position: relative; z-index: 4; pointer-events: none; }
#ui > * { pointer-events: auto; }
.stage-space { display: none; }

.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

/* ── 결과 띠 ──────────────────────────── */
.result {
  position: fixed; z-index: 4;
  left: 24px; right: calc(var(--pw) + 40px); bottom: 20px;
  width: fit-content; max-width: calc(100vw - var(--pw) - 64px); margin-inline: auto;
  display: flex; align-items: center; gap: 22px;
  padding: 16px 22px 16px 20px; border-radius: 26px;
  background: linear-gradient(135deg, rgba(30, 18, 60, 0.78), rgba(14, 9, 30, 0.78));
  border: 1px solid var(--line-2);
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.result-head { display: flex; flex-direction: column; gap: 4px; min-width: 92px; }
.result-label { font-family: var(--display); font-size: 17px; color: var(--gold); line-height: 1.15; }
.result-mode { font-size: 12px; color: var(--muted); }
.result-balls { display: flex; gap: 9px; perspective: 600px; }
.result-info { display: flex; flex-direction: column; gap: 8px; min-width: 0; max-width: 330px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap;
}
.chips li b { color: var(--ink); font-weight: 700; margin-left: 4px; }
.chips li.ok b { color: #9ff5c9; }
.fortune { margin: 0; font-size: 13.5px; color: #e9ddff; }
.fortune em { font-style: normal; color: var(--gold); font-weight: 700; }
.result.is-empty .result-info .chips { display: none; }

/* 공 */
.ball {
  --c: var(--b1); --bs: 48px;
  width: var(--bs); height: var(--bs); flex: none; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: calc(var(--bs) * 0.36); color: #1a1430; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.9) 0 5%, transparent 16%),
    radial-gradient(circle at 50% 52%, #fff 0 35%, rgba(0, 0, 0, 0.12) 36.5%, transparent 38%),
    radial-gradient(circle at 34% 30%, color-mix(in srgb, var(--c) 50%, white), var(--c) 46%, color-mix(in srgb, var(--c) 58%, black) 100%);
  box-shadow: inset -3px -5px 9px rgba(0, 0, 0, 0.28), 0 6px 14px rgba(0, 0, 0, 0.45), 0 0 20px color-mix(in srgb, var(--c) 40%, transparent);
}
.ball[data-g="1"] { --c: var(--b2); }
.ball[data-g="2"] { --c: var(--b3); }
.ball[data-g="3"] { --c: var(--b4); }
.ball[data-g="4"] { --c: var(--b5); }
.ball.ghost {
  background: rgba(255, 255, 255, 0.04); color: var(--dim);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.12);
  font-weight: 700;
}
.ball.pop { animation: ballIn 0.75s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
@keyframes ballIn {
  from { opacity: 0; transform: translateY(-46px) rotateY(-540deg) scale(0.3); }
  65% { opacity: 1; transform: translateY(4px) rotateY(16deg) scale(1.1); }
  to { opacity: 1; transform: none; }
}
.ball.sm { --bs: 30px; box-shadow: inset -2px -3px 6px rgba(0, 0, 0, 0.28), 0 3px 8px rgba(0, 0, 0, 0.4); }
.ball.xs { --bs: 24px; box-shadow: inset -2px -3px 5px rgba(0, 0, 0, 0.25); }

/* ── 오른쪽 판 ────────────────────────── */
.panel {
  position: fixed; z-index: 4; top: 16px; right: 16px; bottom: 16px; width: var(--pw);
  overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px; border-radius: 28px;
  background: linear-gradient(180deg, rgba(22, 14, 46, 0.74), rgba(10, 7, 24, 0.8));
  border: 1px solid var(--line-2);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%);
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

/* 추첨 버튼 */
.draw-box { display: flex; flex-direction: column; gap: 12px; padding-bottom: 4px; }
.btn-draw {
  position: relative; display: block; width: 100%; padding: 0; border: 0;
  border-radius: 22px; background: #4c1a5c;
  box-shadow: 0 8px 0 #2f0c3c, 0 22px 44px -12px rgba(255, 79, 180, 0.6);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-draw:hover { transform: translateY(-2px); box-shadow: 0 10px 0 #2f0c3c, 0 26px 50px -12px rgba(255, 79, 180, 0.75); }
.btn-draw:active { transform: translateY(7px); box-shadow: 0 1px 0 #2f0c3c, 0 10px 24px -10px rgba(255, 79, 180, 0.6); }
.btn-draw-face {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  height: 76px; border-radius: 22px;
  font-family: var(--display); font-size: 30px; letter-spacing: 0.02em; color: #2a0b2e;
  background: linear-gradient(115deg, #ffe692 0%, #ffb43c 28%, #ff5fae 58%, #8f5cff 82%, #ffe692 100%);
  background-size: 250% 100%;
  animation: shimmer 7s linear infinite;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}
.btn-draw-face::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  transform: skewX(-20deg);
  animation: sweep 3.2s ease-in-out infinite;
}
@keyframes shimmer { to { background-position: 250% 0; } }
@keyframes sweep { 0%, 55% { left: -60%; } 100% { left: 130%; } }
.spark {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background:
    radial-gradient(circle at 50% 54%, #fff 0 36%, transparent 38%),
    radial-gradient(circle at 34% 28%, #fff3c4, #ffc21a 50%, #b8740a 100%);
  box-shadow: inset -2px -3px 5px rgba(0, 0, 0, 0.3), 0 0 14px rgba(255, 255, 255, 0.6);
  animation: roll 2.4s linear infinite;
}
@keyframes roll { to { transform: rotate(360deg); } }
.btn-draw.is-busy { background: #1d1535; box-shadow: 0 8px 0 #0f0a1f, 0 18px 40px -14px rgba(64, 232, 255, 0.45); }
.btn-draw.is-busy .btn-draw-face {
  background: linear-gradient(115deg, #1c2a4f, #2a1a52 50%, #1c2a4f); background-size: 250% 100%;
  color: var(--cyan); text-shadow: 0 0 16px rgba(64, 232, 255, 0.7); font-size: 26px;
}
.btn-draw.is-busy .spark { animation-duration: 0.5s; }

.draw-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 8px; }
.chip-btn {
  height: 42px; padding: 0 10px; border-radius: 14px;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.05);
  font-size: 13.5px; font-weight: 700; color: #e6dcff;
  transition: background 0.2s, border-color 0.2s, transform 0.12s, color 0.2s;
}
.chip-btn:hover { background: rgba(255, 255, 255, 0.1); }
.chip-btn:active { transform: scale(0.96); }
.chip-btn:disabled { opacity: 0.4; cursor: not-allowed; }
#btnFive { color: #2a0b2e; border-color: transparent; background: linear-gradient(135deg, #7ef0ff, #8f9bff); }
#btnFive:hover { filter: brightness(1.08); }
.chip-btn.toggle[aria-pressed="true"] { border-color: rgba(255, 211, 107, 0.6); color: var(--gold); background: rgba(255, 211, 107, 0.1); }

/* 블록 */
.block {
  padding: 16px; border-radius: 22px;
  background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line);
}
.block-title { margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: 0.14em; color: var(--muted); }

.tabs {
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 4px; border-radius: 16px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line);
}
.tab {
  position: relative; z-index: 1; height: 38px; border: 0; background: none; border-radius: 12px;
  font-size: 14px; font-weight: 700; color: var(--muted); transition: color 0.25s;
}
.tab[aria-selected="true"] { color: #2a0b2e; }
.tab-pill {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px;
  width: calc((100% - 8px) / 3); border-radius: 12px;
  background: linear-gradient(135deg, #ffe08a, #ffb43c);
  box-shadow: 0 6px 18px -6px rgba(255, 180, 60, 0.7);
  transform: translateX(calc(100% * var(--i, 0)));
  transition: transform 0.35s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.pane { padding-top: 12px; }
.pane-desc { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.k-fixed { color: var(--gold); }
.k-ex { color: #ff8a9a; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.field input {
  height: 42px; padding: 0 12px; border-radius: 12px;
  border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.35); color: var(--ink); font-size: 14px;
  min-width: 0;
}
.field input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 211, 107, 0.18); }

.num-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; }
.num {
  --c: var(--b1);
  position: relative; aspect-ratio: 1; padding: 0; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12.5px; font-weight: 700; color: #ddd3f5;
  transition: transform 0.15s, background 0.2s, color 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.num:hover { transform: scale(1.1); }
.num[data-g="1"] { --c: var(--b2); }
.num[data-g="2"] { --c: var(--b3); }
.num[data-g="3"] { --c: var(--b4); }
.num[data-g="4"] { --c: var(--b5); }
.num.fixed {
  color: #1a1430; border-color: #fff;
  background: radial-gradient(circle at 34% 30%, color-mix(in srgb, var(--c) 45%, white), var(--c) 55%, color-mix(in srgb, var(--c) 60%, black));
  box-shadow: 0 0 0 2px var(--gold), 0 0 14px color-mix(in srgb, var(--c) 70%, transparent);
}
.num.ex { opacity: 0.38; color: #ff8a9a; border-style: dashed; }
.num.ex::after {
  content: ""; position: absolute; left: 18%; right: 18%; top: 50%; height: 1.5px;
  background: #ff8a9a; transform: rotate(-40deg);
}
.grid-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.link-btn { border: 0; background: none; padding: 4px 2px; font-size: 12.5px; color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }

.switch { display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  flex: none; width: 44px; height: 26px; margin-top: 1px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.12); border: 1px solid var(--line-2);
  position: relative; transition: background 0.25s;
}
.switch-track i {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.switch input:checked + .switch-track { background: linear-gradient(135deg, #ffd36b, #ff5fae); border-color: transparent; }
.switch input:checked + .switch-track i { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--gold); outline-offset: 2px; }
.switch-text { display: flex; flex-direction: column; gap: 2px; }
.switch-text b { font-size: 14px; }
.switch-text small { font-size: 12px; color: var(--muted); line-height: 1.45; }

/* 행운 용지 */
.ticket-block { padding: 0; background: none; border: 0; }
.ticket {
  position: relative; overflow: hidden;
  padding: 16px; border-radius: 22px;
  border: 1.5px solid transparent;
  background:
    linear-gradient(160deg, rgba(36, 22, 72, 0.96), rgba(15, 10, 32, 0.96)) padding-box,
    conic-gradient(from var(--ang), #ffd36b, #ff4fb4, #40e8ff, #8f5cff, #ffd36b) border-box;
  animation: holo 6s linear infinite;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.25s ease-out;
  transform-style: preserve-3d;
}
@keyframes holo { to { --ang: 360deg; } }
.ticket-shine {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.3s;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.13), transparent 45%);
}
.ticket:hover .ticket-shine { opacity: 1; }
.ticket-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.ticket-title { margin: 0; font-family: var(--display); font-weight: 400; font-size: 21px; color: var(--gold); letter-spacing: 0.01em; }
.ticket-date { margin: 2px 0 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ticket-badge {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.2em; padding: 4px 8px; border-radius: 8px;
  color: #2a0b2e; background: linear-gradient(135deg, #7ef0ff, #ff9ad6);
}
.ticket-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ticket-rows li {
  display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px;
  min-height: 44px; padding: 6px 8px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.04); border: 1px dashed rgba(255, 255, 255, 0.1);
}
.ticket-rows li.filled { border-style: solid; border-color: rgba(255, 211, 107, 0.22); background: rgba(255, 211, 107, 0.05); }
.ticket-rows li.fresh { animation: rowIn 0.7s cubic-bezier(0.2, 1.3, 0.4, 1); }
@keyframes rowIn { from { transform: perspective(500px) rotateX(-70deg); opacity: 0; } to { transform: none; opacity: 1; } }
.row-label { font-family: var(--display); font-size: 18px; color: var(--gold); text-align: center; }
.row-balls { display: flex; gap: 4px; }
.row-empty { font-size: 12px; color: var(--dim); }
.row-mode { font-size: 11px; color: var(--muted); white-space: nowrap; }
.ticket-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.act-btn {
  height: 38px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.05);
  font-size: 13px; font-weight: 700; color: #e6dcff; transition: background 0.2s, transform 0.12s;
}
.act-btn:hover { background: rgba(255, 255, 255, 0.11); }
.act-btn:active { transform: scale(0.96); }

/* 기록 */
.history summary {
  display: flex; justify-content: space-between; align-items: center;
  list-style: none; cursor: pointer; font-size: 14px; font-weight: 700;
}
.history summary::-webkit-details-marker { display: none; }
.history summary b {
  min-width: 26px; height: 22px; padding: 0 8px; border-radius: 999px; display: grid; place-items: center;
  font-size: 12px; background: rgba(255, 255, 255, 0.08); color: var(--muted);
}
.history-list { list-style: none; margin: 12px 0 6px; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.history-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--dim); }
.history-list .row-balls { gap: 3px; }
.history-empty { font-size: 12.5px; color: var(--dim); }

.odds-btn {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 14px 16px; border-radius: 20px;
  border: 1px solid rgba(64, 232, 255, 0.25); background: linear-gradient(135deg, rgba(64, 232, 255, 0.09), rgba(143, 92, 255, 0.09));
  transition: transform 0.15s, background 0.2s;
}
.odds-btn:hover { transform: translateY(-2px); background: linear-gradient(135deg, rgba(64, 232, 255, 0.15), rgba(143, 92, 255, 0.15)); }
.odds-btn > span:last-child { display: flex; flex-direction: column; }
.odds-btn b { font-size: 14.5px; }
.odds-btn small { font-size: 12px; color: var(--muted); }
.odds-ico {
  flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 900; font-size: 18px; color: #06222a; background: linear-gradient(135deg, #7ef0ff, #8f9bff);
}
.disclaimer { margin: 2px 4px 4px; font-size: 11.5px; line-height: 1.6; color: var(--dim); }

/* ── 확률 창 ──────────────────────────── */
.odds {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto;
  padding: 26px 26px 22px; border-radius: 28px; color: var(--ink);
  background: linear-gradient(170deg, #1d1240, #0b0719 70%);
  border: 1px solid var(--line-2);
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 211, 107, 0.08);
}
.odds[open] { animation: dlgIn 0.45s cubic-bezier(0.2, 1.3, 0.4, 1); }
@keyframes dlgIn { from { opacity: 0; transform: perspective(900px) rotateX(18deg) translateY(30px) scale(0.94); } }
.odds::backdrop { background: rgba(4, 2, 10, 0.62); backdrop-filter: blur(6px); }
.odds-close-form { position: absolute; top: 14px; right: 14px; margin: 0; }
.odds-close { width: 36px; height: 36px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.06); }
.odds h2 { margin: 0 0 8px; font-family: var(--display); font-weight: 400; font-size: 28px; color: var(--gold); }
.odds-lead { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.odds-lead b { color: var(--ink); }
.odds-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.odds-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--dim); padding: 0 8px 8px; }
.odds-table td { padding: 9px 8px; border-top: 1px solid var(--line); }
.odds-table td:last-child { text-align: right; font-weight: 700; }
.odds-table th:last-child { text-align: right; }
.rank { display: inline-block; min-width: 44px; text-align: center; padding: 2px 8px; border-radius: 8px; font-weight: 800; font-size: 12.5px; color: #1a1430; }
.r1 { background: linear-gradient(135deg, #fff1b3, #ffc21a); }
.r2 { background: linear-gradient(135deg, #ffd0ea, #ff6fc0); }
.r3 { background: linear-gradient(135deg, #c9f7ff, #40c8ff); }
.r4 { background: linear-gradient(135deg, #e3d9ff, #9f86ff); }
.r5 { background: linear-gradient(135deg, #e6f8cf, #8fd43a); }
.sim { margin-top: 20px; padding: 18px; border-radius: 20px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.sim h3 { margin: 0 0 4px; font-size: 16px; }
.sim-desc { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.btn-sim {
  width: 100%; height: 48px; border: 0; border-radius: 14px;
  font-family: var(--display); font-size: 19px; color: #2a0b2e;
  background: linear-gradient(135deg, #ffe08a, #ff9ad6);
  box-shadow: 0 5px 0 #7a2d5c; transition: transform 0.12s, box-shadow 0.12s;
}
.btn-sim:active { transform: translateY(4px); box-shadow: 0 1px 0 #7a2d5c; }
.btn-sim:disabled { opacity: 0.6; }
.sim-out { margin-top: 14px; }
.sim-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.sim-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffd36b, #ff4fb4, #40e8ff); }
.sim-ranks { list-style: none; margin: 14px 0 10px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sim-ranks li { padding: 10px; border-radius: 14px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); text-align: center; }
.sim-ranks li small { display: block; font-size: 11.5px; color: var(--muted); }
.sim-ranks li b { font-size: 22px; font-variant-numeric: tabular-nums; }
.sim-ranks li.hit b { color: var(--gold); text-shadow: 0 0 14px rgba(255, 211, 107, 0.6); }
.sim-summary { margin: 0; font-size: 13.5px; color: #e9ddff; line-height: 1.65; }
.sim-summary b { color: var(--gold); }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: rgba(20, 14, 40, 0.92); border: 1px solid rgba(255, 211, 107, 0.4);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  transition: opacity 0.3s, transform 0.3s;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.noscript { position: fixed; inset: auto 0 40% 0; text-align: center; z-index: 70; }

/* 3D가 안 될 때 */
body.no-gl #gl { display: none; }
body.no-gl { background: radial-gradient(90% 70% at 35% 40%, #2a1555, var(--bg) 70%); }

/* ── 좁은 화면 ────────────────────────── */
@media (max-width: 1180px) and (min-width: 901px) {
  :root { --pw: 360px; }
  .result { gap: 14px; padding: 14px 16px; }
  .result-head { display: none; }
  .ball { --bs: 42px; }
}

@media (max-width: 900px) {
  body { overflow-x: hidden; overflow-y: auto; }
  #scrim { background: radial-gradient(130% 70% at 50% 28%, transparent 50%, rgba(5, 3, 12, 0.75) 100%); }
  .brand { position: absolute; top: 14px; left: 16px; }
  .logo-word { font-size: 30px; }
  .logo-ball { width: 36px; height: 36px; font-size: 14px; }
  .tagline { font-size: 11.5px; letter-spacing: 0.16em; margin-top: 4px; }
  #announce { right: 0; top: 13svh; padding: 0 16px; }
  #announce span { font-size: clamp(30px, 9vw, 48px); }
  .hint { left: 50%; top: calc(max(56svh, 330px) - 46px); transform: translateX(-50%); position: absolute; white-space: nowrap; }
  .hint.gone { transform: translate(-50%, -6px); }
  #ui { pointer-events: none; }
  .stage-space { display: block; height: max(56svh, 330px); pointer-events: none !important; }
  .result {
    position: relative; left: auto; right: auto; bottom: auto; width: auto; max-width: none;
    margin: 0 12px 12px; flex-wrap: wrap; justify-content: center; gap: 12px; padding: 14px;
  }
  .result-head { flex-direction: row; justify-content: space-between; width: 100%; min-width: 0; }
  .result-balls { gap: 6px; }
  .ball { --bs: min(46px, calc((100vw - 90px) / 6)); }
  .result-info { max-width: none; width: 100%; align-items: center; text-align: center; }
  .chips { justify-content: center; }
  .panel {
    position: relative; top: auto; right: auto; bottom: auto; width: auto;
    margin: 0 12px calc(24px + env(safe-area-inset-bottom)); overflow: visible; border-radius: 24px; padding: 14px;
  }
  .num-grid { gap: 6px; }
  .num { font-size: 13px; }
  .ticket { transform: none !important; }
}

@media (max-width: 380px) {
  .field-row { grid-template-columns: 1fr; }
  .draw-row { grid-template-columns: 1fr 1fr; }
  #btnFive { grid-column: 1 / -1; }
}

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