:root {
  --bg: #150910;
  --bg-alt: #20101b;
  --card: #2a1420;
  --card-glass: rgba(42, 20, 32, 0.72);
  --gold: #d9a441;
  --gold-soft: #e8c988;
  --text: #f6ece3;
  --text-dim: #b79c8f;
  --hairline: rgba(217, 164, 65, 0.22);
  --accent: #d9a441;
  --accent-light: #f0cf8f;
  color-scheme: dark;
}

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

html, body {
  height: 100%;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "SF Pro Text", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  touch-action: manipulation;
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  background:
    radial-gradient(ellipse 120% 60% at 50% -10%, rgba(217,164,65,0.16), transparent 60%),
    radial-gradient(ellipse 90% 50% at 85% 100%, rgba(154,111,224,0.12), transparent 55%),
    radial-gradient(ellipse 90% 50% at 10% 90%, rgba(69,176,140,0.10), transparent 55%),
    var(--bg);
}

.topbar {
  text-align: center;
  padding: 16px 24px 10px;
  flex: 0 0 auto;
}

.topbar h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold) 60%, #a3702b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stats {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.stats span { color: var(--gold-soft); font-weight: 700; }

.progress-track {
  margin: 10px auto 0;
  max-width: 280px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(217,164,65,0.6);
}

.wheel-zone {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 8px 16px;
}

.wheel-wrap {
  position: relative;
  width: min(80vw, 74vh, 380px);
  aspect-ratio: 1 / 1;
}

.wheel-wrap::before {
  content: "";
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217,164,65,0.22), transparent 70%);
  filter: blur(14px);
  z-index: 0;
}

.wheel {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
  transform: rotate(0deg);
  border-radius: 50%;
  filter: drop-shadow(0 10px 28px rgba(0,0,0,0.55));
  z-index: 1;
}

.wheel.spinning {
  transition: transform 4.4s cubic-bezier(0.10, 0.75, 0.12, 1);
}

.pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-top: 22px solid var(--gold-soft);
  z-index: 5;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.6));
}
.pointer::after {
  content: "";
  position: absolute;
  top: -22px;
  left: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold-soft);
  box-shadow: 0 0 10px rgba(232,201,136,0.8);
}

.hub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 27%;
  aspect-ratio: 1/1;
  border-radius: 50%;
  border: none;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,0.16), transparent 45%),
    radial-gradient(circle at 50% 55%, var(--card), var(--bg-alt) 75%);
  color: var(--gold-soft);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  z-index: 6;
  cursor: pointer;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.55),
    0 0 0 3px var(--gold) inset,
    0 0 18px rgba(217,164,65,0.35);
  transition: transform 0.15s ease;
}

.hub:active { transform: translate(-50%, -50%) scale(0.93); }
.hub:disabled { opacity: 0.45; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }

.empty-msg {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-top: 20px;
}

.hidden { display: none !important; }

.bottombar {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  padding: 10px 16px 18px;
}

.ghost-btn, .secondary-btn, .primary-btn {
  border: none;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 13px 24px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s ease, background 0.15s ease;
}

.ghost-btn {
  background: rgba(255,255,255,0.04);
  color: var(--text-dim);
  border: 1px solid var(--hairline);
}
.ghost-btn:active { background: rgba(217,164,65,0.12); transform: scale(0.97); }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,3,6,0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
}

.result-card {
  width: 100%;
  max-width: 480px;
  background: var(--card-glass);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.08);
  border-bottom: none;
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  padding: 24px 24px calc(20px + env(safe-area-inset-bottom));
  text-align: center;
  box-shadow: 0 -12px 40px rgba(0,0,0,0.55);
  animation: slideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-height: 88vh;
  overflow-y: auto;
}

.result-card::before {
  content: "";
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  margin: 0 auto 16px;
}

@keyframes slideUp {
  from { transform: translateY(40px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.illustration {
  width: 190px;
  height: 162px;
  margin: 0 auto 14px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--accent-light) 55%, transparent), transparent 60%),
    linear-gradient(160deg, color-mix(in srgb, var(--accent) 22%, var(--card)), var(--card-glass));
  border: 1px solid color-mix(in srgb, var(--accent-light) 35%, transparent);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  animation: popIn 0.45s cubic-bezier(0.2, 0.9, 0.25, 1.3);
}
.illustration svg { width: 100%; height: 100%; }

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

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-light) 40%, transparent);
  margin-bottom: 10px;
}

.category-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.category-chip span:last-child {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--accent-light);
}

.result-card h2 {
  margin: 0 0 10px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.01em;
}

.result-card p {
  margin: 0 0 22px;
  font-size: 0.93rem;
  line-height: 1.55;
  color: var(--text-dim);
}

.result-actions {
  display: flex;
  gap: 12px;
}

.secondary-btn {
  flex: 1;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.08);
}
.secondary-btn:active { background: rgba(255,255,255,0.12); transform: scale(0.97); }

.primary-btn {
  flex: 1.4;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  color: #2a1408;
  box-shadow: 0 6px 18px rgba(217,164,65,0.35);
}
.primary-btn:active { transform: scale(0.97); box-shadow: 0 3px 10px rgba(217,164,65,0.3); }
