/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #264850;
    --bg-dark: #1e3a40;
    --bg-darker: #172f34;
    --card-bg: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover-border: rgba(255, 255, 255, 0.18);
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.6);
    --text-soft: rgba(255, 255, 255, 0.45);
    --accent: #FFFF00;
    --accent-bg: rgba(255, 255, 0, 0.06);
    --accent-border: rgba(255, 255, 0, 0.5);
    --accent-glow: rgba(255, 255, 0, 0.15);
    --green: #4ade80;
    --green-bg: rgba(34, 197, 94, 0.15);
    --green-border: rgba(34, 197, 94, 0.3);
    --red: #f87171;
    --red-bg: rgba(239, 68, 68, 0.15);
    --red-border: rgba(239, 68, 68, 0.3);
    --blue: #60a5fa;
    --blue-bg: rgba(96, 165, 250, 0.15);
    --blue-border: rgba(96, 165, 250, 0.3);
    --orange: #fbbf24;
    --orange-bg: rgba(245, 158, 11, 0.15);
    --orange-border: rgba(245, 158, 11, 0.3);
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --radius-pill: 100px;
    --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.15);
    --shadow-card-hover: 0 8px 32px rgba(0, 0, 0, 0.25);
    --transition: 0.2s ease;
    --max-width: 800px;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

/* ===== Header ===== */
.header {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 40px 24px 24px;
    text-align: center;
}

.header__logo {
    height: auto;
    width: 160px;
    margin-bottom: 20px;
    opacity: 0.95;
}

.header__title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.header__subtitle {
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-muted);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ===== Stepper ===== */
.stepper {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 8px 24px 24px;
}

.stepper__inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.stepper__step {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.35;
    transition: opacity var(--transition);
}

.stepper__step--active {
    opacity: 1;
}

.stepper__step--done {
    opacity: 0.7;
}

.stepper__circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    transition: all var(--transition);
}

.stepper__step--active .stepper__circle {
    background: var(--accent-bg);
    border-color: var(--accent-border);
    color: var(--accent);
    box-shadow: 0 0 16px var(--accent-glow);
}

.stepper__step--done .stepper__circle {
    background: var(--green-bg);
    border-color: var(--green-border);
    color: var(--green);
}

.stepper__label {
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.stepper__line {
    width: 40px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 8px;
    flex-shrink: 0;
}

/* ===== Main ===== */
.main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px 40px;
}

/* ===== Steps ===== */
.step {
    display: none;
}

.step--active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Card Panel ===== */
.card-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 32px;
}

.card-panel--wide {
    max-width: 100%;
}

.card-panel__title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.card-panel__desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 28px;
    line-height: 1.6;
}

/* ===== Form ===== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-label--sm {
    font-size: 0.7rem;
    margin-bottom: 4px;
}

.form-label__opt {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-soft);
}

.form-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xs);
    padding: 12px 16px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-input::placeholder {
    color: var(--text-soft);
}

.form-input:focus {
    border-color: var(--accent-border);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input--sm {
    width: 80px;
    padding: 8px 12px;
    font-size: 0.85rem;
}

.form-hint {
    display: block;
    font-size: 0.7rem;
    color: var(--text-soft);
    margin-top: 4px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn--primary {
    background: var(--accent);
    color: #1a1a1a;
    padding: 12px 28px;
    font-size: 0.85rem;
    width: 100%;
    margin-top: 8px;
}

.btn--primary:hover {
    background: #e6e600;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn--primary:active {
    transform: translateY(0);
}

.btn--primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn--lg {
    padding: 14px 32px;
    font-size: 0.9rem;
}

.btn--xl {
    padding: 16px 40px;
    font-size: 1rem;
    border-radius: var(--radius-sm);
}

.btn--ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 10px 24px;
    font-size: 0.8rem;
    border-radius: var(--radius-xs);
}

.btn--ghost:hover {
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}

.btn--sm {
    padding: 6px 14px;
    font-size: 0.72rem;
}

.btn--danger {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red-border);
    padding: 6px 14px;
    font-size: 0.72rem;
}

.btn--danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-row {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

/* ===== Conditions ===== */
.condition-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.condition {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    padding: 16px;
    transition: border-color var(--transition);
}

.condition:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.condition--locked {
    opacity: 0.7;
}

.condition__header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.condition__info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.condition__name {
    font-size: 0.88rem;
    font-weight: 600;
}

.condition__desc {
    font-size: 0.75rem;
    color: var(--text-soft);
    margin-top: 6px;
    line-height: 1.5;
}

.condition__options {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ===== Toggle ===== */
.toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle__track {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 11px;
    transition: background var(--transition);
}

.toggle__track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition);
}

.toggle input:checked + .toggle__track {
    background: var(--accent);
}

.toggle input:checked + .toggle__track::after {
    transform: translateX(18px);
}

.toggle--on {
    width: 40px;
    height: 22px;
    background: var(--accent);
    border-radius: 11px;
    position: relative;
}

.toggle--on::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
}

.toggle--disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Badges ===== */
.badge {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    line-height: 1;
}

