/* ==========================================================================
   SatelCity - Game Stylesheet
   Builds on ../css/atlas.css (tokens, base and shared components).
   Accent: sea teal via <body data-game="satelcity">.
   ========================================================================== */

.satel-page {
  max-width: 1200px;
}

/* --------------------------------------------------------------------------
   Screens
   -------------------------------------------------------------------------- */
.screen {
  display: none;
}

.screen.active {
  display: flex;
  flex-direction: column;
  animation: satelFadeIn 0.25s var(--ease);
}

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

.animate-fade-in {
  animation: satelFadeIn 0.2s var(--ease) both;
}

/* --------------------------------------------------------------------------
   Home: hero
   -------------------------------------------------------------------------- */
.satel-hero {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(24px, 6vw, 56px) 0 clamp(24px, 4vw, 36px);
}

.satel-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
}

.satel-hero-title {
  font-size: clamp(44px, 7vw, 72px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
}

.satel-hero-subtitle {
  max-width: 620px;
  font-size: 18px;
  color: var(--ink-soft);
}

/* --------------------------------------------------------------------------
   Home: difficulty selector
   -------------------------------------------------------------------------- */
.difficulty-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.difficulty-pill-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  max-width: 560px;
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--rule);
  background: var(--paper-sunken);
}

.btn-diff-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 56px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.btn-diff-pill:hover {
  color: var(--ink);
}

.btn-diff-pill .diff-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.15;
}

.btn-diff-pill .diff-desc {
  font-size: 13px;
  color: var(--ink-muted);
}

.btn-diff-pill.active {
  background: var(--paper-raised);
  border-color: var(--rule);
  box-shadow: 0 1px 2px rgba(30, 41, 51, 0.12);
}

.btn-diff-pill.active .diff-title {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Home: mode cards
   -------------------------------------------------------------------------- */
.modes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.mode-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.mode-card:hover {
  border-color: var(--accent);
}

.mode-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mode-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

.mode-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 24px;
}

.mode-stats-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}

.mode-stats-badge .badge-pct {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.1;
}

.mode-stats-badge .badge-ratio {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
}

.mode-title {
  font-size: 28px;
}

.mode-desc {
  font-size: 15px;
  color: var(--ink-soft);
  flex-grow: 1;
}

.mode-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.mode-action-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--accent);
}

.mode-card:hover .mode-action-link .icon {
  transform: translateX(3px);
}

.mode-action-link .icon {
  transition: transform 0.15s var(--ease);
}

/* --------------------------------------------------------------------------
   Game: HUD
   -------------------------------------------------------------------------- */
.game-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  padding: 0 0 14px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}

.bar-left,
.bar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

/* --------------------------------------------------------------------------
   Game: workspace
   -------------------------------------------------------------------------- */
.game-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 24px;
  align-items: start;
}

/* Satellite photo */
.photo-frame-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--rule-strong);
  background: var(--paper-sunken);
  box-shadow: var(--shadow-card);
}

.satellite-viewport {
  width: 100%;
  height: 560px;
  background: var(--paper-sunken);
  cursor: default;
}

.leaflet-container {
  background: var(--paper-sunken) !important;
  font-family: var(--font-body) !important;
  cursor: default !important;
}

.leaflet-control-attribution {
  background: rgba(251, 248, 241, 0.85) !important;
  color: var(--ink-muted) !important;
  font-family: var(--font-mono) !important;
  font-size: 10px !important;
  padding: 2px 6px !important;
  border-radius: 4px 0 0 0;
}

.leaflet-control-attribution a {
  color: var(--ink-soft) !important;
}

.photo-overlay-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.photo-badge-compass,
.photo-btn-expand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: rgba(251, 248, 241, 0.94);
  color: var(--ink);
  box-shadow: 0 2px 8px -2px rgba(30, 41, 51, 0.35);
}

.photo-badge-compass {
  min-height: 32px;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.photo-badge-compass .icon {
  color: var(--accent);
}

.photo-btn-expand {
  min-height: 40px;
  padding: 0 14px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s var(--ease);
}

.photo-btn-expand:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Controls panel */
.game-controls-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   Clues
   -------------------------------------------------------------------------- */
.hints-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hints-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hint-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--rule-strong);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.hint-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.hint-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}

.hint-head .icon {
  color: var(--accent);
}

.hint-value {
  font-size: 13px;
  color: var(--ink-muted);
  text-align: right;
  min-width: 0;
}

.hint-item.unlocked {
  border-style: solid;
  border-color: var(--rule);
  background: var(--paper);
  cursor: default;
}

.hint-item.unlocked .hint-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Multiple Choice mode
   -------------------------------------------------------------------------- */
.mc-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mc-prompt {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
}

.mc-options-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Type & Guess mode
   -------------------------------------------------------------------------- */
.tg-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tg-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}

.tg-prompt {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
}

