:root {
  --primary: #D4AF37; /* Gold */
  --dark: #0f172a;    /* Deep Blue/Black */
  --light: #f8fafc;
  --accent: #ef4444;  /* Red for errors */
  --glass: rgba(30, 41, 59, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--dark);
  color: var(--light);
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-image: radial-gradient(circle at 50% 10%, #1e293b 0%, #020617 100%);
}

.container {
  width: 100%;
  max-width: 700px;
  padding: 2.5rem;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 24px;
  border: 1px solid var(--glass-border);
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  margin: 20px;
}

h1, h2, h3 {
  font-family: 'Cinzel', serif;
  text-align: center;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

p { line-height: 1.6; color: #cbd5e1; }

/* Quiz helper */
.scale-helper{
  text-align: center;
  margin: 14px 0 18px;
  font-family: 'Inter';
  font-weight: 300;
  opacity: 0.85;
  line-height: 1.3;
  padding: 0 12px;
}

/* --- Intro instruction grid --- */
.instruction-grid{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 18px 0 10px;
}

.instruction-card{
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  padding: 14px 12px;
  text-align: center;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.instruction-card:hover{
  border-color: rgba(212, 175, 55, 0.35);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.10);
  background: rgba(255,255,255,0.05);
  transform: translateY(-1px);
}

.inst-icon{
  font-size: 1.35rem;
  margin-bottom: 10px;
}

.inst-title{
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 8px;
}

.inst-desc{
  font-size: 0.92rem;
  line-height: 1.55;
  color: #cbd5e1;
}

/* --- Progress Bar --- */
.progress-container {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.35);
}

/* --- Question base --- */
.question-card {
  display: none;
  animation: fadeIn 0.4s ease;
}
.question-card.active {
  display: block;
}

/* Keep legacy question text working (if some questions still use q.text directly) */
.question-text {
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  text-align: left;
  line-height: 1.7;
  max-width: 60ch;
  margin-left: auto;
  margin-right: auto;
}

/* --- Split-Card Layout --- */
.q-top {
  max-width: 60ch;
  margin: 0 auto 14px;
}

.q-tag {
  font-size: 0.72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(203, 213, 225, 0.65);
  margin-bottom: 10px;
}

.q-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--light);
  text-align: left;
}

.q-scene {
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 14px;
  line-height: 1.7;
  color: #cbd5e1;
}

/* Two choice cards */
.q-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0 24px;
  align-items: stretch;
}

.q-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  padding: 18px;
  cursor: pointer;
  text-align: left;

  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 130px;

  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.q-card:hover {
  border-color: rgba(212, 175, 55, 0.35);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.10);
  background: rgba(212, 175, 55, 0.06);
  transform: translateY(-1px);
}

.q-card-label {
  font-size: 0.78rem;
  opacity: 0.78;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  font-weight: 700;
}

.q-card-body {
  line-height: 1.6;
  color: #e2e8f0;
  font-size: 1.05rem;
}

/* Card highlight depending on selected value */
/* --- Card Highlights Based on Selection Strength --- */

/* Strong Left (1) */
.question-card:has(input[value="1"]:checked) .q-card-left {
  border-color: rgba(212, 175, 55, 0.80); /* Brighter Gold */
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.25); /* Stronger glow */
  background: rgba(212, 175, 55, 0.12); /* Deeper background */
  transform: scale(1.02); /* Slight pop-out effect */
}

/* Lean Left (2) */
.question-card:has(input[value="2"]:checked) .q-card-left {
  border-color: rgba(212, 175, 55, 0.40); /* Softer Gold */
  box-shadow: 0 0 5px rgba(212, 175, 55, 0.10); /* Subtle glow */
  background: rgba(212, 175, 55, 0.05); /* Lighter background */
}

