:root {
  --brand:      #0033a0;   /* 4Life royal blue */
  --brand-dark: #00246b;
  --brand-100:  #eaf0fb;
  --brand-200:  #d4e0f6;
  --accent:     #e4002b;   /* 4Life red (used sparingly) */
  --geo:        #12a150;   /* location / go */

  --bg:      #eef1f6;
  --card:    #ffffff;
  --text:    #16203a;
  --muted:   #6b7690;
  --line:    #e6e9f0;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --r: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

/* Center as a phone-width column so the browser demo reads as an app */
.phone {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 0, 0, .06);
}

/* ---- App bar ---- */
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-top) + 14px) 16px 14px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
}
.brand { display: flex; flex-direction: column; line-height: 1.1; }
.logo { font-size: 22px; font-weight: 800; letter-spacing: .3px; }
.brand-sub { font-size: 12px; opacity: .82; margin-top: 2px; }
.badge {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: rgba(255, 255, 255, .18); color: #fff;
}

/* ---- Tabs ---- */
.tabs {
  position: sticky; top: 0; z-index: 15;
  display: flex; gap: 4px; padding: 8px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.tab {
  flex: 1; border: none; background: transparent; cursor: pointer;
  padding: 8px 4px; border-radius: 10px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: background .15s, color .15s;
}
.tab .ti { font-size: 18px; }
.tab.active { background: var(--brand-100); color: var(--brand); }

/* ---- Panels ---- */
#app { flex: 1; padding: 14px 14px calc(var(--safe-bottom) + 20px); }
.panel { display: none; }
.panel.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---- Hero (geo) ---- */
.hero {
  background: var(--card); border-radius: var(--r); padding: 22px 18px;
  text-align: center; border: 1px solid var(--line); margin-bottom: 14px;
}
.hero-emoji { font-size: 34px; }
.hero h1 { font-size: 20px; margin: 6px 0 8px; }
.muted { color: var(--muted); font-size: 14px; }

/* ---- Inputs / buttons ---- */
.search-row { margin-bottom: 12px; }
.input {
  width: 100%; padding: 13px 14px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
  color: var(--text); outline: none;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 13px 16px; margin-top: 14px;
  border: none; border-radius: 12px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-geo { background: var(--geo); color: #fff; }
.btn-ghost { background: var(--brand-100); color: var(--brand); }
.btn-sm { width: auto; padding: 9px 14px; margin: 0; font-size: 13px; }

.geo-status { font-size: 13px; margin-top: 12px; min-height: 18px; }
.geo-status .ok { color: var(--geo); }
.geo-status .err { color: var(--accent); }
.geo-coords { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- Result meta line ---- */
.result-meta { font-size: 13px; color: var(--muted); margin: 2px 2px 10px; }

/* ---- Center card ---- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px; margin-bottom: 10px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.card:active { border-color: var(--brand-200); box-shadow: 0 2px 10px rgba(0, 51, 160, .08); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card-city { font-size: 16px; font-weight: 700; }
.card-dist {
  flex: none; font-size: 12.5px; font-weight: 700; color: var(--geo);
  background: rgba(18, 161, 80, .1); padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.card-tag {
  display: inline-block; font-size: 11px; color: var(--brand);
  background: var(--brand-100); padding: 2px 8px; border-radius: 999px; margin-top: 4px;
}
.card-row { display: flex; gap: 7px; font-size: 13.5px; color: var(--text); margin-top: 8px; }
.card-row .ic { flex: none; width: 16px; text-align: center; opacity: .7; }
.card-row.muted, .card-row.muted * { color: var(--muted); }

/* ---- Rows (city / district lists) ---- */
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin-bottom: 8px; cursor: pointer; font-size: 15px; font-weight: 600;
}
.row:active { border-color: var(--brand-200); }
.row .count { font-size: 13px; font-weight: 600; color: var(--muted); }
.row .chev { color: var(--brand); font-weight: 700; }

/* ---- Country chips ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 8px 13px; border-radius: 999px; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Metro filter — single scrollable row (Moscow has many stations) */
.metro-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.metro-chips::-webkit-scrollbar { display: none; }
.metro-chips .chip { flex: none; white-space: nowrap; }

/* ---- Breadcrumbs ---- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; font-size: 13.5px; }
.crumb { color: var(--brand); font-weight: 600; cursor: pointer; }
.crumb.static { color: var(--muted); cursor: default; }
.crumb-sep { color: var(--muted); }

/* ---- Empty state ---- */
.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }

/* ---- Footer ---- */
.foot { text-align: center; font-size: 11px; color: var(--muted); padding: 10px 0 calc(var(--safe-bottom) + 14px); }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 18, 40, .5); }
.modal-card {
  position: relative; width: 100%; max-width: 480px; background: var(--card);
  border-radius: 18px 18px 0 0; padding: 20px 18px calc(var(--safe-bottom) + 20px);
  max-height: 88vh; overflow-y: auto; animation: slideup .22s ease;
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.m-city { font-size: 21px; font-weight: 800; }
.m-tag { display: inline-block; font-size: 12px; color: var(--brand); background: var(--brand-100); padding: 3px 9px; border-radius: 999px; margin: 6px 0 14px; }
.m-line { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.m-line .ic { flex: none; width: 20px; text-align: center; }
.m-line .k { color: var(--muted); font-size: 12px; }
.m-line a { color: var(--brand); text-decoration: none; }
.m-actions { display: flex; gap: 8px; margin-top: 16px; }
.m-actions .btn { margin-top: 0; }
.m-close { position: absolute; top: 12px; right: 14px; font-size: 24px; color: var(--muted); cursor: pointer; line-height: 1; border: none; background: none; }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 24px); transform: translateX(-50%);
  background: #16203a; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13.5px; z-index: 80;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
.toast.hidden { display: none; }
