:root{
  color-scheme: dark;
  --bg0:#070913;
  --bg1:#05060c;
  --ink:#eef0ff;
  --muted:rgba(238,240,255,.68);
  --muted2:rgba(238,240,255,.48);
  --line:rgba(255,255,255,.09);
  --line2:rgba(255,255,255,.14);
  --shadow:0 30px 90px rgba(0,0,0,.55);
  --r:22px;
  --ease:cubic-bezier(.2,.9,.2,1);
  --pad:18px;

  --danger: rgba(251,113,133,.95);
  --dangerBg: rgba(236,72,153,.08);
  --dangerBd: rgba(236,72,153,.22);
  --brand: rgba(34,211,238,1);
}

*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
  margin:0;
  background: radial-gradient(1200px 900px at 70% 20%, rgba(139,92,246,.22), transparent 55%),
              radial-gradient(900px 700px at 30% 70%, rgba(34,211,238,.16), transparent 60%),
              radial-gradient(800px 700px at 10% 20%, rgba(236,72,153,.10), transparent 58%),
              linear-gradient(180deg, var(--bg0), var(--bg1));
  color:var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  overflow:hidden;
}

.noise{
  pointer-events:none;
  position:fixed;
  inset:0;
  opacity:.06;
  mix-blend-mode: overlay;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  z-index: 1;
}

/* Confetti Canvas - z-index 99 */
#confetti{
  position:fixed;
  inset:0;
  width:100%;
  height:100%;
  pointer-events:none;
  z-index: 99;
}

.app{
  height:100vh;
  width:100vw;
  display:grid;
  grid-template-columns: minmax(420px, 100vh) 1fr;
  position:relative;
  z-index: 2;
}

/* Left wheel side */
.wheelSide{
  position:relative;
  height:100vh;
  padding: 0;
  display:grid;
  place-items:center;
  overflow:hidden;
}

.wheelGlow{
  position:absolute;
  inset: 10% 10% 10% 10%;
  filter: blur(40px);
  opacity:.7;
  background: radial-gradient(closest-side, rgba(59,130,246,.30), transparent 60%),
              radial-gradient(closest-side, rgba(139,92,246,.22), transparent 55%),
              radial-gradient(closest-side, rgba(236,72,153,.14), transparent 60%);
  transform: translateZ(0);
  animation: floaty 10s ease-in-out infinite;
}

@keyframes floaty{
  0%{ transform: translate3d(0,0,0) scale(1); opacity:.65; }
  50%{ transform: translate3d(0,-10px,0) scale(1.02); opacity:.78; }
  100%{ transform: translate3d(0,0,0) scale(1); opacity:.65; }
}

.wheelWrap{
  position:relative;
  width:100%;
  height:100%;
  display:grid;
  place-items:center;
  isolation:isolate;
  padding: 12px;
}

canvas.wheelCanvas{
  display:block;
  border-radius: 999px;
  filter: drop-shadow(0 30px 80px rgba(0,0,0,.55));
  will-change: transform;
  transform: translateZ(0);
}

.pointer{
  position:absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  z-index: 6;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,.55));
  pointer-events:none;
}

.pointer:before{
  content:"";
  position:absolute;
  left:50%;
  top: calc(-1 * var(--pDist, 0px));
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 26px solid rgba(238,240,255,.95);
  filter: drop-shadow(0 0 12px rgba(34,211,238,.18));
}

.centerCap{
  position:absolute;
  left:50%;
  top:50%;
  transform: translate(-50%, -50%);
  width: 128px;
  height: 128px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.10), transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(34,211,238,.10), transparent 60%),
    linear-gradient(180deg, rgba(10,12,20,.72), rgba(10,12,20,.42));
  border: 1px solid rgba(255,255,255,.10);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
  z-index: 7;

  display:flex;
  flex-direction: column;
  align-items:center;
  justify-content:center;
  gap: 6px;

  cursor:pointer;
  user-select:none;
  appearance:none;
  outline:none;
  color: var(--ink);
  font-family: inherit;
  padding: 0;

  transition: transform 220ms var(--ease), border-color 220ms var(--ease), background 220ms var(--ease);
}

.centerCap:hover{
  transform: translate(-50%, -50%) scale(1.02);
  border-color: rgba(34,211,238,.20);
}

