:root {
  --navy: #1B3D6B;
  --navy-light: #2A5298;
  --gold: #C9A84C;
  --white: #FFFFFF;
  --gray-light: #F5F7FA;
  --gray: #E2E8F0;
  --text: #1A202C;
  --text-muted: #718096;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(27, 61, 107, 0.12);
  --shadow-lg: 0 8px 40px rgba(27, 61, 107, 0.18);
}

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

body {
  font-family: 'Assistant', sans-serif;
  background: linear-gradient(135deg, #EEF2FF 0%, #F5F7FA 50%, #EDF4FF 100%);
  color: var(--text);
  min-height: 100vh;
  direction: rtl;
}

/* Header */
.header {
  background: var(--navy);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 16px rgba(0,0,0,0.2);
}

.logo { height: 44px; object-fit: contain; }

.site-link {
  color: var(--gold);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: opacity 0.2s;
}
.site-link:hover { opacity: 0.8; }

/* Main */
.main {
  max-width: 600px;
  margin: 48px auto;
  padding: 0 20px;
}

#screen-welcome.active ~ * .main,
.main:has(#screen-welcome.active) {
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Screens */
.screen { display: none; }
.screen.active { display: block; animation: fadeInUp 0.45s ease both; }

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

/* Card */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 44px 40px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,0.8);
}

h1 {
  font-size: 30px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 10px;
  line-height: 1.3;
}

h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 10px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 16px;
  margin-bottom: 36px;
  line-height: 1.7;
}

/* Form fields */
.field { margin-bottom: 22px; }

.field label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--navy);
  font-size: 15px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
textarea {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--gray);
  border-radius: 12px;
  font-family: 'Assistant', sans-serif;
  font-size: 16px;
  transition: border-color 0.25s, box-shadow 0.25s;
  direction: rtl;
  background: var(--white);
  color: var(--text);
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--navy-light);
  box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.12);
}

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 17px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 12px;
  font-family: 'Assistant', sans-serif;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  margin-top: 8px;
  letter-spacing: 0.3px;
}

.btn-primary:hover {
  background: var(--navy-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(27, 61, 107, 0.3);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  width: 100%;
  padding: 15px;
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--navy);
  border-radius: 12px;
  font-family: 'Assistant', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.2s;
}

.btn-secondary:hover { background: var(--gray-light); }

.btn-skip {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-family: 'Assistant', sans-serif;
  font-size: 15px;
  cursor: pointer;
  margin-top: 10px;
  text-decoration: underline;
}

/* Chat container */
.chat-container {
  background: var(--white);
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}