.tg-remaining {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
}

.tg-remaining strong {
  font-weight: 500;
  color: var(--ink);
}

.tg-search-wrapper {
  position: relative;
}

.tg-input-group {
  display: flex;
  gap: 8px;
}

.tg-input-group .tg-input {
  flex: 1 1 auto;
  min-width: 0;
}

.tg-btn-submit {
  flex-shrink: 0;
}

.tg-autocomplete-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 600;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--rule-strong);
  background: var(--paper-raised);
  box-shadow: 0 16px 32px -16px rgba(30, 41, 51, 0.4);
}

.tg-autocomplete-dropdown.active {
  display: block;
}

.tg-dropdown-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.tg-dropdown-item:hover {
  background: var(--accent-soft);
}

.tg-item-name {
  font-weight: 600;
  color: var(--ink);
}

.tg-item-country {
  margin-left: auto;
  font-size: 13px;
  color: var(--ink-muted);
  text-align: right;
}

.tg-dropdown-empty {
  padding: 12px;
  font-size: 14px;
  color: var(--ink-muted);
}

.tg-warning-msg {
  display: none;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--wrong);
  background: var(--wrong-soft);
  color: var(--wrong);
  font-size: 14px;
  font-weight: 600;
}

.tg-guesses-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tg-empty-hint {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--rule-strong);
  font-size: 14px;
  color: var(--ink-muted);
  text-align: center;
}

.tg-guess-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--rule);
  background: #FFFFFF;
}

.tg-row-num {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
}

/* Proximity marker: warmer = closer */
.tg-row-num::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--prox, var(--rule-strong));
}

.tg-row-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-weight: 600;
  line-height: 1.25;
}

.tg-row-country {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-muted);
}

.tg-row-metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}

.tg-distance {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.tg-direction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.tg-bearing-arrow {
  color: var(--accent);
}

.tg-exact-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--correct);
}

.tg-guess-row.prox-exact {
  --prox: var(--correct);
  border-color: var(--correct);
  background: var(--correct-soft);
}

.tg-guess-row.prox-very-close { --prox: var(--brick); }
.tg-guess-row.prox-close      { --prox: #C9822A; }
.tg-guess-row.prox-medium     { --prox: var(--sea); }
.tg-guess-row.prox-far        { --prox: var(--rule-strong); }

.tg-actions {
  display: flex;
  justify-content: flex-end;
}

/* --------------------------------------------------------------------------
   Result card
   -------------------------------------------------------------------------- */
.result-overlay-card {
  display: none;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--rule);
  background: var(--paper);
}

.result-overlay-card.active {
  display: flex;
  animation: satelFadeIn 0.25s var(--ease);
}

.result-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}

.result-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
}

.result-title.correct {
  color: var(--correct);
}

.result-title.wrong {
  color: var(--wrong);
}

.result-accuracy-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
}

.result-city-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}

.result-city-name {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--accent);
}

.result-city-country {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}

.result-city-detail {
  font-size: 14px;
  color: var(--ink-soft);
}

#btn-next-city {
  align-self: stretch;
}

/* --------------------------------------------------------------------------
   Level completed
   -------------------------------------------------------------------------- */
.completed-card {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 16px;
  text-align: center;
}

.completed-card.active {
  display: flex;
}

.completed-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 28px;
}

.completed-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
}

.completed-desc {
  font-size: 15px;
  color: var(--ink-soft);
}

.completed-btn-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Expanded photo modal (locked, no pan/zoom)
   -------------------------------------------------------------------------- */
.photo-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(30, 41, 51, 0.6);
}

.photo-modal-backdrop.active {
  display: flex;
}

.photo-modal-container {
  position: relative;
  width: 100%;
  max-width: 1080px;
  height: 85vh;
  max-height: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--rule-strong);
  background: var(--paper-sunken);
  box-shadow: 0 24px 48px -24px rgba(30, 41, 51, 0.6);
  cursor: default !important;
}

.modal-map-viewport {
  width: 100%;
  height: 100%;
  cursor: default !important;
}

.btn-close-modal {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  min-height: 40px;
  box-shadow: 0 2px 8px -2px rgba(30, 41, 51, 0.35);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .game-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .satellite-viewport {
    height: 420px;
  }
}

@media (max-width: 700px) {
  .modes-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .satellite-viewport {
    height: 300px;
  }

  .mode-card {
    padding: 20px;
  }

  .game-controls-card {
    padding: 16px;
  }

  .hint-item {
    flex-wrap: wrap;
  }

  .hint-value {
    text-align: left;
  }

  .tg-btn-submit {
    padding: 0 14px;
  }

  .photo-btn-expand span {
    display: none;
  }

  .photo-btn-expand {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .completed-btn-group {
    flex-direction: column;
    width: 100%;
  }

  .completed-btn-group .atlas-btn {
    width: 100%;
  }
}
