/* =====================================================================
   EventSpin Pro — Design tokens (from prd/DESIGN.md)
   ===================================================================== */
:root {
  --color-brand-primary: #6A00FF;
  --color-brand-secondary: #00C2FF;
  --color-interactive-accent: #FFD700;

  --color-text-dark: #1A1A1A;
  --color-text-light: #FFFFFF;
  --color-bg-default: #F8F8F8;
  --color-bg-card: #FFFFFF;
  --color-border-default: #E0E0E0;

  --color-status-success: #28A745;
  --color-status-warning: #FFC107;
  --color-status-error: #DC3545;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  color: var(--color-text-dark);
  background: var(--color-bg-default);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Poppins', 'Inter', system-ui, sans-serif;
  font-weight: 700;
  margin: 0 0 var(--space-sm);
}

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

p { margin: 0 0 var(--space-md); }

/* ---------------------------------------------------------------------
   Top navigation
   --------------------------------------------------------------------- */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(90deg, var(--color-brand-primary), #8A2BFF);
  color: var(--color-text-light);
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.topnav-brand {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  display: flex; align-items: center; gap: var(--space-sm);
}
.topnav-user {
  display: flex; align-items: center; gap: var(--space-md);
  font-size: .9rem;
}
.topnav-role {
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,.2);
  font-weight: 600;
  font-size: .75rem;
  letter-spacing: .04em;
}
.topnav-name { font-weight: 500; }

/* ---------------------------------------------------------------------
   Layout
   --------------------------------------------------------------------- */
.app-layout { display: flex; min-height: calc(100vh - 62px); }