/* Strong Right (5) */
.question-card:has(input[value="5"]:checked) .q-card-right {
  border-color: rgba(212, 175, 55, 0.80); /* Brighter Gold */
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.25); /* Stronger glow */
  background: rgba(212, 175, 55, 0.12); /* Deeper background */
  transform: scale(1.02); /* Slight pop-out effect */
}

/* Lean Right (4) */
.question-card:has(input[value="4"]:checked) .q-card-right {
  border-color: rgba(212, 175, 55, 0.40); /* Softer Gold */
  box-shadow: 0 0 5px rgba(212, 175, 55, 0.10); /* Subtle glow */
  background: rgba(212, 175, 55, 0.05); /* Lighter background */
}

/* Neutral (3) - Optional: Dim both cards slightly if they pick 3 */
.question-card:has(input[value="3"]:checked) .q-card-left,
.question-card:has(input[value="3"]:checked) .q-card-right {
  opacity: 0.7;
}

/* Dim the unselected card to increase focus on the chosen one */
.question-card:has(input[value="1"]:checked, input[value="2"]:checked) .q-card-right {
  opacity: 0.5;
  filter: grayscale(50%);
}
.question-card:has(input[value="4"]:checked, input[value="5"]:checked) .q-card-left {
  opacity: 0.5;
  filter: grayscale(50%);
}

/* --- 1-5 Scale (circular buttons + connecting line) --- */
.options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  position: relative;
  padding: 0 10px;
  margin: 10px auto 12px;
  max-width: 520px;
}

/* connecting line */
.options::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 22px;
  right: 22px;
  height: 2px;
  background: rgba(255, 255, 255, 0.10);
  transform: translateY(-50%);
  z-index: 0;
}

.option-label {
  z-index: 1;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(2, 6, 23, 0.35);
  border: 1px solid rgba(255,255,255,0.18);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
  font-weight: 700;
  color: rgba(255,255,255,0.65);
  user-select: none;
  position: relative;
}

/* hide input but keep it accessible */
.option-label input{
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.option-label:hover {
  border-color: rgba(212, 175, 55, 0.55);
  color: var(--primary);
  transform: scale(1.07);
}

.option-label:focus-within {
  outline: 2px solid rgba(212, 175, 55, 0.55);
  outline-offset: 3px;
}

.option-label:has(input:checked) {
  background: var(--primary);
  color: var(--dark);
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.35);
  transform: scale(1.12);
}

.q-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  opacity: 0.55;
  padding: 0 5px;
  margin-top: 6px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Quiz corner navigation --- */
#quiz-screen { position: relative; padding-bottom: 120px; }

#btn-prev, #btn-next {
  position: absolute;
  bottom: 16px;
  width: calc(50% - 10px);
  margin-top: 0;
}

#btn-prev { left: 0; }
#btn-next { right: 0; }

/* --- Buttons --- */
.btn {
  background: linear-gradient(135deg, #D4AF37 0%, #b4932a 100%);
  color: #0f172a;
  border: none;
  padding: 16px 32px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  width: 100%;
  margin-top: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(212, 175, 55, 0.4);
}

/* --- Result Styles --- */
.result-view {
  display: none;
  text-align: left;
}
.card-image {
  width: 100%;
  border-radius: 16px;
  border: 2px solid var(--primary);
  box-shadow: 0 0 30px rgba(212, 175, 55, 0.15);
  margin: 1.5rem 0;
  display: block;
}

.stat-group {
  margin: 20px 0;
  padding: 15px;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
}
.stat-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: #94a3b8;
}
.stat-label { width: 80px; font-weight: 600; }
.stat-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  margin-left: 10px;
}
.stat-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
}

