:root {
    --bg: #0f1222;
    --panel: #171b30;
    --panel-2: #1f2440;
    --text: #eef0fb;
    --muted: #9aa1c4;
    --accent: #ffb020;
    --accent-2: #22c1a4;
    --danger: #ef5566;
    --border: #2b3057;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* Present in the DOM (so existing JS logic — counters, the reel's number pool,
   award tracking — keeps working) but never shown on the public screen. */
.ui-hidden { display: none !important; }

body {
    margin: 0;
    background: radial-gradient(circle at top, #1b1f3b, var(--bg));
    color: var(--text);
    min-height: 100vh;
}

.page { max-width: 900px; margin: 0 auto; padding: 24px 20px 60px; }

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.topbar h1 { font-size: 26px; margin: 0; }
.topbar-center { justify-content: center; }

.btn {
    border: none; border-radius: 10px; padding: 12px 22px; font-size: 15px;
    font-weight: 600; cursor: pointer; transition: transform .08s ease, opacity .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); text-decoration: none; display: inline-block; }
.btn-start { background: var(--accent-2); color: #052b23; }
.btn-stop  { background: var(--danger); color: #2b0409; }
.btn-yes   { background: var(--accent-2); color: #052b23; }
.btn-no    { background: transparent; border: 1px solid var(--border); color: var(--text); }

.stats-bar { display: flex; gap: 16px; margin: 18px 0; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 20px; flex: 1; text-align: center; }
.stat-num { display: block; font-size: 28px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.prize-panel {
    display: flex; gap: 20px; align-items: center; background: var(--panel);
    border: 1px solid var(--border); border-radius: 16px; padding: 20px; margin-top: 18px;
}
.prize-photo {
    width: 140px; height: 140px; flex: none; border-radius: 12px; overflow: hidden;
    background: var(--panel-2); display: flex; align-items: center; justify-content: center;
}
.prize-photo img { width: 100%; height: 100%; object-fit: cover; }
.prize-photo-placeholder { font-size: 52px; }
.prize-info { flex: 1; min-width: 0; }
.prize-tag {
    display: inline-block; background: rgba(255,176,32,.15); color: var(--accent);
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    padding: 4px 10px; border-radius: 20px; margin-bottom: 8px;
}
.prize-info h2 { margin: 0 0 6px; font-size: 24px; }
.prize-info p { margin: 0; color: var(--muted); font-size: 15px; }

.prize-order-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.prize-order-item {
    display: flex; align-items: center; gap: 12px; background: var(--panel-2);
    border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: 14px;
}
.prize-order-item.is-awarded { opacity: .5; }
.prize-order-thumb {
    width: 34px; height: 34px; border-radius: 8px; overflow: hidden; flex: none;
    background: var(--panel); display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.prize-order-thumb img { width: 100%; height: 100%; object-fit: cover; }
.prize-order-name { flex: 1; }

.modal-prize-photo { width: 120px; height: 120px; margin: 0 auto 14px; border-radius: 12px; overflow: hidden; }
.modal-prize-photo img { width: 100%; height: 100%; object-fit: cover; }

.reel-wrapper { text-align: center; margin: 30px 0; }
.reel {
    display: inline-block; min-width: 320px; background: var(--panel);
    border: 2px solid var(--border); border-radius: 18px; padding: 40px 30px;
    font-size: 56px; font-weight: 800; letter-spacing: .05em; color: var(--accent);
    box-shadow: 0 0 0 rgba(255,176,32,0);
    transition: box-shadow .2s ease;
}
.reel.spinning { box-shadow: 0 0 40px rgba(255,176,32,.35); }
.reel-photo {
    display: block; margin: 16px auto 0; width: 160px; height: 160px;
    object-fit: cover; border-radius: 14px; border: 2px solid var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.reel-sub { margin-top: 10px; color: var(--muted); font-size: 15px; min-height: 20px; }

.controls { display: flex; justify-content: center; gap: 18px; margin-bottom: 30px; }

/* ---------- Public raffle screen: focused, larger layout ---------- */
/* Now that only the title, current prize, reel, and Start/Stop remain visible,
   give them more room and bigger type so the screen reads well from a distance. */
.raffle-page { max-width: 760px; padding-top: 44px; }
.raffle-page .topbar h1 { font-size: 34px; }

.raffle-page .prize-panel {
    flex-direction: column; text-align: center; padding: 36px 32px; gap: 16px;
    border-radius: 22px;
}
.raffle-page .prize-photo { width: 240px; height: 240px; border-radius: 18px; }
.raffle-page .prize-photo-placeholder { font-size: 84px; }
.raffle-page .prize-tag { font-size: 14px; padding: 6px 16px; }
.raffle-page .prize-info h2 { font-size: 34px; margin: 6px 0 8px; }
.raffle-page .prize-info p { font-size: 18px; }

.raffle-page .reel-wrapper { margin: 40px 0; }
.raffle-page .reel {
    min-width: 420px; font-size: 76px; padding: 54px 44px; border-radius: 24px;
}
.raffle-page .reel-sub { font-size: 17px; margin-top: 14px; }

.raffle-notice {
    display: inline-block; margin-top: 14px; padding: 8px 18px; border-radius: 20px;
    background: rgba(255,176,32,.12); color: var(--accent); border: 1px solid rgba(255,176,32,.3);
    font-size: 14px; opacity: 0; transform: translateY(-4px); pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
}
.raffle-notice.show { opacity: 1; transform: translateY(0); }

.raffle-page .controls { gap: 26px; margin-bottom: 10px; }
.raffle-page .btn-start, .raffle-page .btn-stop { padding: 18px 40px; font-size: 19px; border-radius: 16px; }

@media (max-width: 520px) {
    .raffle-page .reel { min-width: 0; width: 100%; font-size: 52px; padding: 40px 20px; }
    .raffle-page .prize-photo { width: 180px; height: 180px; }
    .raffle-page .prize-info h2 { font-size: 26px; }
}

.pool-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.pool-panel h2 { margin: 0 0 14px; font-size: 16px; color: var(--muted); font-weight: 600; }
.pool-grid { display: flex; flex-wrap: wrap; gap: 8px; max-height: 260px; overflow-y: auto; }
.chip {
    background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
    padding: 6px 12px; font-size: 14px; display: inline-flex; align-items: center; gap: 8px;
}
.chip-thumb { width: 24px; height: 24px; object-fit: cover; border-radius: 5px; }
.empty-msg { color: var(--muted); }
.empty-msg a { color: var(--accent); }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(6,7,16,.72); display: none;
    align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
    padding: 34px; max-width: 420px; width: 100%; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal h3 { margin: 0 0 14px; font-size: 22px; }
.modal-photo {
    width: 140px; height: 140px; object-fit: cover; border-radius: 14px;
    border: 2px solid var(--border); margin: 0 auto 12px; display: block;
}
.modal-number { font-size: 40px; font-weight: 800; color: var(--accent); margin: 6px 0; }
.modal-prize { color: var(--muted); margin: 0 0 16px; }
.modal-question { margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }

/* ---------- Admin panel ---------- */
.admin-page { max-width: 1100px; }
.admin-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-top: 20px; }
@media (max-width: 860px) { .admin-grid { grid-template-columns: 1fr; } }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin-bottom: 20px; }
.card h2 { margin-top: 0; font-size: 17px; }

.admin-tabs { display: flex; gap: 8px; margin: 20px 0 4px; flex-wrap: wrap; }
.tab-btn {
    background: var(--panel); border: 1px solid var(--border); color: var(--muted);
    padding: 10px 16px; border-radius: 10px 10px 0 0; cursor: pointer; font-size: 14px; font-weight: 600;
}
.tab-btn.active { background: var(--panel-2); color: var(--text); border-bottom-color: var(--panel-2); }
.tab-panel { background: transparent; }

.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; display: block; }
.thumb-placeholder { display: flex; align-items: center; justify-content: center; background: var(--panel-2); font-size: 18px; }

table.prize-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.prize-table th, table.prize-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.prize-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.badge { padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-available { background: rgba(34,193,164,.15); color: var(--accent-2); }
.badge-won { background: rgba(239,85,102,.15); color: var(--danger); }
.badge-declined { background: rgba(255,176,32,.15); color: var(--accent); }
.badge-released, .badge-skipped, .badge-pending, .badge-drawing { background: rgba(154,161,196,.15); color: var(--muted); }

.thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.thumb-empty {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    color: var(--muted); background: var(--panel-2); border-radius: 6px; font-size: 12px;
}

.form-row { margin-bottom: 12px; display: flex; flex-direction: column; gap: 5px; }
.form-row label { font-size: 13px; color: var(--muted); }
.form-row input[type=text], .form-row input[type=file], .form-row select, .form-row textarea, .form-row input[type=password] {
    background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
    padding: 10px 12px; color: var(--text); font-size: 14px;
}
.form-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-inline .form-row { flex: 1; min-width: 140px; margin-bottom: 0; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.flash-success { background: rgba(34,193,164,.15); color: var(--accent-2); border: 1px solid rgba(34,193,164,.3); }
.flash-error { background: rgba(239,85,102,.15); color: var(--danger); border: 1px solid rgba(239,85,102,.3); }

.pending-draw-banner {
    display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap;
    background: rgba(255,176,32,.1); border: 1px solid rgba(255,176,32,.35); border-radius: 12px;
    padding: 16px 20px; margin-bottom: 16px;
}
.pending-draw-info strong { color: var(--accent); }
.pending-draw-info p { margin: 6px 0 0; color: var(--muted); font-size: 13px; max-width: 560px; }
.pending-draw-actions { display: flex; gap: 10px; flex: none; }
.pending-draw-actions form { margin: 0; }

.icon-btn { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 13px; text-decoration: underline; padding: 0; }
.icon-btn.danger { color: var(--danger); }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 340px; }
