* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Manrope', sans-serif;
    background:
        radial-gradient(circle at top left, rgba(26, 127, 114, 0.12), transparent 32%),
        radial-gradient(circle at top right, rgba(244, 183, 64, 0.16), transparent 28%),
        linear-gradient(180deg, #f9fbfc 0%, var(--background) 100%);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.page-backdrop {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.55) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.55) 1px, transparent 1px);
    background-size: 34px 34px;
    opacity: 0.22;
    pointer-events: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 18px 20px 0;
}

.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 14px 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(18px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brandmark {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.brandmark strong {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
}

.brandmark small {
    color: rgba(15, 23, 42, 0.65);
}

.brandmark-dots {
    display: inline-flex;
    gap: 5px;
    padding: 10px 11px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--secondary), color-mix(in srgb, var(--primary) 55%, white));
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
}

.brandmark-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.brandmark-dots span:nth-child(1) { background: #ff5f57; }
.brandmark-dots span:nth-child(2) { background: #febc2e; }
.brandmark-dots span:nth-child(3) { background: #28c840; }

.segmented-nav {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
}

.segmented-nav__item {
    padding: 10px 16px;
    border-radius: 999px;
    font-weight: 700;
    color: rgba(15, 23, 42, 0.72);
    transition: 180ms ease;
}

.segmented-nav__item:hover,
.segmented-nav__item.is-active {
    background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--secondary) 85%, white));
    color: #fff;
}

.page-shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 20px 80px;
    position: relative;
    z-index: 1;
}

.hero,
.page-heading,
.section-header,
.dashboard-layout,
.raffle-detail-layout {
    animation: fadeUp 380ms ease both;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 28px;
    align-items: center;
    padding: 40px 0 34px;
}

.hero-copy h1,
.page-heading h1 {
    margin: 10px 0 14px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 4vw, 4rem);
    line-height: 1.02;
}

.hero-copy p,
.page-heading p,
.panel p,
.empty-state p,
.muted {
    margin: 0;
    color: rgba(15, 23, 42, 0.72);
    line-height: 1.65;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(26, 127, 114, 0.1);
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-actions,
.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-panel__window,
.panel,
.raffle-card,
.admin-raffle-card,
.auth-card .panel,
.empty-state {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 22px 44px rgba(15, 23, 42, 0.08);
}

.hero-panel__window {
    padding: 18px;
}

.window-chrome {
    display: inline-flex;
    gap: 8px;
    margin-bottom: 18px;
}

.window-chrome span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.window-chrome span:nth-child(1) { background: #ff5f57; }
.window-chrome span:nth-child(2) { background: #febc2e; }
.window-chrome span:nth-child(3) { background: #28c840; }

.window-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.window-grid article,
.stats-grid article {
    padding: 18px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(26, 127, 114, 0.08), rgba(255, 255, 255, 0.65));
}

.window-grid strong,
.stats-grid strong {
    display: block;
    font-size: 1.7rem;
    font-weight: 800;
}

.window-grid span,
.stats-grid span {
    color: rgba(15, 23, 42, 0.66);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    cursor: pointer;
    border-radius: 16px;
    padding: 14px 18px;
    font-weight: 800;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--secondary) 88%, white));
    box-shadow: 0 14px 26px rgba(26, 127, 114, 0.24);
}

.button-secondary {
    background: rgba(26, 127, 114, 0.11);
    color: var(--primary);
}

.button-ghost {
    background: rgba(15, 23, 42, 0.06);
    color: var(--secondary);
}

.button-danger {
    background: rgba(190, 24, 93, 0.12);
    color: #be185d;
}

.button-small {
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.82rem;
}

.button-block {
    width: 100%;
}

.section-header,
.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.section-header h2,
.panel h2,
.modal h2 {
    margin: 8px 0 0;
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.35rem, 2vw, 2rem);
}

.page-heading__cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.raffle-grid,
.admin-raffles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.raffle-card,
.admin-raffle-card,
.panel,
.empty-state {
    padding: 24px;
}

.raffle-card h3,
.admin-raffle-card h3,
.empty-state h3,
.auth-card h1 {
    margin: 14px 0 10px;
    font-size: 1.3rem;
    font-family: 'Space Grotesk', sans-serif;
}

.raffle-card__top,
.admin-raffle-card__top,
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.progress-card {
    margin: 18px 0;
}

.progress-card__meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.92rem;
}

.progress-track {
    height: 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.progress-track--large {
    height: 16px;
}

.progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--primary));
}

.raffle-card__stats,
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: rgba(15, 23, 42, 0.72);
    font-size: 0.92rem;
}

.avatar-stack,
.avatar-board {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.avatar-pill {
    width: 42px;
    height: 42px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    background: rgba(15, 23, 42, 0.08);
    color: var(--secondary);
}

.avatar-pill.is-confirmed {
    background: rgba(40, 200, 64, 0.16);
    color: #166534;
    box-shadow: inset 0 0 0 1px rgba(22, 101, 52, 0.18);
}

.participant-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.04);
}