.centerCap:active{
  transform: translate(-50%, -50%) scale(0.99);
}

.centerCap:focus-visible{
  box-shadow: 0 0 0 3px rgba(34,211,238,.18), 0 18px 60px rgba(0,0,0,.55);
}

.spinText{
  font-weight: 860;
  letter-spacing: .8px;
  font-size: 16px;
  text-transform: uppercase;
  text-shadow: 0 14px 40px rgba(0,0,0,.45);
}

.spinSub{
  font-size: 11px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted2);
}

.credit{
    position: absolute;
    bottom: 24px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 11px;
    color: var(--muted2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
}
.credit a {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    transition: border-color 0.2s;
}
.credit a:hover {
    border-color: var(--brand);
}

/* Right side */
.mainSide{
  position:relative;
  height:100vh;
  padding: calc(var(--pad) + 2px) calc(var(--pad) + 6px);
  display:flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
}

.brand{
  display:flex;
  flex-direction: column;
  gap: 6px;
  min-width:0;
}

.brandTitle{
  font-size: 14px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted2);
}

.brandName{
  font-size: 26px;
  font-weight: 760;
  margin:0;
  line-height: 1.05;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

.sub{
  font-size: 13px;
  color: var(--muted);
  max-width: 190ch;
  line-height: 1.4;
}

.actionsBar{
  display:flex;
  gap: 10px;
  align-items:center;
  flex-wrap: wrap;
  margin-top: 6px;
}

.pill{
  border: 1px solid var(--line);
  background: rgba(10,12,20,.30);
  backdrop-filter: blur(14px);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--ink);
  cursor:pointer;
  transition: transform 200ms var(--ease), border-color 200ms var(--ease), background 200ms var(--ease);
  box-shadow: 0 14px 40px rgba(0,0,0,.25);
  user-select:none;
  display:inline-flex;
  align-items:center;
  gap: 10px;
  white-space: nowrap;
  font-size: 13px;
}

.pill:hover{
  transform: translateY(-1px);
  border-color: var(--line2);
  background: rgba(10,12,20,.45);
}

.pillPrimary{
  border-color: rgba(34,211,238,.22);
  background: linear-gradient(90deg, rgba(34,211,238,.20), rgba(139,92,246,.14));
}

.pillPrimary:hover{
  border-color: rgba(34,211,238,.30);
  background: linear-gradient(90deg, rgba(34,211,238,.26), rgba(139,92,246,.18));
}

.pillDanger{
  border-color: var(--dangerBd);
  background: linear-gradient(90deg, rgba(236,72,153,.12), rgba(10,12,20,.28));
  color: rgba(255,220,230,.95);
}

.pillDanger:hover{
  border-color: rgba(236,72,153,.30);
  background: linear-gradient(90deg, rgba(236,72,153,.16), rgba(10,12,20,.36));
}

.pillDanger:disabled{
  cursor: not-allowed;
  transform:none;
  opacity: 0.5;
}

/* Settings Elements (Checkbox & Select) */
.optItem{
  display:flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 0;
}

.optItem.selectRow{
    align-items: center;
    justify-content: space-between;
}

.optText{
    display: flex;
    flex-direction: column;
}

.optText strong { color: var(--ink); font-weight: 500; }
.optText span { font-size: 12px; color: var(--muted2); margin-top: 2px; }

/* Sound Controls */
.soundControls{
  display: flex;
  align-items: center;
  gap: 8px;
}

.miniIconBtn{
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  color: var(--ink);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s;
}
.miniIconBtn:hover{
  background: rgba(255,255,255,.12);
  border-color: var(--line2);
}

select.glassSelect{
  appearance: none;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 6px 32px 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='rgba(238,240,255,0.7)' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 100px;
}
select.glassSelect:hover {
    background-color: rgba(255,255,255,.1);
}

.itemsBlock{
  display:flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  padding-top: 6px;
}

.itemsHead{
  display:flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.itemsHead strong{
  font-size: 12px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted2);
  white-space: nowrap;
}

.itemsHeadRight{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content:flex-end;
  min-width:0;
}

