* { box-sizing: border-box; }
:root {
  --bg: #0b1020;
  --card: #121934;
  --accent: #7c5cff;
  --accent-2: #3ddc97;
  --text: #eaf0ff;
  --muted: #a9b4d0;
  --danger: #ff6b6b;
}
/* Light theme variables */
body[data-theme='light'] {
  /* Softer, slightly darker light theme for eye comfort */
  --bg: #e9edf5;
  --card: #f8faff;
  --accent: #6b5cff;
  --accent-2: #0f9960;
  --text: #0f172a;
  --danger: #e11d48;
}
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, 'Apple Color Emoji', 'Segoe UI Emoji';
  background: var(--bg);
  color: var(--text);
}

/* Floating background symbols */
.floating-bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.floating-bg .sym { position: absolute; font-size: 38px; opacity: 0.28; filter: blur(0.1px); padding: 20px 16px; 
  text-shadow: 0 2px 8px rgba(0,0,0,0.25);
  animation: floatY linear infinite, floatX ease-in-out infinite, spinSym linear infinite, pulse 6s ease-in-out infinite; }
body[data-theme='light'] .floating-bg .sym { opacity: 0.20; text-shadow: 0 2px 8px rgba(0,0,0,0.15); }
@keyframes floatY { from { transform: translateY(110vh); } to { transform: translateY(-20vh); } }
@keyframes floatX { 0%,100% { margin-left: 0; } 50% { margin-left: 28px; } }
@keyframes spinSym { from { rotate: 0deg; } to { rotate: 360deg; } }
@keyframes pulse { 0%,100% { transform-origin: center; scale: 1; } 50% { scale: 1.15; } }
/* Randomize positions/durations */
.floating-bg .sym:nth-child(1)  { left: 6%;  animation-duration: 20s, 6s, 18s;  animation-delay: 0s, .2s, 0s; }
.floating-bg .sym:nth-child(2)  { left: 14%; animation-duration: 25s, 7s, 19s;  animation-delay: 2s, .6s, .4s; }
.floating-bg .sym:nth-child(3)  { left: 22%; animation-duration: 22s, 6s, 16s;  animation-delay: 1.2s, .4s, .8s; }
.floating-bg .sym:nth-child(4)  { left: 30%; animation-duration: 19s, 8s, 22s; animation-delay: .6s, .8s, .2s; }
.floating-bg .sym:nth-child(5)  { left: 38%; animation-duration: 24s, 6s, 15s;  animation-delay: 3s, .1s, 1.1s; }
.floating-bg .sym:nth-child(6)  { left: 50%; animation-duration: 21s, 7s, 20s;  animation-delay: .4s, 1s, .7s; }
.floating-bg .sym:nth-child(7)  { left: 62%; animation-duration: 19s, 6s, 15s;  animation-delay: 2.6s, .3s, 1.4s; }
.floating-bg .sym:nth-child(8)  { left: 70%; animation-duration: 26s, 6s, 17s;  animation-delay: 1.4s, .9s, .3s; }
.floating-bg .sym:nth-child(9)  { left: 78%; animation-duration: 18s, 7s, 18s;  animation-delay: .8s, .5s, .9s; }
.floating-bg .sym:nth-child(10) { left: 86%; animation-duration: 24s, 6s, 21s;  animation-delay: 3.2s, .7s, 1.5s; }
.floating-bg .sym:nth-child(11) { left: 18%; animation-duration: 22s, 7s, 20s;  animation-delay: 2.1s, .9s, .6s; }
.floating-bg .sym:nth-child(12) { left: 44%; animation-duration: 27s, 6s, 23s;  animation-delay: .9s, .2s, 1.2s; }
/* New ones for 13-24 */
.floating-bg .sym:nth-child(13) { left: 8%;  animation-duration: 21s, 6s, 18s;  animation-delay: .3s, .5s, .2s; font-size: 38px; }
.floating-bg .sym:nth-child(14) { left: 20%; animation-duration: 20s, 6s, 16s;  animation-delay: 1.1s, .2s, .9s; font-size: 30px; }
.floating-bg .sym:nth-child(15) { left: 28%; animation-duration: 23s, 7s, 21s;  animation-delay: 2.5s, .4s, .7s; font-size: 40px; }
.floating-bg .sym:nth-child(16) { left: 36%; animation-duration: 26s, 8s, 24s; animation-delay: .7s, .8s, .3s; font-size: 32px; }
.floating-bg .sym:nth-child(17) { left: 48%; animation-duration: 18s, 6s, 19s;  animation-delay: 1.8s, .6s, 1.1s; font-size: 36px; }
.floating-bg .sym:nth-child(18) { left: 58%; animation-duration: 22s, 7s, 22s;  animation-delay: .2s, 1s, .5s; font-size: 34px; }
.floating-bg .sym:nth-child(19) { left: 66%; animation-duration: 19s, 6s, 14s;  animation-delay: 1.3s, .3s, .8s; font-size: 42px; }
.floating-bg .sym:nth-child(20) { left: 74%; animation-duration: 24s, 6s, 17s;  animation-delay: 2.9s, .9s, .4s; font-size: 28px; }
.floating-bg .sym:nth-child(21) { left: 82%; animation-duration: 21s, 7s, 18s;  animation-delay: .5s, .4s, 1.3s; font-size: 36px; }
.floating-bg .sym:nth-child(22) { left: 12%; animation-duration: 27s, 6s, 22s;  animation-delay: 1.7s, .7s, .6s; font-size: 32px; }
.floating-bg .sym:nth-child(23) { left: 40%; animation-duration: 18s, 8s, 15s; animation-delay: .4s, .1s, 1.0s; font-size: 44px; }
.floating-bg .sym:nth-child(24) { left: 68%; animation-duration: 28s, 6s, 25s;  animation-delay: 2.2s, .6s, .2s; font-size: 30px; }

