/* The MapShell frame (SPEC §5), the panel and the sign-in card, ported from design/up/ride-on.css and
   design/up/proto.css. Tokens come from /tokens.css. */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font-sans); color: var(--label); background: var(--map-land); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }

.shell, .map { position: fixed; inset: 0; }

.panel {
  position: absolute; top: var(--panel-inset); left: var(--panel-inset); bottom: var(--panel-inset);
  width: var(--panel-width); border-radius: var(--radius-panel); overflow: hidden;
  display: flex; flex-direction: column;
}
.day-strip { position: absolute; bottom: var(--day-strip-offset); left: calc(var(--panel-width) + var(--panel-inset) + (100% - var(--panel-width) - var(--panel-inset)) / 2); translate: -50% 0; border-radius: var(--radius-capsule); }
.controls { position: absolute; top: var(--panel-inset); right: var(--panel-inset); display: flex; gap: 8px; }
@media (max-width: 767px) {
  .panel { inset: auto 0 0; width: auto; height: var(--panel-medium-detent); border-radius: var(--radius-panel) var(--radius-panel) 0 0; }
  .day-strip { left: 50%; bottom: calc(var(--panel-medium-detent) + 8px); }
  .controls { top: max(var(--panel-inset), env(safe-area-inset-top)); }
}

/* Lucide icons, inline: 1em square in the text colour. */
.icon { display: inline-flex; width: 1em; height: 1em; flex: none; }
.icon svg { width: 100%; height: 100%; }
.f1 { flex: 1; }
.minw0 { min-width: 0; }

.control {
  min-height: var(--target-min); padding: 0 16px; border: 0; border-radius: var(--radius-capsule);
  font: 500 var(--text-subheadline) / 1 var(--font-sans); color: var(--label); cursor: pointer;
}

