/* Layout: harta ocupă stânga, panoul cu destinații dreapta (dedesubt pe telefon); cardurile apar deasupra. */
:root {
  --sky: #eaf5fc;
  --sea: #a7d8f0;
  --navy: #1d3557;
  --navy-2: #2b4a75;
  --red: #e63946;
  --red-dark: #b62a35;
  --cream: #fff8e8;
  --ink: #17243a;
  --muted: #5d6b80;
  --line: #d5e3ee;
  --green: #2a9d8f;
  --gold: #f2a900;
  --card: #ffffff;
  --font: 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--sky); color: var(--ink); font-family: var(--font); }
body { overflow: hidden; -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; color: inherit; cursor: pointer; border: none; background: none; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

.btn {
  font-weight: 800;
  font-size: 19px;
  border-radius: 999px;
  padding: 8px 20px;
  transition: transform 0.12s;
}
.btn:active { transform: translateY(2px); }
.btn.primary { background: var(--red); color: #fff; box-shadow: 0 4px 0 var(--red-dark); }
.btn.ghost { background: #fff; color: var(--navy); box-shadow: inset 0 0 0 2px var(--line), 0 3px 0 var(--line); }
.btn.small { font-size: 15px; padding: 2px 12px; background: var(--sky); color: var(--navy); }
.icon {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  background: #fff;
  font-size: 21px;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 0 var(--line), inset 0 0 0 1px var(--line);
}
.eyebrow { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--red); }

/* ---------- aplicația ---------- */
.app { height: 100%; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;
  background: var(--navy);
  color: #fff;
}
.brand { font-size: 20px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.brand b { color: #ffd166; }
.chips { display: flex; gap: 6px; }
.chip { background: var(--navy-2); border-radius: 999px; padding: 2px 12px; font-weight: 700; font-size: 16px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.main { flex: 1; min-height: 0; display: flex; }
.map-wrap { position: relative; flex: 1; min-width: 0; background: var(--sea); overflow: hidden; }
#map { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#map .country { stroke: #fff; stroke-width: 0.7px; vector-effect: non-scaling-stroke; }
#map .graticule { fill: none; stroke: #fff; stroke-opacity: 0.35; stroke-width: 0.5px; vector-effect: non-scaling-stroke; }
#map .route { fill: none; stroke: var(--red); stroke-width: 3px; stroke-dasharray: 8 7; vector-effect: non-scaling-stroke; }
#map .city { cursor: pointer; }
#map .city .dot { fill: var(--navy); stroke: #fff; vector-effect: non-scaling-stroke; stroke-width: 2px; }
#map .city.capital .dot { fill: var(--gold); stroke: var(--navy); stroke-width: 1.5px; }
#map .city.visited .dot { fill: var(--green); }
#map .city.selected .dot { fill: var(--red); }
#map .city .ring { fill: none; stroke: var(--red); stroke-width: 3px; vector-effect: non-scaling-stroke; opacity: 0; }
#map .city.selected .ring { opacity: 1; animation: ring 1.2s ease-out infinite; }
@keyframes ring { from { stroke-opacity: 1; } to { stroke-opacity: 0; } }
#map .city text {
  font-family: var(--font);
  font-weight: 700;
  fill: var(--ink);
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4px;
  stroke-linejoin: round;
  pointer-events: none;
}
#map .city.current text { fill: var(--red); }
#map .plane path { fill: var(--red); stroke: #fff; stroke-width: 1.5px; }

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--navy);
  color: #fff;
  border-radius: 12px;
  padding: 6px 12px;
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 14px));
}
.tooltip small { color: #bcd0ea; }
.map-controls { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 8px; }
.map-fly { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); font-size: 21px; white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; }
.map-fly:active { transform: translate(-50%, 2px); }

