:root {
  --bg-abyss: #070b16;
  --bg-surface: #0d1428;
  --bg-card: #131d38;
  --bg-card-hover: #1a2749;
  --bg-glass: rgba(13, 20, 40, 0.85);
  --gold: #e5a93c;
  --gold-light: #f7d98c;
  --gold-soft: rgba(229, 169, 60, 0.14);
  --gold-border: rgba(229, 169, 60, 0.25);
  --teal: #2dd4bf;
  --rose: #fb7185;
  --violet: #c084fc;
  --text-main: #f8fafc;
  --text-sec: #cbd5e1;
  --text-muted: #8e9aaf;
  --radius-2xl: 24px;
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.45);
}

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

body {
  font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-abyss);
  background-image:
    radial-gradient(circle at 50% -10%, rgba(229, 169, 60, 0.15) 0%, transparent 55%),
    radial-gradient(circle at 10% 85%, rgba(45, 212, 191, 0.07) 0%, transparent 45%),
    radial-gradient(circle at 90% 40%, rgba(192, 132, 252, 0.05) 0%, transparent 40%);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.85;
  padding-bottom: 90px;
}

/* ================= HEADER ================= */
header {
  background: rgba(7, 11, 22, 0.88);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(229, 169, 60, 0.18);
  padding: 0.8rem 2rem;
  position: sticky;
  top: 0;
  z-index: 150;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
}

.brand-logo {
  width: 44px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 10px rgba(229, 169, 60, 0.3));
}

.brand-titles h1 {
  font-size: 1.3rem;
  color: var(--gold-light);
  font-weight: 800;
  letter-spacing: -0.2px;
  line-height: 1.2;
}

.brand-titles span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.top-link {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-sec);
  padding: 0.45rem 0.95rem;
  border-radius: 99px;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.top-link:hover {
  color: var(--gold-light);
  background: rgba(255, 255, 255, 0.04);
}

.top-link.active {
  background: var(--gold-soft);
  color: var(--gold-light);
  border-color: var(--gold-border);
  font-weight: 700;
}

.palace-pill {
  background: rgba(229, 169, 60, 0.1);
  border: 1px solid var(--gold-border);
  color: var(--gold-light);
  padding: 0.42rem 1rem;
  border-radius: 99px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.palace-pill:hover {
  background: rgba(229, 169, 60, 0.2);
  transform: translateY(-1px);
}

/* ================= MAIN CONTAINER ================= */
.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.screen {
  display: none;
  animation: smoothFade 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.screen.active {
  display: block;
}

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

/* ================= HOME: GUIDED COURTYARD (FTUE) ================= */
.welcome-sanctuary {
  text-align: center;
  max-width: 720px;
  margin: 1rem auto 2.5rem;
}

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(229, 169, 60, 0.1);
  border: 1px solid var(--gold-border);
  color: var(--gold-light);
  padding: 0.3rem 0.9rem;
  border-radius: 99px;
  font-size: 0.78rem;
  margin-bottom: 1rem;
}

.welcome-sanctuary h2 {
  font-size: 1.85rem;
  color: var(--text-main);
  font-weight: 800;
  margin-bottom: 0.65rem;
  line-height: 1.4;
}

.welcome-sanctuary p {
  font-size: 1rem;
  color: var(--text-sec);
}

/* 4 Guided Journey Cards */
.journey-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.2rem;
}

.journey-card {
  background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-surface) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 1.65rem;
  cursor: pointer;
  transition: all 0.28s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.journey-card:hover {
  border-color: var(--gold);
  transform: translateY(-4px);
  background: linear-gradient(145deg, var(--bg-card-hover) 0%, var(--bg-card) 100%);
}

.journey-card-top {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.journey-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(229, 169, 60, 0.12);
  border: 1px solid var(--gold-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.journey-card h3 {
  font-size: 1.12rem;
  color: var(--gold-light);
  margin-bottom: 0.35rem;
}

.journey-card p {
  font-size: 0.88rem;
  color: var(--text-sec);
  line-height: 1.7;
}

.journey-cta {
  margin-top: 1.2rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--teal);
  font-weight: 700;
}

/* Subtle Bottom Philosophy Teaser on Home */
.home-footer-note {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ================= HALL WORKSPACE & STEPPER ================= */
.hall-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.back-home-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-sec);
  padding: 0.45rem 0.95rem;
  border-radius: 99px;
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: 0.2s;
}

.back-home-btn:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}

.stepper-pills {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.step-badge {
  font-size: 0.76rem;
  padding: 0.3rem 0.8rem;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid transparent;
}

.step-badge.active {
  background: var(--gold-soft);
  color: var(--gold-light);
  border-color: var(--gold);
  font-weight: 700;
}

.sanctuary-box {
  background: var(--bg-surface);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-2xl);
  padding: 2rem;
  box-shadow: var(--shadow-soft);
}

.mentor-greeting {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: rgba(229, 169, 60, 0.07);
  border-right: 4px solid var(--gold);
  padding: 1.1rem 1.3rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.mentor-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

/* Rich Presets Grid (8 Categorized Scenarios) */
.presets-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.presets-title {
  font-size: 0.86rem;
  color: var(--gold-light);
  font-weight: 700;
}

.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.35rem;
}