/* Additional symbols 25-36 */
.floating-bg .sym:nth-child(25) { left: 10%; animation-duration: 22s, 6s, 19s; animation-delay: 1.0s, .4s, .7s; font-size: 34px; }
.floating-bg .sym:nth-child(26) { left: 16%; animation-duration: 24s, 7s, 20s; animation-delay: .5s, .6s, .2s; font-size: 30px; }
.floating-bg .sym:nth-child(27) { left: 26%; animation-duration: 20s, 6s, 16s; animation-delay: 1.7s, .3s, 1.0s; font-size: 36px; }
.floating-bg .sym:nth-child(28) { left: 34%; animation-duration: 23s, 7s, 21s; animation-delay: 2.4s, .8s, .9s; font-size: 32px; }
.floating-bg .sym:nth-child(29) { left: 46%; animation-duration: 19s, 6s, 15s; animation-delay: .8s, .2s, .4s; font-size: 40px; }
.floating-bg .sym:nth-child(30) { left: 54%; animation-duration: 25s, 7s, 22s; animation-delay: 1.3s, .9s, .6s; font-size: 28px; }
.floating-bg .sym:nth-child(31) { left: 60%; animation-duration: 21s, 6s, 18s; animation-delay: 2.1s, .5s, 1.1s; font-size: 38px; }
.floating-bg .sym:nth-child(32) { left: 72%; animation-duration: 24s, 7s, 20s; animation-delay: .2s, .7s, .3s; font-size: 30px; }
.floating-bg .sym:nth-child(33) { left: 80%; animation-duration: 20s, 6s, 17s; animation-delay: 1.9s, .4s, .5s; font-size: 36px; }
.floating-bg .sym:nth-child(34) { left: 84%; animation-duration: 26s, 7s, 23s; animation-delay: .6s, .8s, .9s; font-size: 32px; }
.floating-bg .sym:nth-child(35) { left: 88%; animation-duration: 22s, 6s, 19s; animation-delay: 2.7s, .1s, 1.2s; font-size: 34px; }
.floating-bg .sym:nth-child(36) { left: 92%; animation-duration: 24s, 7s, 21s; animation-delay: 1.4s, .6s, .7s; font-size: 30px; }

/* Floating icons on visible sides */
.floating-side { position: fixed; top: 0; bottom: 0; width: 72px; z-index: 0; pointer-events: none; display: grid; place-items: center; }
.floating-side.left { left: 0; }
.floating-side.right { right: 0; }
.floating-side .sym {
  position: absolute; font-size: 30px; opacity: 0.30; filter: blur(0.1px);
  text-shadow: 0 2px 8px rgba(0,0,0,0.25);
  animation: sideFloatY linear infinite, sideWobble ease-in-out infinite, spinSym linear infinite;
}
body[data-theme='light'] .floating-side .sym { opacity: 0.24; text-shadow: 0 2px 8px rgba(0,0,0,0.15); }

@keyframes sideFloatY { from { transform: translateY(105vh); } to { transform: translateY(-20vh); } }
@keyframes sideWobble { 0%,100% { transform-origin: center; translate: 0 0; } 50% { translate: 4px -2px; } }

