/* SpotCountry extends the shared Discovery game design system. */

.gt-country-page { overflow: clip; }

.gt-country-top-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.gt-country-fullscreen {
  min-width: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.gt-country-command {
  margin-top: 20px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
}

#spotcountry-form { min-width: 0; }

.gt-country-actions {
  display: flex;
  gap: 8px;
}

.gt-country-actions .btn {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.gt-country-command .input-group .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.gt-country-stats {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.gt-country-stats > span {
  min-width: 0;
  min-height: 64px;
  padding: 10px 13px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--gt-border-soft);
  border-radius: 15px;
  background: var(--gt-surface);
}

.gt-country-stats > span > i {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--gt-surface-2);
  color: var(--gt-brand);
}

.gt-country-stats small {
  overflow: hidden;
  color: var(--gt-muted);
  font-size: .7rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gt-country-stats strong {
  font-size: 1.05rem;
  font-weight: 900;
}

.gt-country-stats .gt-country-streak {
  border-color: color-mix(in srgb, var(--gt-brand) 32%, var(--gt-border));
  background: linear-gradient(135deg, color-mix(in srgb, var(--gt-brand) 10%, var(--gt-card)), var(--gt-surface));
}

.gt-hint-panel {
  margin-top: 12px;
  padding: 12px 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid color-mix(in srgb, #ffb703 42%, var(--gt-border));
  border-radius: 15px;
  background: color-mix(in srgb, #ffb703 9%, var(--gt-card));
  animation: gtCountryHintIn .22s ease-out;
}

.gt-hint-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, #ffb703 20%, transparent);
  color: #b46d00;
}

[data-bs-theme="dark"] .gt-hint-icon { color: #ffd166; }

.gt-hint-panel div { display: grid; gap: 2px; }
.gt-hint-panel small { color: var(--gt-muted); font-size: .68rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.gt-hint-panel strong { color: var(--gt-text); font-size: .9rem; }

.gt-country-map-frame {
  position: relative;
  margin-top: 13px;
  min-height: 520px;
  border: 1px solid var(--gt-border);
  border-radius: 21px;
  background: #dce8e9;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
  overflow: hidden;
}

#spotcountry-map {
  width: 100%;
  height: clamp(520px, 62vh, 720px);
  min-height: 520px;
  background: #dce8e9;
}

[data-bs-theme="dark"] .gt-country-map-frame,
[data-bs-theme="dark"] #spotcountry-map { background: #111d25; }

.gt-country-map-frame .gt-map-badge {
  z-index: 500;
  pointer-events: none;
}

.gt-country-map-frame .leaflet-control-attribution {
  border-radius: 8px 0 0 0;
  background: color-mix(in srgb, var(--gt-card) 88%, transparent);
  color: var(--gt-muted);
  font-size: 9px;
}

.gt-country-map-frame .leaflet-control-attribution a { color: var(--gt-brand); }

.gt-country-map-frame .leaflet-bar {
  border: 1px solid var(--gt-border) !important;
  border-radius: 11px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .12);
  overflow: hidden;
}

.gt-country-map-frame .leaflet-bar a {
  border-color: var(--gt-border-soft);
  background: var(--gt-card);
  color: var(--gt-text);
}

.gt-country-map-frame .leaflet-tooltip.gt-country-label {
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  background: #101820;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .25);
  color: #fff;
  font-size: .76rem;
  font-weight: 850;
}

.gt-map-loader {
  position: absolute;
  z-index: 700;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: color-mix(in srgb, var(--gt-card) 88%, transparent);
  color: var(--gt-muted);
  font-size: .82rem;
  font-weight: 800;
  backdrop-filter: blur(8px);
  transition: opacity .2s ease, visibility .2s ease;
}

.gt-map-loader.is-hidden { opacity: 0; visibility: hidden; }
.gt-map-loader .spinner-border { width: 28px; height: 28px; color: var(--gt-brand); }

.gt-country-status {
  min-height: 24px;
  margin: 11px 2px 0;
  color: var(--gt-muted);
  font-size: .82rem;
  font-weight: 800;
}

.gt-country-status.is-success { color: #16825d; }
.gt-country-status.is-error { color: #d84a4a; }
.gt-country-status.is-info { color: var(--gt-brand); }

.gt-country-map-frame.is-correct { animation: gtCountryCorrect .55s ease; }
.gt-country-map-frame.is-wrong { animation: gtCountryWrong .35s ease; }

.gt-country-progress { padding: 78px 0; }

.gt-country-summary {
  margin-top: 30px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

.gt-country-summary article {
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 13px;
  border: 1px solid var(--gt-border);
  border-radius: 18px;
  background: var(--gt-card);
  box-shadow: var(--gt-shadow-soft);
}

.gt-country-summary article > span {
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--gt-surface-2);
  color: var(--gt-brand);
}

.gt-country-summary article > div { display: grid; gap: 2px; }
.gt-country-summary small { color: var(--gt-muted); font-size: .7rem; font-weight: 800; }
.gt-country-summary strong { font-size: 1.35rem; font-weight: 900; }

.gt-country-results {
  margin-top: 15px;
  padding: 20px;
  min-height: 128px;
  border: 1px solid var(--gt-border);
  border-radius: 20px;
  background: linear-gradient(145deg, var(--gt-card), var(--gt-surface));
  box-shadow: var(--gt-shadow-soft);
}

.gt-country-empty {
  min-height: 86px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  color: var(--gt-muted);
  text-align: center;
}

.gt-country-empty i { margin-bottom: 5px; color: var(--gt-brand); font-size: 1.5rem; }
.gt-country-empty strong { color: var(--gt-text); }
.gt-country-empty span { font-size: .78rem; }

.gt-continent-group + .gt-continent-group { margin-top: 20px; }
.gt-continent-group h3 { margin: 0 0 10px; color: var(--gt-muted); font-size: .72rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }

.gt-country-chip-list { display: flex; flex-wrap: wrap; gap: 8px; }

.gt-country-chip {
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid color-mix(in srgb, #21b485 32%, var(--gt-border));
  border-radius: 10px;
  background: color-mix(in srgb, #21b485 9%, var(--gt-card));
  color: var(--gt-text);
  font-size: .76rem;
  font-weight: 800;
}

.gt-country-chip i { color: #21a876; }

.gt-country-rules {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.gt-country-rules article {
  position: relative;
  padding: 24px;
  border: 1px solid var(--gt-border);
  border-radius: 20px;
  background: var(--gt-card);
  box-shadow: var(--gt-shadow-soft);
  overflow: hidden;
}

.gt-country-rules article > span { position: absolute; top: 17px; right: 20px; color: var(--gt-border); font-size: 2rem; font-weight: 950; }
.gt-country-rules article > i { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--gt-surface-2); color: var(--gt-brand); }
.gt-country-rules h3 { margin: 18px 0 8px; font-size: 1.05rem; font-weight: 900; }
.gt-country-rules p { margin: 0; color: var(--gt-muted); font-size: .84rem; line-height: 1.65; }

.gt-country-modal {
  position: fixed;
  z-index: 2000;
  inset: 0;
  padding: 18px;
  display: none;
  place-items: center;
}

.gt-country-modal.is-open { display: grid; }
.gt-country-modal-backdrop { position: absolute; inset: 0; background: rgba(5, 10, 16, .72); backdrop-filter: blur(10px); }

.gt-country-modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  padding: 32px;
  border: 1px solid var(--gt-border);
  border-radius: 25px;
  background: var(--gt-card);
  box-shadow: 0 35px 100px rgba(0, 0, 0, .36);
  text-align: center;
  animation: gtCountryModalIn .25s ease-out;
}

.gt-country-modal-close {
  position: absolute;
  top: 13px;
  right: 13px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gt-border);
  border-radius: 12px;
  background: var(--gt-surface);
  color: var(--gt-text);
}

.gt-country-modal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 17px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: color-mix(in srgb, var(--gt-brand) 15%, transparent);
  color: var(--gt-brand);
  font-size: 1.55rem;
}

.gt-country-modal-card h2 { margin: 8px 0 8px; font-size: clamp(1.8rem, 6vw, 2.6rem); font-weight: 950; letter-spacing: -.04em; }
.gt-country-modal-card > p { margin: 0 auto; max-width: 42ch; color: var(--gt-muted); line-height: 1.6; }

.gt-country-modal-stats { margin: 23px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gt-country-modal-stats span { padding: 13px 8px; display: grid; gap: 4px; border: 1px solid var(--gt-border-soft); border-radius: 14px; background: var(--gt-surface); }
.gt-country-modal-stats small { color: var(--gt-muted); font-size: .66rem; font-weight: 850; }
.gt-country-modal-stats strong { font-size: 1.35rem; font-weight: 950; }
.gt-country-modal-card .gt-country-save-note { min-height: 22px; color: var(--gt-brand); font-size: .78rem; font-weight: 800; }
.gt-country-modal-actions { margin-top: 16px; display: grid; grid-template-columns: auto 1fr; gap: 9px; }

body.gt-modal-open { overflow: hidden; }

#spotcountry-game:fullscreen {
  width: 100%;
  height: 100%;
  padding: 18px;
  border: 0;
  border-radius: 0;
  overflow: auto;
  background: var(--gt-bg);
}

#spotcountry-game:fullscreen .gt-game-topbar { display: none; }
#spotcountry-game:fullscreen .gt-country-command { margin-top: 0; }
#spotcountry-game:fullscreen #spotcountry-map { height: calc(100vh - 196px); min-height: 360px; }
#spotcountry-game:fullscreen .gt-country-map-frame { min-height: 360px; }

@keyframes gtCountryHintIn { from { opacity: 0; transform: translateY(-5px); } }
@keyframes gtCountryCorrect { 45% { box-shadow: 0 0 0 5px rgba(33, 180, 133, .23); } }
@keyframes gtCountryWrong { 25%, 75% { transform: translateX(-4px); } 50% { transform: translateX(4px); } }
@keyframes gtCountryModalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }

@media (max-width: 991.98px) {
  .gt-country-command { grid-template-columns: 1fr; }
  .gt-country-actions { display: grid; grid-template-columns: repeat(3, 1fr); }
  .gt-country-actions .btn { justify-content: center; }
  .gt-country-map-frame, #spotcountry-map { min-height: 470px; height: 56vh; }
}

@media (max-width: 767.98px) {
  .gt-country-top-actions { width: 100%; justify-content: space-between; }
  .gt-country-fullscreen span { display: none; }
  .gt-country-stats { grid-template-columns: repeat(2, 1fr); }
  .gt-country-summary, .gt-country-rules { grid-template-columns: 1fr; }
  .gt-country-progress { padding: 58px 0; }
  .gt-country-map-frame, #spotcountry-map { min-height: 430px; height: 53vh; }
}

@media (max-width: 575.98px) {
  .gt-country-command .input-group { display: grid; grid-template-columns: 42px minmax(0, 1fr); }
  .gt-country-command .input-group .input-group-text { grid-row: 1; border-radius: 12px 0 0 12px; }
  .gt-country-command .input-group input { grid-row: 1; border-radius: 0 12px 12px 0 !important; }
  .gt-country-command .input-group input { width: 100%; }
  .gt-country-command .input-group .btn { grid-column: 1 / -1; margin-top: 8px !important; border-radius: 12px !important; }
  .gt-country-actions .btn { min-width: 0; padding-inline: 8px; font-size: .76rem; }
  .gt-country-stats > span { min-height: 57px; padding: 8px 9px; }
  .gt-country-stats > span > i { width: 28px; height: 28px; }
  .gt-country-map-frame, #spotcountry-map { min-height: 390px; height: 50vh; }
  .gt-country-results { padding: 15px; }
  .gt-country-modal-card { padding: 28px 18px 20px; }
  .gt-country-modal-actions { grid-template-columns: 1fr; }
  #spotcountry-game:fullscreen { padding: 10px; }
  #spotcountry-game:fullscreen .gt-country-stats { display: none; }
  #spotcountry-game:fullscreen #spotcountry-map { height: calc(100vh - 205px); }
}

@media (prefers-reduced-motion: reduce) {
  .gt-country-map-frame, .gt-hint-panel, .gt-country-modal-card { animation: none !important; }
}