.preset-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: right;
}

.preset-card:hover, .preset-card.selected {
  background: rgba(229, 169, 60, 0.12);
  border-color: var(--gold);
  transform: translateY(-2px);
}

.preset-tag {
  font-size: 0.7rem;
  color: var(--teal);
  font-weight: 700;
  display: block;
  margin-bottom: 0.2rem;
}

.preset-text {
  font-size: 0.82rem;
  color: var(--text-main);
  line-height: 1.55;
}

textarea, input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  background: rgba(7, 11, 22, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 1rem 1.2rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  transition: 0.2s;
}

textarea:focus, input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(229, 169, 60, 0.15);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, #c4831d 100%);
  color: #070b16;
  border: none;
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-deep {
  background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  color: #fff;
  border: none;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: 0.2s;
}

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

/* Output Layers */
.layer-panel {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  animation: smoothFade 0.35s ease;
}

.cards-trio {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.insight-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.insight-card.gold { border-top: 4px solid var(--gold); }
.insight-card.rose { border-top: 4px solid var(--rose); }
.insight-card.teal { border-top: 4px solid var(--teal); }
.insight-card.violet { border-top: 4px solid var(--violet); }

.deep-dive-card {
  background: linear-gradient(135deg, rgba(19, 29, 56, 0.96), rgba(7, 11, 22, 0.96));
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-top: 1.25rem;
  animation: smoothFade 0.35s ease;
}

.choice-btn {
  display: block;
  width: 100%;
  text-align: right;
  background: rgba(7, 11, 22, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-main);
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  margin-top: 0.6rem;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: 0.2s;
}

.choice-btn:hover {
  border-color: var(--teal);
  background: rgba(45, 212, 191, 0.14);
  transform: translateX(-4px);
}

.chat-bubble {
  padding: 0.95rem 1.15rem;
  border-radius: 14px;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.chat-bubble.user {
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  margin-left: 1.5rem;
}

.chat-bubble.ai {
  background: var(--bg-card);
  border-right: 4px solid var(--teal);
  margin-right: 1rem;
}

/* ================= PHILOSOPHY PAGE ================= */
.philosophy-book {
  background: linear-gradient(180deg, #111936 0%, #090d1d 100%);
  border: 1px solid rgba(229, 169, 60, 0.35);
  border-radius: var(--radius-2xl);
  padding: 3rem 3.5rem;
  max-width: 860px;
  margin: 0 auto;
  box-shadow: var(--shadow-soft);
}

.philosophy-book-header {
  text-align: center;
  border-bottom: 1px solid rgba(229, 169, 60, 0.22);
  padding-bottom: 1.75rem;
  margin-bottom: 2rem;
}

.philosophy-book-header h2 {
  font-size: 1.8rem;
  color: var(--gold-light);
  margin-top: 0.75rem;
}

.philosophy-content {
  font-size: 1.06rem;
  line-height: 2.15;
  color: var(--text-main);
  text-align: right;
}

.philosophy-content p { margin-bottom: 1.15rem; }

.poetry-callout {
  background: rgba(229, 169, 60, 0.1);
  border-right: 4px solid var(--gold);
  padding: 1rem 1.4rem;
  border-radius: var(--radius-md);
  margin: 1.4rem 0;
  color: var(--gold-light);
  font-weight: 700;
  font-size: 1.1rem;
}

/* ================= MOBILE BOTTOM BAR ================= */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  background: rgba(7, 11, 22, 0.96);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--gold-border);
  z-index: 200;
  padding: 0.45rem 0.35rem;
  justify-content: space-around;
}

.mob-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.mob-item.active {
  color: var(--gold-light);
  font-weight: 700;
}

@media (max-width: 860px) {
  .journey-grid { grid-template-columns: 1fr; }
  .header-nav { display: none; }
  .mobile-nav { display: flex; }
  header { padding: 0.75rem 1.1rem; }
  .sanctuary-box { padding: 1.3rem; }
  .philosophy-book { padding: 1.75rem 1.3rem; }
  .welcome-sanctuary h2 { font-size: 1.45rem; }
}

/* ================= AUTH SCREEN ================= */
.auth-wrap {
  max-width: 440px;
  margin: 3rem auto;
}

.auth-switch {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-sec);
}

.auth-switch a {
  color: var(--gold-light);
  cursor: pointer;
  text-decoration: underline;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-sec);
  margin-bottom: 0.8rem;
}

.consent-row input {
  width: auto;
  margin-top: 0.2rem;
}

.form-msg {
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  padding: 0.7rem 1rem;
  margin-bottom: 0.9rem;
  display: none;
}

.form-msg.error {
  display: block;
  background: rgba(251, 113, 133, 0.12);
  border: 1px solid var(--rose);
  color: #ffd7dd;
}

.form-msg.success {
  display: block;
  background: rgba(45, 212, 191, 0.12);
  border: 1px solid var(--teal);
  color: var(--text-main);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.locked-lamp { opacity: 0.55; }
