/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color: rgba(255,255,255,0.92);
  overflow-x: hidden;
}

/* Background: soft "apple-ish" gradient + subtle noise-ish overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 800px at 15% 20%, rgba(120, 160, 255, 0.55), transparent 60%),
    radial-gradient(900px 700px at 85% 30%, rgba(90, 240, 210, 0.35), transparent 55%),
    radial-gradient(1000px 900px at 55% 85%, rgba(210, 120, 255, 0.35), transparent 60%),
    linear-gradient(180deg, rgba(8, 10, 20, 1), rgba(6, 8, 16, 1));
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 4px 4px;
  opacity: 0.10;
  z-index: -1;
  pointer-events: none;
}

/* Root container */
#app { min-height: 100vh; }

/* ---------- Layout ---------- */
.shell {
  width: min(1100px, calc(100% - 32px));
  margin: 24px auto 56px;
  display: grid;
  gap: 16px;
}

.header {
  padding: 18px 18px;
  display: grid;
  gap: 6px;
}

.title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.subtitle {
  font-size: 14px;
  opacity: 0.8;
}

/* ---------- Glass effect ---------- */
.glass {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow:
    0 10px 30px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(255,255,255,0.10);
  border-radius: 18px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* ---------- Country grid ---------- */
.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.country-card {
  cursor: pointer;
  padding: 0;
  border: 0;
  text-align: left;
  overflow: hidden;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.country-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.12);
}

.country-card:active {
  transform: translateY(0px);
}

.country-thumb {
  width: 100%;
  height: 140px;
  display: block;
  object-fit: cover;
  filter: saturate(1.05) contrast(1.02);
}

.country-card.no-thumb .country-thumb { display: none; }

.country-label {
  padding: 12px 12px 14px;
  display: grid;
  gap: 4px;
}

.country-name {
  font-size: 16px;
  font-weight: 800;
  text-transform: capitalize;
}

.country-count {
  font-size: 12px;
  opacity: 0.75;
}

/* ---------- Gallery ---------- */
.gallery-top {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.back-btn {
  cursor: pointer;
  border: 0;
  padding: 10px 12px;
  border-radius: 14px;
  color: rgba(255,255,255,0.92);
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.14);
  transition: background 120ms ease, transform 120ms ease;
}

.back-btn:hover { background: rgba(255,255,255,0.14); transform: translateY(-1px); }
.back-btn:active { transform: translateY(0); }

.gallery-title .title { font-size: 20px; }
.gallery-title .subtitle { margin-top: 2px; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.gallery-tile {
  cursor: pointer;
  border: 0;
  padding: 0;
  overflow: hidden;
  transition: transform 120ms ease, border-color 120ms ease;
}

.gallery-tile:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.26); }
.gallery-tile:active { transform: translateY(0); }

.gallery-img {
  width: 100%;
  height: 160px;
  display: block;
  object-fit: cover;
}

.gallery-tile.broken {
  opacity: 0.35;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 9999;
}

.modal {
  width: min(980px, 100%);
  position: relative;
  padding: 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 10px;
}

.modal-img {
  grid-column: 1 / -1;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(0,0,0,0.20);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 0;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.9);
  cursor: pointer;
}

.modal-prev, .modal-next {
  border: 0;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.9);
  cursor: pointer;
}

.modal-counter {
  grid-column: 1 / -1;
  justify-self: center;
  font-size: 12px;
  opacity: 0.75;
}

/* ---------- Error panel ---------- */
.error-wrap {
  width: min(900px, calc(100% - 32px));
  margin: 60px auto;
}
.error-card { padding: 18px; }
.error-card h2 { margin: 0 0 8px; font-size: 18px; }
.error-card pre {
  margin: 0;
  opacity: 0.85;
  white-space: pre-wrap;
  line-height: 1.35;
}

