* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: #eef0ff;
  background: radial-gradient(1200px 600px at 10% -10%, #343b7a 0%, transparent 60%), radial-gradient(900px 500px at 110% 10%, #5b2a6e 0%, transparent 55%), #14172e;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; }
input { font-family: inherit; }
.small { font-size: 13px; }
.muted { color: #a6abcf; }
.center { text-align: center; }
.warn { color: #ffd166; }
.big-emoji { font-size: 54px; line-height: 1; margin-bottom: 6px; }
.wobble { animation: wob 2.4s ease-in-out infinite; }
@keyframes wob { 50% { transform: translateY(-8px) rotate(-4deg); } }
.row-gap { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.row-gap.end { justify-content: flex-end; }

.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.panel { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); border-radius: 22px; padding: 28px 24px; width: min(420px, 100%); backdrop-filter: blur(8px); }
.panel h2 { margin: 6px 0 8px; }
.spinner { width: 40px; height: 40px; border: 4px solid rgba(255, 255, 255, .15); border-top-color: #ffd166; border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn { border: 0; border-radius: 14px; padding: 12px 18px; font-weight: 700; font-size: 15px; cursor: pointer; transition: transform .1s, filter .15s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, #ffd166, #ff9f1c); color: #2a1a00; }
.btn.ghost { background: rgba(255, 255, 255, .1); color: #eef0ff; }
.btn.small { padding: 8px 12px; font-size: 13px; }
.btn.wide { width: 100%; margin-top: 8px; }
.btn.google { background: #fff; color: #222; display: inline-flex; gap: 10px; align-items: center; font-size: 16px; padding: 14px 22px; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); }
.g-logo { font-weight: 900; background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 20px; }
.icon-btn { background: rgba(255, 255, 255, .08); border: 0; color: #fff; border-radius: 10px; width: 34px; height: 34px; cursor: pointer; font-size: 16px; }

.field { display: block; text-align: left; font-size: 13px; color: #c9cdee; margin-top: 12px; }
.field input, .demo-box input { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .15); background: rgba(0, 0, 0, .25); color: #fff; font-size: 16px; }

/* 로그인 */
.login .logo { font-size: 44px; margin: 10px 0 4px; letter-spacing: -0.04em; font-weight: 900; }
.login .logo span, .brand span { background: linear-gradient(90deg, #ffd166, #ff7eb6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { color: #c9cdee; line-height: 1.6; margin: 0 0 22px; }
.login-cards { position: relative; height: 150px; width: 220px; margin: 0 auto; }
.fan { position: absolute; left: 50%; bottom: 0; width: 92px; height: 128px; border-radius: 10px; transform-origin: 50% 120%; box-shadow: 0 10px 24px rgba(0, 0, 0, .4); border: 4px solid rgba(255, 255, 255, .7); }
.f1 { background: linear-gradient(135deg, #c4793a, #8a4f20); transform: translateX(-50%) rotate(-18deg); }
.f2 { background: linear-gradient(135deg, #2f9e8f, #1d655b); transform: translateX(-50%) rotate(0deg); z-index: 1; }
.f3 { background: linear-gradient(135deg, #b5478f, #6f2556); transform: translateX(-50%) rotate(18deg); }
.demo-box { background: rgba(255, 255, 255, .06); border: 1px dashed rgba(255, 209, 102, .5); border-radius: 16px; padding: 16px; width: min(360px, 100%); display: grid; gap: 10px; }
.demo-box p { margin: 0; color: #c9cdee; }
.demo-tag { justify-self: center; background: #ffd166; color: #2a1a00; font-weight: 800; font-size: 12px; padding: 3px 10px; border-radius: 99px; }

/* 상단 */
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: rgba(20, 23, 46, .82); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(255, 255, 255, .06); }
.brand { font-weight: 900; font-size: 19px; letter-spacing: -0.03em; }
.who { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.team-chip { background: var(--c); color: #fff; font-weight: 800; font-size: 12px; padding: 3px 9px; border-radius: 99px; }

.hero { max-width: 960px; margin: 16px auto 0; padding: 0 16px; display: grid; gap: 12px; }
.pack-zone { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); border-radius: 20px; padding: 14px 16px; }
.pack-zone.ready { background: linear-gradient(135deg, rgba(255, 209, 102, .16), rgba(255, 126, 182, .12)); border-color: rgba(255, 209, 102, .35); }
.mini-pack { width: 48px; height: 64px; border-radius: 8px; background: linear-gradient(160deg, #6b72c9, #2d3270); display: grid; place-items: center; position: relative; box-shadow: 0 4px 12px rgba(0, 0, 0, .3); }
.mini-pack b { background: #ef476f; border-radius: 99px; min-width: 24px; height: 24px; display: grid; place-items: center; font-size: 13px; position: absolute; top: -8px; right: -8px; }
.mini-pack.glow { background: linear-gradient(160deg, #ffd166, #ff7eb6 60%, #8b5cf6); animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-3deg); } }
.tickets { font-size: 17px; }
.tickets b { font-size: 22px; color: #ffd166; }
.open-btn { background: linear-gradient(135deg, #ffd166, #ff7eb6); color: #2a1030; font-size: 16px; padding: 14px 18px; }
.pack-zone.ready .open-btn { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(255, 209, 102, .18); } }
.progress-label { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; color: #c9cdee; }
.bar { height: 12px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.bar.small { height: 8px; margin-top: 6px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #06d6a0, #ffd166); border-radius: 99px; transition: width .6s; }

.tabs { max-width: 960px; margin: 16px auto 0; padding: 0 16px; display: flex; gap: 6px; overflow-x: auto; }
.tab { flex: 1; min-width: max-content; border: 0; background: rgba(255, 255, 255, .06); color: #c9cdee; padding: 11px 12px; border-radius: 12px; font-weight: 700; font-size: 14px; cursor: pointer; position: relative; }
.tab.on { background: #eef0ff; color: #1b1f3a; }
.tab .dot { font-style: normal; background: #ef476f; color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 6px; margin-left: 4px; }
main { max-width: 960px; margin: 0 auto; padding: 16px 16px 60px; }

.set-block { background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .07); border-left: 5px solid var(--set); border-radius: 18px; padding: 14px; margin-bottom: 14px; }
.set-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.set-name { font-weight: 900; font-size: 18px; }
.set-count { font-weight: 800; background: rgba(255, 255, 255, .08); padding: 4px 12px; border-radius: 99px; font-size: 14px; }
.set-count.done { background: var(--set); color: #fff; }
.card-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.card-grid .hcard:not(.locked) { cursor: pointer; transition: transform .15s; }
.card-grid .hcard:not(.locked):hover { transform: translateY(-4px) rotate(-1deg); }

.info-card { background: rgba(255, 255, 255, .06); border-radius: 16px; padding: 14px 16px; margin-bottom: 14px; line-height: 1.6; }
.info-card p { margin: 4px 0 0; color: #c9cdee; }
.info-card ul { margin: 6px 0 0; padding-left: 20px; color: #c9cdee; }
.empty { text-align: center; padding: 26px; color: #a6abcf; background: rgba(255, 255, 255, .04); border-radius: 14px; }
.step { margin: 18px 0 10px; font-size: 16px; }
.pick-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pick { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; text-align: left; align-items: center; background: rgba(255, 255, 255, .07); border: 2px solid transparent; color: #eef0ff; border-radius: 14px; padding: 10px; cursor: pointer; }
.pick.on { border-color: #ffd166; background: rgba(255, 209, 102, .14); }
.pick:disabled { opacity: .45; cursor: not-allowed; }
.pick.target { border-left: 4px solid var(--set); }
.pick.target:not(:disabled):hover { border-color: #ffd166; }
.pick-ic { grid-row: span 2; font-size: 26px; }
.pick-name { font-weight: 800; font-size: 14px; }
.pick-sub { font-size: 12px; color: #a6abcf; }
.gtxt { font-weight: 900; }
.gtxt.g-N { color: var(--g-N); } .gtxt.g-R { color: var(--g-R); } .gtxt.g-SR { color: var(--g-SR); } .gtxt.g-SSR { color: var(--g-SSR); }

.rate-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; background: rgba(255, 255, 255, .04); border-radius: 14px; overflow: hidden; font-size: 14px; }
.rate-table th, .rate-table td { padding: 10px 12px; text-align: right; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.rate-table th:first-child, .rate-table td:first-child { text-align: left; }
.rate-table th { color: #a6abcf; font-weight: 600; font-size: 12px; }
.pity-meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 10px; }
.meter { background: rgba(255, 255, 255, .06); border-radius: 14px; padding: 12px 14px; }
.meter-top { display: flex; justify-content: space-between; font-size: 14px; }
.meter-top b { color: #ffd166; }

.stage-list { display: grid; gap: 10px; }
.stage { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center; background: rgba(255, 255, 255, .05); border-radius: 16px; padding: 12px 14px; border-left: 5px solid var(--set); }
.stage.final { background: linear-gradient(135deg, rgba(255, 209, 102, .12), rgba(255, 126, 182, .1)); }
.stage.done { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--set) 60%, transparent); }
.stage-ic { font-size: 30px; text-align: center; }
.stage-title { font-weight: 800; }
.stage-state { font-weight: 800; color: #ffd166; font-size: 14px; }

/* 오버레이 공통 */
.overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(8, 10, 24, .86); backdrop-filter: blur(4px); animation: fadein .25s; }
@keyframes fadein { from { opacity: 0; } }
.modal { background: #23284d; border-radius: 20px; padding: 22px; width: min(420px, 92vw); box-shadow: 0 20px 60px rgba(0, 0, 0, .5); max-height: 92vh; overflow: auto; }
.card-modal { display: grid; justify-items: center; gap: 10px; }

/* 카드팩 */
.pack-ov { grid-template-rows: 1fr auto auto; padding: 40px 0; cursor: pointer; }
.rays { position: absolute; inset: -50%; background: repeating-conic-gradient(from 0deg, rgba(255, 209, 102, .08) 0 10deg, transparent 10deg 20deg); animation: spin 18s linear infinite; pointer-events: none; }
.pack { position: relative; width: 210px; height: 290px; align-self: end; }
.pack-top { height: 26px; border-radius: 10px 10px 2px 2px; background: repeating-linear-gradient(90deg, #d9d9e8 0 6px, #b9b9cc 6px 12px); }
.pack-body { height: calc(100% - 26px); border-radius: 2px 2px 14px 14px; background: linear-gradient(160deg, #ffd166, #ff7eb6 45%, #8b5cf6); display: grid; place-content: center; text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .5), inset 0 0 0 4px rgba(255, 255, 255, .35); overflow: hidden; position: relative; }
.pack-body::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .55) 48%, transparent 60%); background-size: 250% 100%; animation: shine 2.2s infinite; }
.pack-logo { font-size: 64px; font-weight: 900; color: #fff; text-shadow: 0 4px 0 rgba(0, 0, 0, .2); letter-spacing: -0.04em; }
.pack-sub { color: #fff; font-weight: 800; opacity: .9; }
.pack-why { color: #ffd166; font-weight: 700; margin: 24px 0 4px; }
.pack-hint { color: #a6abcf; margin: 0; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.pack.shake { animation: shake .8s; }
@keyframes shake { 0%, 100% { transform: none; } 10%, 30%, 50%, 70%, 90% { transform: translateX(-8px) rotate(-4deg); } 20%, 40%, 60%, 80% { transform: translateX(8px) rotate(4deg); } }
.pack.burst { animation: burst .45s forwards; }
@keyframes burst { to { transform: scale(1.6); opacity: 0; filter: brightness(3); } }
.pack-ov.flash::before { content: ""; position: absolute; inset: 0; background: #fff; animation: flash .45s forwards; }
@keyframes flash { from { opacity: .9; } to { opacity: 0; } }

/* 카드 공개 */
.reveal-ov { grid-template-rows: 1fr auto auto; padding: 30px 0 34px; gap: 10px; }
.reveal-ov .rays { opacity: 0; transition: opacity .6s; }
.reveal-ov.flipped .rays { opacity: 1; }
.reveal-ov.g-SR .rays { background: repeating-conic-gradient(rgba(194, 124, 255, .16) 0 10deg, transparent 10deg 20deg); }
.reveal-ov.g-SSR .rays { background: repeating-conic-gradient(rgba(255, 183, 3, .25) 0 8deg, transparent 8deg 16deg); }
.flip { perspective: 1200px; align-self: center; }
.flip-in { position: relative; transform-style: preserve-3d; transition: transform .8s cubic-bezier(.2, .8, .2, 1.1); transform: rotateY(180deg) scale(.8); }
.flipped .flip-in { transform: rotateY(0) scale(1); }
.flip-back, .flip-front { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip-back { position: absolute; inset: 0; transform: rotateY(180deg); border-radius: 20px; background: linear-gradient(160deg, #2d3270, #6b72c9); display: grid; place-items: center; box-shadow: inset 0 0 0 8px rgba(255, 255, 255, .2); }
.back-logo { font-size: 70px; font-weight: 900; color: rgba(255, 255, 255, .85); }
.reveal-text { display: grid; justify-items: center; gap: 6px; opacity: 0; transition: opacity .4s .6s; }
.flipped .reveal-text { opacity: 1; }
.reveal-tag { font-weight: 900; font-size: 20px; background: rgba(255, 255, 255, .12); padding: 6px 16px; border-radius: 99px; }
.reveal-tag.new { background: #ef476f; }
.pity-tag { font-weight: 800; color: #2a1a00; background: #06d6a0; padding: 4px 12px; border-radius: 99px; }
.reveal-btns { display: flex; gap: 10px; opacity: 0; transition: opacity .3s .9s; }
.flipped .reveal-btns { opacity: 1; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; background: #eef0ff; color: #1b1f3a; font-weight: 700; padding: 12px 18px; border-radius: 14px; z-index: 300; transition: all .25s; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: #ef476f; color: #fff; }
#toast.good { background: #ffd166; }

@media (max-width: 560px) {
  .pack-zone { grid-template-columns: auto 1fr; }
  .open-btn { grid-column: 1 / -1; width: 100%; }
  .hcard-s { --w: calc((100vw - 32px - 28px - 30px) / 3); }
  .who b { display: none; }
}
