:root {
  --bg: #0f172a;
  --panel: #1e293b;
  /* --panel: #33456b; */
  --panel-2: #3e5180;
  --text: #e2e8f0;
  --muted: #94a3b8;
  /* --primary: #6366f1; */
  --primary: #004a91; /*#004A92*/
  --primary-hover: #003a7a;
  --danger: #ef4444;
  --border: #334155;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  /* background: radial-gradient(circle at top, #1e293b, var(--bg)); */
  background-color: #004A92;
  background-image: url('background.jpg');
  /* background-size: cover;
  background-position: center center; */
  background-size: unset;
  background-position: bottom;
  background-repeat: repeat;  
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  min-width: 100vw;
}

/* On touch devices, fixed attachment is unreliable; let it scroll with content
   while still covering the full viewport. */
@media (max-width: 900px), (hover: none) {
  body {
    background-attachment: scroll;
  }
}

#root {
  min-height: 100vh;
  min-width: 100vw;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.app-header {
  text-align: center;
  padding: 28px 16px 8px;
}

.app-header h1 {
  margin: 0;
  font-size: 2.2rem;
  letter-spacing: 0.5px;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.layout {
  flex: 1;
  display: flex;
  /* flex-wrap: wrap; */
  gap: 32px;
  justify-content: center;
  align-items: center;
  padding: 24px 16px 48px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* Wheel */
.wheel-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wheel-wrap {
  position: relative;
  width: min(700px, 90vw, 78vh);
  aspect-ratio: 1 / 1;
}

.wheel-canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  display: block;
}

.pointer {
  position: absolute;
  top: clamp(-6px, -1.2vw, -4px);
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: clamp(12px, 3.4vw, 18px) solid transparent;
  border-right: clamp(12px, 3.4vw, 18px) solid transparent;
  border-top: clamp(20px, 5.8vw, 30px) solid #f8fafc;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.4));
  z-index: 5;
}

.spin-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(64px, 18.5vw, 96px);
  height: clamp(64px, 18.5vw, 96px);
  border-radius: 50%;
  border: clamp(4px, 1.2vw, 6px) solid #f8fafc;
  background: var(--primary);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  z-index: 4;
  transition: background 0.2s, transform 0.1s;
}

.spin-center:hover:not(:disabled) { background: var(--primary-hover); }
.spin-center:active:not(:disabled) { transform: translate(-50%, -50%) scale(0.95); }
.spin-center:disabled { opacity: 0.9; cursor: not-allowed; }

.total-info {
  margin-top: 18px;
  color: var(--muted);
}

/* Panel */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  width: 340px;
  max-width: 90vw;
}

.panel h2 { margin: 0 0 14px; }

.event-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.event-label {
  font-size: 13px;
  color: var(--muted, #94a3b8);
}

.event-form input[type="time"],
.event-form input[type="number"] {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: inherit;
  padding: 8px 10px;
  font-size: 14px;
  width: 100%;
}

.pacing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pacing-grid .event-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.event-note {
  margin: 0;
  font-size: 12px;
  color: var(--muted, #94a3b8);
  line-height: 1.4;
}

.sched-info {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.sched-info .event-label {
  margin: 0 0 8px;
  font-weight: 600;
  color: var(--text);
}

.sched-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sched-list li {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.sched-list li span:last-child {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.add-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.add-form input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 10px;
  font-size: 0.95rem;
  min-width: 0;
}

.add-form input[type="text"] {
  flex: 1;
}

.add-form input[name="qty"] {
  flex: 0 0 56px;
  width: 56px;
}

.add-form .btn {
  flex-shrink: 0;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  width: 100%;
  margin-top: 12px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

.toggle-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  width: auto;
  margin-top: 0;
  z-index: 20;
  background: var(--panel);
}

.prize-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prize-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-2);
  border-radius: 8px;
  padding: 8px 10px;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}

.prize-row .name {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.95rem;
  min-width: 0;
}

.prize-row .name:focus { outline: 1px solid var(--primary); border-radius: 4px; }

.prize-row .count {
  width: 56px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 5px 6px;
  text-align: center;
}

.remove-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.remove-btn:hover { color: var(--danger); }

.empty-msg {
  color: var(--muted);
  text-align: center;
  padding: 20px 0;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal.hidden { display: none; }

.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  max-width: 360px;
  width: 90%;
  animation: pop 0.25s ease;
}

@keyframes pop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-label {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.8rem;
}

.modal-card .modal-title {
  margin: 2.5rem;
  font-size: 2.5rem;
  color: var(--text);
}

.modal-note { color: var(--muted); margin: 0 0 20px; }

/* Responsive: tablet */
@media (max-width: 900px) {
  .layout {
    flex-direction: column;
    gap: 24px;
    padding: 16px 12px 40px;
  }

  .panel {
    width: 100%;
    max-width: 520px;
  }
}

/* Responsive: mobile */
@media (max-width: 600px) {
  .app-header {
    padding: 20px 12px 4px;
  }

  .app-header h1 {
    font-size: 1.6rem;
  }

  .subtitle {
    font-size: 0.85rem;
  }

  .toggle-panel {
    position: static;
    margin: 12px auto 0;
    display: block;
    width: auto;
  }

  .layout {
    padding: 12px 10px 32px;
  }

  .spin-center {
    font-size: 0.9rem;
  }
}