.content-block {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.section-title {
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pain-point {
  background: rgba(220, 38, 38, 0.1);
  border-left: 4px solid var(--accent);
  padding: 15px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 20px;
}
.solution {
  background: rgba(16, 185, 129, 0.1);
  border-left: 4px solid #10b981;
  padding: 15px;
  border-radius: 0 8px 8px 0;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Mobile --- */
@media (max-width: 600px) {
  .container { padding: 1.5rem; margin: 10px; }
  h1 { font-size: 1.8rem; }

  .instruction-grid{
    grid-template-columns: 1fr;
  }

  .q-cards {
    grid-template-columns: 1fr;
  }
  .q-title {
    font-size: 1.2rem;
  }

  #quiz-screen { padding-bottom: 160px; }
  #btn-prev, #btn-next {
    position: static;
    width: 100%;
  }
}

/* REPORT STYLING (For the long description) */
.report-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.report-section:last-child {
    border-bottom: none;
}

.report-header {
    font-family: 'Cinzel', serif;
    color: #D4AF37; /* Gold */
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    text-align: left; /* Keep headers left aligned */
    border-left: 3px solid #D4AF37;
    padding-left: 10px;
}

#result-desc p, #result-desc li {
    font-size: 1rem;
    line-height: 1.7;
    color: #e2e8f0;
    margin-bottom: 1rem;
}

#result-desc strong {
    color: #fff;
    font-weight: 600;
}

#result-roast p, #result-roast li {
    font-size: 1rem;
    line-height: 1.7;
    color: #e2e8f0;
    margin-bottom: 1rem;
}

#result-roast strong {
    color: #fff;
    font-weight: 600;
}

/* LEGENDARY BADGE */
.legendary-banner {
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid #D4AF37;
    color: #D4AF37;
    text-align: center;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
    animation: pulseGold 3s infinite;
}

@keyframes pulseGold {
    0% { box-shadow: 0 0 10px rgba(212, 175, 55, 0.2); }
    50% { box-shadow: 0 0 20px rgba(212, 175, 55, 0.5); }
    100% { box-shadow: 0 0 10px rgba(212, 175, 55, 0.2); }
}

/* --- Minimal settings menu (fixed top-right) --- */
#app-settings{
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 9999;
  display: flex;
  gap: 10px;
  align-items: center;
}

#settings-btn{
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(2, 6, 23, 0.55);
  color: #cbd5e1;
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

#settings-btn:hover{
  border-color: rgba(255,255,255,0.22);
  background: rgba(2, 6, 23, 0.7);
}

#settings-menu{
  position: absolute;
  top: 50px;
  right: 0;
  width: 220px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 20px 40px rgba(0,0,0,0.45);
  padding: 10px;
  backdrop-filter: blur(10px);
}

#menu-pop{
  position: absolute;
  top: 50px;
  right: 0;
  width: 220px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 20px 40px rgba(0,0,0,0.45);
  padding: 10px;
  backdrop-filter: blur(10px);
}


.settings-title{
  font-size: 0.8rem;
  opacity: 0.75;
  padding: 6px 8px 10px;
}

.settings-item{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: #e2e8f0;
  cursor: pointer;
  text-align: left;
}

.settings-item:hover{
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.08);
}

.settings-item .check{
  opacity: 0;
}

.settings-item.active .check{
  opacity: 1;
  color: var(--primary);
}

.settings-sep{
  height: 1px;
  background: rgba(255,255,255,0.10);
  margin: 8px 4px;
}

#lang-btn, #restart-btn, #settings-btn {
  height: 40px;
  border-radius: 99px; /* Pill shape */
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(2, 6, 23, 0.55);
  color: #cbd5e1;
  cursor: pointer;
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px; /* Give text room to breathe */
  gap: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  white-space: nowrap; /* Forces text to stay on one line */
  width: auto; /* Allows the button to expand to fit the text */
  font-size: 1rem;     /* Increased from 0.9rem for better visibility */
  font-weight: 600;    /* Makes the text bolder */
}

#lang-btn:hover, #restart-btn:hover, #settings-btn:hover {
  border-color: rgba(255,255,255,0.22);
  background: rgba(2, 6, 23, 0.7);
  color: var(--primary);
}