/* ---------- panoul ---------- */
.panel {
  width: 380px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-left: 1px solid var(--line);
  min-height: 0;
}
.here { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--cream); }
.here-flag { font-size: 40px; width: 56px; height: 40px; display: grid; place-items: center; flex: none; }
.here-flag img, .city-flag img, .row-flag img { width: 100%; height: 100%; object-fit: contain; }
.here > div:nth-child(2) { flex: 1; min-width: 0; }
.label { font-size: 13px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.here-name { font-size: 26px; font-weight: 800; line-height: 1.05; color: var(--navy); }
.here-country { font-size: 15px; color: var(--muted); }
#choose { display: flex; flex-direction: column; min-height: 0; flex: 1; padding: 12px 16px 0; }
#choose h2 { margin: 0 0 8px; font-size: 22px; line-height: 1.15; text-wrap: balance; color: var(--navy); }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 2px 12px;
  font-size: 20px;
}
.search:focus-within { border-color: var(--navy); }
.search input { flex: 1; min-width: 0; border: none; outline: none; font: inherit; font-size: 20px; padding: 6px 0; background: transparent; color: var(--ink); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.filters.regions { margin: 6px 0 8px; }
.filters.regions .filter { background: #fff3e0; color: #8a4b00; }
.filters.regions .filter.on { background: #e07b00; color: #fff; }
.filter { font-size: 15px; font-weight: 700; padding: 2px 12px; border-radius: 999px; background: var(--sky); color: var(--navy); }
.filter.on { background: var(--navy); color: #fff; }
.list { list-style: none; margin: 0 -16px; padding: 0 8px 16px; overflow-y: auto; flex: 1; min-height: 0; }
.row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 12px;
  cursor: pointer;
}
.row:hover, .row.hover { background: var(--sky); }
.row.selected { background: #ffe9eb; box-shadow: inset 0 0 0 2px var(--red); }
.row-flag { width: 40px; height: 28px; font-size: 28px; display: grid; place-items: center; }
.row-name { font-size: 19px; font-weight: 700; line-height: 1.1; }
.row-name .star { color: var(--gold); }
.row-name .seen { color: var(--green); font-size: 15px; }
.row-sub { font-size: 14px; color: var(--muted); }
.row-km { font-size: 14px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .btn { grid-column: 1 / -1; margin-top: 4px; }
.empty { color: var(--muted); padding: 12px 8px; font-size: 17px; }

/* ---------- biletul de îmbarcare ---------- */
.boarding { padding: 16px; }
.ticket { background: var(--cream); border: 2px dashed #e6c98f; border-radius: 18px; padding: 14px 16px; }
.ticket-top { font-size: 13px; font-weight: 800; letter-spacing: 2px; color: var(--red); }
.ticket-route { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0; }
.ticket-route small { display: block; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
.ticket-route b { font-size: 24px; line-height: 1.05; color: var(--navy); }
.ticket-route > div:last-child { text-align: right; }
.ticket-plane { font-size: 30px; animation: fly 1s ease-in-out infinite alternate; }
@keyframes fly { from { transform: translateY(-3px); } to { transform: translateY(3px); } }
.ticket-info { font-size: 17px; color: var(--ink); }
.progress { height: 10px; background: #f0e2c2; border-radius: 999px; margin-top: 10px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--red); border-radius: 999px; }

/* ---------- carduri ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(23, 36, 58, 0.5);
  overflow-y: auto;
}
.card {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border-radius: 24px;
  padding: 22px 22px 20px;
  box-shadow: 0 18px 50px rgba(23, 36, 58, 0.35);
  animation: pop 0.35s ease-out;
}
@keyframes pop { from { transform: translateY(20px) scale(0.95); opacity: 0; } to { transform: none; opacity: 1; } }
.city { text-align: center; }
.city-emoji { font-size: 64px; line-height: 1; }
.city h2 { margin: 2px 0 4px; font-size: 38px; line-height: 1.05; color: var(--navy); text-wrap: balance; }
.city-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; font-size: 18px; color: var(--muted); }
.city-flag { width: 36px; height: 26px; font-size: 26px; display: grid; place-items: center; }
.tag { background: #fff3cc; color: #8a6100; border-radius: 999px; padding: 0 10px; font-weight: 700; font-size: 15px; }
.airport-note { background: var(--sky); border-radius: 12px; padding: 6px 12px; font-size: 16px; margin: 10px 0 0; }
.hello { margin: 12px 0 6px; font-size: 19px; }
.hello b { font-size: 26px; color: var(--red); }
.facts { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; text-align: left; }
.facts li { background: var(--cream); border-radius: 12px; padding: 8px 12px 8px 40px; font-size: 18px; line-height: 1.3; position: relative; }
.facts li::before { content: '💡'; position: absolute; left: 10px; top: 8px; }
.food { font-size: 17px; color: var(--muted); margin: 6px 0 14px; }
.card-buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.stamp {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 92px;
  height: 92px;
  border: 4px solid var(--red);
  border-radius: 50%;
  color: var(--red);
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 800;
  font-size: 12px;
  line-height: 1.1;
  transform: rotate(-14deg);
  opacity: 0.85;
  animation: stampin 0.5s 0.4s ease-out both;
}
@keyframes stampin { from { transform: rotate(-14deg) scale(2.2); opacity: 0; } to { transform: rotate(-14deg) scale(1); opacity: 0.85; } }

/* ---------- pașaport ---------- */
.passport { max-width: 640px; background: var(--cream); }
.close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; font-size: 20px; border-radius: 50%; background: #fff; }
.passport-head { display: flex; align-items: center; gap: 14px; background: var(--navy); color: #fff; border-radius: 16px; padding: 12px 16px; margin-right: 44px; }
.passport-head h2 { margin: 0; font-size: 28px; color: #ffd166; }
.passport-head .eyebrow { color: #bcd0ea; }
.passport-emblem { font-size: 44px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.stat { background: #fff; border-radius: 14px; padding: 8px; text-align: center; }
.stat b { display: block; font-size: 28px; color: var(--navy); font-variant-numeric: tabular-nums; }
.stat span { font-size: 14px; color: var(--muted); }
.passport h3 { margin: 12px 0 8px; color: var(--navy); font-size: 20px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.badge { background: #fff; border-radius: 14px; padding: 8px; text-align: center; font-size: 14px; line-height: 1.2; color: var(--muted); }
.badge .b-icon { font-size: 30px; display: block; filter: grayscale(1); opacity: 0.4; }
.badge.got { color: var(--ink); box-shadow: inset 0 0 0 2px var(--gold); }
.badge.got .b-icon { filter: none; opacity: 1; }
.badge b { display: block; font-size: 15px; }
.stamps { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.pstamp {
  aspect-ratio: 1;
  max-width: 100%;
  border: 3px solid var(--c, var(--red));
  color: var(--c, var(--red));
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 800;
  font-size: 13px;
  line-height: 1.1;
  padding: 6px;
  background: #fff;
}
.pstamp span { font-size: 26px; display: block; }

/* ---------- start ---------- */
.start { background: linear-gradient(160deg, rgba(29, 53, 87, 0.85), rgba(167, 216, 240, 0.7)); }
.start-card { max-width: 560px; text-align: center; color: #fff; }
.start-plane { font-size: 80px; animation: takeoff 3s ease-in-out infinite; display: inline-block; }
@keyframes takeoff { 0%, 100% { transform: translate(-10px, 6px) rotate(-6deg); } 50% { transform: translate(10px, -6px) rotate(4deg); } }
.start .eyebrow { color: #ffd166; }
.start h1 { margin: 4px 0 8px; font-size: clamp(36px, 8vw, 60px); line-height: 1; text-wrap: balance; }
.start h1 span { color: #ffd166; }
.lead { font-size: 20px; line-height: 1.35; margin: 0 auto 18px; max-width: 46ch; }
.start-buttons { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.start-buttons .btn { font-size: 22px; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }

@media (max-width: 820px) {
  .main { flex-direction: column; }
  .map-wrap { flex: none; height: 44vh; }
  .panel { width: auto; flex: 1; border-left: none; border-top: 1px solid var(--line); }
  .brand { font-size: 16px; white-space: normal; line-height: 1.1; }
  .brand > span { display: none; }
  .brand b { display: block; line-height: 1; }
  .chip { font-size: 14px; padding: 2px 8px; }
  .here { padding: 8px 16px; }
  .here-name { font-size: 22px; }
  .stamp { width: 74px; height: 74px; font-size: 10px; }
  .city h2 { font-size: 32px; }
}
@media (max-width: 440px) {
  #chip-km { display: none; }
  .brand { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .start-plane, .ticket-plane, #map .city.selected .ring { animation: none; }
}
