/*
Copyright (c) 2021 Kil Hyung-jin, with Reserved Font Name Pretendard.
https://github.com/orioncactus/pretendard

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
*/

@font-face {
	font-family: 'Pretendard Variable';
	font-weight: 45 920;
	font-style: normal;
	font-display: swap;
	src: url('/assets/PretendardVariable-CJuje-Rk.woff2') format('woff2-variations');
}
:root {
    --bg: #f4f4f4;
    --ink: #111;
    --sub: #8a8a8a;
    --line: #f0f0f0;
    --pink: #ff40b9;
    /* 화면 전환(모핑)용 — 천천히 출발해 부드럽게 멎는다 */
    --morph: cubic-bezier(0.7, 0, 0.2, 1);
    --out: cubic-bezier(0.16, 1, 0.3, 1);
    --morph-ms: 1100ms;
}

* {
    box-sizing: border-box;
}

html,
body,
#root {
    height: 100%;
    margin: 0;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
}

/* ───────── 비밀번호 ───────── */

.gate {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 36px;
}
.gate-logo {
    width: 260px;
}
.gate-input {
    width: 340px;
    height: 60px;
    border: 0;
    border-radius: 18px;
    background: #fff;
    padding: 0 24px;
    font: inherit;
    font-size: 20px;
    text-align: center;
    outline: 2px solid transparent;
    transition: outline-color 0.2s;
}
.gate-input:focus {
    outline-color: #111;
}
.gate-input.wrong {
    outline-color: #f04452;
    animation: shake 0.4s;
}
@keyframes shake {
    20%,
    60% {
        transform: translateX(-8px);
    }
    40%,
    80% {
        transform: translateX(8px);
    }
}

/* ───────── 추첨 화면 ───────── */

.viewport {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: var(--bg);
}
.preload {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    opacity: 0;
}

/* 1920×1080 고정 좌표로 그리고 화면 크기에 맞춰 통째로 확대·축소한다 */
.stage {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1920px;
    height: 1080px;
    overflow: hidden;
    transform-origin: center;
    user-select: none;
}

.brand {
    position: absolute;
    left: 210px;
    top: 44px;
    width: 340px;
    transform-origin: 0 0;
    cursor: pointer;
    transition: transform var(--morph-ms) var(--morph);
    will-change: transform;
}
.stage[data-mode="focus"] .brand {
    transform: translate(-146px, -4px) scale(0.882);
}

.warru {
    position: absolute;
    right: 40px;
    top: 24px;
    height: 90px;
    opacity: 0.6;
}

/* 경품 목록 카드 */
.prizes {
    position: absolute;
    left: 80px;
    top: 318px;
    width: 600px;
    padding: 20px 44px;
    border-radius: 32px;
    background: #fff;
    transition:
        opacity 700ms var(--out) 420ms,
        transform 900ms var(--out) 420ms;
}
.stage[data-mode="focus"] .prizes {
    opacity: 0;
    transform: translateX(-56px) scale(0.97);
    transition:
        opacity 380ms ease,
        transform 600ms var(--morph);
}
.prize-row {
    display: flex;
    align-items: center;
    height: 86px;
    font-size: 34px;
    border-top: 1px solid var(--line);
    transition:
        opacity 600ms var(--out) calc(480ms + var(--i) * 45ms),
        transform 800ms var(--out) calc(480ms + var(--i) * 45ms);
}
.prize-row:first-child {
    border-top: 0;
}
.stage[data-mode="focus"] .prize-row {
    opacity: 0;
    transform: translateX(-24px);
    transition:
        opacity 240ms ease,
        transform 400ms ease;
}
.dot {
    flex: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin-right: 22px;
    /* 흰색 원도 흰 카드 위에서 보이도록 옅은 테두리 */
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.14);
}
.prize-row .rank {
    width: 92px;
    font-weight: 500;
    color: var(--sub);
}
.prize-row .name {
    font-weight: 600;
}
.prize-row .pct {
    margin-left: auto;
    font-weight: 500;
    color: var(--sub);
    font-variant-numeric: tabular-nums;
}

/* 소진 안내 — 경품 카드 위를 블러로 덮고 가운데에 표시 */
.closed {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    font-size: 38px;
    font-weight: 700;
    letter-spacing: -0.02em;
    animation: closed-in 600ms var(--out) both;
}
@keyframes closed-in {
    from {
        opacity: 0;
    }
}