/* Progress */
.progress-bar {
  height: 6px;
  background: var(--gray);
  border-radius: 3px;
  margin-bottom: 8px;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #E6BA5A);
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.question-counter {
  text-align: left;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
  font-weight: 600;
}

/* Question card */
.question-card {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: var(--white);
  padding: 26px 28px;
  border-radius: 14px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(27, 61, 107, 0.25);
}

.question-hint {
  font-size: 14px;
  color: rgba(255,255,255,0.72);
  font-weight: 400;
  margin-top: 10px;
  line-height: 1.5;
}

/* Answer area */
.answer-area { margin-bottom: 20px; }

.answer-area textarea {
  min-height: 130px;
  resize: vertical;
}

/* Choice buttons */
.choice-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-btn {
  padding: 17px 20px;
  border: 2px solid var(--gray);
  border-radius: 12px;
  background: var(--white);
  font-family: 'Assistant', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-align: right;
  transition: all 0.2s;
  color: var(--text);
}

.choice-btn:hover {
  border-color: var(--navy-light);
  background: var(--gray-light);
}

.choice-btn.selected {
  border-color: var(--navy);
  background: rgba(27, 61, 107, 0.06);
  color: var(--navy);
}

/* Photos */
.photos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.photo-upload {
  border: 2px dashed var(--gray);
  border-radius: 14px;
  height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  overflow: hidden;
  position: relative;
  background: var(--gray-light);
}

.photo-upload:hover { border-color: var(--navy-light); background: #EEF2FF; }

.upload-placeholder {
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.upload-icon { font-size: 36px; }
.upload-placeholder span { font-weight: 600; font-size: 15px; }
.upload-placeholder small { font-size: 12px; color: var(--text-muted); }

.photo-upload .preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0; left: 0;
}

.photos-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

/* Loading */
.loading-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 70px 40px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.loading-logo {
  height: 56px;
  margin-bottom: 32px;
  opacity: 0.7;
}

.spinner {
  width: 52px;
  height: 52px;
  border: 4px solid var(--gray);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 28px;
}

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

.loading-card h2 { color: var(--navy); margin-bottom: 10px; }
.loading-card p { color: var(--text-muted); }
.loading-hint { font-size: 13px; margin-top: 8px !important; }

/* Success */
.success-card { text-align: center; }
.success-icon { font-size: 60px; margin-bottom: 20px; display: block; }

.page-link-display {
  display: block;
  background: var(--gray-light);
  padding: 16px 20px;
  border-radius: 12px;
  color: var(--navy-light);
  font-weight: 600;
  word-break: break-all;
  margin: 16px 0 28px;
  text-decoration: none;
  font-size: 15px;
  border: 1px solid var(--gray);
  transition: background 0.2s;
}

.page-link-display:hover { background: #EEF2FF; }

.success-actions { display: flex; flex-direction: column; gap: 12px; }

/* Welcome screen */
#screen-welcome {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: #f5f6f8;
  padding: 48px 20px;
}

#screen-welcome.active {
  display: flex;
}

.welcome-hero-inner {
  background: linear-gradient(160deg, #0d2141 0%, #1B3D6B 60%, #1e4275 100%);
  border-radius: 28px;
  padding: 64px 60px 52px;
  text-align: center;
  box-shadow: 0 40px 100px rgba(0,0,0,0.18), 0 0 0 1px rgba(255,255,255,0.06) inset;
  max-width: 720px;
  width: 100%;
}

.welcome-logo {
  height: 72px;
  object-fit: contain;
  margin-bottom: 40px;
  opacity: 0.95;
}

.welcome-title {
  font-size: 46px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.25;
  margin-bottom: 18px;
  letter-spacing: -0.5px;
}

.welcome-divider {
  width: 52px;
  height: 3px;
  background: var(--gold);
  border-radius: 2px;
  margin: 0 auto 36px;
}

/* Tagline — the emotional hook, big and golden */
.welcome-tagline {
  font-size: 20px;
  font-weight: 600;
  color: var(--gold);
  line-height: 1.75;
  text-align: center;
  margin-bottom: 40px;
  letter-spacing: 0.1px;
}

/* Body sections */
.welcome-section {
  margin-bottom: 32px;
  text-align: center;
}

.welcome-section p {
  font-size: 17px;
  line-height: 2;
  color: rgba(255,255,255,0.78);
  margin: 0 0 16px;
}

/* The big quote */
.welcome-quote {
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  margin: 8px 0 0 !important;
  letter-spacing: 0.2px;
}

/* Poetic closing lines */
.welcome-breathe {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 44px;
  padding: 28px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.welcome-breathe span {
  font-size: 16px;
  font-weight: 400;
  color: rgba(255,255,255,0.55);
  line-height: 1.6;
}

.welcome-breathe span:first-child {
  font-size: 18px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
}

.welcome-cta {
  display: block;
  width: 100%;
  padding: 22px;
  background: var(--gold);
  color: #1B3D6B;
  border: none;
  border-radius: 14px;
  font-family: 'Assistant', sans-serif;
  font-size: 21px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 8px 32px rgba(201,168,76,0.4);
  letter-spacing: 0.3px;
  margin-bottom: 28px;
}

.welcome-cta:hover {
  background: #dba83e;
  transform: translateY(-2px);
  box-shadow: 0 14px 44px rgba(201,168,76,0.55);
}

.welcome-footer {
  font-size: 13px;
  color: rgba(255,255,255,0.35);
}

.welcome-footer a {
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.welcome-footer a:hover { color: var(--gold); }

/* Responsive */
@media (max-width: 600px) {
  #screen-welcome { padding: 0; align-items: stretch; }
  .welcome-hero-inner {
    border-radius: 0;
    padding: 52px 24px 40px;
    min-height: 100vh;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .welcome-title { font-size: 32px; }
  .welcome-tagline { font-size: 17px; }
  .welcome-section p { font-size: 16px; line-height: 1.85; }
  .welcome-quote { font-size: 18px; }
  .welcome-breathe span { font-size: 15px; }
  .welcome-breathe span:first-child { font-size: 17px; }
  .welcome-cta { font-size: 19px; padding: 20px; }
}

@media (max-width: 500px) {
  .card, .chat-container { padding: 28px 20px; }
  .main { margin: 24px auto; }
  .photos-grid { grid-template-columns: 1fr; }
  h1 { font-size: 24px; }
  .question-card { font-size: 17px; }
}