.badge--auto {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid var(--green-border);
}

.badge--manual {
    background: var(--orange-bg);
    color: var(--orange);
    border: 1px solid var(--orange-border);
}

/* ===== Summary ===== */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.summary-item {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-xs);
    padding: 12px 16px;
}

.summary-item__label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-soft);
    margin-bottom: 4px;
}

.summary-item__value {
    font-size: 0.9rem;
    font-weight: 600;
    word-break: break-all;
}

/* ===== Loading ===== */
.loading-state {
    text-align: center;
    padding: 32px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: spin 0.8s linear infinite;
}

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

.loading-state__text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== Error ===== */
.error-box {
    background: var(--red-bg);
    border: 1px solid var(--red-border);
    border-radius: var(--radius-xs);
    padding: 14px 18px;
    font-size: 0.8rem;
    color: var(--red);
    margin-top: 16px;
    line-height: 1.5;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}

.stat-card__value {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 2px;
}

.stat-card__value--accent { color: var(--accent); }
.stat-card__value--green { color: var(--green); }
.stat-card__value--red { color: var(--red); }
.stat-card__value--blue { color: var(--blue); }

.stat-card__label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-soft);
}

/* ===== Participants ===== */
.participants-panel {
    margin-bottom: 24px;
}

.participants-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-xs);
    padding: 12px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    list-style: none;
    transition: all var(--transition);
}

.participants-panel__header:hover {
    background: rgba(0, 0, 0, 0.15);
    color: var(--text);
}

.participants-panel__header::-webkit-details-marker {
    display: none;
}

.participants-panel[open] .participants-panel__header svg {
    transform: rotate(180deg);
}

.participants-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.participant-chip {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-pill);
    padding: 5px 12px;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* ===== Draw Section ===== */
.draw-section {
    text-align: center;
    padding: 8px 0 16px;
}

/* ===== Draw Animation ===== */
.draw-animation {
    text-align: center;
    padding: 40px 0;
}

.draw-animation__slot {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent);
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid var(--accent-border);
    border-radius: var(--radius-sm);
    margin: 0 auto 12px;
    max-width: 400px;
    overflow: hidden;
    letter-spacing: -0.01em;
}

.draw-animation__label {
    font-size: 0.8rem;
    color: var(--text-soft);
    font-weight: 500;
}

/* ===== Winners ===== */
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    text-align: center;
}

.winners-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.winner-card {
    background: rgba(255, 255, 0, 0.04);
    border: 1px solid rgba(255, 255, 0, 0.15);
    border-radius: var(--radius-sm);
    padding: 20px;
    animation: winnerIn 0.4s ease;
}

@keyframes winnerIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.winner-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.winner-card__rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: #1a1a1a;
    font-size: 0.75rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.winner-card__user {
    flex: 1;
    margin-left: 12px;
}

.winner-card__username {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
}

.winner-card__meta {
    font-size: 0.7rem;
    color: var(--text-soft);
    margin-top: 2px;
}

.winner-card__checks {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.check-item__box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.check-item__box:hover {
    border-color: var(--green);
}

.check-item__box--checked {
    background: var(--green-bg);
    border-color: var(--green);
    color: var(--green);
}

.winner-card__actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 32px 24px 40px;
    font-size: 0.75rem;
    color: var(--text-soft);
}

.footer__hint {
    margin-top: 4px;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.3);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header {
        padding: 32px 16px 20px;
    }

    .header__title {
        font-size: 1.5rem;
    }

    .stepper {
        padding: 8px 16px 20px;
    }

    .stepper__label {
        display: none;
    }

    .stepper__line {
        width: 24px;
    }

    .main {
        padding: 0 16px 32px;
    }

    .card-panel {
        padding: 24px 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .stat-card__value {
        font-size: 1.3rem;
    }

    .btn-row {
        flex-direction: column;
    }
}

/* ── Wide Stat Card ── */
.stat-card--wide {
    grid-column: 1 / -1;
}

/* ── Form Row ── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
}

/* ── Verify Section ── */
.verify-section {
    text-align: center;
    margin: 24px 0;
}

.verify-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.btn--accent {
    background: var(--accent);
    color: var(--bg);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn--accent:hover {
    background: #e6e600;
    transform: translateY(-1px);
}

.btn--accent:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ── Check Badges ── */
.check-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
}

.check-badge--ok {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
}

.check-badge--fail {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

.check-badge--pending {
    background: rgba(241, 196, 15, 0.15);
    color: #f1c40f;
}

/* ── Auto-verified checkbox ── */
.check-item__box--auto {
    background: rgba(46, 204, 113, 0.2) !important;
    border-color: #2ecc71 !important;
    color: #2ecc71 !important;
}

.check-item__box--failed {
    background: rgba(231, 76, 60, 0.2) !important;
    border-color: #e74c3c !important;
    color: #e74c3c !important;
}

/* ── Small Spinner ── */
.spinner--sm {
    width: 18px;
    height: 18px;
    border-width: 2px;
    display: inline-block;
    vertical-align: middle;
}
