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

:root {
  --bg: #f8f7f4;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --accent: #c4621a;
  --accent-light: #f5e8de;
  --border: #e8e6e1;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 12px;
}

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* ─── Screens ─────────────────────────────────────── */

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

/* ─── Intro ───────────────────────────────────────── */

#screen-intro {
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}

.intro-content {
  max-width: 480px;
}

.intro-emoji {
  font-size: 56px;
  margin-bottom: 24px;
  line-height: 1;
}

h1 {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1.15;
  margin-bottom: 16px;
}

.intro-subtitle {
  font-size: 17px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 40px;
}

/* ─── Buttons ─────────────────────────────────────── */

.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 16px 44px;
  font-size: 17px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn-primary:hover {
  background: #a85215;
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  display: inline-block;
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 50px;
  padding: 14px 40px;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  margin-top: 32px;
}

.btn-secondary:hover {
  background: var(--accent);
  color: #fff;
}

.btn-secondary:active {
  transform: scale(0.97);
}

/* ─── Quiz ────────────────────────────────────────── */

#screen-quiz {
  padding: 0;
}

.quiz-header {
  padding: 24px 24px 0;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}

.question-counter {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.quiz-body {
  padding: 32px 24px 48px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.question-text {
  font-size: clamp(18px, 3vw, 22px);
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 28px;
  letter-spacing: -0.2px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  line-height: 1.5;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.option-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.option-btn:active {
  transform: scale(0.99);
}

.option-btn.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.option-letter {
  display: inline-block;
  font-weight: 600;
  color: var(--accent);
  margin-right: 8px;
  min-width: 18px;
}

/* ─── Result — landscape (default) ───────────────── */

#screen-result {
  flex-direction: column;
}

.result-image-wrap {
  position: relative;
  width: 100%;
  height: clamp(220px, 38vw, 340px);
  background: var(--accent-light);
  overflow: hidden;
  flex-shrink: 0;
}

#result-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.result-image-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  background: var(--accent-light);
}

.result-body {
  padding: 32px 24px 60px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.result-city-name {
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 20px;
}

.result-description {
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
}

/* ─── Result — portrait layout ────────────────────── */

#screen-result.portrait-layout {
  flex-direction: row;
  min-height: 100vh;
  align-items: stretch;
}

#screen-result.portrait-layout .result-image-wrap {
  width: 42%;
  height: auto;
  flex-shrink: 0;
  align-self: stretch;
}

#screen-result.portrait-layout #result-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

#screen-result.portrait-layout .result-body {
  flex: 1;
  max-width: none;
  padding: 48px 40px 60px;
  margin: 0;
  justify-content: center;
}

@media (max-width: 640px) {
  #screen-result.portrait-layout {
    flex-direction: column;
    min-height: unset;
  }

  #screen-result.portrait-layout .result-image-wrap {
    width: 100%;
    height: clamp(200px, 55vw, 320px);
    align-self: auto;
  }

  #screen-result.portrait-layout #result-img {
    position: relative;
    inset: unset;
  }

  #screen-result.portrait-layout .result-body {
    padding: 24px 16px 48px;
  }
}

/* ─── Twemoji ─────────────────────────────────────── */

img.emoji {
  height: 1.2em;
  width: 1.2em;
  vertical-align: -0.2em;
  display: inline;
}

/* ─── Transition ──────────────────────────────────── */

.screen-fade-out {
  animation: fadeOut 0.2s ease forwards;
}

.screen-fade-in {
  animation: fadeIn 0.25s ease forwards;
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateY(-8px); }
}

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

/* ─── Mobile ──────────────────────────────────────── */

@media (max-width: 480px) {
  .quiz-body {
    padding: 24px 16px 40px;
  }

  .quiz-header {
    padding: 20px 16px 0;
  }

  .option-btn {
    padding: 14px 16px;
    font-size: 15px;
  }

  .result-body {
    padding: 24px 16px 48px;
  }
}