/* 휠 — 회전 화면 크기(지름 1600)로 그려 두고 대기 화면에서는 0.55배로 줄여 오른쪽에 둔다 */
.wheel {
    position: absolute;
    left: 160px;
    top: 190px;
    transform: translate(340px, -418px) scale(0.55);
    transition: transform var(--morph-ms) var(--morph);
    will-change: transform;
}
.stage[data-mode="focus"] .wheel {
    transform: none;
}
.ring-outer,
.ring-pink {
    position: absolute;
    border-radius: 50%;
}
.ring-outer {
    background: #111;
    box-shadow: 0 40px 110px rgba(0, 0, 0, 0.16);
}
.ring-pink {
    background: var(--pink);
}
.rotor {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #111;
    will-change: transform;
}
.face {
    position: absolute;
    border-radius: 50%;
}
.pin {
    position: absolute;
    border-radius: 50%;
    background: #fff;
}
.label {
    position: absolute;
    color: #fff;
    font-size: 68px;
    font-weight: 800;
    white-space: nowrap;
    text-shadow:
        -2px 0 #000,
        0 2px #000,
        2px 0 #000,
        0 -2px #000;
}
.hub {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 128px;
    height: 128px;
    margin: -64px 0 0 -64px;
    padding: 9px;
    border-radius: 50%;
    background: #111;
}
.hub img {
    display: block;
    width: 100%;
}
.pointer {
    position: absolute;
    left: 50%;
    /* 아래 끝이 흰 점 중심보다 4px 위에 오는 높이 — 점의 윗부분에 걸린다 */
    top: -139px;
    width: 160px;
    margin-left: -80px;
    /* 회전축은 별 모양의 중심 — 좌우 꼭짓점을 이은 선과 상하 꼭짓점을 이은 선이 만나는 점 */
    transform-origin: 51.1% 46.7%;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.18));
    will-change: transform;
}

/* 고양이 */
.cat {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.cat img {
    position: absolute;
    /* 휠 오른쪽을 아래로 긁는다 — 시계 방향으로 도는 휠을 더 돌리는 쪽 */
    left: 520px;
    top: 0;
    width: 1900px;
    will-change: transform;
}
.scratch {
    position: absolute;
    left: 1010px;
    top: 330px;
    width: 640px;
    pointer-events: none;
    animation: scratch 2400ms ease-out forwards;
}
@keyframes scratch {
    0% {
        opacity: 0;
        transform: rotate(-45deg) scale(0.86);
    }
    6% {
        opacity: 1;
        transform: rotate(-45deg) scale(1);
    }
    70% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: rotate(-45deg) scale(1.02);
    }
}

/* 결과 창 */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(12, 12, 14, 0.62);
    opacity: 0;
    pointer-events: none;
    transition: opacity 420ms ease;
}
.stage[data-phase="result"] .overlay {
    opacity: 1;
    transition: opacity 520ms ease;
}
.result {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 860px;
    padding: 76px 64px 84px;
    border-radius: 52px;
    background: #fff;
    box-shadow: 0 50px 120px rgba(0, 0, 0, 0.28);
    text-align: center;
    transform: translate(-50%, calc(-50% + 960px));
    transition: transform 460ms cubic-bezier(0.6, 0, 0.9, 0.35);
    will-change: transform;
}
.stage[data-phase="result"] .result {
    transform: translate(-50%, -50%);
    transition: transform 820ms var(--out) 60ms;
}
/* 닫힐 때는 내용을 건드리지 않는다 — 카드가 보이던 그대로 내려가고, 화면 밖으로 나간 뒤에 다음 등장을 위해 되돌린다 */
.result > * {
    opacity: 0;
    transform: translateY(28px);
    transition:
        opacity 0s linear 460ms,
        transform 0s linear 460ms;
}
.stage[data-phase="result"] .result > * {
    opacity: 1;
    transform: none;
    transition:
        opacity 600ms var(--out),
        transform 800ms var(--out);
}
.stage[data-phase="result"] .result > :nth-child(1) {
    transition-delay: 260ms;
}
.stage[data-phase="result"] .result > :nth-child(2) {
    transition-delay: 340ms;
}
.stage[data-phase="result"] .result > :nth-child(3) {
    transition-delay: 420ms;
}
.result-rank {
    display: inline-flex;
    align-items: center;
    font-size: 44px;
    font-weight: 600;
    color: var(--sub);
}
.result-rank .dot {
    width: 24px;
    height: 24px;
    margin-right: 18px;
}
.result-image {
    display: block;
    max-width: 100%;
    max-height: 340px;
    margin: 36px auto 0;
    object-fit: contain;
}
.result-name {
    margin-top: 24px;
    font-size: 108px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.035em;
    word-break: keep-all;
}

