:root {
  color-scheme: dark;
  --bg1: #1a1a2e;
  --bg2: #16213e;
  --bg3: #0f3460;
  --red: #e94560;
  --red2: #ff2e63;
  --teal: #00cec9;
  --green: #00b894;
  --gold: #f9a826;
  --yellow: #ffeb3b;
  --border: rgba(255, 255, 255, 0.18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Jua', 'Gowun Dodum', system-ui, "Malgun Gothic", sans-serif;
  color: #fff;
  background: linear-gradient(135deg, var(--bg1), var(--bg2), var(--bg3));
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

h1 {
  font-size: 1.9rem;
  text-align: center;
  margin: 8px 0 20px;
  text-shadow: 0 0 10px var(--red);
}

h2 { color: var(--gold); font-size: 1.3rem; text-align: center; }

label { color: #cfcfe6; }

select, input[type="text"], input[type="number"], input[type="password"] {
  width: 100%;
  padding: 14px;
  font-size: 1.05rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

select:focus, input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
select option { color: #222; }

.hidden { display: none !important; }

#prize-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }

.prize-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.95);
  color: #1a1a2e;
  border: 2px solid transparent;
  border-radius: 14px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.prize-option:has(input:checked) { border-color: var(--gold); transform: translateY(-2px); }

button {
  padding: 15px 26px;
  font-size: 1.15rem;
  font-family: 'Jua', 'Gowun Dodum', sans-serif;
  border: none;
  border-radius: 50px;
  background: linear-gradient(45deg, var(--red), var(--red2));
  color: white;
  cursor: pointer;
  margin: 6px 6px 6px 0;
  box-shadow: 0 8px 15px rgba(233, 69, 96, 0.4);
  transition: transform 0.1s ease;
}

button:active:not(:disabled) { transform: scale(0.95); }
button:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

button.secondary { background: linear-gradient(45deg, #8a7ba8, #5b4a80); box-shadow: 0 8px 15px rgba(90, 70, 130, 0.4); }
button.danger { background: linear-gradient(45deg, var(--green), var(--teal)); box-shadow: 0 8px 15px rgba(0, 184, 148, 0.4); }

.error { color: var(--red2); font-weight: 600; }

#status-message { color: #cfcfe6; margin: 8px 0 16px; text-align: center; }

table { width: 100%; border-collapse: collapse; margin: 12px 0; background: rgba(255, 255, 255, 0.95); border-radius: 12px; overflow: hidden; color: #1a1a2e; }
th, td { border-bottom: 1px solid #ddd; padding: 10px 8px; text-align: left; font-size: 0.9rem; }
th { background: #f0f0f5; font-weight: normal; }

fieldset { border: 1px solid var(--border); border-radius: 18px; margin-bottom: 20px; padding: 16px; background: rgba(255, 255, 255, 0.05); }
legend { padding: 4px 10px; font-size: 1.05rem; color: var(--gold); }

ul { list-style: none; padding: 0; margin: 0 0 12px; }
li { display: flex; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px dashed var(--border); }
.prize-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; vertical-align: middle; margin-right: 6px; border: 2px solid var(--gold); }

#seed-picker-list { max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; padding: 10px; margin-bottom: 10px; background: rgba(255, 255, 255, 0.05); }
#seed-picker-list label { display: block; padding: 4px 0; }

@keyframes reveal-pop { from { opacity: 0; transform: scale(0.9) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }
#reveal-list li, #live-reveal-list li { animation: reveal-pop 0.3s ease-out; }

/* Slot-machine style event reveal */
.shake-title {
  text-align: center;
  color: var(--yellow);
  font-size: 1.3rem;
  margin: 8px 0;
  animation: shake 0.3s infinite;
}

@keyframes shake {
  0% { transform: translate(2px, 1px) rotate(0deg); }
  50% { transform: translate(-2px, -1px) rotate(-1deg); }
  100% { transform: translate(1px, 2px) rotate(1deg); }
}

.heartbeat { animation: heartbeat 0.8s infinite; }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

.spotlight {
  background: rgba(0, 0, 0, 0.6);
  border: 4px solid var(--red);
  border-radius: 15px;
  padding: 24px 16px;
  margin: 16px 0;
  text-align: center;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
  width: min(90vw, 420px);
}

.spotlight-prize { font-size: 1.1rem; color: var(--gold); margin-bottom: 10px; }

.spotlight-name {
  font-size: 2.6rem;
  color: var(--teal);
  text-shadow: 0 0 16px rgba(0, 184, 148, 0.7);
  animation: spotlight-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  word-break: keep-all;
}

@keyframes spotlight-pop { 0% { transform: scale(0.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.spotlight-spinning { color: #fff; text-shadow: none; animation: none; }

/* Full-screen event takeover for the live draw moment */
.event-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  margin: 0;
  padding: 24px 20px 32px;
  background: linear-gradient(135deg, var(--bg1), var(--bg2), var(--bg3));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow-y: auto;
  animation: fade-in 0.4s ease-in-out;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.event-screen h2 { margin-bottom: 4px; }

#reveal-list, #live-reveal-list {
  width: 100%;
  max-width: 420px;
  max-height: 26vh;
  overflow-y: auto;
  margin-top: 12px;
}

.login-icon { font-size: 3.5rem; text-align: center; margin-bottom: 4px; }
.login-subtitle { text-align: center; color: #cfcfe6; margin: 0 0 20px; }
#login-section { text-align: center; }

.admin-entry { text-align: center; margin-top: 40px; }
.admin-entry a { color: #cfcfe6; text-decoration: none; font-size: 0.9rem; opacity: 0.7; }
.admin-entry a:hover { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .spotlight-name, .shake-title, .heartbeat, #reveal-list li, #live-reveal-list li, .event-screen {
    animation: none !important;
  }
}