.sidebar {
  width: 220px;
  background: var(--color-bg-card);
  border-right: 1px solid var(--color-border-default);
  padding: var(--space-lg) var(--space-sm);
  flex-shrink: 0;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar-link {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  color: var(--color-text-dark);
  font-weight: 500;
  transition: background .15s ease-in-out;
}
.sidebar-link:hover { background: var(--color-bg-default); text-decoration: none; }
.sidebar-link.active { background: var(--color-brand-primary); color: #fff; }
.sidebar-icon { font-size: 1.1rem; }

.main-content { flex: 1; padding: var(--space-lg); max-width: 1280px; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap; gap: var(--space-md);
}
.page-header h1 { font-size: 1.875rem; margin: 0; }
.page-subtitle { color: #666; margin: 4px 0 0; }

/* ---------------------------------------------------------------------
   Cards / panels
   --------------------------------------------------------------------- */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}
.card-title { font-size: 1.25rem; margin-bottom: var(--space-md); }

.grid { display: grid; gap: var(--space-lg); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.stat-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  border-left: 4px solid var(--color-brand-primary);
}

/* ---------------------------------------------------------------------
   Event cards (admin/events.php) — scales gracefully with many events,
   unlike a giant table.
   --------------------------------------------------------------------- */
.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-md);
}
.event-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  display: flex; flex-direction: column; gap: 8px;
  transition: box-shadow .15s ease-in-out, border-color .15s ease-in-out;
}
.event-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,.08); border-color: var(--color-brand-secondary); }
.event-card-top { display: flex; align-items: center; justify-content: space-between; }
.event-card-logo {
  width: 40px; height: 40px; object-fit: contain; border-radius: 8px;
  border: 1px solid var(--color-border-default);
}
.event-card-logo-placeholder { display: flex; align-items: center; justify-content: center; font-size: 1.3rem; background: var(--color-bg-default); }
.event-card-title { font-size: 1.05rem; margin: 0; line-height: 1.3; }
.event-card-meta { display: flex; flex-direction: column; gap: 2px; font-size: .82rem; color: #666; }
.event-card-stats { display: flex; gap: var(--space-md); font-size: .85rem; color: #444; padding: 6px 0; border-top: 1px solid var(--color-border-default); }
.event-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: var(--space-lg); flex-wrap: wrap; }
.pagination-link {
  min-width: 32px; text-align: center;
  padding: 5px 10px;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  color: var(--color-text-dark);
  font-size: .85rem; font-weight: 600;
}
.pagination-link:hover { background: var(--color-bg-default); text-decoration: none; }
.pagination-link.active { background: var(--color-brand-primary); color: #fff; border-color: var(--color-brand-primary); }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; font-family: 'Poppins', sans-serif; }
.stat-card .stat-label { color: #666; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  transition: transform .15s ease-in-out, background .15s ease-in-out, box-shadow .15s ease-in-out;
  text-decoration: none;
}
.btn:hover { transform: translateY(-2px); text-decoration: none; }
.btn-sm { padding: 4px 10px; font-size: .8rem; }
.btn-primary { background: var(--color-brand-primary); color: #fff; }
.btn-primary:hover { background: #5800d6; }
.btn-secondary { background: var(--color-brand-secondary); color: #fff; }
.btn-accent { background: var(--color-interactive-accent); color: var(--color-text-dark); }
.btn-success { background: var(--color-status-success); color: #fff; }
.btn-danger { background: var(--color-status-error); color: #fff; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.5); color: inherit; }
.btn-outline { background: transparent; border-color: var(--color-border-default); color: var(--color-text-dark); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */
.form-group { margin-bottom: var(--space-md); }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; }
.form-row { display: flex; gap: var(--space-md); flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], input[type=file], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--color-brand-secondary);
  outline-offset: 1px;
  border-color: var(--color-brand-secondary);
}
.form-hint { font-size: .8rem; color: #777; margin-top: 4px; }
.form-actions { display: flex; gap: var(--space-sm); margin-top: var(--space-lg); }

/* ---------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--color-border-default); }
th { font-weight: 600; color: #555; background: var(--color-bg-default); }
tr:hover td { background: #fafafa; }

/* ---------------------------------------------------------------------
   Badges / status
   --------------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge-success { background: #e6f7ec; color: var(--color-status-success); }
.badge-warning { background: #fff8e1; color: #b8860b; }
.badge-error { background: #fdecee; color: var(--color-status-error); }
.badge-neutral { background: #eee; color: #555; }
.badge-info { background: #e6f7ff; color: #0077a8; }

/* ---------------------------------------------------------------------
   Flash messages
   --------------------------------------------------------------------- */
.flash {
  margin: var(--space-md) var(--space-lg) 0;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-weight: 500;
  animation: fadein .2s ease-in-out;
}
.flash-success { background: #e6f7ec; color: #1b6e35; border: 1px solid #b7e3c6; }
.flash-error { background: #fdecee; color: #a01526; border: 1px solid #f3b8c0; }
.flash-info { background: #e6f7ff; color: #045a80; border: 1px solid #b3e3f7; }
@keyframes fadein { from { opacity: 0; transform: translateY(-4px);} to { opacity: 1; transform: translateY(0);} }

/* ---------------------------------------------------------------------
   Auth / login screen
   --------------------------------------------------------------------- */
.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 900px 700px at 15% -10%, color-mix(in srgb, var(--color-brand-primary) 60%, transparent), transparent 60%),
    radial-gradient(ellipse 700px 600px at 100% 100%, color-mix(in srgb, var(--color-brand-secondary) 38%, transparent), transparent 60%),
    #0b0714;
  padding: var(--space-md);
}
.auth-shell::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}
.auth-card {
  position: relative;
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-xl);
  width: 100%; max-width: 400px;
  box-shadow:
    0 30px 80px -20px color-mix(in srgb, var(--color-brand-primary) 45%, rgba(0,0,0,.35)),
    0 0 0 1px rgba(0,0,0,.04);
}
.auth-card h1 { text-align: center; font-size: 1.4rem; }
.auth-brand {
  display: flex; align-items: center; justify-content: center;
  width: 96px; height: 96px; margin: 0 auto var(--space-md);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-brand-primary), var(--color-brand-secondary));
  color: #fff; font-size: 1.8rem; font-weight: 700;
  font-family: 'Poppins', sans-serif;
  box-shadow: 0 10px 24px -6px color-mix(in srgb, var(--color-brand-primary) 45%, transparent);
  overflow: hidden;
}
.auth-brand:has(img) { background: none; box-shadow: none; }
.auth-brand img { width: 100%; height: 100%; object-fit: contain; }
.auth-subtitle { text-align: center; color: #777; margin-bottom: var(--space-xl); font-size: .9rem; }
.auth-card .btn-block { box-shadow: 0 8px 20px -4px color-mix(in srgb, var(--color-brand-primary) 40%, transparent); }
.auth-demo { margin-top: var(--space-lg); padding: var(--space-md); background: var(--color-bg-default); border-radius: var(--radius-md); font-size: .8rem; color: #555; line-height: 1.7; }
.auth-demo code { background: #fff; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--color-border-default); }
.auth-links { text-align: center; margin-top: var(--space-md); font-size: .85rem; }

/* ---------------------------------------------------------------------
   Show/hide password toggle (login, reset password) — see
   password_toggle_button() in includes/functions.php.
   --------------------------------------------------------------------- */
.password-field { position: relative; }
.password-field input { padding-right: 40px; }
.password-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  background: none; border: none; padding: 6px; cursor: pointer;
  color: #999; display: flex; align-items: center;
  border-radius: var(--radius-sm);
}
.password-toggle:hover { color: #555; }
.password-toggle .icon-eye-off { display: none; }
.password-toggle.is-visible .icon-eye { display: none; }
.password-toggle.is-visible .icon-eye-off { display: block; }

/* ---------------------------------------------------------------------
   Scanner (mobile-first)
   --------------------------------------------------------------------- */
.scanner-shell {
  /* 100vh on mobile is measured against the viewport with the browser's
     address bar hidden — the shell (and the flex-grown #qr-reader inside
     it) ends up taller than what's actually visible once the address bar
     is shown, pushing the bottom of the camera/manual-input area under it
     with the shell's own dark background showing through. 100dvh tracks
     the real, currently-visible viewport; the 100vh line above it stays
     as a fallback for older browsers that don't support dvh yet. */
  min-height: 100vh; min-height: 100dvh;
  color: #fff; display: flex; flex-direction: column;
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, color-mix(in srgb, var(--color-brand-primary) 22%, transparent), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 10%, color-mix(in srgb, var(--color-brand-secondary) 14%, transparent), transparent 55%),
    #0b0b0e;
}
.scanner-header {
  padding: var(--space-md);
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.scanner-header .evt { font-weight: 600; display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; }
.scanner-logo { height: 42px; max-width: 130px; object-fit: contain; }

/* Device-mode picker — first screen a check-in desk sees, choosing between
   Camera and a physical Scanner Barcode device. Choice is stored client-side
   (localStorage) and can be changed later via "Ganti tipe perangkat". */
.device-mode-picker {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-lg);
}
.device-mode-picker h2 { margin: 0 0 6px; font-size: 1.4rem; }
.device-mode-picker p { color: #999; margin: 0 0 var(--space-lg); font-size: .9rem; }
.device-mode-cards {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  justify-content: center;
  max-width: 640px;
}
.device-mode-card {
  flex: 1 1 220px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: var(--space-lg) var(--space-md);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-lg);
  color: #fff;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.device-mode-card:hover, .device-mode-card:focus-visible {
  background: rgba(255,255,255,.1);
  border-color: var(--color-brand-secondary);
  transform: translateY(-2px);
}
.device-mode-icon { font-size: 2.4rem; line-height: 1; }
.device-mode-title { font-weight: 700; font-size: 1.05rem; }
.device-mode-desc { font-size: .85rem; color: #aaa; line-height: 1.4; }

/* Wraps everything that was previously a direct flex child of
   .scanner-shell — needs to be a flex container itself (matching
   .scanner-shell's own column layout) so #qr-reader's `flex: 1 1 auto`
   below still grows to fill the available height exactly as before this
   wrapper existed. min-height:0 lets it actually shrink inside the outer
   flexbox instead of overflowing. */
#scannerMain {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
/* Hardware Scanner mode has no camera running — hide the (otherwise empty
   black) camera box and give the manual-code input the visual weight,
   since it's the primary input in this mode, not a fallback. */
#scannerMain.mode-hardware #qr-reader { display: none; }
#scannerMain.mode-hardware .scanner-manual input {
  font-size: 1.3rem;
  padding: 16px 18px;
}
.hardware-status {
  margin: var(--space-md) var(--space-md) 0;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-brand-secondary) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-brand-secondary) 40%, transparent);
  color: var(--color-brand-secondary);
  font-weight: 600;
  font-size: .9rem;
  text-align: center;
}

#qr-reader {
  position: relative;
  width: calc(100% - 2 * var(--space-md));
  /* Was 640px — on a laptop/desktop-width screen that capped the camera
     box to a fairly narrow, centered column with a lot of the shell's own
     dark background visible on either side of it, which reads as "the
     camera isn't full, black is blocking it" just as much as a literal
     video-sizing gap does. 1100px lets it actually use a wide screen. */
  max-width: 1100px;
  margin: var(--space-md) auto 0;
  flex: 1 1 auto;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,.08);
  background: #000;
  box-shadow: 0 0 0 1px rgba(255,255,255,.03), 0 20px 50px rgba(0,0,0,.5);
}
/* `height: 100%` (tried previously) depends on an unbroken chain of
   explicitly-sized ancestors to resolve correctly — if html5-qrcode wraps
   the <video> in its own unstyled div, that percentage can silently
   resolve to nothing and the video falls back to its intrinsic size again,
   leaving #qr-reader's own black background exposed around it. `position:
   absolute; inset: 0` instead sizes directly against the nearest
   *positioned* ancestor (#qr-reader, already `position: relative`) — it
   doesn't depend on that percentage-height chain at all, so it can't be
   broken by markup this CSS doesn't control. */
