/* Screen: depart — Departure: lanes, speeds and the forecast.
   Tablet first: map + lanes on the left, speeds + forecast on the right; one column on phones. */

.screen--depart {
  gap: var(--sp-4);
}

.screen--depart.is-rerender,
.screen--depart .mate.is-still {
  animation: none;
}

/* ── Head ──────────────────────────────────────────────── */
.depart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-3) var(--sp-5);
}

.depart-head__text {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
}

.depart-head__route {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-2);
  font-weight: 800;
  color: var(--ink-soft);
}

.depart-head__arrow {
  color: var(--ink-faint);
}

.depart-head .mate {
  max-width: 480px;
  align-items: center;
}

/* Pip side by side with the button, so the head stays short (like the load screen). */
.depart-head .mate__bubble {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
}

.depart-head .mate__name {
  flex-basis: 100%;
}

.depart-head .mate__text {
  flex: 1 1 200px;
}

.depart-section-title {
  font-size: var(--fs-md);
  margin-bottom: var(--sp-3);
}

/* ── Layout ────────────────────────────────────────────── */
.depart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-4);
  align-items: start;
}

.depart-main,
.depart-side {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
}

/* ── Map ───────────────────────────────────────────────── */
.depart-map .map {
  width: 100%;
}

.depart-map .map-route-alt {
  stroke-width: 7;
  opacity: 0.6;
  transition: opacity var(--dur-2) var(--ease), stroke-width var(--dur-2) var(--ease);
}

.depart-map .map-route-alt.is-hot {
  stroke-width: 10;
  opacity: 1;
}

/* ── Lanes ─────────────────────────────────────────────── */
.depart-lanes {
  padding: var(--sp-4);
}

.depart-leg + .depart-leg {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 2px dashed var(--line);
}

.depart-leg__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 900;
  margin-bottom: var(--sp-2) !important;
}

.depart-leg__options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: var(--sp-2);
}

.depart-leg__only {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0 var(--sp-2);
  margin: 0 !important;
  color: var(--ink-soft);
}

.depart-leg__only-facts {
  grid-column: 2;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.depart-leg__only-label {
  font-weight: 800;
  color: var(--ink);
}

.lane-card {
  --leg-color: var(--stop-1);
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-1);
  min-height: 64px;
  padding: var(--sp-3);
  border: 3px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.lane-card:hover {
  border-color: var(--line-strong);
}

.lane-card:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--line);
}

.lane-card.is-selected {
  border-color: var(--leg-color);
  background: color-mix(in srgb, var(--leg-color) 7%, #ffffff);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--leg-color) 55%, #ffffff);
}

.lane-card__top {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding-right: 28px;
}

.lane-card__swatch {
  flex: none;
}

.lane-card__label {
  font-weight: 900;
  font-size: var(--fs-base);
  line-height: 1.2;
}

.lane-card__check {
  position: absolute;
  top: var(--sp-2);
  right: var(--sp-2);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--leg-color);
  color: #ffffff;
  font-weight: 900;
  font-size: var(--fs-sm);
}

.lane-card__default {
  flex: none;
  align-self: flex-start;
  padding: 1px 0.55em;
  border-radius: var(--r-pill);
  background: var(--gain-bg);
  color: var(--gain);
  font-size: var(--fs-xs);
  font-weight: 900;
  white-space: nowrap;
}

.lane-card__facts,
.lane-card__risks {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-soft);
}

.lane-fact,
.lane-risk {
  white-space: nowrap;
  min-width: 0;
}

.lane-fact--toll {
  color: var(--accent-700);
}

.lane-risk {
  color: var(--ink);
}

.lane-risk--pirate {
  flex: 1 1 100%;
  white-space: normal; /* the lane's own words ("faster and cheaper, but riskier") wrap inside the card */
  padding: 2px 0.5em;
  border-radius: var(--r-sm);
  background: var(--accent-100);
  color: var(--accent-700);
}

/* ── Speeds ────────────────────────────────────────────── */
.depart-speeds__row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-3);
}

.speed-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 150px;
  padding: var(--sp-3) var(--sp-2);
  border: 3px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  text-align: center;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--line);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), background-color var(--dur-2) var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.speed-card:hover {
  border-color: var(--sea-300);
}

.speed-card:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--line);
}

.speed-card.is-selected {
  border-color: var(--accent-500);
  background: var(--accent-100);
  box-shadow: 0 4px 0 var(--accent-600);
}

