:root {
  --bg-0: #050816;
  --bg-1: #08111f;
  --bg-2: #0d1729;

  --card: rgba(15, 23, 42, 0.74);
  --card-strong: rgba(15, 23, 42, 0.92);
  --card-soft: rgba(30, 41, 59, 0.58);

  --border: rgba(148, 163, 184, 0.22);
  --border-strong: rgba(125, 211, 252, 0.42);

  --text: #eef6ff;
  --text-soft: #c7d2fe;
  --muted: #94a3b8;

  --accent: #38bdf8;
  --accent-2: #818cf8;
  --accent-3: #22c55e;
  --danger: #fb7185;

  --shadow-lg: 0 28px 80px rgba(0, 0, 0, 0.42);
  --shadow-md: 0 18px 46px rgba(0, 0, 0, 0.28);

  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;

  --container: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter,
    Vazirmatn,
    "Segoe UI",
    Tahoma,
    Arial,
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 8%, rgba(56, 189, 248, 0.22), transparent 30%),
    radial-gradient(circle at 85% 15%, rgba(129, 140, 248, 0.20), transparent 34%),
    radial-gradient(circle at 50% 100%, rgba(34, 197, 94, 0.11), transparent 30%),
    linear-gradient(135deg, var(--bg-0), var(--bg-1) 45%, #020617);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

::selection {
  background: rgba(56, 189, 248, 0.35);
  color: #fff;
}

/* Background decoration */

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -3;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.055) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.75), transparent 90%);
  pointer-events: none;
}

.bg-orb {
  position: fixed;
  z-index: -2;
  width: 420px;
  height: 420px;
  border-radius: 999px;
  filter: blur(60px);
  opacity: 0.46;
  pointer-events: none;
}

.bg-orb-one {
  top: -120px;
  right: -120px;
  background: rgba(56, 189, 248, 0.38);
}

.bg-orb-two {
  left: -150px;
  bottom: 5%;
  background: rgba(129, 140, 248, 0.32);
}

/* Top bar */

.topbar {
  width: min(var(--container), calc(100% - 36px));
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(56, 189, 248, 0.28), rgba(129, 140, 248, 0.20));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  font-size: 24px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-text strong {
  font-size: 19px;
  letter-spacing: 0.2px;
}

.brand-text small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ghost-link,
.soft-button,
.primary-button {
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.56);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  backdrop-filter: blur(18px);
  transition:
    transform 0.22s ease,
    border-color 0.22s ease,
    background 0.22s ease,
    box-shadow 0.22s ease;
}

.ghost-link:hover,
.soft-button:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: rgba(30, 41, 59, 0.72);
}

.primary-button {
  border: 0;
  color: #03101f;
  font-weight: 800;
  background: linear-gradient(135deg, #67e8f9, #a5b4fc);
  box-shadow: 0 16px 38px rgba(56, 189, 248, 0.22);
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 48px rgba(56, 189, 248, 0.32);
}

/* Hero */

.site-hero {
  position: relative;
  padding-bottom: 26px;
}

.hero-content {
  width: min(var(--container), calc(100% - 36px));
  margin: 0 auto;
  padding: 52px 0 28px;
  text-align: center;
}

.hero-kicker {
  width: fit-content;
  margin: 0 auto 18px;
  color: #bae6fd;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
}

.hero-content h1 {
  margin: 0;
  font-size: clamp(44px, 8vw, 92px);
  line-height: 0.95;
  letter-spacing: -2.4px;
  background: linear-gradient(135deg, #fff, #bae6fd 42%, #c4b5fd 82%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-content p {
  width: min(760px, 100%);
  margin: 22px auto 0;
  color: var(--text-soft);
  line-height: 2;
  font-size: 16px;
}

/* Search */

.search-panel {
  width: min(760px, 100%);
  margin: 34px auto 0;
  position: relative;
}

.search-icon {
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 24px;
  pointer-events: none;
}

.search {
  width: 100%;
  height: 64px;
  border: 1px solid rgba(125, 211, 252, 0.26);
  outline: none;
  border-radius: 24px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(15, 23, 42, 0.62));
  padding: 0 58px 0 22px;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(22px);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.search::placeholder {
  color: rgba(203, 213, 225, 0.72);
}

.search:focus {
  border-color: rgba(56, 189, 248, 0.74);
  box-shadow:
    0 28px 90px rgba(56, 189, 248, 0.14),
    0 0 0 5px rgba(56, 189, 248, 0.10);
  transform: translateY(-1px);
}

/* Stats */

.stats-row {
  margin: 26px auto 0;
  width: min(620px, 100%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.stat-card {
  padding: 16px 14px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-md);
}

.stat-card span {
  display: block;
  font-size: 24px;
  font-weight: 900;
  color: #fff;
}

.stat-card small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

/* Main */

.main-wrap {
  width: min(var(--container), calc(100% - 36px));
  margin: 0 auto;
  padding: 30px 0 64px;
}

.section-head {
  margin: 10px 0 22px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
}

.section-head h2 {
  margin: 0;
  font-size: 24px;
}

.meta {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

/* Grid cards */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 18px;
}

.country-card {
  position: relative;
  min-height: 318px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.055), transparent 30%),
    rgba(15, 23, 42, 0.66);
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(22px);
  transform: translateZ(0);
  transition:
    transform 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    background 0.25s ease;
}

.country-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.18), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(129, 140, 248, 0.12), transparent 48%);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.country-card:hover {
  transform: translateY(-7px);
  border-color: rgba(125, 211, 252, 0.55);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(56, 189, 248, 0.05);
}

