/* ═══ DECORAI — Warm Editorial Interior Design Aesthetic ═══ */

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

:root {
  --bg: #FAF7F2;
  --bg-warm: #F5F0E8;
  --text: #1A1A1A;
  --text-muted: #7A7268;
  --accent: #C4956A;
  --accent-hover: #AD7D54;
  --accent-light: rgba(196, 149, 106, 0.12);
  --card: #FFFFFF;
  --border: #E8E2DB;
  --border-light: #F0EBE4;
  --shadow: 0 2px 20px rgba(26, 26, 26, 0.06);
  --shadow-lg: 0 8px 40px rgba(26, 26, 26, 0.1);
  --radius: 12px;
  --radius-lg: 20px;
  --font-display: 'Instrument Serif', serif;
  --font-body: 'DM Sans', sans-serif;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ─── SCREENS ─── */
.screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}
.screen.active {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.5s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── NAV ─── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  position: relative;
  z-index: 10;
}
.logo {
  font-family: var(--font-display);
  font-size: 26px;
  font-style: italic;
  color: var(--text);
  letter-spacing: -0.5px;
  user-select: none;
}
.nav-back {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  transition: color var(--transition);
}
.nav-back:hover { color: var(--text); }

/* ─── BUTTONS ─── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--text);
  color: var(--bg);
  border: none;
  padding: 16px 36px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.2px;
}
.btn-primary:hover {
  background: #333;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(26, 26, 26, 0.2);
}
.btn-primary:active { transform: translateY(0); }

.btn-outline-sm {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-outline-sm:hover {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

/* ═══ WELCOME SCREEN ═══ */
#screen-welcome {
  align-items: center;
  justify-content: center;
  padding: 0 32px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(196, 149, 106, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(196, 149, 106, 0.05) 0%, transparent 50%),
    var(--bg);
}

.welcome-content {
  text-align: center;
  max-width: 680px;
  z-index: 2;
  padding-top: 40px;
}
.welcome-badge {
  display: inline-block;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 28px;
}
.welcome-content h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 7vw, 68px);
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 24px;
  letter-spacing: -1px;
}
.welcome-content h1 em {
  font-style: italic;
  color: var(--accent);
}
.welcome-sub {
  font-size: 17px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 36px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}
.welcome-note {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* Decorative visual */
.welcome-visual {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.room-preview {
  position: absolute;
  inset: 0;
}
.room-layer {
  position: absolute;
  border-radius: 50%;
  opacity: 0.04;
}
.layer-1 {
  width: 600px; height: 600px;
  top: -10%; right: -10%;
  background: var(--accent);
  animation: float1 20s ease-in-out infinite;
}
.layer-2 {
  width: 400px; height: 400px;
  bottom: -5%; left: -5%;
  background: var(--accent);
  animation: float2 25s ease-in-out infinite;
}
.layer-3 {
  width: 300px; height: 300px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--text);
  animation: float3 18s ease-in-out infinite;
}
@keyframes float1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-30px, 20px) scale(1.05); }
}
@keyframes float2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -30px) scale(1.08); }
}
@keyframes float3 {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.1); }
}

/* ═══ QUIZ SCREEN ═══ */
#screen-quiz {
  background: var(--bg);
}
.quiz-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 32px 60px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

/* Progress */
.progress-bar {
  width: 100%;
  max-width: 400px;
  height: 3px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 16.67%;
}
.progress-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 48px;
  letter-spacing: 0.5px;
}

/* Question */
.question-area {
  width: 100%;
  text-align: center;
  animation: slideUp 0.4s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.question-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 400;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}
.question-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 40px;
}

/* Options */
.options-grid {
  display: grid;
  gap: 12px;
  width: 100%;
}
.options-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.options-grid.cols-1 { grid-template-columns: 1fr; max-width: 480px; margin: 0 auto; }

.option-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 16px;
}
.option-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.option-card:active { transform: translateY(0); }
.option-card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.option-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-warm);
  border-radius: 12px;
}
.option-text { flex: 1; }
.option-label {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}
.option-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* Color swatches for color question */
.color-swatches {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ═══ GENERATING SCREEN ═══ */
#screen-generating {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at center, rgba(196, 149, 106, 0.06) 0%, transparent 60%),
    var(--bg);
}
.generating-content {
  text-align: center;
}