.speed-card__check {
  position: absolute;
  top: -12px;
  right: -8px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-500);
  border: 3px solid #ffffff;
  color: var(--ink);
  font-weight: 900;
  box-shadow: var(--shadow-1);
}

.speed-card__name {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: 900;
  font-size: var(--fs-md);
  line-height: 1.1;
}

.speed-card__emoji {
  font-size: 2rem;
  line-height: 1.1;
}

.speed-card__days {
  font-weight: 900;
  font-size: var(--fs-lg);
  color: var(--sea-700);
  line-height: 1.2;
}

.speed-card__kept {
  font-weight: 900;
  color: var(--gain);
  font-variant-numeric: tabular-nums;
}

.speed-card.is-loss .speed-card__kept {
  color: var(--loss);
}

.speed-card__perday,
.speed-card__fuel {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.speed-card__notes {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: var(--sp-1);
}

.speed-card__note {
  padding: 1px 0.5em;
  border-radius: var(--r-sm);
  background: var(--loss-bg);
  color: var(--ink-soft);
  font-size: var(--fs-xs);
  font-weight: 800;
  line-height: 1.3;
}

.speed-card.is-off {
  cursor: default;
  border-style: dashed;
  background: var(--loss-bg);
  box-shadow: none;
  opacity: 0.85;
}

.speed-card.is-off:active {
  transform: none;
}

.speed-card__why {
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
}

.speed-card__note.is-good {
  background: var(--gain-bg);
  color: var(--gain);
}

/* ── Forecast ──────────────────────────────────────────── */
.depart-forecast {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  background: #fffef9;
  border: 3px solid var(--gain-bg);
}

.depart-forecast.is-loss {
  border-color: var(--loss-bg);
}

.depart-forecast__headline {
  font-size: var(--fs-xl);
  font-weight: 900;
  line-height: 1.2;
  color: var(--gain);
}

.depart-forecast.is-loss .depart-forecast__headline {
  color: var(--ink);
}

.depart-forecast__days {
  margin: 0 !important;
  font-weight: 800;
  color: var(--ink-soft);
}

.depart-forecast__about {
  font-weight: 700;
}

/* Cash will run out at sea: a calm note (slate, never red). */
.depart-forecast__short {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  margin: 0 !important;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  background: var(--loss-bg);
  border: 2px solid var(--line);
  font-weight: 700;
  color: var(--ink);
}

.depart-forecast__short-icon {
  flex: none;
  font-size: 1.3em;
  line-height: 1.2;
}

.bill {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-3) var(--sp-4);
  margin-top: var(--sp-1);
  font-variant-numeric: tabular-nums;
}

.bill__group-title {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-1) !important;
  padding-bottom: 2px;
  border-bottom: 2px solid var(--line);
  font-weight: 900;
  font-size: var(--fs-sm);
}

.bill__group.is-in .bill__group-total {
  color: var(--gain);
}

.bill__group.is-out .bill__group-total {
  color: var(--loss);
}

.bill__lines {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bill__line {
  display: flex;
  align-items: baseline;
  gap: var(--sp-1);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.bill__label {
  display: flex;
  align-items: baseline;
  gap: 0.35em;
  min-width: 0;
}

.bill__emoji {
  flex: none;
}

.bill__dots {
  flex: 1 1 8px;
  min-width: 8px;
  border-bottom: 2px dotted var(--line-strong);
  transform: translateY(-4px);
}

.bill__amount {
  flex: none;
  font-weight: 900;
}

.bill__line.is-in .bill__amount {
  color: var(--gain);
}

.bill__line.is-out .bill__amount {
  color: var(--loss);
}

/* ── Risk panel: danger lines, guards, cover; Why? holds the rest ── */
.depart-risk {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
}

.depart-risk__lines {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.depart-risk__line {
  font-weight: 900;
  font-size: var(--fs-md);
  line-height: 1.3;
}

.depart-why__group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.depart-why__title {
  margin: 0 !important;
  font-weight: 900;
  font-size: var(--fs-sm);
  color: var(--ink-soft);
}

.depart-why__chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

.depart-why__chip {
  padding: 2px 0.6em;
  border-radius: var(--r-pill);
  background: var(--accent-100);
  color: var(--accent-700);
  font-size: var(--fs-sm);
  font-weight: 900;
}

.depart-why__chip.is-down {
  background: var(--gain-bg);
  color: var(--gain);
}

.depart-why__note {
  margin: 0 !important;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-soft);
  line-height: 1.35;
}

/* A deposit trip's one line above the forecast. */
.depart-cash-now {
  margin: 0 !important;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  border: 2px solid var(--sand-200);
  background: var(--sand-50);
  font-weight: 800;
  line-height: 1.35;
}

.depart-cash-now.is-refused {
  border-color: var(--line-strong);
  background: var(--loss-bg);
  color: var(--ink-soft);
}

/* Bill day comes on this trip: a note in the forecast's footer. */
.depart-forecast__bills {
  margin: var(--sp-3) 0 0 !important;
  padding-top: var(--sp-2);
  border-top: 1px dashed var(--line-strong);
  font-size: var(--fs-sm);
  font-weight: 800;
  color: var(--ink-soft);
}

.depart-cards__title {
  font-weight: 900;
  margin-bottom: var(--sp-2) !important;
}

.depart-cards__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
  gap: var(--sp-2);
}

.depart-cards__item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-md);
  background: var(--sea-50);
  font-weight: 800;
  font-size: var(--fs-sm);
}