.itemsHeadRight span{
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.fieldRow{
  display:grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items:center;
}

input[type="text"], input[type="number"], textarea{
  width:100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  color: var(--ink);
  padding: 12px 12px;
  outline:none;
  transition: border-color 200ms var(--ease), background 200ms var(--ease);
}

input[type="text"]:focus, input[type="number"]:focus, textarea:focus{
  border-color: rgba(34,211,238,.22);
  background: rgba(255,255,255,.06);
}

.mini{
  border-radius: 999px;
  padding: 10px 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  cursor:pointer;
  color: var(--ink);
  transition: background 200ms var(--ease), border-color 200ms var(--ease), transform 200ms var(--ease);
  user-select:none;
  white-space: nowrap;
}

.mini:hover{
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.16);
  transform: translateY(-1px);
}

.colsHint{
  display:grid;
  grid-template-columns: 1fr 90px 42px;
  gap: 10px;
  align-items:center;
  padding: 2px 0 0;
  color: var(--muted2);
  font-size: 11px;
  letter-spacing: .6px;
  text-transform: uppercase;
  user-select:none;
}

.colsHint span:nth-child(2){
  text-align:center;
}

.itemsList{
  flex: 1;
  min-height: 0;
  overflow:auto;
  padding-right: 6px;
  display:flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.itemRow{
  display:grid;
  grid-template-columns: 1fr 90px 42px;
  gap: 10px;
  align-items:center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.itemRow:last-child{ border-bottom:none; }

.xBtn{
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display:grid;
  place-items:center;
  cursor:pointer;
  user-select:none;

  border: 1px solid var(--dangerBd);
  background: var(--dangerBg);
  color: var(--danger);

  font-size: 18px;
  line-height: 1;
  transition: transform 200ms var(--ease), background 200ms var(--ease), border-color 200ms var(--ease);
}

.xBtn:hover{
  transform: translateY(-1px);
  background: rgba(236,72,153,.12);
  border-color: rgba(236,72,153,.32);
}

.xBtn:active{
  transform: translateY(0);
}

/* Winner Pane (Persistent Bottom Text) */
.winnerPane{
  padding: 20px 0 30px;
  display:flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.winnerLabel{
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 700;
}

/* Fix: Increased line-height and padding to prevent clipping of descenders */
.winnerValue{
  font-size: clamp(40px, 6vw, 80px);
  font-weight: 860;
  line-height: 1.3;
  padding-bottom: 0.2em;
  margin:0;
  word-break: break-word;
  text-shadow: 0 14px 40px rgba(0,0,0,.45);
  background: linear-gradient(135deg, #fff 30%, #eef0ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 240ms var(--ease), transform 240ms var(--ease);
}


/* Winner Modal (Custom) - z-index 100 to stay above confetti */
.winnerModal{
  position:fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.winnerModal.open{
  display: flex;
  opacity: 1;
}

.winnerCard{
  position: relative;
  background: rgba(10,12,20,.85);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 32px;
  padding: 40px 60px;
  text-align: center;
  box-shadow: 0 40px 100px rgba(0,0,0,.7);
  transform: scale(0.9);
  transition: transform 0.3s var(--ease);
  max-width: 90vw;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.winnerModal.open .winnerCard{
  transform: scale(1);
}

.winCloseBtn{
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.05);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}
.winCloseBtn:hover{
  background: rgba(255,255,255,.1);
  color: var(--ink);
}

.winLabel{
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 700;
  opacity: 0.9;
}

/* Modal specific value - distinct from bottom text */
.winValue{
  font-size: clamp(32px, 8vw, 64px);
  font-weight: 860;
  line-height: 1.3;
  padding-bottom: 0.2em;
  margin: 10px 0;
  word-break: break-word;
  background: linear-gradient(135deg, #fff 30%, #eef0ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 30px rgba(34,211,238,.2));
}

.winSub{
  font-size: 13px;
  color: var(--muted2);
  margin-top: 8px;
}

/* Credits Section in Settings */
.creditsSection{
  padding-top: 10px;
  font-size: 11px;
  color: var(--muted2);
  display: flex;
  flex-direction: column;
  gap: 6px;
  line-height: 1.4;
}
.creditsSection p { margin: 0; }
.creditsSection a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.creditsSection a:hover {
  border-color: var(--brand);
  color: var(--ink);
}

/* Settings panel */
.scrim{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.55);
  opacity:0;
  pointer-events:none;
  transition: opacity 260ms var(--ease);
  z-index: 50;
}

.scrim.open{
  opacity:1;
  pointer-events:auto;
}

.panel{
  position:fixed;
  top: 18px;
  right: 18px;
  bottom: 18px;
  width: min(520px, calc(100vw - 36px));
  background: rgba(10,12,20,.62);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: var(--r);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  transform: translateX(110%);
  transition: transform 320ms var(--ease);
  z-index: 55;
  display:flex;
  flex-direction: column;
  overflow:hidden;
}

.panel.open{
  transform: translateX(0);
}

.panelHead{
  padding: 14px 16px 10px;
  display:flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panelTitle{
  display:flex;
  flex-direction: column;
  gap: 2px;
  min-width:0;
}

.panelTitle strong{
  font-size: 14px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted2);
}

.panelTitle span{
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

.iconBtn{
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 12px;
  cursor:pointer;
  transition: background 200ms var(--ease), border-color 200ms var(--ease);
}

.iconBtn:hover{
  background: rgba(255,255,255,.08);
  border-color: var(--line2);
}

.panelBody{
  padding: 6px 16px 16px;
  overflow:auto;
}

.divider{
  height:1px;
  background: rgba(255,255,255,.08);
  margin: 10px 0 14px;
}

.section{
  display:flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.sectionLabel{
  font-size: 12px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted2);
}

.presetRow{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

.seg{
  flex: 1;
  min-width: 120px;
  text-align:center;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  cursor:pointer;
  transition: transform 200ms var(--ease), background 200ms var(--ease), border-color 200ms var(--ease);
  user-select:none;
  color: var(--ink);
}

.seg:hover{
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.16);
  background: rgba(255,255,255,.07);
}

.seg.active{
  border-color: rgba(34,211,238,.28);
  background: linear-gradient(90deg, rgba(34,211,238,.18), rgba(139,92,246,.12));
}

.sliderBlock{
  display:flex;
  flex-direction: column;
  gap: 8px;
}

.sliderTop{
  display:flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.sliderTop strong{
  font-size: 13px;
  font-weight: 760;
  color: rgba(238,240,255,.92);
}

.sliderTop span{
  font-size: 12px;
  color: var(--muted);
}

.sliderRow{
  display:grid;
  grid-template-columns: 60px 1fr 60px;
  gap: 10px;
  align-items: center;
}

.edgeTxt{
  font-size: 11px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted2);
  text-align:center;
  user-select:none;
}

input[type="range"]{
  width:100%;
  margin:0;
  appearance: none;
  height: 22px;
  background: transparent;
  cursor:pointer;
}

input[type="range"]::-webkit-slider-runnable-track{
  height: 6px;
  border-radius: 999px;
  /* Updated Gradient for better visibility */
  background: linear-gradient(90deg, rgba(34,211,238,.5), rgba(139,92,246,.5), rgba(236,72,153,.4));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
input[type="range"]::-webkit-slider-thumb{
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  margin-top: -5px;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.95), rgba(238,240,255,.65));
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 0 16px rgba(34,211,238,.15), 0 10px 24px rgba(0,0,0,.35);
}

input[type="checkbox"]{
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  cursor: pointer;
  margin: 0;
}

.hint{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

code {
    background: rgba(255,255,255,0.1);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
}

/* Modal */
.modalBack{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.62);
  display:none;
  align-items:center;
  justify-content:center;
  padding: 18px;
  z-index: 80;
}
.modalBack.open{ display:flex; }

.modal{
  width: min(600px, 96vw);
  border-radius: var(--r);
  background: rgba(10,12,20,.70);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  overflow:hidden;
}

.modalHead{
  padding: 14px 16px;
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.modalHead strong{
  font-size: 14px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted2);
}

.modalBody{
  padding: 14px 16px 16px;
}

.modalBody textarea{
  min-height: 280px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  line-height: 1.35;
}

.modalFoot{
  padding: 12px 16px 16px;
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 1100px){
  body{ overflow:auto; }
  .app{
    grid-template-columns: 1fr;
    height:auto;
    min-height:100vh;
  }
  .wheelSide{ height: 100vh; }
  .mainSide{
    height:auto;
    min-height: 100vh;
  }
  .itemsList{ max-height: 45vh; }
}

@media (prefers-reduced-motion: reduce){
  *{ animation:none !important; transition:none !important; scroll-behavior:auto !important; }
}