/* ================================================================
   Gonza Raffle Draw global stylesheet
   Colour palette mirrors cente_events (Gonza Ticketing).
   ================================================================ */

:root {
    --primary-color: #003FA2;
    --primary-dark: #002d76;
    --primary-glow: rgba(0, 63, 162, 0.32);
    --secondary-color: #D15460;
    --secondary-dark: #a83b46;
    --secondary-glow: rgba(209, 84, 96, 0.32);

    --background-color: #ffffff;
    --panel: #ffffff;
    --panel-alt: #f8f9fa;
    --text-color: #333333;
    --ink: #333333;
    --ink-soft: #6b7280;
    --light-gray: #f8f9fa;
    --border-color: #dee2e6;

    --success: #16a34a;
    --warn: #f59e0b;
    --danger: #dc3545;

    --radius: 12px;
    --shadow-1: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-2: 0 12px 30px rgba(15, 23, 42, 0.12);
    --shadow-3: 0 25px 60px rgba(15, 23, 42, 0.22);

    --font: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "Menlo", "Monaco", "Consolas", monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    font-family: var(--font);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-color); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

/* ---------- Topbar (matches cente_events anonymous navbar sizing) ---------- */
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 24px;
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    position: sticky; top: 0; z-index: 10;
}
.brand {
    display: inline-flex; align-items: center; gap: 14px;
    color: #fff; font-weight: 600; font-size: 22px; text-decoration: none;
}
.brand:hover { color: #fff; text-decoration: none; opacity: 0.95; }
.brand-logo { height: 100px; width: auto; display: block; }
.brand-text { letter-spacing: -0.01em; }

.topbar-user { display: flex; align-items: center; gap: 16px; }
.user-block { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.user-name { font-weight: 600; font-size: 14px; color: #fff; }
.user-org { font-size: 12px; color: rgba(255,255,255,0.75); }
.logout-link { font-size: 14px; color: rgba(255,255,255,0.85); }
.logout-link:hover { color: #fff; text-decoration: none; }

/* ---------- Content ---------- */
.content {
    max-width: 1080px; margin: 0 auto; padding: 32px 24px 80px;
}
.back-link {
    display: inline-block; margin-bottom: 18px; font-size: 14px; color: var(--ink-soft);
}
.back-link:hover { color: var(--primary-color); text-decoration: none; }

.page-head {
    display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
    margin-bottom: 24px; flex-wrap: wrap;
}
.page-title { margin: 0; font-size: 28px; font-weight: 700; color: var(--primary-color); letter-spacing: -0.01em; }
.page-sub { margin: 6px 0 0; color: var(--ink-soft); font-size: 15px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
    background: #fff; color: var(--ink);
    font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); text-decoration: none; }
.btn-primary {
    background: var(--primary-color); color: #fff; border-color: var(--primary-color);
    box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; box-shadow: 0 8px 22px var(--primary-glow); }
.btn-ghost { background: transparent; border-color: var(--border-color); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { color: #fff; }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-huge { padding: 18px 42px; font-size: 20px; border-radius: 12px; }

.btn-glow {
    position: relative; overflow: hidden;
    animation: pulse-glow 2.4s ease-in-out infinite;
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 4px 14px var(--primary-glow); }
    50%      { box-shadow: 0 14px 36px rgba(0, 63, 162, 0.55); }
}

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row.centered { justify-content: center; }

/* ---------- Messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.msg {
    padding: 12px 14px; border-radius: 8px; font-size: 14px;
    animation: slide-in 0.35s ease;
}
.msg-success { background: #eafaf1; color: #14532d; border: 1px solid #b7e4c7; }
.msg-error   { background: #fdecea; color: #721c24; border: 1px solid #f5c2c7; }
.msg-warning { background: #fff8e1; color: #78350f; border: 1px solid #fde68a; }
.msg-info    { background: #e8f0fc; color: var(--primary-dark); border: 1px solid #c7d7f2; }

@keyframes slide-in {
    from { transform: translateY(-6px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ---------- Forms ---------- */
.stacked-form { display: grid; gap: 16px; }
.stacked-form label {
    display: grid; gap: 6px; font-size: 14px; color: var(--ink);
    font-weight: 600;
}
.stacked-form label em { font-style: normal; font-weight: 400; color: #94a3b8; }
.stacked-form input[type=text],
.stacked-form input[type=password],
.stacked-form input[type=email],
.stacked-form input[type=tel],
.stacked-form select,
.stacked-form textarea {
    padding: 11px 12px; border-radius: 8px; border: 1px solid var(--border-color);
    font-family: inherit; font-size: 15px; color: var(--ink); background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
}
.stacked-form input:focus, .stacked-form select:focus {
    outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-glow);
}
.field-error { color: var(--danger); font-size: 13px; margin: 4px 0 0; }

.file-drop { position: relative; }
.file-drop input[type=file] {
    position: absolute; inset: 22px 0 0 0; opacity: 0; cursor: pointer;
    height: calc(100% - 22px);
}
.file-drop-hint {
    padding: 22px; border: 2px dashed var(--border-color); border-radius: 10px;
    text-align: center; color: var(--ink-soft); background: var(--panel-alt);
    transition: border-color 0.15s ease, background 0.15s ease;
    pointer-events: none;
}
.file-drop:hover .file-drop-hint { border-color: var(--primary-color); background: #e8f0fc; }
.file-drop-hint.has-file { border-style: solid; border-color: var(--success); color: #14532d; background: #eafaf1; }

.cover-preview {
    margin-top: 10px; border-radius: 10px; overflow: hidden;
    background: var(--panel-alt); border: 1px solid var(--border-color);
    display: flex; flex-direction: column;
}
.cover-preview img {
    max-width: 100%; max-height: 260px; width: 100%;
    object-fit: cover; display: block;
    background: var(--panel-alt);
}
.cover-preview-label {
    padding: 6px 12px; font-size: 12px; font-weight: 600;
    color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border-color);
    background: #fff;
}

.fieldset { border: 1px solid var(--border-color); border-radius: 10px; padding: 14px 16px; }
.fieldset legend { padding: 0 6px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.check-item {
    display: flex; align-items: center; gap: 8px; padding: 8px 10px;
    border: 1px solid var(--border-color); border-radius: 8px; background: #fff;
    cursor: pointer; font-weight: 500; color: var(--ink);
}
.check-item:hover { border-color: var(--primary-color); }
.check-item input { accent-color: var(--primary-color); }

.sample-details {
    background: var(--panel-alt); border: 1px solid var(--border-color); border-radius: 10px;
    padding: 10px 14px;
}
.sample-details summary { cursor: pointer; font-weight: 600; color: var(--ink-soft); }
.sample-table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 13px; }
.sample-table th, .sample-table td {
    padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}
.sample-table th { color: var(--ink-soft); font-weight: 600; width: 200px; }

/* ---------- Cards / panels ---------- */
.card-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.raffle-card {
    display: block; border-radius: var(--radius);
    background: #fff; border: 1px solid var(--border-color); box-shadow: var(--shadow-1);
    color: var(--ink); text-decoration: none; overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.raffle-card:hover {
    transform: translateY(-3px); text-decoration: none;
    box-shadow: var(--shadow-2); border-color: var(--primary-color);
}
.raffle-card-cover {
    height: 140px;
    background-color: var(--panel-alt); background-size: cover; background-position: center;
}
.raffle-card-cover-placeholder {
    display: flex; align-items: center; justify-content: center;
    font-size: 46px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
}
.raffle-card-body { padding: 18px 20px; }
.raffle-card-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; color: var(--primary-color); }
.raffle-card-meta { color: var(--ink-soft); font-size: 13px; display: flex; gap: 6px; }
.raffle-card-foot { margin-top: 14px; display: flex; justify-content: space-between; align-items: center; }
.raffle-card-date { font-size: 12px; color: #94a3b8; }
.tag {
    padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.tag-ready { background: #eafaf1; color: #14532d; }
.tag-draft { background: #fff8e1; color: #78350f; }

.empty-state {
    padding: 60px 20px; text-align: center; background: #fff;
    border: 1px dashed var(--border-color); border-radius: var(--radius);
}
.empty-icon { font-size: 42px; margin-bottom: 10px; }
.empty-state h2 { margin: 0 0 6px; color: var(--primary-color); }
.empty-state p { color: var(--ink-soft); margin: 0 0 18px; }

.form-card {
    max-width: 640px; margin: 0 auto; padding: 28px;
    background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius);
    box-shadow: var(--shadow-2);
}
.form-title { margin: 0 0 6px; font-size: 22px; font-weight: 700; color: var(--primary-color); letter-spacing: -0.01em; }
.form-sub { margin: 0 0 20px; color: var(--ink-soft); font-size: 14px; }

.detail-cover {
    height: 220px; border-radius: var(--radius); background-size: cover; background-position: center;
    margin-bottom: 22px; box-shadow: var(--shadow-2);
}

.two-col {
    display: grid; grid-template-columns: 1fr 1.4fr; gap: 20px;
}
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
.panel {
    padding: 22px; background: #fff; border: 1px solid var(--border-color);
    border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.panel-title { margin: 0 0 14px; font-size: 16px; font-weight: 700; color: var(--primary-color); }
.kv-list { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; margin: 0; font-size: 14px; }
.kv-list dt { color: var(--ink-soft); font-weight: 600; }
.kv-list dd { margin: 0; }
.chip {
    display: inline-block; padding: 3px 9px; margin: 0 4px 4px 0;
    background: #e8f0fc; color: var(--primary-dark); border-radius: 999px;
    font-size: 12px; font-weight: 500;
}
.empty-note { color: var(--ink-soft); font-size: 14px; }

/* ---------- Publish page bits ---------- */
.published-banner {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; margin: 0 0 18px;
    background: #eafaf1; color: #14532d;
    border: 1px solid #b7e4c7; border-radius: 8px;
    font-size: 14px;
}
.published-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.18);
    animation: pulse-dot 1.8s ease-in-out infinite;
}
.published-url { word-break: break-all; font-weight: 600; color: var(--success); }
@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.18); }
    50%      { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0.10); }
}
.panel + .panel { margin-top: 16px; }
.panel-title-em {
    font-style: normal; font-weight: 400; color: var(--ink-soft); font-size: 13px;
    margin-left: 6px;
}

.profile-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
.profile-card {
    display: flex; flex-direction: column;
    border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden;
    background: #fff; box-shadow: var(--shadow-1);
}
.profile-photo {
    height: 180px; background: var(--panel-alt);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.profile-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-photo-placeholder {
    font-size: 46px;
    color: rgba(255,255,255,0.9);
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}
.profile-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.profile-pos { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--primary-color); font-weight: 700; }
.profile-name { font-size: 16px; font-weight: 700; color: var(--ink); }
.profile-ref { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); letter-spacing: 0.04em; }
.profile-bio { font-size: 13px; color: var(--ink-soft); margin: 6px 0 8px; }

.gallery-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px; margin-top: 12px;
}
.gallery-item {
    position: relative;
    border-radius: 10px; overflow: hidden;
    border: 1px solid var(--border-color); background: var(--panel-alt);
    aspect-ratio: 4 / 3;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-caption {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 6px 10px; font-size: 12px; color: #fff;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.75) 100%);
}
.gallery-delete { position: absolute; top: 6px; right: 6px; margin: 0; }
.gallery-delete-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%;
    background: rgba(15, 23, 42, 0.7); color: #fff;
    border: none; font-size: 16px; line-height: 1; cursor: pointer;
    padding: 0;
}
.gallery-delete-btn:hover { background: var(--danger); }

.winner-actions { margin-top: 10px; }

/* Multi-file gallery picker */
.photo-picker {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 32px 20px;
    text-align: center;
    background: var(--panel-alt);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
.photo-picker:hover,
.photo-picker.is-drag {
    border-color: var(--primary-color);
    background: #e8f0fc;
}
.photo-picker.is-drag { transform: scale(1.01); }
.photo-picker input[type=file] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer;
    width: 100%; height: 100%;
}
.photo-picker-icon { font-size: 40px; margin-bottom: 6px; }
.photo-picker-hint { color: var(--ink); font-weight: 600; font-size: 15px; }
.photo-picker-sub { font-size: 12px; margin-top: 4px; color: var(--ink-soft); }

.photo-picker-previews {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.photo-preview {
    display: flex; flex-direction: column;
    border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden;
    background: #fff; box-shadow: var(--shadow-1);
    animation: pop-in 0.25s ease;
}
.photo-preview-thumb { position: relative; }
.photo-preview-thumb img {
    display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover;
    background: var(--panel-alt);
}
.photo-preview-remove {
    position: absolute; top: 6px; right: 6px;
    width: 26px; height: 26px; border-radius: 50%;
    background: rgba(15, 23, 42, 0.75); color: #fff;
    border: none; font-size: 16px; line-height: 1; cursor: pointer;
    padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
}
.photo-preview-remove:hover { background: var(--danger); }
.photo-preview-meta {
    padding: 6px 10px; font-size: 11px; color: var(--ink-soft);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo-preview-caption {
    border: none; padding: 8px 10px; font-size: 13px;
    font-family: inherit; background: #fff; color: var(--ink);
    width: 100%;
}
.photo-preview-caption:focus { outline: none; background: var(--panel-alt); }

/* ---------- Winners on detail ---------- */
.winner-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.winner-item {
    display: flex; gap: 14px; padding: 14px;
    border: 1px solid var(--border-color); border-radius: 10px; background: var(--panel-alt);
}
.winner-pos {
    width: 48px; height: 48px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.winner-body { flex: 1; }
.winner-ref { font-family: var(--mono); font-size: 18px; font-weight: 700; letter-spacing: 0.05em; color: var(--ink); }
.winner-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; font-size: 13px; color: var(--ink-soft); }
.winner-date { margin-top: 6px; font-size: 12px; color: #94a3b8; }

/* ---------- Auth screen ---------- */
.auth-shell {
    min-height: calc(100vh - 200px);
    display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(900px 500px at 15% -10%, rgba(0,63,162,0.10), transparent 60%),
        radial-gradient(700px 400px at 100% 20%, rgba(209,84,96,0.10), transparent 60%);
    padding: 40px 16px;
    border-radius: var(--radius);
}
.auth-card {
    width: 100%; max-width: 400px; padding: 36px 32px;
    background: #fff; border-radius: 16px; box-shadow: var(--shadow-3);
    border-top: 4px solid var(--primary-color);
}
.auth-title { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.01em; color: var(--primary-color); }
.auth-sub { margin: 0 0 20px; color: var(--ink-soft); }

/* ---------- Animation utility ---------- */
.animate-pop { animation: pop-in 0.4s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes pop-in {
    from { transform: translateY(10px) scale(0.985); opacity: 0; }
    to   { transform: translateY(0) scale(1);        opacity: 1; }
}

.hidden { display: none !important; }

/* ================================================================
   Run stage: the animated draw
   ================================================================ */

.bg-stage {
    background:
        radial-gradient(1000px 700px at 50% -20%, rgba(0, 63, 162, 0.55) 0%, transparent 60%),
        radial-gradient(800px 500px at 15% 100%, rgba(0, 63, 162, 0.45) 0%, transparent 60%),
        radial-gradient(800px 500px at 85% 100%, rgba(209, 84, 96, 0.35) 0%, transparent 60%),
        #001a45;
    color: #f8fafc;
    overflow-x: hidden;
    position: relative;
}
.bg-stage .topbar {
    background: rgba(0, 26, 69, 0.75);
    backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    box-shadow: none;
}
.bg-stage .brand,
.bg-stage .brand:hover { color: #fff; }
.bg-stage .user-name { color: #f8fafc; }
.bg-stage .user-org { color: rgba(255,255,255,0.7); }
.bg-stage .logout-link { color: rgba(255,255,255,0.8); }
.bg-stage .logout-link:hover { color: #fff; }
.bg-stage .content { max-width: 1200px; }

.stage {
    padding: 20px 0 60px;
    position: relative; z-index: 1;
}
.stage-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 0 4px 30px;
}
.stage-eyebrow { text-transform: uppercase; letter-spacing: 0.2em; font-size: 12px; color: #a8c1f0; }
.stage-title { margin: 4px 0 0; font-size: 34px; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.bg-stage .btn-ghost { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.18); color: #f8fafc; }
.bg-stage .btn-ghost:hover { background: rgba(255,255,255,0.15); }

.stage-cover {
    position: relative; z-index: 1;
    margin: 0 auto 24px;
    max-width: 900px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 20px 45px rgba(0,0,0,0.35);
    background: rgba(255,255,255,0.04);
}
.stage-cover img {
    display: block;
    width: 100%;
    max-height: 260px;
    object-fit: cover;
}

.stage-body {
    position: relative;
    min-height: 50vh;
    display: flex; align-items: center; justify-content: center;
}
.phase {
    width: 100%; max-width: 900px;
    text-align: center;
    animation: phase-in 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes phase-in {
    from { transform: translateY(14px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Idle phase */
.idle-badge {
    display: inline-block; padding: 8px 16px; border-radius: 999px;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
    color: #dbe6fb; font-size: 13px; letter-spacing: 0.05em; text-transform: uppercase;
    margin-bottom: 18px;
}
.idle-column { font-size: 22px; margin-bottom: 8px; color: #eaf0fb; }
.idle-column strong { color: #fff; }
.idle-remaining { color: #a8c1f0; font-size: 14px; margin-bottom: 30px; }

/* Shuffle phase */
.phase-eyebrow {
    text-transform: uppercase; letter-spacing: 0.28em; font-size: 12px;
    color: #a8c1f0; margin-bottom: 8px;
}
.shuffle-column-name, .reveal-column-name {
    font-size: 14px; color: #a8c1f0; margin-bottom: 20px;
    text-transform: uppercase; letter-spacing: 0.15em;
}

/* Vertical marquee: numbers flow UPWARD in multiple columns */
.marquee-v {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    height: 340px;
    overflow: hidden;
    padding: 14px 14px;
    margin-bottom: 28px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: inset 0 0 60px rgba(0,0,0,0.45);
}
.marquee-v::before, .marquee-v::after {
    content: ''; position: absolute; left: 0; right: 0; height: 80px; z-index: 2; pointer-events: none;
}
.marquee-v::before { top: 0;    background: linear-gradient(180deg, #001a45 0%, transparent 100%); }
.marquee-v::after  { bottom: 0; background: linear-gradient(0deg,   #001a45 0%, transparent 100%); }

.marquee-col {
    position: relative;
    overflow: hidden;
}
.marquee-track-v {
    display: flex; flex-direction: column; gap: 10px;
    padding: 6px 0;
    will-change: transform;
    animation: marquee-scroll-up 8s linear infinite;
}
.marquee-item-v {
    display: block; padding: 10px 6px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 10px;
    font-family: var(--mono);
    font-size: 16px; font-weight: 700; letter-spacing: 0.04em;
    color: #f8fafc; text-align: center;
    text-shadow: 0 0 20px rgba(168, 193, 240, 0.35);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

@keyframes marquee-scroll-up {
    from { transform: translateY(0); }
    to   { transform: translateY(-50%); }
}

@media (max-width: 640px) {
    .marquee-v { grid-template-columns: repeat(3, 1fr); height: 300px; }
    .marquee-col:nth-child(4), .marquee-col:nth-child(5) { display: none; }
}

.shuffle-countdown {
    display: inline-flex; align-items: center; justify-content: center;
    width: 100px; height: 100px;
    position: relative;
}
.progress-ring {
    position: absolute; inset: 0; border-radius: 50%;
    background:
        conic-gradient(from -90deg, var(--secondary-color) var(--pct, 0%), rgba(255,255,255,0.10) 0);
    padding: 6px;
    mask: radial-gradient(circle 44px, transparent 42px, black 44px);
    -webkit-mask: radial-gradient(circle 44px, transparent 42px, black 44px);
}
.countdown-label {
    position: relative; font-size: 28px; font-weight: 800; color: #fff; z-index: 1;
}
.countdown-label span { color: var(--secondary-color); }

/* Reveal phase: slots sit on a single line and scale to fit the row. */
.digit-row {
    display: inline-flex;
    flex-wrap: nowrap;
    justify-content: center;
    max-width: 100%;
    gap: var(--slot-gap, 12px);
    margin: 8px 0 22px;
}
.digit-slot {
    flex: 0 0 auto;
    width: var(--slot-w, 68px);
    height: var(--slot-h, 88px);
    background: linear-gradient(180deg, #001a45, #002d76);
    border: 1px solid rgba(168, 193, 240, 0.35);
    border-radius: calc(var(--slot-w, 68px) * 0.15);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--mono); font-size: var(--slot-fs, 42px); font-weight: 800;
    color: #f8fafc; overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5), 0 12px 30px rgba(0,0,0,0.35);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.digit-slot.rolling .digit-reel {
    animation: reel-blur 0.1s linear infinite;
}
.digit-slot.locked {
    background: linear-gradient(180deg, var(--secondary-color), #e77b86);
    border-color: #fff;
    color: #fff;
    box-shadow:
        inset 0 0 20px rgba(255,255,255,0.18),
        0 0 40px var(--secondary-glow),
        0 20px 40px rgba(209, 84, 96, 0.35);
    transform: translateY(-4px) scale(1.06);
    animation: slot-lock 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes reel-blur {
    from { transform: translateY(-3px); }
    to   { transform: translateY(3px); }
}
@keyframes slot-lock {
    0%   { transform: translateY(0) scale(1); }
    30%  { transform: translateY(-10px) scale(1.15); }
    100% { transform: translateY(-4px) scale(1.06); }
}
.reveal-hint { color: #dbe6fb; font-size: 15px; }

/* Winner celebration modal: light-themed pop-over */
@keyframes crown-bounce {
    0%, 100% { transform: translateY(0) rotate(-4deg); }
    50%      { transform: translateY(-8px) rotate(4deg); }
}

body.modal-open { overflow: hidden; }

.winner-modal-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0, 20, 55, 0.55);
    backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    animation: overlay-in 0.25s ease;
}
@keyframes overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.winner-modal {
    position: relative; z-index: 1;
    width: 100%; max-width: 520px;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 34px 32px 28px;
    text-align: center;
    color: var(--ink);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.35),
        0 0 0 4px rgba(255, 255, 255, 0.08);
    animation: winner-modal-in 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.winner-modal-close {
    position: absolute; top: 12px; right: 12px;
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(15, 23, 42, 0.06); color: var(--ink-soft);
    border: none; font-size: 22px; line-height: 1; cursor: pointer;
    padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.winner-modal-close:hover {
    background: rgba(15, 23, 42, 0.12); color: var(--ink);
    transform: rotate(90deg);
}
@keyframes winner-modal-in {
    from { transform: translateY(16px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0)     scale(1);    opacity: 1; }
}

.winner-modal-crown {
    font-size: 64px; line-height: 1;
    animation: crown-bounce 1.4s ease-in-out infinite;
    filter: drop-shadow(0 6px 18px rgba(251, 191, 36, 0.5));
}
.winner-modal-eyebrow {
    margin-top: 8px;
    color: var(--primary-color);
    text-transform: uppercase; letter-spacing: 0.24em; font-size: 12px; font-weight: 700;
}
.winner-modal-title {
    margin: 4px 0 20px;
    font-size: 28px; font-weight: 800; letter-spacing: -0.01em;
    color: var(--primary-color);
}
.winner-modal-ref-label {
    color: var(--ink-soft);
    text-transform: uppercase; letter-spacing: 0.15em;
    font-size: 12px; font-weight: 600;
    margin-bottom: 6px;
}
.winner-modal-ref {
    font-family: var(--mono);
    font-size: 34px; font-weight: 800; letter-spacing: 0.08em;
    color: var(--secondary-color);
    padding: 14px 18px; margin: 0 auto 22px;
    background: #fff5f6;
    border: 2px dashed rgba(209, 84, 96, 0.35);
    border-radius: 12px;
    display: inline-block;
    max-width: 100%;
    overflow-wrap: anywhere;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.6);
}

.winner-modal-details {
    display: grid; gap: 10px;
    text-align: left;
    padding: 16px 18px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-1);
}
.winner-detail-row {
    display: grid; grid-template-columns: 130px 1fr; gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 15px;
}
.winner-detail-row:last-child { border-bottom: none; }
.wd-key {
    color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.08em;
    font-size: 11px; font-weight: 700; align-self: center;
}
.wd-val { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }

.winner-modal-actions {
    display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
}

/* ================================================================
   Public page (no auth)
   ================================================================ */

.public-body {
    background:
        radial-gradient(1000px 500px at 20% -10%, rgba(0, 63, 162, 0.10), transparent 60%),
        radial-gradient(800px 400px at 100% 10%, rgba(209, 84, 96, 0.10), transparent 60%),
        #ffffff;
}
.public-topbar {
    padding: 1rem 24px;
    background: var(--primary-color); color: #fff;
    display: flex; align-items: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.brand-public { color: #fff; }

.public-main {
    max-width: 960px; margin: 0 auto; padding: 32px 20px 60px;
}

.public-hero {
    text-align: center;
    margin-bottom: 32px;
}
.public-cover {
    height: 320px; border-radius: 18px;
    background-size: cover; background-position: center;
    margin-bottom: 22px; box-shadow: var(--shadow-2);
}
.public-title {
    font-size: 40px; letter-spacing: -0.02em; color: var(--primary-color);
    margin: 0 0 6px;
}
.public-org {
    font-size: 14px; color: var(--ink-soft);
    text-transform: uppercase; letter-spacing: 0.12em;
    margin-bottom: 6px;
}
.public-date { font-size: 13px; color: var(--ink-soft); }

.public-section { margin: 44px 0; }
.public-section-title {
    font-size: 22px; color: var(--primary-color); font-weight: 700;
    margin: 0 0 18px; padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}
.public-about {
    color: var(--ink); font-size: 16px; line-height: 1.7;
}

.public-winners {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}
.public-winner-card {
    background: #fff; border: 1px solid var(--border-color); border-radius: 14px;
    overflow: hidden; box-shadow: var(--shadow-1);
    display: flex; flex-direction: column;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.public-winner-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.public-winner-photo {
    height: 240px; background: var(--panel-alt);
    overflow: hidden;
}
.public-winner-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.public-winner-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.public-winner-pos {
    color: var(--primary-color); font-size: 12px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.12em;
}
.public-winner-name { margin: 0; font-size: 20px; color: var(--ink); }
.public-winner-ref {
    font-family: var(--mono); font-size: 14px; color: var(--secondary-color);
    letter-spacing: 0.04em; font-weight: 700;
}
.public-winner-bio { color: var(--ink); font-size: 14px; line-height: 1.6; margin-top: 6px; }

.public-gallery {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.public-gallery-item {
    margin: 0; border-radius: 12px; overflow: hidden; background: var(--panel-alt);
    border: 1px solid var(--border-color); box-shadow: var(--shadow-1);
    display: flex; flex-direction: column;
}
.public-gallery-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.public-gallery-item figcaption {
    padding: 8px 12px; font-size: 13px; color: var(--ink-soft);
}

.public-footer {
    padding: 24px; text-align: center; color: var(--ink-soft); font-size: 13px;
    border-top: 1px solid var(--border-color); background: var(--panel-alt);
}

.public-error {
    text-align: center;
    max-width: 560px;
    margin: 60px auto;
    padding: 48px 28px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: var(--shadow-2);
}
.public-error-icon {
    font-size: 72px; line-height: 1;
    margin-bottom: 14px;
    filter: drop-shadow(0 8px 20px rgba(0, 63, 162, 0.15));
}
.public-error-code {
    display: inline-block;
    padding: 5px 12px; margin-bottom: 14px;
    background: #e8f0fc; color: var(--primary-color);
    border-radius: 999px;
    font-size: 12px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.14em;
}
.public-error-title {
    font-size: 28px; letter-spacing: -0.01em;
    color: var(--primary-color); margin: 0 0 12px;
}
.public-error-message {
    font-size: 15px; color: var(--ink-soft); line-height: 1.65;
    margin: 0;
}

.public-gallery-item.is-clickable,
.public-winner-card.is-clickable {
    cursor: zoom-in;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.public-gallery-item.is-clickable:hover,
.public-winner-card.is-clickable:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-2);
}
.public-gallery-item.is-clickable:focus,
.public-winner-card.is-clickable:focus {
    outline: 3px solid var(--primary-color); outline-offset: 3px;
}
.public-winner-card.is-clickable {
    cursor: pointer;
}

/* Lightbox */
.lightbox {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(0, 0, 0, 0.9);
    display: flex; align-items: center; justify-content: center;
    padding: 40px;
    animation: overlay-in 0.2s ease;
}
.lightbox-frame {
    position: relative;
    max-width: 92vw;
    text-align: center;
}
.lightbox-img {
    max-width: 92vw; max-height: 80vh;
    display: block; margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
    background: #111;
}
.lightbox-caption {
    color: #fff; font-size: 15px; line-height: 1.5;
    margin: 14px auto 0; max-width: 720px;
}
.lightbox-counter {
    color: rgba(255,255,255,0.65); font-size: 12px;
    letter-spacing: 0.14em; margin-top: 6px; text-transform: uppercase;
}
.lightbox-close,
.lightbox-nav {
    background: rgba(255,255,255,0.15); color: #fff;
    border: none; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0; line-height: 1; cursor: pointer;
    transition: background 0.15s ease;
    position: absolute;
}
.lightbox-close:hover,
.lightbox-nav:hover:not(:disabled) { background: rgba(255,255,255,0.32); }
.lightbox-close {
    top: 16px; right: 20px;
    width: 42px; height: 42px; font-size: 24px;
}
.lightbox-nav {
    top: 50%; transform: translateY(-50%);
    width: 52px; height: 52px; font-size: 34px;
    font-family: Arial, sans-serif;
}
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
@media (max-width: 640px) {
    .lightbox { padding: 20px; }
    .lightbox-nav { width: 40px; height: 40px; font-size: 24px; }
    .lightbox-prev { left: 8px; }
    .lightbox-next { right: 8px; }
    .lightbox-close { top: 8px; right: 8px; }
}

/* Winner lightbox: two-column card, image left, details right */
.winner-lightbox-frame {
    position: relative;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 1.1fr;
    width: 92vw; max-width: 940px; max-height: 86vh;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.winner-lightbox-photo {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex; align-items: center; justify-content: center;
    min-height: 320px;
    overflow: hidden;
    position: relative;
}
.winner-lightbox-photo img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.winner-lightbox-photo-placeholder {
    font-size: 90px; color: #fff;
    filter: drop-shadow(0 6px 20px rgba(0,0,0,0.35));
}
.winner-lightbox-body {
    padding: 32px 30px 28px;
    display: flex; flex-direction: column; gap: 8px;
    overflow-y: auto;
    color: var(--ink);
}
.winner-lightbox-pos {
    color: var(--primary-color); font-size: 12px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.16em;
}
.winner-lightbox-name {
    margin: 0; font-size: 28px; letter-spacing: -0.01em; color: var(--ink); font-weight: 800;
}
.winner-lightbox-ref {
    font-family: var(--mono); font-size: 15px; letter-spacing: 0.04em;
    color: var(--secondary-color); font-weight: 700;
    padding: 8px 12px; margin: 6px 0 12px;
    background: #fff5f6; border: 1px dashed rgba(209, 84, 96, 0.4);
    border-radius: 8px; align-self: flex-start;
    overflow-wrap: anywhere;
}
.winner-lightbox-bio {
    color: var(--ink); font-size: 15px; line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.winner-lightbox-frame .lightbox-counter {
    margin-top: auto; padding-top: 16px;
    color: var(--ink-soft);
    text-align: left;
}

@media (max-width: 720px) {
    .winner-lightbox-frame {
        grid-template-columns: 1fr;
        max-height: 92vh;
    }
    .winner-lightbox-photo { min-height: 240px; max-height: 280px; }
    .winner-lightbox-body { padding: 22px 22px 24px; }
    .winner-lightbox-name { font-size: 22px; }
}

/* Confetti (simple css-only) */
.confetti {
    position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.confetti-modal { z-index: 0; }
.confetti span {
    position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px;
    opacity: 0.9; animation: fall linear infinite;
}
.confetti span:nth-child(1)  { left: 5%;  background: var(--secondary-color); animation-duration: 4.2s; animation-delay: 0.0s; }
.confetti span:nth-child(2)  { left: 12%; background: #a8c1f0; animation-duration: 3.6s; animation-delay: 0.3s; }
.confetti span:nth-child(3)  { left: 20%; background: #fbbf24; animation-duration: 4.8s; animation-delay: 0.7s; }
.confetti span:nth-child(4)  { left: 28%; background: #34d399; animation-duration: 4.0s; animation-delay: 0.2s; }
.confetti span:nth-child(5)  { left: 36%; background: var(--primary-color); animation-duration: 3.8s; animation-delay: 0.5s; }
.confetti span:nth-child(6)  { left: 44%; background: var(--secondary-color); animation-duration: 4.5s; animation-delay: 0.9s; }
.confetti span:nth-child(7)  { left: 52%; background: #a8c1f0; animation-duration: 4.2s; animation-delay: 0.1s; }
.confetti span:nth-child(8)  { left: 60%; background: #fbbf24; animation-duration: 3.7s; animation-delay: 0.6s; }
.confetti span:nth-child(9)  { left: 68%; background: #34d399; animation-duration: 4.3s; animation-delay: 0.4s; }
.confetti span:nth-child(10) { left: 76%; background: var(--primary-color); animation-duration: 4.9s; animation-delay: 0.8s; }
.confetti span:nth-child(11) { left: 84%; background: var(--secondary-color); animation-duration: 3.6s; animation-delay: 0.2s; }
.confetti span:nth-child(12) { left: 92%; background: #a8c1f0; animation-duration: 4.4s; animation-delay: 0.5s; }
.confetti span:nth-child(13) { left: 15%; background: #fbbf24; animation-duration: 4.1s; animation-delay: 1.0s; }
.confetti span:nth-child(14) { left: 55%; background: #34d399; animation-duration: 3.9s; animation-delay: 1.2s; }
.confetti span:nth-child(15) { left: 80%; background: var(--primary-color); animation-duration: 4.6s; animation-delay: 1.5s; }
@keyframes fall {
    from { transform: translateY(-20px) rotate(0deg);       opacity: 1; }
    to   { transform: translateY(110vh) rotate(720deg);     opacity: 0.9; }
}