/* The panel: a header that stays, and a list that scrolls and fades out at the foot. */
.panel-h { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px; flex: none; }
.panel-s {
  flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; padding: 4px 14px 28px;
  display: flex; flex-direction: column; gap: 22px;
  -webkit-mask-image: linear-gradient(#000 calc(100% - 64px), transparent); mask-image: linear-gradient(#000 calc(100% - 64px), transparent);
}
.panel-s::-webkit-scrollbar { display: none; }
.hint { margin: 0; padding: 0 6px; font-size: var(--text-subheadline); color: var(--label-secondary); }

.search { flex: 1; height: 44px; border-radius: 999px; background: var(--fill-tertiary); display: flex; align-items: center; gap: 8px; padding: 0 16px; color: var(--label-secondary); font-size: var(--text-body); }
.search .icon { font-size: 18px; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font: inherit; color: var(--label); padding: 0; }
.search input::placeholder { color: var(--label-secondary); }
.search input::-webkit-search-cancel-button { display: none; }
.search:focus-within { box-shadow: 0 0 0 2px var(--accent); }

/* Solid content: cards and grouped lists. */
.card { background: var(--surface); border-radius: var(--radius-card); padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.card.hover { box-shadow: inset 0 0 0 999px var(--fill-tertiary); }
.list { background: var(--surface); border-radius: var(--radius-card); overflow: hidden; }
.row { position: relative; display: flex; gap: 12px; padding: 12px 16px; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 64px; right: 0; border-top: 0.5px solid var(--separator); }
.row.hover { background: var(--fill-tertiary); }

.section-h { display: flex; align-items: baseline; justify-content: space-between; padding: 0 6px 8px; }
.section-h h3 { margin: 0; font-size: var(--text-title3); font-weight: 700; }
.section-h span { font-size: var(--text-footnote); color: var(--label-secondary); }

.name { font-size: var(--text-headline); font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { font-size: var(--text-footnote); line-height: 1.4; color: var(--label-secondary); }
.warn { color: var(--status-below-minimums); display: flex; align-items: center; gap: 5px; }
.nl { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.delta { flex: none; font-size: var(--text-footnote); color: var(--label-secondary); font-variant-numeric: tabular-nums; }

/* Score: the number in the label colour, the route's colour only on its line. */
.score { width: 36px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 2px; }
.score b { font-size: var(--text-title3); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.score > .icon { font-size: 18px; height: 20px; color: var(--label-secondary); }
.bar { display: block; width: 24px; height: 4px; border-radius: 999px; }
/* A route's line, as thin as it is on the map and in its colour: it ties the row to the line. */
.bar.rline { height: 3px; }
.thumb { width: 36px; height: 36px; flex: none; border-radius: var(--radius-thumbnail); background: var(--fill-tertiary); display: grid; place-items: center; font-size: 18px; color: var(--label-secondary); }

/* Best pick card */
.pill { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 11px; border-radius: 999px; font-size: var(--text-footnote); font-weight: 600; background: color-mix(in srgb, var(--accent) 88%, #000); color: var(--on-accent); }
.hero { display: flex; gap: 12px; }
.hero h2 { margin: 0 0 4px; font-size: var(--text-title3); font-weight: 700; line-height: 1.25; }
.hero .dep { font-size: var(--text-body); font-variant-numeric: tabular-nums; }
.hero .facts { font-size: var(--text-subheadline); color: var(--label-secondary); margin-top: 2px; }
.hero-score { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.hero-score b { font-size: var(--text-large-title); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-score .bar { width: 36px; }
.hero-score span { font-size: var(--text-footnote); color: var(--label-secondary); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 999px; background: var(--fill-tertiary); font-size: var(--text-footnote); font-variant-numeric: tabular-nums; }
.chip .icon { font-size: 14px; color: var(--label-secondary); }
.verdict { display: flex; align-items: center; gap: 6px; font-size: var(--text-subheadline); }
.verdict .icon { color: var(--accent); font-size: 17px; }
.verdict.close .icon { color: var(--band-fair); }
.verdict.low .icon { color: var(--band-not-recommended); }

/* Library rows: Add shows on hover, and always on touch. */
.add { margin-left: auto; align-self: center; flex: none; display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 6px 4px; font-size: var(--text-subheadline); font-weight: 600; color: var(--accent); cursor: pointer; }
.row.lib .add { visibility: hidden; }
.row.lib:hover .add, .row.lib:focus-within .add { visibility: visible; }
@media (hover: none) { .row.lib .add { visibility: visible; } }

.footer { text-align: center; font-size: var(--text-caption2); line-height: 1.5; color: var(--label-secondary); padding: 0 12px; }
.footer a { color: inherit; }

.btn { height: 44px; border: 0; border-radius: 999px; padding: 0 20px; font: inherit; font-size: var(--text-body); font-weight: 600; background: var(--fill-tertiary); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.btn.tint { background: color-mix(in srgb, var(--accent) 88%, #000); color: var(--on-accent); }
.btn:focus-visible, .control:focus-visible, .add:focus-visible, .pop-r:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Over the map: the forecast pill and the undo toast sit centred on the map's visible part. */
.checkpill, .toast { position: absolute; left: calc(var(--panel-width) + var(--panel-inset) + (100% - var(--panel-width) - var(--panel-inset)) / 2); bottom: 116px; translate: -50% 0; z-index: 2; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; font-size: var(--text-subheadline); font-weight: 500; white-space: nowrap; animation: fade-up 0.25s ease-out; }
.toast { gap: 14px; padding-right: 6px; }
.toast .btn { height: 30px; padding: 0 12px; font-size: var(--text-subheadline); }
@keyframes fade-up { from { opacity: 0; translate: -50% 8px; } }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }

/* The full-shortlist sheet: beside the panel on desktop, a bottom sheet on phones. */
.pop { position: absolute; left: calc(var(--panel-width) + var(--panel-inset) * 2); top: 72px; z-index: 3; width: 344px; max-height: calc(100% - 96px); border-radius: 28px; padding: 18px 8px 10px; display: flex; flex-direction: column; gap: 10px; }
.pop-h { padding: 0 12px; }
.pop-h h3 { margin: 0 0 4px; font-size: var(--text-headline); font-weight: 700; }
.pop-l { min-height: 0; overflow-y: auto; }
.pop-r { position: relative; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-radius: 14px; font-size: var(--text-subheadline); cursor: pointer; }
.pop-r.on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.pop-r .name { flex: 1; font-size: var(--text-subheadline); font-weight: 500; }
.pop-r b { font-variant-numeric: tabular-nums; font-weight: 600; }
.pop-r .bar { width: 14px; }
.radio { width: 20px; height: 20px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--label-tertiary); display: grid; place-items: center; color: #fff; font-size: 13px; }
.radio.on { background: var(--accent); box-shadow: none; }
.pop-a { display: flex; gap: 8px; padding: 4px 4px 0; }
.pop-a .btn { flex: 1; }

@media (max-width: 767px) {
  .checkpill, .toast { left: 50%; top: 112px; bottom: auto; }
  .pop { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: calc(100% - 64px); animation: sheet-up 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
}
@keyframes sheet-up { from { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
  .checkpill, .toast, .pop { animation: none; }
  .spin { animation-duration: 3s; }
}

/* Sign-in: a glass card where the panel will be, over the still cycle map. */
.sign-in {
  position: absolute; top: var(--panel-inset); left: var(--panel-inset); width: var(--panel-width);
  padding: 28px 24px 24px; border-radius: var(--radius-panel); display: flex; flex-direction: column;
}
.app-icon { width: 64px; height: 64px; margin-bottom: 18px; }
.sign-in h1 { margin: 0; font-size: var(--text-large-title); font-weight: 700; line-height: 1.1; }
.sign-in p { margin: 8px 0 24px; font-size: var(--text-body); line-height: 1.4; color: var(--label-secondary); }
.sign-in [role="alert"] { margin: 16px 0 0; font-size: var(--text-subheadline); color: var(--status-below-minimums); }
@media (max-width: 767px) {
  .sign-in {
    inset: auto 0 0; width: auto; border-radius: var(--radius-panel) var(--radius-panel) 0 0;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
}

/* The providers' buttons, in their own colours: Apple black (white in Dark Mode), Google white with
   its outline (its dark fill in Dark Mode). The logos sit at the left, so both titles centre. */
.sso {
  position: relative; height: 50px; border: 1px solid transparent; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font: 600 var(--text-body) / 1 var(--font-sans); cursor: pointer;
}
.sso + .sso { margin-top: 12px; }
.sso svg { position: absolute; left: 20px; width: 20px; height: 20px; }
.sso.apple { background: #000; color: #fff; }
.sso.google { background: #fff; color: #1f1f1f; border-color: #747775; }
.sso:hover { box-shadow: inset 0 0 0 999px color-mix(in srgb, currentColor 8%, transparent); }
.sso:active { box-shadow: inset 0 0 0 999px color-mix(in srgb, currentColor 14%, transparent); }
.sso:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-color-scheme: dark) {
  .sso.apple { background: #fff; color: #000; }
  .sso.google { background: #131314; color: #e3e3e3; border-color: #8e918f; }
}