#qr-reader video {
  position: absolute !important; inset: 0 !important;
  width: 100% !important; height: 100% !important;
  object-fit: cover;
}
/* Corner-bracket viewfinder overlay — purely decorative, sits above the
   camera video without touching html5-qrcode's own scan-box element. */
#qr-reader::before {
  content: '';
  position: absolute; inset: 14px;
  border-radius: var(--radius-md);
  pointer-events: none;
  z-index: 5;
  background:
    linear-gradient(var(--color-brand-secondary), var(--color-brand-secondary)) top left / 28px 3px no-repeat,
    linear-gradient(var(--color-brand-secondary), var(--color-brand-secondary)) top left / 3px 28px no-repeat,
    linear-gradient(var(--color-brand-secondary), var(--color-brand-secondary)) top right / 28px 3px no-repeat,
    linear-gradient(var(--color-brand-secondary), var(--color-brand-secondary)) top right / 3px 28px no-repeat,
    linear-gradient(var(--color-brand-secondary), var(--color-brand-secondary)) bottom left / 28px 3px no-repeat,
    linear-gradient(var(--color-brand-secondary), var(--color-brand-secondary)) bottom left / 3px 28px no-repeat,
    linear-gradient(var(--color-brand-secondary), var(--color-brand-secondary)) bottom right / 28px 3px no-repeat,
    linear-gradient(var(--color-brand-secondary), var(--color-brand-secondary)) bottom right / 3px 28px no-repeat;
  opacity: .85;
}
/* Detection-box overlay — draws a box that hugs the actual detected
   QR/Code128 (native BarcodeDetector, when the browser supports it) on top
   of the static corner-bracket guide above. Purely visual/read-only;
   pointer-events:none so it never intercepts taps meant for the video. */
.qr-overlay-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 6;
}
/* On-screen readout of whether this browser actually supports the
   detection-box overlay (see startDetectionOverlay in scanner.js) — makes
   "the box doesn't show up" reports diagnosable without needing devtools
   access on whatever phone is being used at the check-in desk. */
.detection-status {
  margin: 6px var(--space-md) 0;
  font-size: .78rem;
  color: #888;
  text-align: center;
}
@keyframes scanner-pop {
  0% { transform: scale(.97); opacity: .6; }
  100% { transform: scale(1); opacity: 1; }
}
.scanner-result {
  margin: var(--space-md);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.01em;
  transition: background .15s ease-in-out;
  animation: scanner-pop .18s ease-out;
}
/* No idle placeholder box — cleaner camera view, especially on mobile.
   Only a real scan result (valid/duplicate/invalid/queued) shows this
   element; it collapses away again once auto-hide resets back to idle. */
.scanner-result.state-idle { display: none; }
.scanner-result.state-valid { background: var(--color-status-success); color: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.15) inset, 0 12px 30px color-mix(in srgb, var(--color-status-success) 45%, transparent); }
.scanner-result.state-duplicate { background: var(--color-status-warning); color: #1A1A1A; box-shadow: 0 0 0 1px rgba(0,0,0,.1) inset, 0 12px 30px color-mix(in srgb, var(--color-status-warning) 45%, transparent); }
.scanner-result.state-invalid { background: var(--color-status-error); color: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.15) inset, 0 12px 30px color-mix(in srgb, var(--color-status-error) 45%, transparent); }
.scanner-result.state-queued { background: var(--color-brand-secondary); color: #06222c; box-shadow: 0 0 0 1px rgba(0,0,0,.1) inset, 0 12px 30px color-mix(in srgb, var(--color-brand-secondary) 45%, transparent); }
.scanner-detail { font-size: .95rem; font-weight: 400; margin-top: 6px; opacity: .9; }
.scanner-manual { padding: var(--space-md); background: rgba(0,0,0,.35); border-top: 1px solid rgba(255,255,255,.06); }
.scanner-manual form { display: flex; gap: var(--space-sm); }
.manual-input-wrap { flex: 1; position: relative; }
.scanner-manual input { width: 100%; }
.manual-suggestions {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: #1c1c1c; border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius-md);
  max-height: 260px; overflow-y: auto; z-index: 60;
  box-shadow: 0 14px 34px rgba(0,0,0,.5);
}
.manual-suggestion-item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm);
  padding: 11px 14px; cursor: pointer; color: #fff; font-size: .95rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.manual-suggestion-item:last-child { border-bottom: none; }
