:root {
  --bg: #0c0d11;
  --panel: #171920;
  --panel-2: #1e212b;
  --text: #f7f7f9;
  --muted: #9ca3b3;
  --line: rgba(255,255,255,.09);
  --accent: #ffb703;
  --danger: #ff5b5b;
  --shadow: 0 24px 60px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at 50% 20%, #222633 0, #0c0d11 42%, #08090c 100%); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell { width: min(1580px, 96vw); margin: 0 auto; padding: 20px 0 28px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.topbar h1 { margin: 2px 0 4px; font-size: clamp(32px, 3.7vw, 56px); line-height: .95; letter-spacing: -.045em; }
.topbar p { margin: 8px 0 0; color: var(--muted); font-size: 15px; }
.eyebrow, .section-kicker { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .18em; }
.secondary-btn, .small-btn, .danger-btn, .icon-btn { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 12px; padding: 11px 16px; font-weight: 750; }
.secondary-btn:hover, .small-btn:hover { border-color: rgba(255,183,3,.6); }
.icon-btn { width: 42px; height: 42px; padding: 0; font-size: 26px; }
.danger-btn { color: #fff; background: rgba(255,91,91,.12); border-color: rgba(255,91,91,.35); }

.main-grid { display: grid; grid-template-columns: minmax(350px, 390px) minmax(480px, 1fr) minmax(250px, 300px); align-items: center; gap: 20px; min-height: calc(100vh - 145px); }
.card { background: linear-gradient(180deg, rgba(30,33,43,.97), rgba(21,23,30,.97)); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 18px; }
.section-head, .inline-title { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.section-head h2, .history-panel h2, .settings-section h3, .settings-header h2 { margin: 5px 0 0; }
.count-pill { min-width: 34px; text-align: center; padding: 6px 10px; border-radius: 999px; background: rgba(255,183,3,.14); color: var(--accent); font-weight: 800; }

/* 10 deelnemers zonder scroll: op desktop twee kolommen van maximaal vijf rijen. */
.participants-list { margin-top: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; overflow: visible; }
.participant-btn { display: grid; grid-template-columns: 44px minmax(0,1fr) 18px; align-items: center; gap: 8px; width: 100%; min-height: 58px; border: 1px solid var(--line); background: #11131a; color: var(--text); border-radius: 14px; padding: 7px; text-align: left; transition: transform .16s ease, border-color .16s ease, background .16s ease; }
.participant-btn:hover { transform: translateY(-2px); border-color: rgba(255,183,3,.55); background: #181b24; }
.participant-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.avatar { width: 44px; height: 44px; border-radius: 11px; overflow: hidden; background: #2a2e3b; display: grid; place-items: center; font-weight: 900; font-size: 17px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.participant-name { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.participant-arrow { font-size: 20px; color: var(--accent); }
.empty-state { color: var(--muted); line-height: 1.5; grid-template-columns: 1fr; }

.wheel-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; }
.wheel-stage { position: relative; width: min(62vw, 690px, calc(100vh - 180px)); aspect-ratio: 1; display: grid; place-items: center; }
#wheelCanvas { width: 100%; height: 100%; filter: drop-shadow(0 30px 40px rgba(0,0,0,.45)); transform: rotate(0deg); }
.pointer { position: absolute; top: -5px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 22px solid transparent; border-right: 22px solid transparent; border-top: 54px solid #fff; z-index: 5; filter: drop-shadow(0 6px 8px rgba(0,0,0,.4)); }
.wheel-center { position: absolute; width: 118px; height: 118px; border-radius: 50%; background: #0f1117; border: 8px solid rgba(255,255,255,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 8px 25px rgba(0,0,0,.45); pointer-events: none; }
.wheel-center span { font-size: 13px; letter-spacing: .18em; color: var(--accent); font-weight: 900; }
.wheel-center strong { font-size: 27px; line-height: 1; }
.spin-hint { margin-top: 10px; color: var(--muted); font-size: 14px; min-height: 22px; }

.history-panel { align-self: center; }
.history-list { display: grid; gap: 9px; margin-top: 14px; }
.history-empty { color: var(--muted); font-size: 14px; padding: 18px 0; }
.history-item { display: grid; grid-template-columns: 34px 1fr 34px; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 13px; padding: 8px; background: #11131a; }
.history-thumb { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; background: #2a2e3b; display: grid; place-items: center; font-weight: 900; font-size: 11px; overflow: hidden; }
.history-thumb img { width:100%; height:100%; object-fit:cover; }
.history-thumb.bottle img { object-fit:contain; background:#fff; }
.history-copy { min-width:0; font-size: 12px; line-height: 1.25; color: var(--muted); }
.history-copy strong { color: var(--text); display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* Fullscreen uitslag */
.result-overlay { position: fixed; inset: 0; z-index: 100; background: radial-gradient(circle at 50% 35%, rgba(52,56,72,.98), rgba(5,6,9,.98) 68%); display: grid; place-items: center; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .22s ease, visibility .22s ease; }
.result-overlay.show { opacity: 1; visibility: visible; pointer-events: auto; cursor: pointer; }
.overlay-content { width: min(1050px, 92vw); display:flex; flex-direction:column; align-items:center; text-align:center; animation: overlayPop .35s ease both; }
@keyframes overlayPop { from { transform:scale(.88); opacity:0; } to { transform:scale(1); opacity:1; } }
.overlay-images { display:flex; align-items:center; justify-content:center; gap: clamp(18px, 3vw, 44px); }
.overlay-image { width: clamp(190px, 25vw, 360px); height: clamp(190px, 25vw, 360px); border-radius: 34px; overflow:hidden; background:#2a2e3b; border: 4px solid rgba(255,255,255,.2); display:grid; place-items:center; font-size:clamp(60px, 9vw, 120px); font-weight:900; box-shadow: 0 28px 80px rgba(0,0,0,.5); }
.overlay-image img { width:100%; height:100%; object-fit:cover; }
.overlay-image.bottle { background:#fff; }
.overlay-image.bottle img { object-fit:contain; padding:14px; }
.overlay-plus { color:var(--accent); font-size:clamp(54px, 7vw, 96px); font-weight:1000; }
.overlay-text { margin-top: clamp(24px, 4vh, 46px); font-size: clamp(38px, 5vw, 78px); font-weight:950; line-height:1.05; letter-spacing:-.04em; }
.overlay-text strong { color:var(--accent); }
.overlay-hint { margin-top:22px; font-size:14px; color:rgba(255,255,255,.55); }

.settings-panel { position: fixed; inset: 0; pointer-events: none; visibility: hidden; z-index: 50; }
.settings-panel.open { pointer-events: auto; visibility: visible; }
.settings-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.68); opacity: 0; transition: opacity .2s ease; }
.settings-panel.open .settings-backdrop { opacity: 1; }
.settings-drawer { position: absolute; top: 0; right: 0; width: min(620px, 100vw); height: 100%; background: #111319; border-left: 1px solid var(--line); transform: translateX(100%); transition: transform .25s ease; overflow: auto; box-shadow: -30px 0 80px rgba(0,0,0,.45); }
.settings-panel.open .settings-drawer { transform: translateX(0); }
.settings-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px; background: rgba(17,19,25,.95); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.settings-body { padding: 22px; }
.settings-section { padding: 0 0 26px; margin-bottom: 26px; border-bottom: 1px solid var(--line); }
.settings-section p { color: var(--muted); margin: 7px 0 14px; font-size: 14px; line-height: 1.5; }
.segment-choice { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.segment-choice button { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px 8px; font-weight: 900; font-size: 16px; }
.segment-choice button.active { background: var(--accent); color: #151515; border-color: var(--accent); }
.editor-list { display: grid; gap: 12px; }
.editor-row { display: grid; grid-template-columns: 1fr 122px 42px; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.editor-row input[type="text"] { width: 100%; background: #0e1015; border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 11px; outline: none; }
.editor-row input[type="text"]:focus { border-color: rgba(255,183,3,.55); }
.file-label { display: flex; justify-content: center; align-items: center; min-height: 42px; background: #262a34; border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-size: 12px; font-weight: 800; text-align: center; cursor: pointer; overflow: hidden; }
.file-label.has-image { color: var(--accent); }
.file-label input { display: none; }
.remove-btn { width: 42px; height: 42px; border-radius: 10px; border: 1px solid rgba(255,91,91,.25); background: rgba(255,91,91,.08); color: #ff8585; font-size: 21px; }
.storage-note { border-bottom: 0; }

@media (max-width: 1200px) {
  .main-grid { grid-template-columns: 330px 1fr; align-items:start; }
  .history-panel { grid-column: 1 / -1; }
  .history-list { grid-template-columns: repeat(3, 1fr); }
  .wheel-stage { width:min(64vw, 620px); }
}
@media (max-width: 800px) {
  .app-shell { width:94vw; padding-top:16px; }
  .topbar { align-items:center; }
  .topbar p { display:none; }
  .main-grid { grid-template-columns:1fr; min-height:0; }
  .wheel-panel { order:1; }
  .participants-panel { order:2; }
  .history-panel { order:3; grid-column:auto; }
  .wheel-stage { width:min(92vw, 620px); }
  .participants-list { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .history-list { grid-template-columns:1fr; }
}
@media (max-width: 560px) {
  .participants-list { grid-template-columns:1fr; }
  .segment-choice { grid-template-columns: repeat(5,1fr); }
  .editor-row { grid-template-columns:1fr 102px 40px; }
  .overlay-images { gap:10px; }
  .overlay-image { width:38vw; height:38vw; border-radius:20px; }
  .overlay-plus { font-size:42px; }
}