.country-card:hover::before {
  opacity: 1;
}

.flag-shell {
  position: relative;
  z-index: 1;
  height: 132px;
  margin: 14px 14px 0;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(135deg, rgba(2, 6, 23, 0.72), rgba(15, 23, 42, 0.90));
  border: 1px solid rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.flag-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.05) 45%, transparent 70%);
  pointer-events: none;
}

.flag-img {
  width: auto;
  height: auto;
  max-width: 86%;
  max-height: 84px;
  object-fit: contain;
  display: block;
  filter:
    drop-shadow(0 12px 18px rgba(0, 0, 0, 0.26));
  transition: transform 0.25s ease;
}

.country-card:hover .flag-img {
  transform: scale(1.045);
}

.card-body {
  position: relative;
  z-index: 1;
  padding: 16px 16px 18px;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-title-row h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.55;
  color: #fff;
}

.code-pill,
.entity-code {
  flex: 0 0 auto;
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
  text-align: center;
  color: #cffafe;
  background: rgba(14, 165, 233, 0.13);
  border: 1px solid rgba(125, 211, 252, 0.24);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 800;
}

.card-info {
  min-height: 24px;
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.card-info span {
  color: var(--muted);
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
}

.card-summary {
  margin: 12px 0 0;
  color: #b6c3d8;
  font-size: 13px;
  line-height: 1.75;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.profile-badge {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.profile-badge.ok {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.13);
  border: 1px solid rgba(74, 222, 128, 0.22);
}

.profile-badge.base {
  color: #ddd6fe;
  background: rgba(129, 140, 248, 0.13);
  border: 1px solid rgba(165, 180, 252, 0.20);
}

.open-arrow {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #03101f;
  background: linear-gradient(135deg, #67e8f9, #a5b4fc);
  font-weight: 900;
  transition: transform 0.25s ease;
}

.country-card:hover .open-arrow {
  transform: translateX(-4px);
}

/* Empty / loading / errors */

.empty-state,
.loading-card,
.error-card {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 46px 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px);
}

.empty-icon {
  font-size: 44px;
}

.empty-state h3,
.error-card h1 {
  margin: 12px 0 8px;
}

.empty-state p,
.error-card p,
.loading-card p {
  color: var(--muted);
  line-height: 1.8;
}

.loader {
  width: 46px;
  height: 46px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 4px solid rgba(148, 163, 184, 0.22);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Entity page */

.entity-header {
  padding-bottom: 10px;
}

.entity-main {
  width: min(var(--container), calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 76px;
}

.entity-card {
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  gap: 28px;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 36px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.055), transparent 28%),
    rgba(15, 23, 42, 0.70);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  backdrop-filter: blur(24px);
}

.entity-visual {
  min-height: 420px;
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 18%, rgba(56, 189, 248, 0.20), transparent 42%),
    rgba(2, 6, 23, 0.34);
  border-left: 1px solid var(--border);
}

.entity-flag-shell {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 32px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background:
    linear-gradient(135deg, rgba(2, 6, 23, 0.78), rgba(15, 23, 42, 0.94));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
  overflow: hidden;
}

.entity-flag {
  max-width: 86%;
  max-height: 72%;
  object-fit: contain;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.34));
}

.entity-content {
  padding: 42px 38px;
}

.entity-kicker {
  width: fit-content;
  color: #bae6fd;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 800;
}

.entity-title-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.entity-title-row h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.08;
  letter-spacing: -1px;
}

.entity-summary {
  margin: 20px 0 0;
  color: var(--text-soft);
  line-height: 2.05;
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.info-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.info-row {
  min-height: 72px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.48);
  border-radius: 20px;
  padding: 14px 16px;
}

.info-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.info-row strong {
  display: block;
  margin-top: 7px;
  color: #fff;
  font-size: 16px;
  line-height: 1.5;
}

.entity-actions {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Footer */

.site-footer {
  width: min(var(--container), calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0 38px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

/* Compatibility with older markup */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  padding: 14px;
}

.flag-box {
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(135deg, rgba(2, 6, 23, 0.72), rgba(15, 23, 42, 0.90));
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 24px;
  overflow: hidden;
}

.flag-box img,
.card img {
  max-width: 86%;
  max-height: 84px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* Responsive */

@media (max-width: 900px) {
  .entity-card {
    grid-template-columns: 1fr;
  }

  .entity-visual {
    min-height: 300px;
    border-left: 0;
    border-bottom: 1px solid var(--border);
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .hero-content {
    padding-top: 34px;
  }

  .hero-content h1 {
    letter-spacing: -1.2px;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .country-card {
    min-height: auto;
  }

  .site-footer {
    flex-direction: column;
  }

  .entity-content {
    padding: 30px 22px;
  }

  .entity-title-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