/* Vary positions/speeds for left column */
.floating-side.left .sym:nth-child(1)  { left: 18px; top: 4%;  animation-duration: 18s, 6s, 20s; animation-delay: -6s, .1s, 0s; }
.floating-side.left .sym:nth-child(2)  { left: 24px; top: 12%; animation-duration: 21s, 6s, 22s; animation-delay: -5s, .4s, .2s; }
.floating-side.left .sym:nth-child(3)  { left: 12px; top: 20%; animation-duration: 16s, 5s, 18s; animation-delay: -7s, .2s, .3s; }
.floating-side.left .sym:nth-child(4)  { left: 30px; top: 28%; animation-duration: 20s, 7s, 24s; animation-delay: -8s, .7s, .1s; }
.floating-side.left .sym:nth-child(5)  { left: 8px;  top: 36%; animation-duration: 17s, 6s, 19s; animation-delay: -4s, .5s, .4s; }
.floating-side.left .sym:nth-child(6)  { left: 26px; top: 44%; animation-duration: 19s, 6s, 21s; animation-delay: -9s, .3s, .6s; }
.floating-side.left .sym:nth-child(7)  { left: 14px; top: 52%; animation-duration: 23s, 7s, 25s; animation-delay: -3s, .8s, .5s; }
.floating-side.left .sym:nth-child(8)  { left: 34px; top: 60%; animation-duration: 18s, 5s, 20s; animation-delay: -10s, .6s, .8s; }
.floating-side.left .sym:nth-child(9)  { left: 20px; top: 68%; animation-duration: 22s, 6s, 24s; animation-delay: -5s, .2s, .9s; }
.floating-side.left .sym:nth-child(10) { left: 10px; top: 76%; animation-duration: 17s, 6s, 19s; animation-delay: -11s, .4s, .7s; }
.floating-side.left .sym:nth-child(11) { left: 28px; top: 84%; animation-duration: 21s, 6s, 22s; animation-delay: -6s, .6s, .2s; }
.floating-side.left .sym:nth-child(12) { left: 16px; top: 8%;  animation-duration: 19s, 6s, 21s; animation-delay: -7s, .3s, 1.0s; }
.floating-side.left .sym:nth-child(13) { left: 6px;  top: 24%; animation-duration: 20s, 7s, 23s; animation-delay: -8s, .9s, .6s; }
.floating-side.left .sym:nth-child(14) { left: 22px; top: 40%; animation-duration: 18s, 5s, 20s; animation-delay: -9s, .5s, .3s; }
.floating-side.left .sym:nth-child(15) { left: 30px; top: 56%; animation-duration: 24s, 7s, 26s; animation-delay: -10s, .7s, 1.0s; }
.floating-side.left .sym:nth-child(16) { left: 12px; top: 72%; animation-duration: 19s, 6s, 21s; animation-delay: -6s, .6s, .7s; }

/* Vary positions/speeds for right column */
.floating-side.right .sym:nth-child(1)  { right: 18px; top: 6%;  animation-duration: 19s, 6s, 21s; animation-delay: -5s, .2s, .1s; }
.floating-side.right .sym:nth-child(2)  { right: 24px; top: 14%; animation-duration: 22s, 6s, 23s; animation-delay: -7s, .3s, .4s; }
.floating-side.right .sym:nth-child(3)  { right: 12px; top: 22%; animation-duration: 16s, 5s, 18s; animation-delay: -6s, .5s, .5s; }
.floating-side.right .sym:nth-child(4)  { right: 30px; top: 30%; animation-duration: 20s, 7s, 24s; animation-delay: -9s, .7s, .2s; }
.floating-side.right .sym:nth-child(5)  { right: 8px;  top: 38%; animation-duration: 18s, 6s, 20s; animation-delay: -4s, .6s, .6s; }
.floating-side.right .sym:nth-child(6)  { right: 26px; top: 46%; animation-duration: 19s, 6s, 21s; animation-delay: -10s, .4s, .8s; }
.floating-side.right .sym:nth-child(7)  { right: 14px; top: 54%; animation-duration: 23s, 7s, 25s; animation-delay: -3s, .9s, .5s; }
.floating-side.right .sym:nth-child(8)  { right: 34px; top: 62%; animation-duration: 18s, 5s, 20s; animation-delay: -8s, .8s, .9s; }
.floating-side.right .sym:nth-child(9)  { right: 20px; top: 70%; animation-duration: 22s, 6s, 24s; animation-delay: -5s, .4s, 1.1s; }
.floating-side.right .sym:nth-child(10) { right: 10px; top: 78%; animation-duration: 17s, 6s, 19s; animation-delay: -11s, .5s, .7s; }
.floating-side.right .sym:nth-child(11) { right: 28px; top: 86%; animation-duration: 21s, 6s, 22s; animation-delay: -6s, .7s, .3s; }
.floating-side.right .sym:nth-child(12) { right: 16px; top: 10%; animation-duration: 19s, 6s, 21s; animation-delay: -7s, .3s, 1.0s; }
.floating-side.right .sym:nth-child(13) { right: 6px;  top: 26%; animation-duration: 20s, 7s, 23s; animation-delay: -8s, .9s, .6s; }
.floating-side.right .sym:nth-child(14) { right: 22px; top: 42%; animation-duration: 18s, 5s, 20s; animation-delay: -9s, .5s, .4s; }
.floating-side.right .sym:nth-child(15) { right: 30px; top: 58%; animation-duration: 24s, 7s, 26s; animation-delay: -10s, .7s, 1.0s; }
.floating-side.right .sym:nth-child(16) { right: 12px; top: 74%; animation-duration: 19s, 6s, 21s; animation-delay: -6s, .6s, .9s; }

