* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: #6db2ec; }
body { font-family: "VT323", "Courier New", monospace; color: #fff; font-size: 18px; }
body.nocursor { cursor: none; }
#field { display: block; position: fixed; inset: 0; image-rendering: pixelated; image-rendering: crisp-edges; }

/* HUD fades in on mouse move, out after a few seconds */
#hud { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity .35s; }
#hud.visible { opacity: 1; }
#hud > * { pointer-events: auto; }

#gear {
  position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 0;
  border: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(6px);
}
#gear:hover { background: rgba(0,0,0,.65); }

#statusbar {
  position: absolute; left: 14px; bottom: 12px; display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,.45); padding: 4px 12px; border-radius: 0; font-size: 17px; backdrop-filter: blur(6px);
}
#dot { width: 9px; height: 9px; border-radius: 50%; background: #888; }
#dot.on { background: #4ade80; box-shadow: 0 0 8px #4ade80; }
#dot.wait { background: #facc15; }
#dot.off { background: #ef4444; }

#settings {
  position: absolute; top: 64px; right: 14px; width: 340px; max-width: calc(100vw - 28px);
  background: rgba(18,20,34,.92); border-radius: 16px; padding: 18px; display: none;
  box-shadow: 0 10px 40px rgba(0,0,0,.4); backdrop-filter: blur(10px); font-size: 18px; border: 3px solid #fff; border-radius: 0;
}
#settings.open { display: block; }
#settings h1 { margin: 0 0 4px; font-size: 28px; font-weight: 400; }
#settings p { margin: 0 0 12px; opacity: .75; line-height: 1.35; }
#settings label { display: block; margin: 8px 0; }
#settings label.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
#settings input[type=text] {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.08); color: #fff; font: inherit; font-size: 20px; margin-top: 4px; border-radius: 0;
}
#settings input[type=text]:focus, #settings textarea:focus, #settings input[type=number]:focus { outline: 2px solid #a78bfa; }
.row.nums { gap: 12px; margin: 6px 0 0; }
.row.nums label { flex: 1; margin: 4px 0; font-size: 15px; line-height: 1.1; }
#settings input[type=number] {
  width: 100%; padding: 6px 8px; border: 1px solid rgba(255,255,255,.15); border-radius: 0;
  background: rgba(255,255,255,.08); color: #fff; font: inherit; font-size: 18px; margin-top: 4px;
}
#settings textarea {
  width: 100%; padding: 6px 10px; border: 1px solid rgba(255,255,255,.15); border-radius: 0; resize: vertical;
  background: rgba(255,255,255,.08); color: #fff; font: inherit; font-size: 16px; margin-top: 4px; line-height: 1.2;
}
.row { display: flex; gap: 8px; margin: 10px 0 6px; }
button.btn {
  flex: 1; padding: 10px; border-radius: 0; border: 0; font: inherit; font-size: 18px; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff;
}
button.btn.primary { background: #9146ff; }
button.btn:hover { filter: brightness(1.15); }
#close { position: absolute; top: 10px; right: 12px; background: none; border: 0; color: #fff; font-size: 18px; cursor: pointer; opacity: .7; }
#settings .links { margin: 12px 0 0; font-size: 16px; opacity: .85; }
#settings a { color: #c4b5fd; }

/* Advanced settings panel (Shift+S) */
#advanced {
  position: absolute; top: 64px; right: 14px; bottom: 14px; width: 440px; max-width: calc(100vw - 28px);
  background: rgba(18,20,34,.94); padding: 18px; display: none; overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,.4); backdrop-filter: blur(10px); font-size: 17px; border: 3px solid #fff;
}
#advanced.open { display: block; }
#advanced h1 { margin: 0 0 4px; font-size: 26px; font-weight: 400; }
#advanced h2 { margin: 16px 0 6px; font-size: 20px; font-weight: 400; color: #ffd166; border-bottom: 1px solid rgba(255,255,255,.15); padding-bottom: 2px; }
#advanced p { margin: 0 0 8px; opacity: .75; line-height: 1.3; }
#advanced #adv-close { position: absolute; top: 10px; right: 12px; background: none; border: 0; color: #fff; font-size: 18px; cursor: pointer; opacity: .7; }
.adv-row { display: grid; grid-template-columns: 1fr 120px; gap: 4px 10px; align-items: center; margin: 6px 0; }
.adv-row.adv-bool { grid-template-columns: auto 1fr; }
.adv-row.adv-text, .adv-row.adv-textarea, .adv-row.adv-multi { grid-template-columns: 1fr; }
.adv-row label { font-size: 16px; line-height: 1.15; }
.adv-row small { grid-column: 1 / -1; color: #9aa4b8; font-size: 14px; line-height: 1.2; margin-top: -2px; }
.adv-row input[type=number], .adv-row input[type=text], .adv-row select, .adv-row textarea {
  width: 100%; padding: 5px 8px; border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.08); color: #fff; font: inherit; font-size: 16px;
}
.adv-row select option { color: #000; }
.adv-row .multi { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.adv-row .multi label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
#advanced textarea#adv-io { width: 100%; margin-top: 8px; padding: 6px 10px; border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.08); color: #fff; font: inherit; font-size: 14px; }
#advanced .row .btn { font-size: 16px; padding: 8px 4px; }

/* Giveaway race page: streamer controls along the bottom, results in the panel */
#controls {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 8px;
  background: rgba(0,0,0,.45); padding: 8px; backdrop-filter: blur(6px); max-width: calc(100vw - 28px); flex-wrap: wrap; justify-content: center;
}
#controls .btn { flex: none; padding: 8px 14px; white-space: nowrap; }
.btn:disabled { opacity: .4; cursor: default; filter: none; }
#results { margin: 10px 0 0; padding: 8px 10px; background: rgba(255,255,255,.08); border-left: 3px solid #ffd166; line-height: 1.45; }
#results b { font-weight: 400; }
#results .btn { margin-top: 6px; width: 100%; font-size: 16px; padding: 6px; }
details { margin-top: 10px; }
details summary { cursor: pointer; opacity: .8; }
details ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.5; opacity: .85; }
code { background: rgba(255,255,255,.1); padding: 1px 5px; border-radius: 0; font-size: 16px; }
kbd { background: rgba(255,255,255,.15); padding: 1px 6px; border-radius: 0; font-size: 16px; }

/* Splash screen */
#splash {
  position: fixed; inset: 0; z-index: 10; background: #0a0f2a;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: opacity .9s; cursor: default;
}
#splash.hide { opacity: 0; pointer-events: none; }
#splash canvas { image-rendering: pixelated; image-rendering: crisp-edges; margin-bottom: 8px; }
#splash h1 { margin: 0; font-size: clamp(40px, 8vw, 96px); font-weight: 400; color: #fff; text-shadow: 4px 4px 0 #3b2d6e; letter-spacing: 1px; }
#splash p { margin: 0; font-size: clamp(20px, 3vw, 36px); color: #ffd166; text-shadow: 3px 3px 0 #3b2d6e; }
