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


:root {
  --bg: #f5f0eb;
  --text: #1a1a1a;
  --text-secondary: #6b6560;
  --accent: #c8a96e;
  --transition-speed: 0.6s;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--bg);
  color: var(--text);
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
  overflow-x: hidden;
  text-align: center;
  padding: 2rem 2rem 1rem;
}

/* --- State Themes --- */

body[data-state="yes"] {
  --bg: #f5f0eb;
  --text: #1a1a1a;
  --text-secondary: #6b6560;
  --accent: #8b7344;
}

body[data-state="no"] {
  --bg: #1a1f3d;
  --text: #e8e4df;
  --text-secondary: #9a95a0;
  --accent: #7b88b5;
}

body[data-state="unknown"] {
  --bg: #2a2a2a;
  --text: #d0ccc7;
  --text-secondary: #9e9994;
  --accent: #b0b0b0;
}

body[data-state="loading"] {
  --bg: #2a2a2a;
  --text: #d0ccc7;
  --text-secondary: #9e9994;
  --accent: #b0b0b0;
}

/* --- Screen Reader Only --- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Main Content --- */

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

#answer {
  font-size: clamp(6rem, 25vw, 20rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  transition: transform 0.3s ease, opacity 0.3s ease;
  user-select: none;
}

#message {
  font-size: clamp(1rem, 3vw, 1.5rem);
  font-weight: 400;
  color: var(--text-secondary);
  transition: color var(--transition-speed) ease;
  max-width: 40ch;
}

#countdown {
  font-size: clamp(1.5rem, 5vw, 3rem);
  font-weight: 300;
  color: var(--accent);
  margin-top: 0.5rem;
  transition: color var(--transition-speed) ease;
  min-height: 1.2em;
}

/* --- Inline City Link --- */

.city-link {
  background: none;
  border: none;
  border-bottom: 1.5px dashed var(--text-secondary);
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.city-link:hover,
.city-link:focus-visible {
  color: var(--text);
  border-color: var(--text);
}

.city-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- FAQ Footer --- */

#faq {
  width: 100%;
  max-width: 32rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: color var(--transition-speed) ease;
  padding-bottom: 0.5rem;
}

#faq details {
  border-top: 1px solid color-mix(in srgb, var(--text-secondary) 20%, transparent);
}

#faq summary {
  padding: 0.5rem 0;
  cursor: pointer;
  list-style: none;
}

#faq summary::before {
  content: '+ ';
  font-weight: 600;
}

#faq details[open] summary::before {
  content: '- ';
}

#faq p {
  padding: 0 0 0.5rem;
  line-height: 1.5;
}

#faq a {
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

#faq a:hover,
#faq a:focus-visible {
  color: var(--text);
}

#faq a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- City Modal --- */

#city-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#city-modal.open {
  opacity: 1;
}

#modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: 1rem;
  padding: 2rem;
  max-width: 20rem;
  width: 90%;
  z-index: 1;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

#city-search {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid #ddd;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  margin-bottom: 0.75rem;
  color: #1a1a1a;
  transition: border-color 0.15s ease;
}

#city-search:focus {
  border-color: #999;
}

#city-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 50vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.city-option {
  background: none;
  border: none;
  padding: 0.7rem 1rem;
  text-align: left;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  border-radius: 0.5rem;
  color: #1a1a1a;
  transition: background-color 0.15s ease;
}

.city-option:hover,
.city-option:focus-visible {
  background-color: #f0ece7;
}

.city-option:focus-visible {
  outline: 2px solid #c8a96e;
  outline-offset: -2px;
}

.city-empty {
  padding: 0.7rem 1rem;
  color: #595959;
  font-size: 0.9rem;
}

.city-list-scroll {
  max-height: 50vh;
  overflow-y: auto;
}

/* --- Responsive --- */

@media (max-width: 480px) {
  body {
    padding: 1.5rem 1.5rem 1rem;
  }
  .modal-content {
    padding: 1.5rem;
  }
}

/* --- Reduced Motion --- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* --- High Contrast --- */

@media (forced-colors: active) {
  .city-link {
    border-bottom-color: LinkText;
  }
  .city-option:focus-visible,
  .city-link:focus-visible {
    outline: 2px solid Highlight;
  }
}