.participant-card strong,
.prize-item strong,
.winner-row strong {
    display: block;
}

.panel-head {
    margin-bottom: 18px;
}

.panel--nested {
    padding: 18px;
    background: rgba(15, 23, 42, 0.03);
    box-shadow: none;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.stats-grid--admin {
    margin-bottom: 24px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.status-chip,
.ticket-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.82rem;
}

.status-draft { background: rgba(15, 23, 42, 0.08); color: var(--secondary); }
.status-published { background: rgba(26, 127, 114, 0.12); color: var(--primary); }
.status-full { background: rgba(244, 183, 64, 0.18); color: #9a6700; }
.status-finished { background: rgba(96, 165, 250, 0.18); color: #1d4ed8; }

.ticket-badge.pending { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.ticket-badge.confirmed { background: rgba(34, 197, 94, 0.14); color: #166534; }

.empty-state {
    text-align: center;
}

.empty-state--compact {
    padding: 32px 24px;
}

.auth-card {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 220px);
}

.auth-card .panel {
    width: min(100%, 520px);
}

.stack-medium,
.stack-large {
    display: grid;
    gap: 18px;
}

.stack-large {
    gap: 24px;
}

.raffle-detail-layout,
.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.9fr);
    gap: 22px;
}

.field,
.checkbox-row {
    display: grid;
    gap: 8px;
}

.field span,
.checkbox-row span {
    font-weight: 800;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 2px solid color-mix(in srgb, var(--primary) 28%, transparent);
    border-color: var(--primary);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.field--wide {
    grid-column: 1 / -1;
}

.checkbox-row {
    grid-template-columns: auto 1fr;
    align-items: center;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
}

.legend-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.legend-dot.available { background: rgba(15, 23, 42, 0.18); }
.legend-dot.pending { background: #f59e0b; }
.legend-dot.confirmed { background: #22c55e; }

.ticket-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 10px;
}

.ticket-cell {
    min-height: 72px;
    border: 0;
    border-radius: 18px;
    padding: 10px 6px;
    display: grid;
    place-items: center;
    gap: 4px;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.ticket-cell strong {
    font-size: 0.95rem;
}

.ticket-cell small {
    opacity: 0.74;
    min-height: 16px;
}

.ticket-cell.is-available {
    background: rgba(15, 23, 42, 0.06);
    color: var(--secondary);
}

.ticket-cell.is-available:hover,
.ticket-cell.is-selected {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    box-shadow: 0 16px 24px rgba(15, 23, 42, 0.16);
    transform: translateY(-2px);
}

.ticket-cell.is-pending {
    background: rgba(245, 158, 11, 0.18);
    color: #9a6700;
}

.ticket-cell.is-confirmed {
    background: rgba(34, 197, 94, 0.17);
    color: #166534;
}

.ticket-cell:disabled {
    cursor: default;
}

.selection-summary,
.draw-status,
.setup-box {
    padding: 16px 18px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.04);
}

.selection-summary strong,
.draw-status strong,
.setup-box strong {
    display: block;
}

.prize-list,
.winners-list {
    display: grid;
    gap: 12px;
}

.prize-item,
.winner-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.04);
}

.prize-item span,
.winner-row span {
    font-size: 1.3rem;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.color-grid input[type="color"] {
    min-height: 52px;
    padding: 8px;
}

.prize-editor {
    display: grid;
    gap: 12px;
}

.prize-editor__item {
    display: grid;
    grid-template-columns: auto 1.4fr 0.8fr auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.drag-handle {
    cursor: grab;
    user-select: none;
    font-size: 1.1rem;
    color: rgba(15, 23, 42, 0.45);
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    vertical-align: top;
}

.inline-actions--tight {
    gap: 8px;
}

.field-actions {
    display: flex;
    align-items: flex-end;
}

.flash {
    margin-bottom: 18px;
    padding: 16px 18px;
    border-radius: 20px;
    font-weight: 700;
}

.flash-success {
    background: rgba(34, 197, 94, 0.12);
    color: #166534;
}

.flash-error {
    background: rgba(190, 24, 93, 0.12);
    color: #9d174d;
}

.modal[hidden] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 22px;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
}

.modal__dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 480px);
    padding: 24px;
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
}

.modal__dialog--wide {
    width: min(100%, 760px);
}

.modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    background: rgba(15, 23, 42, 0.08);
    font-size: 1.6rem;
}

.draw-wheel-wrap {
    position: relative;
    display: grid;
    place-items: center;
    padding: 12px 0 8px;
}

.draw-pointer {
    position: absolute;
    top: 0;
    width: 0;
    height: 0;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-top: 30px solid #be185d;
    filter: drop-shadow(0 8px 10px rgba(15, 23, 42, 0.2));
}

#draw-wheel {
    width: min(100%, 520px);
    height: auto;
}

