:root {
  --ink: #102033;
  --muted: #5c6b7a;
  --line: #d5dee8;
  --blue: #1d4f91;
  --green: #0f7a4a;
  --bg: #e7eef6;
  --paper: #ffffff;
  --danger: #9f2d2d;
}

* { box-sizing: border-box; }

html, body, #app {
  height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  font: 16px/1.4 "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

#splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  background: linear-gradient(#134646, #1d2d2c);
  transition: opacity 1s ease;
}

#splash img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#splash.hiding {
  opacity: 0;
  pointer-events: none;
}

header {
  position: relative;
  z-index: 6;
  background: var(--ink);
  color: #f4f7fb;
  padding: 12px 14px 10px;
}

.title-row, .title-actions, .toggles, .sheet-bar, .row-actions, .form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-row { justify-content: space-between; }

h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 650;
}

#visited-count {
  margin: 4px 0 0;
  color: #c5d2e0;
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

#airport-total {
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
}

button, input {
  font: inherit;
}

.title-actions button, .toggles button, .sheet-bar button, .text-button {
  background: transparent;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 6px 12px;
}

.title-actions button[aria-pressed="true"] {
  background: #f4f7fb;
  color: var(--ink);
  border-color: #f4f7fb;
}

.menu-wrap { position: relative; }

#menu-btn {
  width: 40px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
}

.hamburger {
  width: 16px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}

.app-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 8;
  min-width: 168px;
  padding: 6px;
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(16, 32, 51, 0.18);
}

.app-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
}

.app-menu button:hover { background: #eef3f8; }

.about-brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.about-brand img {
  width: 112px;
  height: auto;
}

.about-brand p {
  margin: 0;
  font-weight: 650;
}

.pin-key {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

.pin-key li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.how-to h3, .policy h3, .copyright h3 {
  margin: 14px 0 4px;
  font-size: 1rem;
}

.how-to h3:first-child, .policy h3:first-child, .copyright h3:first-child { margin-top: 2px; }

.how-to p, .how-to li, .policy p, .copyright p { margin: 0 0 8px; }

.how-to ul { margin: 0 0 8px; padding-left: 18px; }

.how-to dt { font-weight: 650; }

.how-to dd { margin: 0 0 8px; }

.swatch {
  width: 14px;
  height: 14px;
  flex: none;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(16, 32, 51, 0.2);
}

.toggles button.active {
  background: #f4f7fb;
  color: var(--ink);
  border-color: #f4f7fb;
}

.search-wrap { position: relative; margin-top: 10px; z-index: 4; }

.toggles { margin-top: 10px; }

#search, .field input {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

#results, .suggestions {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  list-style: none;
  margin: 6px 0 0;
  padding: 4px;
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  max-height: 240px;
  overflow: auto;
  box-shadow: 0 10px 24px rgba(16, 32, 51, 0.16);
}

#results button, .suggestions button, .visit-list button.plain, .linkish {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 8px;
  color: var(--ink);
}

#results button:hover, .suggestions button:hover, .visit-list button.plain:hover {
  background: #eef3f8;
}

.country-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 8px 4px;
  color: var(--ink);
}

.country-flag {
  width: 28px;
  height: 21px;
  object-fit: fill;
  border-radius: 0;
  border: 0;
  flex: none;
}

.country-heading.band-white { background: #ffffff; }
.country-heading.band-grey { background: #eceff3; }

#panel[data-view="visited"] #panel-title { font-weight: 700; }

.visit-list button.plain { padding-left: 24px; }

.visit-list button.plain.band-white { background: #ffffff; }
.visit-list button.plain.band-grey { background: #eceff3; }
.visit-list button.plain.band-grey:hover { background: #e0e6ed; }

#results small, .suggestions small, .meta {
  display: block;
  color: var(--muted);
}

main {
  position: relative;
  flex: 1;
  min-height: 0;
}

#map { position: absolute; inset: 0; }

#map-note {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 12px;
  margin: 0;
  padding: 10px 12px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(16, 32, 51, 0.12);
}

#sheet, #panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(64%, calc(100% - 280px));
  overflow: auto;
  background: var(--paper);
  color: var(--ink);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 24px rgba(16, 32, 51, 0.18);
  padding: 4px 14px 10px;
  z-index: 5;
}

.sheet-bar {
  position: sticky;
  top: 0;
  justify-content: space-between;
  background: var(--paper);
  padding: 4px 0;
  z-index: 1;
}

.sheet-bar button, .text-button, .danger {
  color: var(--blue);
  border-color: var(--line);
  background: #fff;
}

h2 { margin: 0 0 2px; font-size: 1.05rem; }

.place { margin: 0 0 2px; color: var(--muted); }
.visit-count { margin: 0 0 2px; font-weight: 650; }
.closed { margin: 0 0 2px; color: #dc2626; font-weight: 600; }
#sheet .meta { margin: 0 0 6px; font-size: 0.85rem; }

.primary, .danger {
  border-radius: 10px;
  padding: 8px 12px;
  border: 0;
}

.primary, .file-button { font: inherit; text-align: center; }
.primary { background: var(--blue); color: #fff; }
.file-button { display: inline-block; cursor: pointer; }
.danger { background: #fff; color: var(--danger); border: 1px solid #e7c7c7; }

.field { margin: 10px 0; }
.field span { display: block; margin-bottom: 4px; font-size: 0.85rem; color: var(--muted); }

#visit-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  align-items: end;
}
#visit-editor .field { margin: 0; }
#visit-editor .field span { margin-bottom: 2px; font-size: 0.75rem; }
#visit-editor .field input { padding: 7px 8px; }
#visit-editor .wide { grid-column: 1 / -1; }
#visit-editor .suggest { position: relative; }
#visit-editor .form-actions { grid-column: 1 / -1; margin-top: 2px; }
#visit-editor .message { grid-column: 1 / -1; min-height: 0; margin: 0; }
#visit-editor .message:empty { display: none; }
.form-actions:has(> button[hidden]) { display: none; }

.visit {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.visit strong { display: block; }
.row-actions { margin-top: 6px; }
.row-actions button { padding: 4px 10px; }

.form-actions { margin-top: 8px; }
.message { color: var(--danger); min-height: 0; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.maplibregl-ctrl-top-right { top: 8px; }
