:root {
  --navy: #1a4a8a;
  --navy-deep: #153a6e;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, system-ui, sans-serif;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overflow-x: hidden;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
.sheet::-webkit-scrollbar,
.country-list::-webkit-scrollbar,
.detail-layer::-webkit-scrollbar,
.letter-row::-webkit-scrollbar,
.field-row::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

@media (max-width: 1024px), (pointer: coarse) {
  * {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  *::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
}

body.no-scroll {
  overflow: hidden !important;
  touch-action: none;
}

button,
input {
  font-family: inherit;
}

.app-shell {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: #f7f8fb;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
  overflow-x: hidden;
}

@media (min-width: 900px) {
  .app-shell {
    max-width: 1100px;
    border-radius: 0;
  }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  padding: calc(10px + env(safe-area-inset-top)) 12px 12px;
}

.header-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.fav-nav-btn {
  position: relative;
}

.fav-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #f59e0b;
  color: #111827;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 2px;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transform: translateY(-2.5px);
}

.brand-mark svg {
  width: 30px;
  height: 30px;
}

.brand-name {
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  margin-left: 1px;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 999px;
  padding: 0 12px;
  min-height: 38px;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.search-wrap input {
  flex: 1 1 auto;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 0.82rem;
  color: #111827;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.search-wrap input::placeholder {
  color: #9aa3b2;
}

.search-icon {
  width: 16px;
  height: 16px;
  color: #8b95a7;
  flex-shrink: 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #fff;
  display: grid;
  place-items: center;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

.icon-btn.is-on {
  background: rgba(255, 255, 255, 0.16);
}

.clear-btn {
  border: 0;
  background: #e5e7eb;
  color: #4b5563;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.app-main {
  padding: 0 12px 40px;
}

.tab-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-bottom: 1px solid #e6e8ee;
  margin: 4px 0 10px;
}

.tab {
  background: transparent;
  border: 0;
  padding: 14px 8px 12px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #9aa3b2;
  cursor: pointer;
}

.tab.is-active {
  color: var(--navy);
  box-shadow: inset 0 -3px 0 var(--navy);
}

.letter-row,
.field-row,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.letter-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: #eceff4;
  color: #4b5563;
  font-weight: 700;
  font-size: 0.85rem;
}

@media (max-width: 480px) {
  .letter-row {
    gap: 6px;
  }

  .letter-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 0.72rem;
  }
}

.letter-btn.is-active {
  background: var(--navy);
  color: #fff;
}

.field-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #dfe3ea;
  background: #fff;
  color: #334155;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

.field-chip.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.results-head {
  padding: 16px 4px 8px;
}

.eyebrow {
  margin: 0;
  color: var(--navy);
  font-weight: 700;
  font-size: 1.05rem;
}

.results-head h1 {
  margin: 8px 0 4px;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.count {
  margin: 0 0 12px;
  color: #6b7280;
  font-size: 0.9rem;
}

.did-you-mean {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: #6b7280;
  margin-bottom: 10px;
}

.suggest-chip {
  border: 1px solid #d5dbe6;
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.75rem;
  color: #334155;
}

.status-row {
  padding: 28px 8px;
  text-align: center;
  color: #64748b;
}

.feed-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (min-width: 900px) {
  .feed-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.uni-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  border: 1px solid #eef1f6;
  text-align: left;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

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

.card-photo {
  position: relative;
  height: 118px;
  background: #dbe3ef center/cover no-repeat;
}

.card-fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 5;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.card-fav-btn:hover {
  transform: scale(1.12);
  background: rgba(15, 23, 42, 0.85);
}

.card-fav-btn.is-fav {
  background: #fff;
  color: #f59e0b;
}

.card-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: grid;
  gap: 4px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  width: fit-content;
}

.flag {
  width: 14px;
  height: 10px;
  object-fit: cover;
  border-radius: 1px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.card-body {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 148px;
}

.meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #6b7280;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.meta-line .dot {
  opacity: 0.45;
}

.card-title {
  margin: 2px 0 0;
  font-size: 0.92rem;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.card-excerpt {
  margin: 0;
  color: #6b7280;
  font-size: 0.72rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.read-full {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
  padding-top: 6px;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet {
  width: min(480px, 100%);
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 10px 16px 24px;
  max-height: 78dvh;
  overflow: auto;
}

.sheet-handle {
  width: 42px;
  height: 4px;
  background: #d1d5db;
  border-radius: 999px;
  margin: 6px auto 12px;
}

.sheet h2 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.sheet-search {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.country-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border: 0;
  background: transparent;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}

.country-item.is-active {
  color: var(--navy);
  font-weight: 700;
}

.detail-layer {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: #f7f8fb;
  overflow: auto;
}

.detail-hero {
  position: relative;
  height: 240px;
  background: #1a4a8a center/cover no-repeat;
}

.detail-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.55));
}

.detail-nav {
  position: absolute;
  z-index: 2;
  top: calc(10px + env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-back,
.detail-fav {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.detail-back:hover,
.detail-fav:hover {
  transform: scale(1.08);
}

.detail-fav.is-fav {
  background: #fff;
  color: #f59e0b;
}

.detail-hero-text {
  position: absolute;
  z-index: 2;
  left: 16px;
  right: 16px;
  bottom: 16px;
  color: #fff;
}

.detail-hero-text h1 {
  margin: 6px 0 0;
  font-size: 1.45rem;
  line-height: 1.2;
}

.detail-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 16px 48px;
}

.detail-body h2 {
  font-size: 1.18rem;
  font-weight: 800;
  color: #0f172a;
  margin: 22px 0 10px;
  letter-spacing: -0.02em;
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 18px;
}

.fact {
  background: #fff;
  border: 1px solid #eef1f6;
  border-radius: 12px;
  padding: 10px 12px;
}

.fact b {
  display: block;
  font-size: 0.68rem;
  color: #6b7280;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 18px;
}

.tag {
  background: #e8eef8;
  color: var(--navy);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

.actions {
  display: grid;
  gap: 10px;
}

.action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
}

.action.primary {
  background: var(--navy);
  color: #fff;
}

.action.ghost {
  background: #fff;
  color: var(--navy);
  border: 1px solid #d7deea;
}

.hidden {
  display: none !important;
}

.skeleton .card-photo,
.skeleton .line {
  background: linear-gradient(90deg, #e8edf5 25%, #f6f8fb 37%, #e8edf5 63%);
  background-size: 400% 100%;
  animation: shine 1.2s ease-in-out infinite;
}

.skeleton .line {
  height: 10px;
  border-radius: 6px;
  margin: 8px 10px;
}

@keyframes shine {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

.map-link {
  color: var(--navy);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.map-link:hover {
  text-decoration: underline;
}

.map-arrow {
  font-size: 0.75rem;
  opacity: 0.7;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 24px 0 12px;
}

.load-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  color: var(--navy);
  border: 1.5px solid #d0d7e5;
  border-radius: 999px;
  padding: 10px 24px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  transition: all 0.15s ease;
}

.load-more-btn:hover {
  background: #f0f4fa;
  border-color: var(--navy);
  transform: translateY(-1px);
}

.load-more-btn:active {
  transform: translateY(0);
}

.load-more-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(26, 74, 138, 0.2);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.dev-badge-banner {
  position: fixed;
  bottom: calc(8px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.65rem;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  max-width: 92vw;
  text-align: center;
}
