:root {
  --bg-deep: #0b241d;
  --bg-accent: #13392e;
  --card-bg: rgba(17, 45, 36, 0.88);
  --card-border: rgba(212, 175, 55, 0.32);
  --gold: #d4af37;
  --gold-soft: #f0d77b;
  --crimson: #c82333;
  --crimson-hover: #a71d2a;
  --text-main: #f8f5ec;
  --text-muted: #c6d4ce;
  --success-bg: rgba(34, 139, 87, 0.22);
  --success-border: rgba(72, 187, 120, 0.5);
  --error-bg: rgba(200, 35, 51, 0.22);
  --error-border: rgba(245, 101, 101, 0.55);
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 20% 15%, rgba(212, 175, 55, 0.12), transparent 40%),
    radial-gradient(circle at 80% 85%, rgba(200, 35, 51, 0.16), transparent 45%),
    linear-gradient(155deg, var(--bg-deep) 0%, var(--bg-accent) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-x: hidden;
}

/* Gentle CSS snow */
.snowflakes {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.snowflakes span {
  position: absolute;
  top: -10%;
  color: rgba(255, 255, 255, 0.22);
  font-size: 1.15rem;
  animation: snowfall 12s linear infinite;
}

.snowflakes span:nth-child(1) { left: 8%; animation-duration: 11s; animation-delay: 0s; }
.snowflakes span:nth-child(2) { left: 20%; animation-duration: 14s; animation-delay: 2s; font-size: 0.9rem; }
.snowflakes span:nth-child(3) { left: 34%; animation-duration: 10s; animation-delay: 4s; }
.snowflakes span:nth-child(4) { left: 49%; animation-duration: 15s; animation-delay: 1s; font-size: 1.3rem; }
.snowflakes span:nth-child(5) { left: 63%; animation-duration: 12s; animation-delay: 5s; }
.snowflakes span:nth-child(6) { left: 76%; animation-duration: 13s; animation-delay: 3s; font-size: 0.95rem; }
.snowflakes span:nth-child(7) { left: 88%; animation-duration: 11.5s; animation-delay: 2.5s; }
.snowflakes span:nth-child(8) { left: 94%; animation-duration: 16s; animation-delay: 6s; font-size: 1.25rem; }

@keyframes snowfall {
  0% {
    transform: translateY(-10vh) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(112vh) translateX(24px);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .snowflakes {
    display: none;
  }
  .spinner {
    animation: none;
  }
}

.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 470px;
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 32px 26px 24px;
  box-shadow: var(--shadow);
}

.card-header {
  text-align: center;
  margin-bottom: 24px;
}

.badge-icon {
  font-size: 2.6rem;
  line-height: 1;
  margin-bottom: 10px;
}

h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  letter-spacing: -0.02em;
  color: var(--gold-soft);
}

.subtitle {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

.progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.14);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: var(--gold-soft);
  font-size: 0.86rem;
  font-weight: 600;
}

.draw-form,
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
}

.select-wrapper {
  position: relative;
}

select,
input[type='password'] {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(9, 28, 22, 0.88);
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

select:focus,
input[type='password']:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.22);
}

select:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 13px 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.18s ease, opacity 0.18s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--crimson);
  color: #fff;
  box-shadow: 0 8px 20px rgba(200, 35, 51, 0.32);
}

.btn-primary:hover:not(:disabled) {
  background: var(--crimson-hover);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: #b02a37;
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #921f2a;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.85rem;
}

.alert {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.4;
}

.alert-error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: #ffd7dc;
}

.alert-success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: #d6ffe6;
}

.result-box {
  margin-top: 20px;
  padding: 22px 18px;
  border-radius: 16px;
  text-align: center;
}

.suspense-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px dashed rgba(212, 175, 55, 0.45);
  color: var(--gold-soft);
}

.spinner {
  width: 32px;
  height: 32px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 3px solid rgba(212, 175, 55, 0.25);
  border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.reveal-box {
  background: linear-gradient(
    145deg,
    rgba(212, 175, 55, 0.18),
    rgba(200, 35, 51, 0.16)
  );
  border: 1px solid rgba(212, 175, 55, 0.55);
}

.result-eyebrow {
  margin: 0 0 6px;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.result-name {
  margin: 0 0 10px;
  font-size: 2.15rem;
  font-weight: 800;
  color: var(--gold-soft);
  letter-spacing: -0.01em;
}

.result-note {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.card-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.link-btn {
  background: none;
  border: none;
  color: var(--gold-soft);
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 8px;
}

.link-btn:hover {
  color: #fff;
}

/* Admin dialog */
.admin-dialog {
  width: min(460px, calc(100vw - 24px));
  border: 1px solid var(--card-border);
  border-radius: 18px;
  background: #0f2f25;
  color: var(--text-main);
  padding: 0;
  box-shadow: var(--shadow);
}

.admin-dialog::backdrop {
  background: rgba(4, 12, 10, 0.72);
  backdrop-filter: blur(4px);
}

.dialog-inner {
  padding: 22px;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--gold-soft);
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-main);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.dialog-desc,
.privacy-note {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.admin-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 700;
  color: var(--gold-soft);
}

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

.admin-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.95rem;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.status-done {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: #a9f5c8;
}

.status-pending {
  background: rgba(212, 175, 55, 0.16);
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: var(--gold-soft);
}

.admin-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

[hidden] {
  display: none !important;
}