/* Scrollable Archetype List styling */
.archetype-list {
  max-height: 280px; /* Limits height so it doesn't run off screen */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Styling for the anchor tags */
.archetype-link {
  text-decoration: none; /* Removes underline from links */
  display: block;
}

.archetype-link:hover {
  background: rgba(212, 175, 55, 0.15); /* Gold hover effect */
  color: var(--primary);
}

/* --- RESPONSIVE LOGIC --- */

/* MOBILE FIRST (Default view for small screens) */
@media (max-width: 768px) {
  /* Keep the Hamburger menu as a 40px circle */
  #settings-btn {
    width: 40px;
    padding: 0; 
  }
  
  /* Allow the Restart button to expand into a pill shape */
  #restart-btn {
    width: auto;
    padding: 0 14px; 
  }
  
  /* Hide the "Archetypes" text inside the settings button */
  #settings-btn .desktop-text {
    display: none !important; 
  }

  /* Force the "Retake Test" text to be visible */
  #restart-btn .desktop-text {
    display: inline-block !important; 
  }

  .mobile-icon {
    display: inline-block;
  }
}

/* PC / DESKTOP (Screens wider than 768px) */
@media (min-width: 769px) {
  /* Hide the hamburger icon on PC */
  .mobile-icon {
    display: none;
  }
  
  /* Ensure the text is visible */
  .desktop-text {
    display: inline-block;
  }
}

/* --- Premium (Upsell) --- */
.premium-block .premium-pitch {
  margin-top: 0;
  color: #cbd5e1;
}

.premium-s-note {
  margin-top: 0;
  margin-bottom: 10px;
  color: rgba(203, 213, 225, 0.9);
}

.premium-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.10);
}

.premium-label {
  display: block;
  font-size: 0.85rem;
  opacity: 0.8;
  margin-bottom: 8px;
}

.premium-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.premium-email {
  flex: 1;
  height: 46px;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(2, 6, 23, 0.35);
  color: #e2e8f0;
}

.premium-email::placeholder {
  color: rgba(203, 213, 225, 0.6);
}

.premium-email:focus {
  outline: 2px solid rgba(212, 175, 55, 0.55);
  outline-offset: 2px;
  border-color: rgba(212, 175, 55, 0.55);
}

.premium-submit {
  width: auto;
  min-width: 140px;
  margin-top: 0;
}

.premium-status {
  margin: 10px 0 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

/* --- Feedback UI polish (existing ids) --- */
#feedback-text {
  width: 100%;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(2, 6, 23, 0.35);
  color: #e2e8f0;
  resize: vertical;
}

#feedback-text:focus {
  outline: 2px solid rgba(212, 175, 55, 0.55);
  outline-offset: 2px;
  border-color: rgba(212, 175, 55, 0.55);
}

#feedback-rating {
  width: 100%;
  accent-color: var(--primary);
}

/* Visual Scale Guide Styles */

.visual-scale-guide {
    background: rgba(0, 0, 0, 0.2); 
    padding: 14px 10px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.guide-options {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.g-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    padding: 8px 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.guide-buttons-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding: 0 5px;
    margin-bottom: 8px;
}

.g-line {
    position: absolute;
    top: 50%;
    left: 15px;
    right: 15px;
    height: 2px;
    background: rgba(255, 255, 255, 0.10);
    transform: translateY(-50%);
    z-index: 0;
}

.g-btn {
    z-index: 1;
    width: 28px; /* Slightly smaller than actual buttons for the mockup */
    height: 28px;
    border-radius: 50%;
    background: rgba(2, 6, 23, 0.35);
    border: 1px solid rgba(255,255,255,0.18);
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255,255,255,0.65);
}

.g-btn:nth-child(2), .g-btn:nth-child(6) {
    /* Mimic the selected/hover state on the '1' and '5' to show them as the extremes */
    border-color: rgba(212, 175, 55, 0.55);
    color: var(--primary);
}

.guide-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.3;
}

.g-lbl {
    flex: 1;
    color: rgba(255, 255, 255, 0.7);
}