.manual-suggestion-item:hover, .manual-suggestion-item:active { background: rgba(255,255,255,.08); }
.manual-suggestion-code { font-weight: 600; letter-spacing: .01em; }
.manual-suggestion-status { font-size: .78rem; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.manual-suggestion-status.is-scanned { background: color-mix(in srgb, var(--color-status-warning) 25%, transparent); color: var(--color-status-warning); }
.manual-suggestion-status.is-active { background: color-mix(in srgb, var(--color-status-success) 22%, transparent); color: var(--color-status-success); }
.scanner-stats { display: flex; gap: var(--space-sm); padding: var(--space-md); justify-content: center; }
.scanner-stat {
  text-align: center; flex: 1; max-width: 120px;
  padding: 10px 6px; border-radius: var(--radius-md);
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06);
}
.scanner-stat .val { font-size: 1.6rem; font-weight: 700; font-family: 'Poppins', sans-serif; line-height: 1.1; }
.scanner-stat .lbl { font-size: .68rem; color: #999; text-transform: uppercase; letter-spacing: .04em; }
@keyframes scanner-queue-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.scanner-queue-indicator {
  margin: 0 var(--space-md) var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: rgba(0,194,255,.12);
  border: 1px solid var(--color-brand-secondary);
  border-radius: var(--radius-md);
  color: var(--color-brand-secondary);
  font-size: .85rem;
  text-align: center;
  animation: scanner-queue-pulse 1.6s ease-in-out infinite;
}

/* ---------------------------------------------------------------------
   Spinner (big screen)
   --------------------------------------------------------------------- */
.spinner-shell {
  min-height: 100vh;
  background: radial-gradient(circle at center, #2a0066, #12001a 80%);
  color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: var(--space-lg);
}
.spinner-title { font-size: clamp(1.75rem, 5vw, 3rem); margin-bottom: var(--space-lg); text-shadow: 0 0 20px rgba(255,215,0,.5); }

.spinner-shell-game {
  display: block;
  text-align: initial;
  padding: 0;
  min-height: 100vh;
  position: relative;
}

/* ---------------------------------------------------------------------
   Start overlay (unlocks audio autoplay + entry point for fullscreen)
   --------------------------------------------------------------------- */
.start-overlay {
  /* absolute (not fixed) relative to #spinnerShell (position:relative) — a
     fixed element would be re-anchored to the fullscreen element as its
     containing block while fullscreened, and get clipped by any overflow
     on that same element. Absolute sidesteps that fullscreen-only quirk. */
  position: absolute; inset: 0;
  background: rgba(5,0,15,.94);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  transition: opacity .3s ease-in-out;
}
.start-overlay.hidden { opacity: 0; pointer-events: none; }
.start-overlay-card { text-align: center; max-width: 360px; padding: var(--space-xl); }
.start-overlay-card h2 { margin: var(--space-sm) 0; }
.start-overlay-logo { max-height: 90px; max-width: 220px; object-fit: contain; margin: 0 auto; display: block; }
.spinner-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(4px);
}
.spinner-topbar-title {
  font-family: 'Poppins', sans-serif; font-weight: 700;
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  text-shadow: 0 0 16px rgba(255,215,0,.5);
  display: flex; align-items: center; gap: 10px;
}
.spinner-logo {
  height: 56px; max-width: 180px;
  object-fit: contain;
}
.volume-control { display: flex; align-items: center; gap: 6px; }
.volume-control input[type=range] {
  width: 90px; accent-color: var(--color-interactive-accent);
}
.volume-label { font-size: .75rem; color: #cfc4ff; min-width: 32px; }
.spinner-columns {
  display: flex;
  /* A bit wider than the base --space-lg gap the rest of the app uses —
     the game panel and winners panel read as too tightly stacked at 24px
     on a wide kiosk display, but a huge gap would visually disconnect the
     live draw from the list of who's already won. */
  gap: calc(var(--space-lg) + var(--space-md));
  padding: var(--space-lg);
  align-items: flex-start;
  min-height: calc(100vh - 70px);
}
.spinner-game-panel {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  gap: var(--space-md);
  min-height: 60vh;
}
.pool-info {
  font-size: .9rem;
  color: #cfc4ff;
  background: rgba(255,255,255,.08);
  padding: 4px 14px;
  border-radius: var(--radius-full);
}
/* Shifted in sync with the wheel below it, wheel/roulette only — `:has()`
   scopes this to a panel that actually contains .wheel-wrap, so the same
   #pool-info element used by Dice Roll/Slot Machine (a different branch of
   the same PHP template) is untouched. No PHP/JS change needed for this
   scoping. */
.spinner-game-panel:has(.wheel-wrap) .pool-info {
  transform: translateX(110px);
}
/* Same shift for the "currently spinning" ticket-number readout below the
   wheel — .spin-ticker/.spin-controls are shared by Dice/Slot too, so this
   stays scoped to :has(.wheel-wrap) exactly like .pool-info above. */
.spinner-game-panel:has(.wheel-wrap) .spin-ticker {
  transform: translateX(110px);
}
.spin-controls { display: flex; flex-direction: column; align-items: center; gap: var(--space-sm); margin-top: var(--space-lg); }

/* Big always-legible "currently spinning" ticket readout — the actual
   fix for legibility once a draw pool has 1000+ tickets (no wheel/reel
   can fit that many labels, but a single large rolling number always
   reads fine at any pool size). */
.spin-ticker {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(1.6rem, 4.5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--color-interactive-accent);
  text-shadow: 0 0 16px rgba(255, 215, 0, .65), 0 0 4px rgba(255, 255, 255, .4);
  background: rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 215, 0, .3);
  border-radius: var(--radius-lg);
  padding: 6px 22px;
  min-width: 200px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.winners-panel {
  /* Wider than before (was 320px) so the 2-column winner grid below has
     room to breathe instead of cramming — a kiosk display has the width
     to spare, and this is what actually keeps a long winner list from
     running deep down the screen: twice the winners per row of scroll. */
  width: 380px;
  flex-shrink: 0;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}
.winners-panel h2 {
  font-size: 1.1rem; margin-bottom: var(--space-md);
  display: flex; align-items: center; gap: 8px;
}
.winners-count {
  font-size: .75rem; font-weight: 700;
  background: var(--color-interactive-accent); color: #1A1A1A;
  padding: 1px 8px; border-radius: var(--radius-full);
}
.winners-empty { color: #888; text-align: center; padding: var(--space-lg) 0; font-size: .9rem; }

/* Two-column grid instead of a single stacked column — the actual fix for
   "a long winner list runs too far down": the same 40 winners now take
   half the vertical scroll to reach. CSS Grid (not flex-wrap) so both
   columns stay evenly sized regardless of how many winners exist. */
.winners-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  counter-reset: winner-num;
}
.winners-empty { grid-column: 1 / -1; }

.winner-row {
  counter-increment: winner-num;
  position: relative;
  background: linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-md);
  padding: 10px 30px 9px 34px;
  transition: background .15s ease-in-out, border-color .15s ease-in-out;
}
.winner-row:hover { background: linear-gradient(160deg, rgba(255,255,255,.11), rgba(255,255,255,.05)); border-color: rgba(255,215,0,.35); }

/* Rank badge — pure CSS counter, no JS/markup change needed. Newest
   winner is row 1 (matches the existing "most recent first" ordering),
   giving the list a sense of sequence rather than an unordered pile. */
.winner-row::before {
  content: counter(winner-num);
  position: absolute; top: 9px; left: 8px;
  min-width: 18px; height: 18px; padding: 0 2px;
  display: flex; align-items: center; justify-content: center;
  font-size: .68rem; font-weight: 700; font-variant-numeric: tabular-nums;
  color: #cfc4ff;
  background: rgba(255,255,255,.08);
  border-radius: var(--radius-full);
}

.winner-row-main { display: flex; flex-direction: column; gap: 1px; margin-bottom: 5px; }
.winner-row-code {
  font-weight: 700; color: var(--color-interactive-accent); font-size: .9rem; background: none;
  font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.winner-row-name { color: #ccc; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.winner-row-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 18px; }
.winner-row-prize {
  font-size: .72rem; color: #cfc4ff;
  background: rgba(207,196,255,.12);
  border-radius: var(--radius-full);
  padding: 1px 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.winner-row-del {
  position: absolute; top: 6px; right: 6px;
  background: none; border: none; color: #999; cursor: pointer;
  font-size: .85rem; width: 20px; height: 20px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s ease-in-out, color .15s ease-in-out, background .15s ease-in-out;
}
.winner-row:hover .winner-row-del,
.winner-row-del:focus-visible { opacity: 1; }
.winner-row-del:hover { color: #fff; background: var(--color-status-error); }

/* .badge-success/-error/-neutral are designed for the light admin theme
   (pale background + dark text) — recolored here only, so the WIN/FORFEIT
   badge reads correctly against this panel's dark background without
   touching how those same classes look anywhere else in the app. */
.winner-row .badge { font-size: .68rem; padding: 1px 8px; }
.winner-row .badge-success { background: rgba(46,204,113,.18); color: #6ee7a0; }
.winner-row .badge-error { background: rgba(255,90,90,.18); color: #ff8a8a; }
.winner-row .badge-neutral { background: rgba(255,255,255,.08); color: #bbb; }


.spin-btn {
  padding: var(--space-md) var(--space-2xl);
  font-size: 1.5rem;
  border-radius: var(--radius-full);
  background: var(--color-interactive-accent);
  color: #1A1A1A;
  border: none;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 30px rgba(255,215,0,.6);
  transition: transform .15s ease-in-out;
}
.spin-btn:hover { transform: scale(1.05); }
.spin-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.spin-btn-stop { background: var(--color-status-error); color: #fff; box-shadow: 0 0 30px rgba(220,53,69,.6); }

/* ---------------------------------------------------------------------
   Spin wheel — flat, polished 2D design: gold conic rim, dark bezel,
   glossy center hub, pin-style pointer with glow, grounded shadow.
   (Design cues studied from the "spin-wheel" canvas library used by
   github.com/jim60105/UnfairSpinWheel: thick rim/border, alternating
   segment colors, labels at ~80% radius, ease-out deceleration.)
   --------------------------------------------------------------------- */
.wheel-wrap {
  position: relative;
  width: min(75vw, 580px); height: min(75vw, 580px);
  border-radius: 50%;
  /* Nudged toward the winners panel (which sits to the right in
     .spinner-columns) instead of sitting dead-center in .spinner-game-panel
     — scoped to just the wheel (Spin Wheel + Roulette both use this same
     class) so dice/slot layouts are untouched. `transform`, not `margin`:
     an asymmetric margin interacts with the parent's `align-items:center`
     in a way that only half-applies (the browser centers the margin box,
     not the visible wheel), and applies differently depending on whether
     the sibling has an `auto` margin or not — which is exactly why the
     shadow below drifted out of sync with the wheel. `transform` is a
     pure post-layout visual offset, unaffected by flex alignment, so the
     same value here and on .wheel-shadow/#poolInfo below always lines up
     pixel-for-pixel regardless of each element's own width. */
  transform: translateX(110px);
}
.wheel-wrap::before {
  content: '';
  position: absolute; inset: -12px;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
    var(--color-interactive-accent), #fff3b0, var(--color-interactive-accent),
    #b8860b, var(--color-interactive-accent), #fff3b0, var(--color-interactive-accent));
  box-shadow: 0 0 0 4px rgba(255,255,255,.08) inset, 0 20px 45px rgba(0,0,0,.55);
  z-index: 0;
}
.wheel-wrap::after {
  content: '';
  position: absolute; inset: -2px;
  border-radius: 50%;
  background: #1a0040;
  z-index: 0;
}
#wheelCanvas {
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  border-radius: 50%;
  box-shadow: 0 0 40px rgba(0,194,255,.4), inset 0 0 24px rgba(0,0,0,.35);
}
/* SPIN/STOP button sitting in the wheel's own hub, like the classic
   prize-wheel "click the middle to spin" pattern. */
.spin-btn-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 22%; height: 22%; min-width: 76px; min-height: 76px;
  border-radius: 50%;
  padding: 0;
  z-index: 6;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  font-size: .85rem;
  line-height: 1.15;
  box-shadow: 0 4px 14px rgba(0,0,0,.55), inset 0 0 8px rgba(255,255,255,.5), 0 0 22px rgba(255,215,0,.55);
}
.spin-btn-center:hover { transform: translate(-50%, -50%) scale(1.06); }
.spin-btn-center:disabled { transform: translate(-50%, -50%); }
.spin-btn-center.spin-btn-stop { box-shadow: 0 4px 14px rgba(0,0,0,.55), inset 0 0 8px rgba(255,255,255,.4), 0 0 22px rgba(220,53,69,.55); }
.wheel-pointer {
  position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 32px solid var(--color-interactive-accent);
  z-index: 5;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.5)) drop-shadow(0 0 10px rgba(255,215,0,.55));
}
.wheel-pointer::after {
  content: '';
  position: absolute; top: -34px; left: -9px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff8dd, var(--color-interactive-accent) 70%);
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.wheel-shadow {
  width: min(75vw, 580px); height: 22px;
  margin: -6px auto 0;
  /* Same transform as .wheel-wrap above, so the shadow stays directly
     under the (now shifted) wheel instead of drifting out of sync with
     it — see the comment on .wheel-wrap for why this has to be
     `transform` and not an asymmetric `margin`. */
  transform: translateX(110px);
  background: radial-gradient(ellipse at center, rgba(0,0,0,.5), transparent 72%);
  filter: blur(3px);
}

/* Roulette — same wheel mechanic, casino red/black/green re-theme */
.wheel-wrap-roulette::before {
  background: conic-gradient(from 0deg,
    #d4af37, #fff3b0, #d4af37, #161616, #d4af37, #fff3b0, #d4af37);
}
.wheel-wrap-roulette .wheel-hub,
.wheel-wrap-roulette .spin-btn-center {
  background: radial-gradient(circle at 35% 30%, #fff8dd, #d4af37 62%, #7a5c00 100%);
}
.wheel-wrap-roulette .wheel-pointer { border-top-color: #d4af37; }
.wheel-wrap-roulette .wheel-pointer::after { background: radial-gradient(circle at 35% 30%, #fff8dd, #d4af37 70%); }

/* ---------------------------------------------------------------------
   Slot Machine — a full illustrated jackpot cabinet, built entirely in
   CSS (no image assets): marquee sign with blinking bulbs, side light
   pillars, chrome-and-gold body, pull lever, base tray. 3 reels of real
   ticket codes — one box always holds exactly one ticket code, sized
   large for a dramatic reveal. Reel technique: a tall strip of cells per
   reel, translateY animates the scroll, ease-out lands on a target cell
   (same pattern used for the wheel/dice elsewhere in this file).
   --------------------------------------------------------------------- */
.slot-machine { display: flex; flex-direction: column; align-items: center; }

.slot-topsign {
  width: min(95vw, 620px);
  box-sizing: border-box;
  background: linear-gradient(160deg, #8a0000, #3d0000);
  border: 4px solid #d4af37;
  border-bottom: none;
  border-radius: 18px 18px 4px 4px;
  padding: 10px 20px 8px;
  text-align: center;
  box-shadow: 0 -6px 20px rgba(255,215,0,.15) inset, 0 10px 25px rgba(0,0,0,.5);
  position: relative; z-index: 2;
}
.slot-topsign-text {
  font-family: 'Poppins', sans-serif; font-weight: 700;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  letter-spacing: .12em;
  color: var(--color-interactive-accent);
  text-shadow: 0 0 14px rgba(255,215,0,.7);
  margin: 4px 0;
}
.slot-lightrow { display: flex; justify-content: space-between; }
.slot-lightrow span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-interactive-accent);
  box-shadow: 0 0 6px rgba(255,215,0,.9);
  animation: slotBulbBlink 1s steps(2) infinite;
}
.slot-lightrow span:nth-child(3n+1) { animation-delay: .15s; }
.slot-lightrow span:nth-child(3n+2) { animation-delay: .3s; }
@keyframes slotBulbBlink { 50% { opacity: .15; } }

.slot-cabinet {
  position: relative; z-index: 1;
  display: flex; align-items: stretch; gap: 12px;
  background: linear-gradient(160deg, #3a3a42, #16161a);
  border: 6px solid #8a8a94;
  border-radius: 8px;
  padding: 16px 18px 20px;
  box-shadow: 0 25px 55px rgba(0,0,0,.6), inset 0 0 0 3px rgba(255,215,0,.25);
}
.slot-pillar {
  width: 16px;
  border-radius: 8px;
  background: linear-gradient(180deg, #c0272d, #7a0000);
  display: flex; flex-direction: column; justify-content: space-around; align-items: center;
  padding: 10px 0;
  box-shadow: inset 0 0 4px rgba(0,0,0,.6);
}
.slot-pillar span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--color-interactive-accent);
  box-shadow: 0 0 6px rgba(255,215,0,.9);
  animation: slotBulbBlink 1.4s steps(2) infinite;
}
.slot-pillar span:nth-child(2) { animation-delay: .2s; }
.slot-pillar span:nth-child(3) { animation-delay: .4s; }
.slot-pillar span:nth-child(4) { animation-delay: .6s; }

.slot-cabinet-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.slot-legend {
  font-size: .68rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--color-interactive-accent); opacity: .85;
}

.slot-window {
  position: relative;
  display: flex; gap: 4px;
  background: #0c0c10;
  border-radius: 10px;
  padding: 6px;
  box-shadow: inset 0 6px 14px rgba(0,0,0,.7);
  max-width: min(92vw, 600px);
  overflow-x: auto;
}
/* One box = one CHARACTER of the ticket code (e.g. "M0001" -> M | 0 | 0 | 0 | 1),
   reel count is dynamic — see initSlotMode() in spinner.js. Cell height
   here (144px) MUST match the CELL_HEIGHT constant in spinner.js — the
   reel-scroll math (translateY per cell) depends on the two agreeing. */
.slot-reel-track {
  width: 68px; height: 144px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 6px;
  background: linear-gradient(180deg, #fff, #f0f0f5);
  box-shadow: inset 0 0 0 2px rgba(255,215,0,.4);
}
.slot-reel { will-change: transform; }
.slot-cell {
  height: 144px;
  width: 68px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 2.6rem;
  color: var(--color-brand-primary);
  text-align: center;
  box-sizing: border-box;
}
.slot-reel.landed .slot-cell:last-child { color: var(--color-status-success); text-shadow: 0 0 10px rgba(40,167,69,.5); }
.slot-payline {
  position: absolute; left: 6px; right: 6px; top: 50%;
  height: 3px; margin-top: -1.5px;
  background: rgba(220,53,69,.75);
  box-shadow: 0 0 8px rgba(220,53,69,.85);
  pointer-events: none;
}

.slot-lever { position: relative; width: 26px; height: 148px; cursor: pointer; align-self: flex-start; margin-top: 6px; }
.slot-lever::before {
  content: '';
  position: absolute; bottom: 0; left: 50%;
  width: 8px; height: 110px;
  background: linear-gradient(90deg, #999, #eee, #999);
  border-radius: 4px;
  transform: translateX(-50%);
  transform-origin: bottom center;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.slot-lever.pulled::before { transform: translateX(-50%) scaleY(.7); }
.slot-lever-knob {
  position: absolute; top: 0; left: 50%;
  width: 28px; height: 28px;
  border-radius: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle at 35% 30%, #ff8a8a, #c0272d 70%);
  box-shadow: 0 3px 8px rgba(0,0,0,.5);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.slot-lever.pulled .slot-lever-knob { transform: translateX(-50%) translateY(24px); }

.slot-base {
  width: min(95vw, 600px);
  box-sizing: border-box;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  background: linear-gradient(160deg, #2a2a30, #111114);
  border: 5px solid #8a8a94;
  border-top: none;
  border-radius: 4px 4px 16px 16px;
  padding: 10px 20px;
  box-shadow: 0 18px 30px rgba(0,0,0,.5);
}
.slot-base-slot {
  width: 70px; height: 9px;
  background: #000;
  border-radius: 5px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.9), 0 1px 0 rgba(255,255,255,.05);
}
.slot-tray { font-size: 1.15rem; letter-spacing: 3px; opacity: .9; }

/* ---------------------------------------------------------------------
   Dice — real 3D cube (6 faces, transform-style: preserve-3d)
   --------------------------------------------------------------------- */
.dice-3d-wrap {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: var(--space-lg);
  max-width: 100%;
}
/* --die-size is set inline by spinner.js, scaled to how many dice are on
   screen at once (one per ticket-code character) so e.g. 6 dice for
   "M-1001" still fit the panel instead of overflowing at the original
   fixed 160px each. Falls back to 160px if JS hasn't set it yet. */
.dice-scene { width: var(--die-size, 160px); height: var(--die-size, 160px); perspective: 800px; }
.die-3d {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(-15deg) rotateY(20deg);
}
.die-face {
  position: absolute;
  width: var(--die-size, 160px); height: var(--die-size, 160px);
  background: linear-gradient(160deg, #fff, #f0f0f5);
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), 0 4px 10px rgba(0,0,0,.3);
  display: flex; align-items: center; justify-content: center;
  padding: 10px;
  box-sizing: border-box;
}
.die-label {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: clamp(.75rem, calc(var(--die-size, 160px) * 0.16), 1.3rem);
  color: var(--color-brand-primary);
  text-align: center;
  word-break: break-word;
  line-height: 1.15;
}
.face-1 { transform: translateZ(calc(var(--die-size, 160px) / 2)); }
.face-2 { transform: rotateX(-90deg) translateZ(calc(var(--die-size, 160px) / 2)); }
.face-3 { transform: rotateY(90deg) translateZ(calc(var(--die-size, 160px) / 2)); }
.face-4 { transform: rotateY(-90deg) translateZ(calc(var(--die-size, 160px) / 2)); }
.face-5 { transform: rotateX(90deg) translateZ(calc(var(--die-size, 160px) / 2)); }
.face-6 { transform: rotateY(180deg) translateZ(calc(var(--die-size, 160px) / 2)); }

/* ---------------------------------------------------------------------
   Winner popup
   --------------------------------------------------------------------- */
.winner-overlay {
  /* absolute, not fixed — see .start-overlay comment above */
  position: absolute; inset: 0;
  background: rgba(5,0,15,.75);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease-in-out;
  z-index: 100;
}
.winner-overlay.show { opacity: 1; pointer-events: auto; }
.winner-popup {
  background: linear-gradient(160deg, #2a0066, #12001a);
  border: 2px solid var(--color-interactive-accent);
  border-radius: var(--radius-lg);
  padding: var(--space-xl) var(--space-2xl);
  text-align: center;
  min-width: 320px;
  max-width: 90vw;
  box-shadow: 0 0 60px rgba(255,215,0,.4);
}
.winner-popup-emoji { font-size: 3rem; }
.winner-popup-logo { max-height: 64px; max-width: 200px; object-fit: contain; margin: 0 auto; display: block; }
.winner-popup-label { letter-spacing: .15em; color: #cfc4ff; font-size: .85rem; margin-top: 4px; }
.winner-popup-code {
  font-family: 'Poppins', sans-serif; font-weight: 700;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  color: var(--color-interactive-accent);
  margin-top: 8px;
}
.winner-popup-name { color: #fff; font-size: 1.1rem; margin-top: 4px; }
.winner-popup-actions { display: flex; gap: var(--space-sm); justify-content: center; margin-top: var(--space-lg); flex-wrap: wrap; }

.winner-popup.anim-bounce { animation: popBounce .6s cubic-bezier(.34,1.56,.64,1); }
.winner-popup.anim-fade { animation: popFade .5s ease-in-out; }
.winner-popup.anim-default { animation: popDefault .35s ease-out; }
.winner-popup.anim-fireworks { animation: popBounce .6s cubic-bezier(.34,1.56,.64,1); }
.winner-popup.anim-confetti { animation: popBounce .6s cubic-bezier(.34,1.56,.64,1); }

@keyframes popBounce {
  0% { transform: scale(.3); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes popFade {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes popDefault {
  from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); }
}

/* ---------------------------------------------------------------------
   Confirm dialog (in-page replacement for native confirm()) — used for
   Forfeit and Delete Winner so a native browser dialog never forces the
   page out of fullscreen mid-session.
   --------------------------------------------------------------------- */
.confirm-overlay {
  /* absolute, not fixed — see .start-overlay comment above */
  position: absolute; inset: 0;
  background: rgba(5,0,15,.8);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease-in-out;
  z-index: 200; /* above .winner-overlay (100) — forfeit is confirmed from inside the winner popup */
}
.confirm-overlay.show { opacity: 1; pointer-events: auto; }
.confirm-popup {
  background: linear-gradient(160deg, #2a0066, #12001a);
  border: 2px solid var(--color-interactive-accent);
  border-radius: var(--radius-lg);
  padding: var(--space-xl) var(--space-2xl);
  text-align: center;
  min-width: 300px;
  max-width: 90vw;
  box-shadow: 0 0 60px rgba(255,215,0,.4);
}
.confirm-popup-message { color: #fff; font-size: 1.05rem; line-height: 1.4; }
.confirm-popup-actions { display: flex; gap: var(--space-sm); justify-content: center; margin-top: var(--space-lg); }

/* ---------------------------------------------------------------------
   Particle FX layer (confetti / fireworks)
   --------------------------------------------------------------------- */
.fx-layer {
  /* absolute, not fixed — see .start-overlay comment above */
  position: absolute; inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 90;
}
.fx-confetti {
  position: absolute; top: -20px;
  width: 10px; height: 16px;
  opacity: .9;
  animation-name: fxFall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes fxFall {
  from { transform: translateY(0) rotate(0deg); opacity: .95; }
  to { transform: translateY(105vh) rotate(540deg); opacity: .2; }
}
.fx-spark {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
  animation: fxSpark 1.3s ease-out forwards;
}
@keyframes fxSpark {
  from { transform: translate(0, 0); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)); opacity: 0; }
}
.fx-glow {
  position: absolute;
  width: 10px; height: 10px;
  margin-left: -5px; margin-top: -5px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,215,0,.85), rgba(255,215,0,0) 70%);
  animation: fxGlowPulse .9s ease-out forwards;
}
@keyframes fxGlowPulse {
  from { width: 10px; height: 10px; margin-left: -5px; margin-top: -5px; opacity: 1; }
  to { width: var(--fx-glow-size, 700px); height: var(--fx-glow-size, 700px); margin-left: calc(var(--fx-glow-size, 700px) / -2); margin-top: calc(var(--fx-glow-size, 700px) / -2); opacity: 0; }
}
.fx-coin {
  position: absolute; top: -20px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6d8, var(--color-interactive-accent) 70%);
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
  animation: fxCoinFall 1.9s cubic-bezier(.17,.67,.53,.87) forwards;
}
@keyframes fxCoinFall {
  0% { transform: translateY(0) rotate(0deg) scale(.6); opacity: 0; }
  12% { opacity: 1; transform: translateY(6vh) rotate(80deg) scale(1); }
  55% { transform: translateY(45vh) rotate(280deg) scale(1); }
  75% { transform: translateY(38vh) rotate(340deg) scale(1); }
  100% { transform: translateY(75vh) rotate(540deg) scale(1); opacity: .15; }
}

/* ---------------------------------------------------------------------
   Print (tickets)
   --------------------------------------------------------------------- */
.ticket-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-md); }
.ticket-card { border: 1px dashed var(--color-border-default); border-radius: var(--radius-md); padding: var(--space-md); text-align: center; }
.ticket-card img { width: 100%; max-width: 160px; }
.ticket-code { font-family: monospace; font-weight: 700; margin-top: 6px; }

@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--color-border-default); }
  .sidebar-nav { flex-direction: row; overflow-x: auto; }
  .spinner-columns { flex-direction: column; }
  .winners-panel { width: 100%; max-height: 260px; }
  .winners-list { grid-template-columns: 1fr; }
  /* The wheel-toward-winners-panel nudge only makes sense side-by-side —
     stacked on mobile (winners panel is now below, not beside), so reset
     it here rather than leave an unexplained rightward drift. */
  .wheel-wrap, .wheel-shadow, .spinner-game-panel:has(.wheel-wrap) .pool-info, .spinner-game-panel:has(.wheel-wrap) .spin-ticker { transform: none; }
}

@media print {
  .topnav, .sidebar, .no-print { display: none !important; }
  .main-content { padding: 0; }
}

/* ---------------------------------------------------------------------
   System activation lock (Scanner/Spinner) — rendered as a sibling
   before the scanner/spinner shell, so position:fixed stays correct
   even once the shell itself is later fullscreened (see the
   .start-overlay/.winner-overlay comments elsewhere on this).
   --------------------------------------------------------------------- */
.system-lock-overlay {
  position: fixed; inset: 0;
  background: rgba(5,0,15,.92);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  padding: var(--space-md);
}
.system-lock-box {
  background: linear-gradient(160deg, #2a0066, #12001a);
  border: 2px solid var(--color-status-error);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  text-align: center;
  max-width: 420px;
  color: #fff;
  box-shadow: 0 0 60px rgba(255,0,80,.3);
}
.system-lock-icon { font-size: 3rem; margin-bottom: var(--space-sm); }
.system-lock-box h2 { margin: 0 0 var(--space-sm); font-size: 1.3rem; }
.system-lock-box p { color: #cfc4e0; margin-bottom: var(--space-lg); }
.system-lock-logout { display: block; margin-top: var(--space-md); color: #aaa; font-size: .85rem; }
