/* ── Screen container ───────────────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.screen.is-active { opacity: 1; pointer-events: auto; }

.screen-body {
  position: relative;
  z-index: 5;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 26px 22px calc(var(--street-h) + 14px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
/* Auto margins centre the block when it fits and let it scroll when it does
   not — unlike justify-content: center, which strands the overflow. */
.screen-body > :first-child { margin-top: auto; }
.screen-body > :last-child  { margin-bottom: auto; }

/* ── Start screen ───────────────────────────────────────────────────────── */
.start-head { text-align: center; }
.logo {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -1.6px;
  line-height: 1;
  color: var(--on-sky);
}
.tagline { margin-top: 5px; font-size: 14.5px; color: var(--on-sky-soft); }

.how-to {
  width: 100%;
  max-width: 340px;
  background: rgba(253, 248, 240, 0.74);
  border: 1px solid rgba(46, 125, 112, 0.28);
  border-radius: var(--radius);
  padding: 13px 16px;
}
.how-to-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  margin-bottom: 5px;
}
.how-to-goal { font-size: 14px; font-weight: 650; margin-bottom: 8px; line-height: 1.35; }
.how-to ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.how-to li {
  position: relative;
  padding-left: 17px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-soft);
}
.how-to li::before {
  content: '';
  position: absolute;
  left: 1px;
  top: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.how-to .hl { font-weight: 700; color: var(--accent); }

/* Dark glass rather than a glaring white slab, and light text to match. */
.is-night .how-to {
  background: rgba(38, 32, 44, 0.62);
  border-color: rgba(126, 200, 184, 0.32);
}
.is-night .how-to-title { color: var(--accent-on-sky); }
.is-night .how-to-goal  { color: var(--on-sky); }
.is-night .how-to li    { color: var(--on-sky-soft); }
.is-night .how-to li::before { background: var(--accent-on-sky); }
.is-night .how-to .hl   { color: var(--accent-on-sky); }

.start-title {
  font-size: clamp(19px, 5vw, 24px);
  font-weight: 800;
  letter-spacing: -0.4px;
  text-align: center;
  margin-top: 4px;
  color: var(--on-sky);
}
.start-lede { font-size: 14px; color: var(--on-sky-soft); text-align: center; margin-top: -6px; }

/* ── City picker (§6) ───────────────────────────────────────────────────── */
.city-grid-wrap { width: 100%; max-width: 460px; }
.city-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 560px) { .city-grid { grid-template-columns: repeat(3, 1fr); } }

.city-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
  font: inherit;
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.12s ease, box-shadow 0.16s ease;
}
.city-card:active { transform: scale(0.985); }
.city-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 125, 112, 0.2), var(--shadow-1);
}
.city-art {
  display: block;
  height: 74px;
  overflow: hidden;
  line-height: 0;
}
.city-art svg { width: 100%; height: 100%; }
.city-name {
  padding: 7px 10px 0;
  font-size: 14px;
  font-weight: 700;
}
.city-blurb {
  padding: 1px 10px 9px;
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--ink-faint);
}

/* Returning player: no picker, just a hello. */
.welcome { text-align: center; }
.welcome-city { font-size: 21px; font-weight: 700; color: var(--on-sky); }
.welcome-stats { margin-top: 3px; font-size: 13.5px; color: var(--on-sky-soft); }

/* ── Intro ──────────────────────────────────────────────────────────────── */
.intro-body { justify-content: center; text-align: center; }
.intro-message {
  font-size: clamp(22px, 6vw, 30px);
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.25;
  color: var(--on-sky);
}
.intro-message.is-leaving { animation: intro-out 0.55s ease forwards; }
@keyframes intro-out { to { opacity: 0; transform: translateY(-14px); } }
.intro-sub { margin-top: 8px; font-size: 14.5px; color: var(--on-sky-soft); }

/* ── Game HUD ───────────────────────────────────────────────────────────── */
/* §15: points are a supporting system, so the score is a small chip and the
   tower gets the screen. */