.depart-cards__emoji {
  font-size: 1.3rem;
}

.depart-cards__name {
  flex: 1 1 auto;
  min-width: 0;
}

.depart-cards__odds {
  flex: none;
  font-weight: 900;
  color: var(--sea-700);
  white-space: nowrap;
}

.depart-cards__small {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-2);
  margin-top: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-soft);
}

.depart-cards__small-label {
  margin: 0 !important;
}

.depart-cards__small-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.depart-cards__small-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  padding: 0.1em 0.6em 0.1em 0.35em;
  border-radius: var(--r-pill);
  background: var(--sea-50);
  border: 1px solid var(--line);
  color: var(--ink);
  white-space: nowrap;
}

.depart-cards__small-emoji {
  font-size: 1.1rem;
  line-height: 1;
}

/* ── Footer: always in reach ───────────────────────────── */
.depart-foot {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: 'back why go';
  align-items: center;
  gap: var(--sp-3);
  margin: 0 calc(-1 * var(--sp-3));
  padding: var(--sp-3);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: rgba(253, 248, 238, 0.94);
  box-shadow: 0 -6px 18px rgba(13, 48, 71, 0.08);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.depart-back {
  grid-area: back;
}

.depart-foot__why {
  grid-area: why;
  margin: 0 !important;
  font-weight: 800;
  color: var(--ink-soft);
}

.depart-go {
  grid-area: go;
  min-width: 220px;
  font-size: var(--fs-lg);
}

/* ── Portrait tablets: map and lanes side by side, then speeds and the forecast ── */
@media (max-width: 60em) {
  .depart-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .depart-main {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: start;
  }

  .depart-lanes .depart-leg__options {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── Phones ────────────────────────────────────────────── */
@media (max-width: 40em) {
  .depart-main {
    display: flex;
    align-items: stretch;
  }
}

/* Small phones: the choices first (speed, then lanes), the forecast, then the map. */
@media (max-width: 37.5em) {
  .depart-layout {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .depart-main,
  .depart-side {
    display: contents;
  }

  .depart-speeds {
    order: 1;
  }

  .depart-lanes {
    order: 2;
  }

  .depart-forecast {
    order: 3;
  }

  .depart-risk {
    order: 4;
  }

  .depart-map {
    order: 5;
  }
}

@media (max-width: 40em) {

  .depart-head .mate {
    max-width: none;
  }

  .depart-speeds__row {
    gap: var(--sp-2);
  }

  .speed-card {
    min-height: 0;
    padding: var(--sp-3) 4px var(--sp-2);
    border-radius: var(--r-md);
  }

  .speed-card__emoji {
    font-size: 1.6rem;
  }

  .speed-card__name {
    font-size: var(--fs-base);
  }

  .speed-card__days {
    font-size: var(--fs-md);
  }

  .speed-card__kept {
    font-size: var(--fs-sm);
  }

  .speed-card__perday,
  .speed-card__fuel {
    font-size: var(--fs-xs);
  }

  .depart-forecast {
    padding: var(--sp-4);
  }

  .depart-forecast__headline {
    font-size: var(--fs-lg);
  }

  .bill {
    grid-template-columns: minmax(0, 1fr);
  }

  .speed-card__fuel-word {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .depart-foot {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    grid-template-areas:
      'why why'
      'back go';
    margin: 0 calc(-1 * var(--gutter));
    padding: var(--sp-3) var(--gutter);
    border-radius: var(--r-md) var(--r-md) 0 0;
  }

  .depart-foot__why:empty {
    display: none;
  }

  .depart-back__more {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .depart-back {
    padding-left: 0.6em;
    padding-right: 0.6em;
    font-size: var(--fs-sm);
  }

  .depart-go {
    min-width: 0;
    padding-left: 0.8em;
    padding-right: 0.8em;
    font-size: var(--fs-md);
    flex-wrap: wrap; /* big text: the ⚓ goes under "Cast off!" instead of off the screen */
  }

  .depart-fix {
    padding-left: 0.5em;
    padding-right: 0.5em;
    font-size: var(--fs-base);
    white-space: normal;
    line-height: 1.15;
  }
}

/* Small phones: a deposit trip's line sits just above the forecast (lane UI-V). */
@media (max-width: 37.5em) {
  .depart-cash-now,
  .depart-trip-loan {
    order: 3;
  }
}

/* ═══ UI-V2: the crossing and her own boxes (SPEC-2 §3.6–§3.10, §5.7, §8.6 lane V) ═══════════════════ */

/* The ocean chart in place of the region map: the same frame as the map. */
.depart-map .chart-frame--depart {
  border-radius: var(--r-lg);
  overflow: hidden;
}

.depart-map .chart-frame--depart .chart {
  display: block;
  width: 100%;
  height: auto;
}

/* The lanes' day pills stay off the departure: the speed cards print this trip's days (SPEC-2 §8.6: a
   crossing's departure gains one number, the home money a day). The storm-season chip stays, and each
   lane still says its days in its aria words. */
.depart-map .chart--depart .chart-lane-days .chart-grow > rect,
.depart-map .chart--depart .chart-lane-days .chart-grow > text {
  display: none;
}

/* ⛽ on a crossing: the tanks reach (green) or not (slate, never red). */
.speed-card__range.is-short {
  background: var(--loss-bg);
  color: var(--ink-soft);
}

/* With her own boxes: the sure part replaces "Keep" (green), "🧾 Trip costs $X" in calm slate. */
.speed-card__sure.is-cost {
  color: var(--ink-soft);
}

/* The landing day's calendar marks replace money a day: icons in a row (the words are aria). */
.speed-card__land {
  display: inline-flex;
  justify-content: center;
  gap: 4px;
  min-height: 1.5em;
  font-size: var(--fs-md);
  line-height: 1.3;
}

.speed-card__mark {
  display: inline-grid;
  place-items: center;
  min-width: 1.6em;
  padding: 0 0.2em;
  border-radius: var(--r-pill);
  background: var(--accent-100);
}

/* The three lines that add up: sure part + boxes' guess = what she keeps (the headline, in big type). */
.depart-own {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.depart-own__line {
  margin: 0 !important;
  font-weight: 800;
  font-size: var(--fs-md);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.depart-own__sure {
  color: var(--gain);
}

.depart-own__sure.is-cost,
.depart-own__boxes.is-less {
  color: var(--ink-soft);
}

.depart-own__total {
  margin: var(--sp-1) 0 0 !important;
  padding-top: var(--sp-1);
  border-top: 2px solid var(--line);
}

.depart-own__lots {
  list-style: none;
  margin: var(--sp-1) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

.depart-own__lot {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* A crossing compares with her days at home: one calm line. */
.depart-forecast__home {
  margin: 0 !important;
  font-weight: 800;
  color: var(--sea-700);
}

/* "🌀 Storm season on The Wide Ocean.": a word chip above the storm line. */
.depart-risk__season {
  align-self: flex-start;
  padding: 2px 0.6em;
  border-radius: var(--r-pill);
  background: #e8eef3;
  color: var(--ink);
  font-size: var(--fs-sm);
}

@media (max-width: 40em) {
  .speed-card__land {
    font-size: var(--fs-base);
  }

  .depart-own__line {
    font-size: var(--fs-base);
  }
}
/* ═══ end UI-V2 ═══ */

/* ── C4: navy convoys (the lane's 🔱 chip: a convoy today, or the wait where it pays) ── */
.lane-risk--convoy {
  flex: 1 1 100%;
  white-space: normal; /* its two short sentences wrap inside the card */
  padding: 2px 0.5em;
  border-radius: var(--r-sm);
  background: var(--sea-100);
  color: var(--sea-800);
}
