:root {
  --bg: #09070f;
  --panel: rgba(20, 15, 31, 0.82);
  --panel-2: rgba(31, 22, 48, 0.92);
  --text: #f7edff;
  --muted: #b9a8c8;
  --gold: #f8c95a;
  --violet: #9d6cff;
  --red: #ff597d;
  --green: #55f0b2;
  --emerald: #2dd4bf;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --radius: 26px;
  --radius-sm: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(157, 108, 255, 0.32), transparent 34%),
    radial-gradient(circle at 85% 5%, rgba(85, 240, 178, 0.18), transparent 28%),
    radial-gradient(circle at 50% 90%, rgba(255, 89, 125, 0.2), transparent 34%),
    var(--bg);
  overflow: hidden;
}

.app { position: relative; width: 100vw; height: 100vh; }
#particle-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 0; }

.scene {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: 28px clamp(16px, 4vw, 48px);
  opacity: 0; visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  z-index: 2;
  overflow: auto;
}
.scene.active { opacity: 1; visibility: visible; }

button, select, input {
  font: inherit; color: var(--text);
}

button, select {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
button:hover:not(:disabled) { transform: translateY(-1px); border-color: rgba(248, 201, 90, 0.7); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: linear-gradient(135deg, var(--violet), #d45cff); border: 0; font-weight: 800; color: #fff; }
button.secondary { background: rgba(255, 255, 255, 0.06); }
button.danger { background: rgba(255, 89, 125, 0.18); border-color: rgba(255, 89, 125, 0.5); }
button.danger:hover { background: rgba(255, 89, 125, 0.28); }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: 0.11em; font-size: 0.78rem; font-weight: 800; margin: 0 0 8px; }

.back-btn {
  align-self: flex-start;
  margin-bottom: 12px;
}

h2 { margin: 0 0 8px; font-size: clamp(1.6rem, 3vw, 2.4rem); }
.scene-subtitle { color: var(--muted); margin: 0 0 22px; }

.toast {
  position: fixed; left: 50%; bottom: 22px;
  transform: translateX(-50%) translateY(90px);
  background: #160f21;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 20px;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.25s ease;
  max-width: min(92vw, 680px);
  text-align: center;
  z-index: 100;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

.modal {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  opacity: 0; visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.modal:not(.hidden) { opacity: 1; visibility: visible; }
.modal-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 420px;
  width: calc(100vw - 40px);
  box-shadow: var(--shadow);
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 rgba(248,201,90,0); } 50% { box-shadow: 0 0 28px rgba(248,201,90,0.35); } }

.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* Focus visible */
button:focus-visible, select:focus-visible, input:focus-visible, .tile:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Eye motif */
.eye-mark {
  width: 32px; height: 32px;
  border-radius: 75% 0%;
  transform: rotate(45deg);
  background: radial-gradient(circle at 30% 30%, #fff 0 6%, var(--green) 7% 28%, transparent 30%),
              radial-gradient(circle, var(--violet) 0 50%, transparent 51%);
  box-shadow: 0 0 18px rgba(85, 240, 178, 0.35);
}