.hud {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 0;
  pointer-events: none;
}
.timer {
  font-size: 21px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 5px 13px;
  color: var(--ink);
  background: rgba(253, 248, 240, 0.9);
  border: 2.5px solid var(--ink);
  border-radius: 8px;
  letter-spacing: 0.5px;
}
.timer.is-urgent {
  color: var(--danger);
  border-color: var(--danger);
  animation: urgent 0.85s ease infinite;
}
@keyframes urgent { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }

.hud-right { display: flex; align-items: center; gap: 7px; }
.floors-chip, .score-chip {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 5px 11px;
  background: rgba(253, 248, 240, 0.86);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--ink-soft);
}
.floors-chip b, .score-chip b {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
/* Hidden until there is a score, so a first floor is about the building. */
.score-chip { opacity: 0; transition: opacity 0.3s ease; }
.score-chip.is-visible { opacity: 1; }

/* ── Hint button (§5) ───────────────────────────────────────────────────── */
.play-controls {
  position: relative;
  z-index: 11;
  display: flex;
  justify-content: center;
  padding: 6px 16px 8px;
}
.btn-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  background: rgba(253, 248, 240, 0.95);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.2s ease;
}
.btn-hint:active { transform: scale(0.97); }
.btn-hint:disabled, .btn-hint.is-spent { opacity: 0.42; cursor: default; }
/* The consequence, stated before the player commits. */
.hint-cost {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-faint);
  white-space: nowrap;
}

/* ── Milestone prompts (§10, §11) ───────────────────────────────────────── */
.milestone-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(58, 45, 33, 0.5);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.24s ease;
}
.milestone-overlay.is-open { opacity: 1; }

.milestone-card {
  width: 100%;
  max-width: 380px;
  padding: 22px 20px 16px;
  background: var(--paper);
  border-radius: 18px;
  box-shadow: var(--shadow-2);
  text-align: center;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.26s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.milestone-overlay.is-open .milestone-card { transform: none; }

.milestone-heading { font-size: 19px; font-weight: 800; letter-spacing: -0.3px; }
.milestone-prompt { margin-top: 5px; font-size: 14px; color: var(--ink-soft); }

.milestone-choices { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 10px; }
.milestone-choice {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  font: inherit;
  text-align: left;
  background: #f7f0e4;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.1s ease;
}
.milestone-choice:hover { border-color: var(--accent); background: #f1f8fc; }
.milestone-choice:active { transform: scale(0.985); }
.choice-name { font-size: 15px; font-weight: 700; }
.choice-blurb { font-size: 12.5px; color: var(--ink-faint); }

.milestone-form { display: flex; flex-direction: column; gap: 10px; margin: 16px 0 10px; }
.milestone-form input {
  padding: 13px 15px;
  font: inherit;
  font-size: 16px;
  text-align: center;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}
.milestone-form input:focus { border-color: var(--accent); }

.milestone-skip {
  padding: 6px;
  font: inherit;
  font-size: 13px;
  color: var(--ink-faint);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}

/* ── Settings ───────────────────────────────────────────────────────────── */
.settings-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(58, 45, 33, 0.5);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.24s ease;
}
.settings-panel.is-open { opacity: 1; }
.settings-card {
  width: 100%;
  max-width: 340px;
  padding: 22px 20px 16px;
  background: var(--paper);
  border-radius: 18px;
  box-shadow: var(--shadow-2);
  transform: translateY(12px) scale(0.97);
  transition: transform 0.26s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.settings-panel.is-open .settings-card { transform: none; }
.settings-card h3 { font-size: 18px; margin-bottom: 14px; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  font-size: 14.5px;
  font-weight: 600;
}
.setting-row select {
  font: inherit;
  font-size: 14px;
  padding: 7px 10px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}
.setting-toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
.setting-note { font-size: 12px; color: var(--ink-faint); line-height: 1.4; margin: -2px 0 6px; }
.settings-card .btn-secondary { width: 100%; margin-top: 12px; }