/* Avoid covering content on very small screens */
@media (max-width: 900px) {
  .floating-side { display: none; }
}

/* Ensure app sits above background */
.app-header, .container, .app-footer { position: relative; z-index: 1; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1100px; margin: 0 auto; }
.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-switcher { 
  display: grid; 
  grid-auto-flow: row; 
  gap: 6px; 
  text-align: right; 
}

.theme-switcher label { 
  font-size: 12px; 
  color: var(--muted); 
}

.theme-switcher select { 
  background: var(--card); 
  border: 1px solid rgba(0,0,0,0.08); 
  color: var(--text); 
  padding: 8px 10px; 
  border-radius: 10px; 
  cursor: pointer;
}

.help-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

.help-btn:hover {
  background: #6a4eff;
  transform: translateY(-1px);
}

.help-btn:active {
  transform: translateY(0);
}

.help-icon {
  font-size: 14px;
  display: inline-flex;
  align-items: center;
}
.app-header h1 {
  margin: 0 0 6px 0;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.subtitle { color: var(--muted); margin: 0; }

/* Footer author styling */
.app-footer { padding: 14px 0 24px; text-align: center; }
.app-footer .author {
  display: inline-block;
  font-weight: 700;
  letter-spacing: 0.4px;
  background: linear-gradient(90deg, var(--accent), #5f87ff, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 10px rgba(92, 135, 255, 0.25);
}
body[data-theme='light'] .app-footer .author { text-shadow: 0 2px 10px rgba(92, 135, 255, 0.15); }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 16px;
}
@media (max-width: 980px) {
  .container { grid-template-columns: 1fr; }
}

.controls {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 14px;
  padding: 16px;
  backdrop-filter: blur(6px);
}
body[data-theme='light'] .controls { background: #ffffff; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field input[type="file"], .field select, .field textarea {
  width: 100%;
  background: var(--card);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
}
.field textarea { height: 140px; resize: vertical; line-height: 1.5; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .row { grid-template-columns: 1fr; } }

.actions { display: flex; gap: 8px; margin-top: 8px; }
button { cursor: pointer; border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 600; }
button.primary { background: linear-gradient(135deg, var(--accent), #5f87ff); color: white; }
button.ghost { background: rgba(255,255,255,0.06); color: var(--text); }
button.danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.stage {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 14px;
  padding: 16px;
  display: grid;
  grid-template-rows: auto auto;
  gap: 12px;
}
body[data-theme='light'] .stage { background: #ffffff; }

.stage-pane { position: relative; display: grid; place-items: center; min-height: 520px; }
.stage-pane.hidden { display: none; }

/* Dual wheels layout */
.wheel-grid { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 980px) { .wheel-grid { grid-template-columns: 1fr; } }
.wheel-pane { display: grid; gap: 8px; justify-items: center; }
.wheel-wrap { position: relative; }
.caption { color: var(--muted); font-size: 13px; text-align: center; }
.wheel-actions { display: flex; gap: 8px; }

.pointer {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  font-size: 28px; color: var(--accent-2);
  text-shadow: 0 0 12px rgba(61,220,151,0.7);
}

canvas#wheelCanvas { background: radial-gradient(400px 300px at 50% 45%, #17214a, #101734); border-radius: 50%; box-shadow: 0 10px 24px rgba(0,0,0,0.20), inset 0 0 0 10px rgba(255,255,255,0.04); }
body[data-theme='light'] canvas#wheelCanvas { background: radial-gradient(400px 300px at 50% 45%, #e7ecfa, #dbe4f9); box-shadow: 0 10px 24px rgba(0,0,0,0.12), inset 0 0 0 10px rgba(0,0,0,0.05); }

.result { text-align: center; }
.result .label { color: var(--muted); font-size: 12px; }
.result .result-name { font-size: 28px; font-weight: 800; margin-top: 6px; }
.result .result-actions { margin-top: 8px; }

/* Name highlight animation when chosen */
.result .result-name.flash-win {
  /* Continuous smooth pulse; single chroma sweep to settle */
  animation: nameBlink 1.6s ease-in-out infinite, nameChroma 1.2s ease-in-out 1 forwards;
}

@keyframes nameBlink {
  0%, 100% {
    color: inherit;
    text-shadow: none;
  }
  50% {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255,255,255,0.5), 0 0 18px rgba(255,255,255,0.35);
  }
}

@keyframes nameChroma {
  0%   { color: var(--accent-2); }
  50%  { color: #ffffff; }
  100% { color: var(--text); }
}

/* Dice (placeholder animation) */
.dice {
  width: 120px; height: 120px; background: var(--card); border-radius: 20px; position: relative; animation: gentle 2.2s ease-in-out infinite;
}
.dice .dot { width: 16px; height: 16px; background: #fff; border-radius: 50%; position: absolute; }
.dice .dot:nth-child(1) { top: 16px; left: 16px; }
.dice .dot:nth-child(2) { top: 16px; right: 16px; }
.dice .dot:nth-child(3) { bottom: 16px; left: 16px; }
.dice .dot:nth-child(4) { bottom: 16px; right: 16px; }
.dice .dot:nth-child(5) { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.dice .dot:nth-child(6) { top: 50%; right: 16px; transform: translateY(-50%); }
/* rolling state */
.dice.rolling { animation: roll 1s cubic-bezier(.2,.8,.2,1) 1; }

@keyframes roll {
  0% { transform: rotate(0deg) translateZ(0); }
  20% { transform: rotate(20deg); }
  40% { transform: rotate(-18deg); }
  60% { transform: rotate(12deg); }
  80% { transform: rotate(-6deg); }
  100% { transform: rotate(0deg); }
}

/* Chest (placeholder) */
.chest { position: relative; width: 240px; height: 160px; }
.chest .box { background: #8b5a2b; width: 100%; height: 100%; border-radius: 8px; box-shadow: inset 0 0 0 4px #5c3c1c; }
.chest .lid { position: absolute; top: 0; left: 0; right: 0; height: 40%; background: #b07d43; border-radius: 8px 8px 0 0; transform-origin: top; }
.chest.open .lid { animation: lid 1.2s ease-out 1 forwards; }
.chest.open .box { box-shadow: inset 0 0 0 4px #5c3c1c, 0 0 20px rgba(255, 215, 0, 0.4); }

@keyframes lid { 0% { transform: rotateX(0deg); } 60% { transform: rotateX(-48deg); } 100% { transform: rotateX(-42deg); } }
@keyframes gentle { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(4deg); } }

.preview { margin-top: 8px; color: var(--muted); font-size: 13px; }
.preview img { max-width: 100%; border-radius: 10px; border: 1px solid rgba(0,0,0,0.08); margin-top: 6px; }

.help-btn {
  display: inline-block;
  margin-left: 10px;
  padding: 8px 14px;
  background-color: #e63946; /* red tone */
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.2s, transform 0.1s;
}

.help-btn:hover {
  background-color: #c62828; /* darker red on hover */
  transform: translateY(-1px);
}

.wheel-wrap {
  position: relative;
}

.center-spin-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  
  width: 70px;
  height: 70px;
  border-radius: 50%;
  
  background: linear-gradient(135deg, #6c63ff, #4dd599);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  
  border: none;
  cursor: pointer;
  z-index: 5;

  box-shadow: 0 8px 20px rgba(0,0,0,.25);
}

.center-spin-btn:hover {
  transform: translate(-50%, -50%) scale(1.05);
}

.center-spin-btn:active {
  transform: translate(-50%, -50%) scale(0.95);
}


