:root {
  --navy: #0b2338;
  --navy-light: #153d5e;
  --gold: #f5c455;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1c2b36;
  --muted: #65798a;
  --border: #dfe6ec;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
#app[hidden] {
  display: none;
}

/* ---------- Splash / cover screen ---------- */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--navy);
  overflow: hidden;
}
.splash-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.splash-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.08) 50%, rgba(0,0,0,0) 100%);
}
.splash-enter-btn {
  background: var(--gold);
  color: var(--navy);
  border: none;
  font-size: 17px;
  font-weight: 700;
  padding: 16px 48px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  letter-spacing: 0.02em;
  animation: splash-pulse 2.2s ease-in-out infinite;
}
@keyframes splash-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 6px 20px rgba(0,0,0,0.35); }
  50% { transform: scale(1.045); box-shadow: 0 8px 26px rgba(0,0,0,0.45); }
}
.splash-screen.hide {
  animation: splash-fade-out 0.35s ease forwards;
  pointer-events: none;
}
@keyframes splash-fade-out {
  to { opacity: 0; }
}

/* ---------- Intro / about screen ---------- */
.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: #aac5d5;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.intro-screen[hidden] {
  display: none;
}
.intro-screen.hide {
  animation: splash-fade-out 0.3s ease forwards;
  pointer-events: none;
}
.intro-content {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(32px + var(--safe-top)) 20px calc(32px + var(--safe-bottom));
  text-align: center;
}
.intro-logo {
  width: 160px;
  max-width: 60%;
  height: auto;
  margin-bottom: 20px;
}
.intro-lead {
  font-size: 15px;
  line-height: 1.55;
  color: var(--navy);
  margin: 0 0 24px;
}
.intro-heading {
  font-size: 19px;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 6px;
}
.intro-sub {
  font-size: 13.5px;
  color: var(--navy-light);
  margin: 0 0 20px;
  line-height: 1.4;
}
.intro-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.intro-card {
  background: rgba(255,255,255,0.85);
  border-radius: 14px;
  padding: 16px;
  text-align: left;
  box-shadow: 0 2px 10px rgba(11,35,56,0.1);
}
.intro-card h3 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 6px;
}
.intro-card p {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  margin: 0 0 12px;
}
.intro-btn {
  display: block;
  width: 100%;
  background: var(--gold);
  color: var(--navy);
  border: none;
  font-size: 14px;
  font-weight: 700;
  padding: 11px 16px;
  border-radius: 10px;
  cursor: pointer;
}
.intro-btn:active {
  filter: brightness(0.95);
}

.appbar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--navy);
  color: white;
  padding: calc(10px + var(--safe-top)) 12px 10px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.appbar h1 {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.iconbtn {
  background: transparent;
  border: none;
  color: white;
  font-size: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.iconbtn:active { background: rgba(255,255,255,0.15); }
.iconbtn.fav-active { color: var(--gold); }

.searchbar {
  position: sticky;
  top: calc(56px + var(--safe-top));
  z-index: 19;
  background: var(--navy);
  padding: 0 12px 10px;
}
#searchInput {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  background: rgba(255,255,255,0.92);
}
.chiprow {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-top: 8px;
  scrollbar-width: none;
}
.chiprow::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.3);
  background: transparent;
  color: white;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.chip.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--navy);
  font-weight: 600;
}

main#viewRoot {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px calc(16px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 18px 4px 8px;
}
.section-title:first-child { margin-top: 4px; }

.list-card {
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 10px;
}
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
}
.list-row + .list-row { border-top: 1px solid var(--border); }
.list-row:active { background: #f0f3f6; }
.list-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.list-row-title { font-size: 15px; font-weight: 600; }
.list-row-sub { font-size: 13px; color: var(--muted); }
.list-row-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex: none;
  background: #eef2f6;
}
.list-row-badge {
  font-size: 11px;
  background: var(--navy-light);
  color: white;
  padding: 3px 8px;
  border-radius: 999px;
  flex: none;
}
.chevron { color: var(--muted); flex: none; font-size: 18px; }

.op-card {
  background: var(--card);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
}
.op-card.premium {
  border: 1.5px solid var(--gold);
  box-shadow: 0 2px 10px rgba(245,196,85,0.25);
}
.op-image-wrap {
  margin: -16px -16px 12px;
  border-radius: 14px 14px 0 0;
  overflow: hidden;
  background: #eef2f6;
  max-height: 150px;
}
.op-image {
  width: 100%;
  max-height: 150px;
  object-fit: cover;
  display: block;
}
.premium-tag {
  position: absolute;
  top: -9px;
  right: 14px;
  background: var(--gold);
  color: var(--navy);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.op-name { font-size: 17px; font-weight: 700; margin: 0 0 2px; }
.op-location { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.op-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag {
  font-size: 11.5px;
  background: #eef2f6;
  color: var(--navy-light);
  padding: 4px 9px;
  border-radius: 999px;
  font-weight: 600;
}
.tag.usa { background: #fde9e9; color: #b33a3a; }
.op-aircraft { font-size: 13.5px; color: var(--text); margin-bottom: 14px; line-height: 1.4; }
.op-aircraft b { color: var(--muted); font-weight: 600; }
.op-description {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.5;
  margin: 0 0 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.op-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  flex: 1;
  min-width: 120px;
  text-align: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-call { background: var(--navy); color: white; }
.btn-web { background: var(--gold); color: var(--navy); }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }
.btn-fav {
  width: 44px; min-width: 44px; flex: none;
  background: #eef2f6; color: var(--navy-light); font-size: 18px;
}
.btn-fav.active { background: #fff6e0; color: var(--gold); }

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
}
.empty-state .big-emoji { font-size: 40px; display: block; margin-bottom: 10px; }

.tabbar {
  display: flex;
  background: white;
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px 10px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.tab.active { color: var(--navy); font-weight: 700; }
.tabicon { font-size: 19px; }

.sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: white;
  display: flex;
  flex-direction: column;
}
.sheet[hidden] {
  display: none;
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + var(--safe-top)) 14px 12px;
  background: var(--navy);
  color: white;
  font-weight: 600;
}
.sheet #browserFrame {
  flex: 1;
  border: none;
  width: 100%;
}
.sheet-footer {
  padding: 10px 14px calc(10px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  text-align: center;
}
.sheet-footer a { color: var(--navy-light); font-size: 14px; text-decoration: none; font-weight: 600; }

.install-banner {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(70px + var(--safe-bottom));
  background: var(--navy);
  color: white;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.btn-small {
  background: var(--gold);
  color: var(--navy);
  border: none;
  padding: 7px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(80px + var(--safe-bottom));
  transform: translateX(-50%);
  background: rgba(20,20,20,0.9);
  color: white;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 200;
}

.index-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.index-jump button {
  background: #eef2f6;
  border: none;
  color: var(--navy-light);
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
}