/* Animated orb */
.gen-orb {
  width: 120px;
  height: 120px;
  position: relative;
  margin: 0 auto 40px;
}
.orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  opacity: 0.3;
}
.r1 { animation: orbPulse 2s ease-in-out infinite; }
.r2 { animation: orbPulse 2s ease-in-out infinite 0.4s; inset: 15px; }
.r3 { animation: orbPulse 2s ease-in-out infinite 0.8s; inset: 30px; }
.orb-core {
  position: absolute;
  inset: 40px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.15;
  animation: orbGlow 2s ease-in-out infinite;
}
@keyframes orbPulse {
  0%, 100% { opacity: 0.15; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.05); }
}
@keyframes orbGlow {
  0%, 100% { opacity: 0.1; transform: scale(1); }
  50% { opacity: 0.25; transform: scale(1.1); }
}

.gen-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  margin-bottom: 8px;
}
.gen-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  animation: subtitleFade 3s ease-in-out infinite;
}
@keyframes subtitleFade {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ═══ RESULTS SCREEN ═══ */
#screen-results {
  background: var(--bg);
  display: none;
}
#screen-results.active { display: flex; }

.results-container {
  flex: 1;
  padding: 0 32px 80px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.results-header {
  text-align: center;
  margin-bottom: 48px;
}
.results-header h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 400;
  margin-bottom: 12px;
}
.results-header h1 em {
  font-style: italic;
  color: var(--accent);
}
.results-header p {
  font-size: 16px;
  color: var(--text-muted);
}

/* Design cards */
.designs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 60px;
}
.design-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}
.design-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

/* Card palette header */
.design-palette {
  display: flex;
  height: 8px;
}
.design-palette-swatch {
  flex: 1;
}

/* Card body */
.design-body {
  padding: 28px;
}
.design-number {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.design-name {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}
.design-tagline {
  font-size: 14px;
  color: var(--accent);
  font-style: italic;
  margin-bottom: 16px;
}
.design-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}
.design-why {
  font-size: 13px;
  color: var(--text);
  background: var(--bg-warm);
  padding: 14px 16px;
  border-radius: 10px;
  line-height: 1.6;
  margin-bottom: 20px;
}
.design-why strong {
  color: var(--accent);
  font-weight: 600;
}

/* Furniture list */
.furniture-list {
  border-top: 1px solid var(--border-light);
  padding-top: 20px;
}
.furniture-list-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.furniture-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.furniture-item:last-child { border-bottom: none; }

.furniture-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.furniture-info { flex: 1; min-width: 0; }
.furniture-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.furniture-brand {
  font-size: 12px;
  color: var(--text-muted);
}
.furniture-price {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}

/* Card total */
.design-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 2px solid var(--border);
}
.design-total-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}
.design-total-price {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--text);
}

/* Results footer */
.results-footer {
  text-align: center;
}

/* ═══ ERROR ═══ */
.error-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.error-overlay.hidden { display: none; }
.error-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.error-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #FEE2E2;
  color: #DC2626;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  margin: 0 auto 16px;
}
.error-card h3 {
  font-family: var(--font-display);
  font-size: 22px;
  margin-bottom: 8px;
}
.error-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
  .nav { padding: 16px 20px; }
  .welcome-content { padding-top: 20px; }
  .welcome-sub { font-size: 15px; }
  .quiz-container { padding: 0 20px 40px; }
  .options-grid.cols-2 { grid-template-columns: 1fr; }
  .option-card { padding: 16px 18px; }
  .results-container { padding: 0 20px 60px; }
  .designs-grid { grid-template-columns: 1fr; }
  .design-body { padding: 22px; }
  .btn-primary { padding: 14px 28px; font-size: 15px; }
  .question-subtitle { margin-bottom: 28px; }
}

@media (max-width: 480px) {
  .welcome-content h1 { font-size: 36px; }
  .question-title { font-size: 26px; }
  .design-name { font-size: 22px; }
}