.draw-result {
    text-align: center;
    padding-top: 10px;
}

.site-footer {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px 28px;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    color: rgba(15, 23, 42, 0.72);
}

.site-footer strong {
    display: block;
    margin-bottom: 6px;
}

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

@media (max-width: 980px) {
    .hero,
    .dashboard-layout,
    .raffle-detail-layout,
    .stats-grid--admin {
        grid-template-columns: 1fr;
    }

    .topbar-inner,
    .page-heading,
    .section-header,
    .panel-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .window-grid,
    .stats-grid,
    .form-grid,
    .color-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .page-shell {
        padding: 22px 14px 64px;
    }

    .topbar {
        padding: 12px 12px 0;
    }

    .topbar-inner,
    .raffle-card,
    .admin-raffle-card,
    .panel,
    .modal__dialog {
        border-radius: 22px;
    }

    .ticket-grid {
        grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
    }

    .prize-editor__item {
        grid-template-columns: 1fr;
    }

    .site-footer {
        flex-direction: column;
        padding: 0 14px 24px;
    }
}

.quick-draw-body {
    --quick-draw-logo: none;
}

.quick-draw-body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: var(--quick-draw-logo);
    background-repeat: no-repeat;
    background-position: center;
    background-size: min(62vw, 720px);
    opacity: 0.11;
    filter: blur(18px) saturate(0.8);
    transform: scale(1.08);
    pointer-events: none;
    z-index: 0;
}

.quick-draw-body .page-shell {
    max-width: none;
    padding-left: 24px;
    padding-right: 24px;
}

.quick-draw-body .site-footer {
    max-width: none;
    padding-left: 24px;
    padding-right: 24px;
}

.quick-draw-hero,
.quick-draw-layout {
    position: relative;
    z-index: 1;
}

.quick-draw-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    padding: 32px 0 24px;
}

.quick-draw-hero__copy {
    max-width: 860px;
}

.quick-draw-hero__copy h1 {
    margin: 10px 0 14px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.2rem, 5vw, 4.8rem);
    line-height: 0.98;
}

.quick-draw-hero__copy p {
    max-width: 760px;
    color: rgba(15, 23, 42, 0.78);
}

.quick-draw-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.quick-draw-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
    gap: 22px;
}

.quick-draw-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.quick-draw-preview-list {
    display: grid;
    gap: 10px;
    max-height: 430px;
    overflow: auto;
    padding-right: 4px;
}

.quick-draw-preview-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.04);
}

.quick-draw-preview-item strong {
    font-family: 'Space Grotesk', sans-serif;
}

.quick-draw-preview-item small {
    color: rgba(15, 23, 42, 0.58);
}

.quick-draw-stage .modal__dialog--wide {
    width: min(100%, 1320px);
}

.quick-draw-stage__dialog {
    background:
        radial-gradient(circle at top left, rgba(244, 183, 64, 0.16), transparent 30%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(243, 248, 250, 0.96));
}

.quick-draw-stage__board {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: 24px;
    align-items: center;
    margin-top: 18px;
}

.quick-draw-stage__wheel {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 720px;
    border-radius: 34px;
    background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.95), rgba(15, 23, 42, 0.03));
    overflow: hidden;
}

#quick-draw-wheel,
#quick-draw-particles {
    width: min(100%, 720px);
    height: auto;
}

#quick-draw-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.quick-draw-stage__spin {
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: 148px;
    height: 148px;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    font-weight: 800;
    text-align: center;
    padding: 18px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 22px 34px rgba(15, 23, 42, 0.28);
}

.quick-draw-stage__spin:disabled {
    cursor: default;
    opacity: 0.65;
}

.quick-draw-stage__pointer {
    top: 18px;
    z-index: 2;
}

.quick-draw-stage__side {
    display: grid;
    gap: 18px;
}

.quick-draw-stage__result {
    min-height: 150px;
    display: grid;
    align-items: center;
    padding: 18px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.quick-draw-stage__winner {
    background: rgba(255, 255, 255, 0.92);
}

.quick-draw-stage__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.quick-draw-stage__redo {
    opacity: 0.72;
}

.quick-draw-upload {
    position: relative;
    overflow: hidden;
}

@media (max-width: 1080px) {
    .quick-draw-layout,
    .quick-draw-stage__board {
        grid-template-columns: 1fr;
    }

    .quick-draw-stage__wheel {
        min-height: 520px;
    }
}

@media (max-width: 760px) {
    .quick-draw-body .page-shell,
    .quick-draw-body .site-footer {
        padding-left: 14px;
        padding-right: 14px;
    }

    .quick-draw-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .quick-draw-preview-item {
        grid-template-columns: 1fr;
    }

    .quick-draw-stage__wheel {
        min-height: 360px;
    }

    .quick-draw-stage__spin {
        width: 116px;
        height: 116px;
        font-size: 0.86rem;
    }
}
