:root {
  --bg: #0f172a; /* Deep Navy */
  --surface: rgba(30, 41, 59, 0.7);
  --border: #334155;
  --gold: #fbbf24; /* Risk Warning Gold */
  --safe: #10b981; /* Emerald Green */
  --danger: #ef4444; /* Rose Red */
  --text: #f8fafc;
  --text-muted: #94a3b8;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
  min-height: 100vh;
  line-height: 1.6;
}

/* Background Grain Effect */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none;
}

header {
  padding: 2rem 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: "Playfair Display", serif;
  font-size: 1.5rem;
  letter-spacing: 0.1em;
}

.logo span {
  color: var(--gold);
}

.hero {
  padding: 0 4rem 3rem;
  max-width: 800px;
}

h1 {
  font-family: "Playfair Display", serif;
  font-size: 3.5rem;
  line-height: 1.1;
  margin-bottom: 1rem;
}

h1 em {
  font-style: italic;
  color: var(--gold);
}

main {
  display: grid;
  grid-template-columns: 1fr 380px;
  max-width: 1200px;
  margin: 0 auto 4rem;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.form-panel {
  padding: 3rem;
  border-right: 1px solid var(--border);
}

.section-title {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
}

.form-group {
  margin-bottom: 2.5rem;
}

.group-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

input,
select {
  background: #1e293b;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem;
  color: white;
  font-family: inherit;
  transition: all 0.2s;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

button[type="submit"] {
  background: var(--gold);
  color: #000;
  border: none;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  width: 100%;
  transition: transform 0.2s;
}

button[type="submit"]:hover {
  transform: translateY(-2px);
}

/* Results Panel Styling */
.result-panel {
  padding: 3rem;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.state-container.hidden {
  display: none;
}

.probability-bar {
  background: #334155;
  height: 8px;
  border-radius: 4px;
  margin: 1.5rem 0;
  overflow: hidden;
}

#probability-fill {
  height: 100%;
  width: 0%;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

@media (max-width: 900px) {
  main {
    grid-template-columns: 1fr;
  }
  .form-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

.loading-main {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 1rem;
}

.loading-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  line-height: 1.5;
  max-width: 250px; /* Keeps the text contained in the side panel */
  margin: 0.5rem auto 0;
  font-style: italic;
  opacity: 0.8;
}

/* Optional: Add a subtle pulse to the subtext so it feels "active" */
.loading-sub {
  animation: pulseText 2s ease-in-out infinite;
}

@keyframes pulseText {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}