@media (prefers-reduced-motion: reduce) {
    .stage * {
        transition-duration: 1ms !important;
        transition-delay: 0ms !important;
    }
}
.admin {
    max-width: 880px;
    margin: 0 auto;
    padding: 40px 20px 80px;
    font-size: 16px;
}
.admin-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.admin h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}
.admin button {
    font: inherit;
    color: inherit;
    border: 0;
    background: none;
    cursor: pointer;
}
.admin button:disabled {
    opacity: 0.3;
    cursor: default;
}
.tabs,
.dates {
    display: flex;
    gap: 4px;
}
.tabs button {
    padding: 9px 16px;
    border-radius: 12px;
    font-weight: 600;
    color: var(--sub);
}
.tabs button.on {
    background: #fff;
    color: var(--ink);
}
.dates {
    margin-bottom: 14px;
    gap: 8px;
}
.dates button {
    flex: 1;
    padding: 12px 0;
    border-radius: 14px;
    background: #eaeaea;
    font-weight: 600;
    color: #666;
    font-variant-numeric: tabular-nums;
}
.dates button.on {
    background: #111;
    color: #fff;
}
.dates em {
    margin-left: 6px;
    font-style: normal;
    font-size: 12px;
    font-weight: 600;
    color: var(--pink);
}
.card {
    background: #fff;
    border-radius: 24px;
    padding: 8px 24px;
    overflow-x: auto;
}
.card.pad {
    padding: 24px;
}
.card.empty {
    padding: 64px 24px;
    text-align: center;
    color: var(--sub);
}
.admin table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}
.admin th {
    padding: 14px 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--sub);
    text-align: center;
    white-space: nowrap;
}
.admin td {
    padding: 12px 8px;
    border-top: 1px solid var(--line);
    text-align: center;
    white-space: nowrap;
}
.admin .left {
    text-align: left;
}
.admin .right {
    text-align: right;
}
.admin .strong {
    font-weight: 600;
}
.admin .muted {
    color: var(--sub);
}
.admin .zero {
    color: #f04452;
    font-weight: 600;
}
.admin .tnum {
    font-variant-numeric: tabular-nums;
}
.admin tfoot td {
    font-weight: 600;
    color: #555;
}
.admin tr.canceled td {
    color: #c4c4c4;
    text-decoration: line-through;
}
.admin tr.canceled td:last-child {
    text-decoration: none;
}
.adot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 10px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}
.stepper {
    display: inline-flex;
    align-items: center;
    background: var(--bg);
    border-radius: 12px;
}
.stepper button {
    width: 40px;
    height: 40px;
    font-size: 20px;
    color: #555;
}
.stepper input {
    width: 64px;
    height: 40px;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 600;
    text-align: center;
    outline: none;
    appearance: textfield;
    -moz-appearance: textfield;
}
.stepper.solo input {
    width: 96px;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}
.stepper:focus-within {
    box-shadow: inset 0 0 0 2px #111;
}
.name-input {
    width: 100%;
    min-width: 160px;
    height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 12px;
    background: var(--bg);
    font: inherit;
    font-weight: 600;
    outline: none;
}
.name-input:focus {
    box-shadow: inset 0 0 0 2px #111;
}
.admin .ghost,
.admin .primary {
    padding: 9px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
}
.admin .ghost {
    background: var(--bg);
}
.admin .primary {
    background: #111;
    color: #fff;
}
.note {
    margin: 14px 8px 16px;
    font-size: 14px;
    color: var(--sub);
}
.note.top {
    margin: 0 0 20px;
}
.row {
    display: flex;
    gap: 8px;
}
.admin-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.admin-title a {
    display: block;
    line-height: 0;
}
.admin-title img {
    height: 56px;
}
