:root {
  color-scheme: light;
  --bg: #ece0c8;
  --paper: #fff7e8;
  --paper-2: #f5e7cf;
  --sand: #dfcda9;
  --ink: #1f1b16;
  --charcoal: #2c2721;
  --soft: #514738;
  --muted: #7d705e;
  --line: rgba(31, 27, 22, 0.14);
  --line-strong: rgba(31, 27, 22, 0.28);
  --olive: #68764a;
  --moss: #87935f;
  --lime: #d7ff5f;
  --water: #2f91a8;
  --cyan: #00a6d6;
  --orange: #f08a24;
  --coral: #f25f4c;
  --pink: #ffc7d4;
  --cream: #fffaf0;
  --shadow: 3px 3px 0 rgba(31, 27, 22, 0.62);
  --radius-xl: 32px;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
}

body {
  background: var(--bg);
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
summary:focus-visible,
[data-date]:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.app {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 430px;
  height: 100svh;
  min-height: 100svh;
  margin: 0 auto;
  overflow: hidden;
  padding:
    calc(8px + env(safe-area-inset-top))
    10px
    calc(8px + env(safe-area-inset-bottom));
}

@supports (height: 100dvh) {
  .app {
    height: 100dvh;
    min-height: 100dvh;
  }
}

.trip-header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 12px;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, var(--paper) 0%, #f9edd5 54%, #f1d9ad 100%);
  box-shadow: 5px 5px 0 var(--ink);
}

.eyebrow {
  margin: 0;
  color: var(--olive);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.trip-header h1 {
  margin: 1px 0 0;
  font-size: clamp(1.08rem, 5.2vw, 1.48rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
}

.trip-dates {
  margin: 4px 0 0;
  color: var(--soft);
  font-size: 0.88rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.header-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.icon-button,
.text-button,
.mini-action {
  min-height: 44px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--lime);
  color: var(--ink);
  cursor: pointer;
  font-weight: 950;
  box-shadow: 2px 2px 0 var(--ink);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  padding: 0;
  font-size: 1.08rem;
}

.text-button {
  padding: 0 15px;
  font-size: 0.78rem;
}

.summary-pills {
  grid-column: 1 / -1;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
}

.summary-pills::-webkit-scrollbar,
.day-cards::-webkit-scrollbar,
.route-legend::-webkit-scrollbar,
.itinerary-list::-webkit-scrollbar,
.weather-meta::-webkit-scrollbar,
.wide-panel::-webkit-scrollbar,
.wide-location-list::-webkit-scrollbar {
  display: none;
}

.summary-pills span,
.status-pill {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--soft);
  font-size: 0.7rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 859px) {
  .summary-pills span:nth-child(n + 4) {
    display: none;
  }
}

.weather-card,
.day-swipe-card,
.day-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 247, 232, 0.9);
  box-shadow: 0 8px 22px rgba(64, 46, 24, 0.08);
}

.compact-weather {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  margin-top: 9px;
  padding: 10px 13px;
  border-color: rgba(31, 27, 22, 0.18);
  background:
    linear-gradient(135deg, #fff9ee 0%, #ffe9b8 100%);
}

.weather-date,
.day-date {
  color: var(--olive);
  font-size: 0.69rem;
  font-weight: 950;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.weather-location {
  overflow: hidden;
  margin: 2px 0 0;
  font-size: 1.02rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weather-temp {
  padding: 4px 0 0;
  font-size: 1.24rem;
  font-weight: 950;
  letter-spacing: -0.035em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.weather-desc {
  grid-column: 1 / -1;
  margin-bottom: 0;
  color: var(--soft);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.22;
}

.weather-meta {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.weather-meta span {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.map-tab {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-top: 0;
  gap: 8px;
}

.map-toolbar {
  display: none;
}

.route-legend {
  display: flex;
  flex: 1;
  gap: 10px;
  overflow-x: auto;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  scrollbar-width: none;
}

.route-legend span {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.rmk-popover {
  position: absolute;
  z-index: 720;
  top: 246px;
  right: 62px;
  display: grid;
  gap: 6px;
  min-width: 138px;
  padding: 8px;
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  background: rgba(255, 250, 240, 0.96);
  box-shadow: 0 8px 18px rgba(31, 27, 22, 0.12);
}

.rmk-toggle {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(255, 250, 240, 0.58);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 950;
  text-align: left;
}

.rmk-toggle.active {
  border-color: var(--ink);
  background: var(--lime);
  color: var(--ink);
}

.legend-line {
  width: 24px;
  height: 0;
  border-top: 4px solid var(--ink);
  border-radius: 999px;
}

.legend-line.ferry {
  border-top-color: var(--cyan);
  border-top-style: dashed;
}

.legend-line.approximate {
  border-top-color: var(--moss);
  opacity: 0.55;
}

.offline-status.hidden,
.hidden {
  display: none !important;
}

.offline-status {
  position: absolute;
  z-index: 710;
  right: 10px;
  bottom: 10px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(31, 27, 22, 0.84);
  color: var(--cream);
  font-size: 0.7rem;
  font-weight: 900;
}

.map-shell {
  flex: 1 1 auto;
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border: 2.5px solid var(--ink);
  border-radius: 34px;
  background: var(--sand);
  box-shadow: var(--shadow);
}

#map {
  width: 100%;
  height: 100%;
}

#map,
.leaflet-container,
.leaflet-map-pane,
.leaflet-tile-pane,
.leaflet-pane {
  filter: none;
  opacity: 1;
}

.journey-context,
.stop-panel {
  position: absolute;
  z-index: 650;
  border: 1.5px solid var(--ink);
  border-radius: 16px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 2px 2px 0 rgba(31, 27, 22, 0.44);
}

.journey-context {
  top: 10px;
  left: 10px;
  max-width: min(258px, calc(100% - 66px));
  padding: 8px 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.journey-context strong {
  display: block;
  font-size: 0.78rem;
  line-height: 1.05;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stop-panel strong {
  display: block;
  margin-top: 2px;
  font-size: 0.98rem;
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.journey-context span {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--soft);
  font-size: 0.9rem;
  font-weight: 950;
  line-height: 1.08;
  text-overflow: ellipsis;
}

.context-weather {
  display: grid;
  gap: 2px;
  max-width: 128px;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: right;
}

.context-weather strong,
.context-weather span {
  display: block;
  overflow: hidden;
  font-size: 0.72rem;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-weather strong {
  letter-spacing: 0;
  text-transform: none;
  font-variant-numeric: tabular-nums;
}

.context-weather span {
  color: var(--muted);
  font-weight: 850;
}

.weather-chip {
  position: absolute;
  z-index: 655;
  right: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 20px);
  min-height: 40px;
  padding: 6px 8px 6px 10px;
  border: 1px solid rgba(31, 27, 22, 0.18);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.88);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
}

.weather-chip span {
  overflow: hidden;
  max-width: 110px;
  color: var(--soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weather-chip img {
  width: 26px;
  height: 26px;
}

.weather-chip strong {
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.weather-chip em {
  color: var(--muted);
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.weather-chip button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
  font-weight: 950;
}

.journey-context p,
.stop-panel p {
  margin: 4px 0 0;
  color: var(--soft);
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1.18;
}

.context-kicker {
  color: var(--orange);
  font-size: 0.64rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.context-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.context-stats span {
  padding: 5px 7px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-size: 0.66rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.next-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line-strong);
  font-size: 0.72rem;
  font-weight: 850;
}

.next-strip b {
  color: var(--coral);
  font-variant-numeric: tabular-nums;
}

.stop-panel {
  z-index: 760;
  right: 10px;
  bottom: 10px;
  left: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border-width: 2px;
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.stop-panel__body {
  min-width: 0;
}

.stop-panel__close {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 950;
  box-shadow: 2px 2px 0 rgba(31, 27, 22, 0.38);
}

.stop-panel .stop-actions {
  grid-column: 1 / -1;
}

.mini-action {
  min-width: 54px;
  padding: 0 12px;
  background: var(--pink);
  font-size: 0.76rem;
}

.stop-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.nav-actions {
  display: flex;
  gap: 8px;
}

.nav-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  min-width: 92px;
  padding: 0 12px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 950;
  text-decoration: none;
  box-shadow: 2px 2px 0 rgba(31, 27, 22, 0.36);
}

.nav-action img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: saturate(0.85);
}

.marker-popup {
  display: grid;
  gap: 7px;
  min-width: 190px;
}

.marker-popup strong {
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.1;
}

.marker-popup span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.marker-popup p,
.marker-popup em {
  margin: 0;
  color: var(--soft);
  font-size: 0.74rem;
  font-style: normal;
  font-weight: 800;
  line-height: 1.22;
}

.marker-popup em {
  color: var(--orange);
}

.business-details {
  font-size: 0.72rem;
}

.business-details summary {
  cursor: pointer;
  font-weight: 950;
}

.business-details div,
.business-details p {
  margin: 5px 0 0;
}

.leaflet-popup-content {
  margin: 12px;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  box-shadow: 2px 2px 0 rgba(31, 27, 22, 0.36);
}

.leaflet-popup-content .nav-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.leaflet-popup-content .nav-action {
  min-width: 0;
  min-height: 48px;
  padding-inline: 10px;
  color: var(--ink);
}

.leaflet-control-attribution {
  z-index: 500 !important;
}

.map-control-stack {
  position: absolute;
  z-index: 740;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.map-control-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--ink);
  border-radius: 16px;
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 950;
  line-height: 1;
  box-shadow: 2px 2px 0 rgba(31, 27, 22, 0.4);
}

.rmk-menu-button {
  font-size: 0.66rem;
}

.map-control-button.active,
.map-control-button.busy,
.map-control-button:active {
  background: var(--lime);
  transform: translate(1px, 1px);
  box-shadow: none;
}

.place-marker {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--cream);
  border-radius: 50%;
  background: var(--marker-color, var(--olive));
  color: var(--cream);
  font-size: 0.68rem;
  font-weight: 950;
  box-shadow: 0 0 0 1px rgba(31, 27, 22, 0.24), 2px 2px 0 rgba(31, 27, 22, 0.28);
}

.place-marker.major {
  width: 34px;
  height: 34px;
  border-width: 3px;
  font-size: 0.74rem;
}

.place-marker.selected {
  width: 42px;
  height: 42px;
  border-color: var(--lime);
  color: var(--ink);
  transform: none;
  box-shadow: 0 0 0 3px rgba(215, 255, 95, 0.42), 2px 2px 0 rgba(31, 27, 22, 0.34);
}

.place-marker.exact {
  border-radius: 12px;
}

.marker-harbour {
  border-radius: 999px 999px 999px 6px;
}

.marker-overnight,
.marker-required,
.marker-city,
.marker-home,
.marker-rental,
.marker-hut,
.marker-watchtower,
.marker-food,
.marker-store {
  border-radius: 12px;
}

.marker-camping {
  border-radius: 999px 999px 8px 999px;
}

.current-marker {
  width: 22px;
  height: 22px;
  border: 3px solid var(--cream);
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(242, 95, 76, 0.16), 0 0 0 1px var(--ink);
}

.day-rail {
  flex: 0 0 auto;
  margin-top: 7px;
}

.wide-panel {
  display: none;
}

.day-cards {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 1px 2px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.day-swipe-card {
  flex: 0 0 min(58vw, 214px);
  height: 96px;
  padding: 10px 12px;
  overflow: hidden;
  scroll-snap-align: start;
  cursor: pointer;
  border: 1.5px solid rgba(31, 27, 22, 0.3);
  border-radius: 22px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: none;
  transition: transform 220ms ease, background-color 220ms ease, border-color 220ms ease;
}

.day-swipe-card.active-day {
  border-color: var(--ink);
  background: var(--lime);
  box-shadow: 3px 3px 0 rgba(31, 27, 22, 0.58);
  transform: translateY(-2px);
}

.day-swipe-card.next-day:not(.active-day) {
  border-color: rgba(240, 138, 36, 0.52);
}

.day-swipe-card h3 {
  margin: 6px 0 0;
  font-size: 0.95rem;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.day-swipe-card p {
  margin: 8px 0 0;
  color: var(--soft);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.18;
}

.day-meta {
  display: flex;
  gap: 5px;
  overflow: hidden;
  margin-bottom: 7px;
}

.day-meta span {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--soft);
  font-size: 0.66rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.day-swipe-card ul {
  margin: 0;
  padding-left: 16px;
  color: var(--soft);
  font-size: 0.76rem;
  line-height: 1.25;
}

.overnight-badge,
.warning-badge,
.unresolved-badge {
  display: inline-flex;
  width: fit-content;
  margin: 8px 6px 0 0;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 950;
}

.overnight-badge {
  background: var(--cream);
  color: var(--soft);
}

.warning-badge {
  background: var(--orange);
  color: var(--ink);
}

.unresolved-badge {
  background: rgba(125, 112, 94, 0.16);
  color: var(--muted);
}

.itinerary-panel {
  position: fixed;
  z-index: 820;
  top: calc(12px + env(safe-area-inset-top));
  right: max(12px, calc((100vw - 430px) / 2 + 12px));
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: max(12px, calc((100vw - 430px) / 2 + 12px));
  display: none;
  flex-direction: column;
  max-width: 410px;
  margin: 0 auto;
  padding: 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 34px;
  background: rgba(255, 247, 232, 0.97);
  box-shadow: 2px 2px 0 rgba(31, 27, 22, 0.68);
}

.app.itinerary-open .itinerary-panel {
  display: flex;
}

.section-heading {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  background: rgba(255, 247, 232, 0.97);
}

.section-heading h2 {
  margin: 2px 0 0;
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: -0.025em;
}

.timeline-status {
  display: none;
}

.itinerary-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 1px 4px;
  scrollbar-width: none;
}

.day-card {
  margin: 0;
  padding: 14px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  border-bottom: 1px solid var(--line);
}

.day-card.active-day {
  border-bottom-color: rgba(31, 27, 22, 0.32);
  background: transparent;
}

.day-card.today {
  border-color: rgba(240, 138, 36, 0.72);
}

.day-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.day-weather {
  flex: 0 0 auto;
  display: grid;
  justify-items: end;
  gap: 1px;
  max-width: 122px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1.15;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.day-weather strong {
  color: var(--ink);
  font-size: 0.78rem;
}

.day-card h3 {
  margin: 3px 0 0;
  font-size: 1rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.day-route {
  margin: 5px 0 0;
  color: var(--soft);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.22;
}

.event-list {
  display: grid;
  gap: 3px;
  margin-top: 10px;
}

.event {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 0;
  border: 0;
  border-left: 3px solid var(--event-color, transparent);
  border-radius: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.ticket-button {
  grid-column: 2;
  width: fit-content;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 950;
}

.ferry-ticket-grid {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.ferry-ticket-tile {
  display: grid;
  gap: 3px;
  min-height: 66px;
  padding: 10px 12px;
  border: 1px solid rgba(47, 145, 168, 0.24);
  border-radius: 18px;
  background: rgba(47, 145, 168, 0.13);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.ferry-ticket-tile span {
  color: var(--water);
  font-size: 0.64rem;
  font-weight: 950;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.ferry-ticket-tile strong {
  font-size: 0.9rem;
  line-height: 1.1;
}

.ferry-ticket-tile b {
  color: var(--soft);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.ferry-ticket-tile.not-booked {
  border-color: rgba(240, 138, 36, 0.28);
  background: rgba(240, 138, 36, 0.12);
}

.ferry-ticket-tile:disabled {
  cursor: default;
  opacity: 0.78;
}

.event.next {
  background: rgba(240, 138, 36, 0.08);
  box-shadow: none;
}

.event-time {
  color: var(--event-color, var(--olive));
  font-size: 0.75rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.event h4 {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.16;
}

.event p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.79rem;
  font-weight: 650;
  line-height: 1.28;
}

.event-type-ferry {
  --event-color: var(--cyan);
}

.event-type-deadline {
  --event-color: var(--orange);
}

.event-type-deadline.urgent {
  --event-color: var(--coral);
}

.event-type-drive,
.event-type-fuel {
  --event-color: var(--olive);
}

.event-type-rental {
  --event-color: var(--ink);
}

.event-type-unresolved {
  --event-color: var(--muted);
}

.flex-list,
.checklist {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--soft);
  font-size: 0.84rem;
  line-height: 1.38;
}

.plain-warning {
  margin: 8px 0 0;
  color: var(--orange);
  font-size: 0.84rem;
  font-weight: 900;
}

.free-day,
.overnight-line {
  margin: 8px 0 0;
  color: var(--soft);
  font-size: 0.86rem;
  font-weight: 750;
}

.ticket-details {
  grid-column: 2;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.ticket-details summary {
  cursor: pointer;
  font-weight: 950;
}

.ticket-sheet {
  position: fixed;
  z-index: 1200;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  padding:
    calc(12px + env(safe-area-inset-top))
    12px
    calc(12px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 0;
  background: rgba(31, 27, 22, 0.44);
  box-shadow: none;
}

.weather-panel {
  position: fixed;
  z-index: 820;
  top: calc(12px + env(safe-area-inset-top));
  right: max(12px, calc((100vw - 430px) / 2 + 12px));
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: max(12px, calc((100vw - 430px) / 2 + 12px));
  display: none;
  flex-direction: column;
  max-width: 410px;
  margin: 0 auto;
  padding: 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 34px;
  background: rgba(255, 247, 232, 0.97);
  box-shadow: 2px 2px 0 rgba(31, 27, 22, 0.68);
}

.app.weather-open .weather-panel {
  display: flex;
}

.drawer-actions {
  display: flex;
  gap: 7px;
}

.weather-list {
  flex: 1 1 auto;
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
}

.weather-list::-webkit-scrollbar {
  display: none;
}

.weather-row {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.weather-row strong {
  display: block;
  margin-top: 3px;
  font-size: 0.94rem;
  line-height: 1.1;
}

.weather-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.weather-row__summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.weather-row__summary b {
  flex: 1 0 100%;
  color: var(--ink);
  font-size: 0.86rem;
}

.ticket-sheet.open {
  display: flex;
}

.ticket-sheet__bar {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  width: min(430px, 100%);
  padding: 10px 10px 0;
  border: 2px solid var(--ink);
  border-bottom: 0;
  border-radius: 30px 30px 0 0;
  background: var(--paper);
}

.ticket-content {
  flex: 1 1 auto;
  width: min(430px, 100%);
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 72px);
  min-height: 0;
  padding: 0 10px 12px;
  border: 2px solid var(--ink);
  border-top: 0;
  border-radius: 0 0 30px 30px;
  background: var(--paper);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

.ticket-content::-webkit-scrollbar {
  display: none;
}

.ferry-pass {
  --ticket-bg: #fff8e8;
  --ticket-ink: #1d1b16;
  --ticket-muted: #746d5f;
  --ticket-line: rgba(29, 27, 22, 0.18);
  --ticket-blue: #4d8096;
  --ticket-warning: #ed8616;
  overflow: hidden;
  border: 1.5px solid var(--ticket-ink);
  border-radius: 28px;
  background: var(--ticket-bg);
  color: var(--ticket-ink);
  max-width: 100%;
  box-shadow: 2px 2px 0 rgba(31, 27, 22, 0.34);
}

.ferry-pass__operator,
.ferry-pass__route,
.ferry-pass__times,
.ferry-pass__details,
.ferry-pass__qr,
.ferry-pass__actions {
  padding: 14px 16px;
}

.ferry-pass__operator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--ticket-line);
}

.ferry-pass__brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.ferry-pass__brand img {
  max-width: 100px;
  max-height: 42px;
  object-fit: contain;
}

.ferry-pass__brand strong,
.ferry-pass__brand small {
  display: block;
}

.ferry-pass__brand strong {
  font-size: 0.92rem;
}

.ferry-pass__brand small,
.ferry-pass__date,
.ferry-pass__details span,
.ferry-pass__times span {
  color: var(--ticket-muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.ferry-pass__status {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(104, 118, 74, 0.14);
  color: var(--olive);
  font-size: 0.68rem;
  font-weight: 950;
}

.ferry-pass__route {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.ferry-pass__route > div:last-child {
  text-align: right;
}

.ferry-pass__route span,
.ferry-pass__route strong,
.ferry-pass__route b {
  display: block;
}

.ferry-pass__route strong {
  margin-top: 4px;
  font-size: 1.22rem;
  line-height: 1;
}

.ferry-pass__route b {
  margin-top: 7px;
  color: var(--ticket-blue);
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.ferry-pass__ship {
  display: grid;
  justify-items: center;
  gap: 7px;
  color: var(--ticket-blue);
}

.ferry-pass__ship i {
  display: block;
  width: 58px;
  border-top: 1.5px dashed var(--ticket-line);
}

.ferry-pass__date {
  padding: 0 16px 14px;
}

.ferry-pass__perforation {
  position: relative;
  border-top: 1.5px dashed var(--ticket-line);
}

.ferry-pass__perforation::before,
.ferry-pass__perforation::after {
  position: absolute;
  top: -11px;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--ticket-ink);
  border-radius: 50%;
  background: var(--bg);
  content: "";
}

.ferry-pass__perforation::before {
  left: -12px;
}

.ferry-pass__perforation::after {
  right: -12px;
}

.ferry-pass__times {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ferry-pass__times strong {
  display: block;
  margin-top: 3px;
  color: var(--ticket-warning);
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
}

.ferry-pass__times div:last-child strong {
  color: var(--ticket-ink);
}

.ferry-pass__details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  border-top: 1px solid var(--ticket-line);
}

.ferry-pass__details strong {
  display: block;
  margin-top: 3px;
  font-size: 0.9rem;
}

.ferry-pass__qr {
  display: grid;
  justify-items: center;
  gap: 8px;
  max-width: 100%;
  border-top: 1px solid var(--ticket-line);
}

.ferry-pass__qr img {
  width: min(100%, 260px);
  height: auto;
  max-height: min(58dvh, 260px);
  max-width: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  padding: 12px;
  border-radius: 18px;
  background: #fff;
  filter: none;
  mix-blend-mode: normal;
}

.ferry-pass__qr small {
  font-size: 0.78rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.ferry-pass__qr em {
  color: var(--ticket-muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
}

.ferry-pass__qr.missing {
  min-height: 120px;
  align-content: center;
  background: rgba(125, 112, 94, 0.08);
}

.ferry-pass__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid var(--ticket-line);
}

.ferry-pass__actions a,
.ferry-pass__actions button {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--ticket-line);
  border-radius: 999px;
  background: var(--cream);
  color: var(--ticket-ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 950;
  text-decoration: none;
}

.map-backdrop {
  position: fixed;
  inset: 0;
  z-index: 800;
  border: 0;
  background: rgba(31, 27, 22, 0.44);
}

body.ticket-open .leaflet-popup,
body.ticket-open .leaflet-control-container,
body.ticket-open .map-control-stack,
body.ticket-open .journey-context,
body.ticket-open .stop-panel,
body.ticket-open .weather-chip {
  visibility: hidden;
}

body.map-expanded .map-shell {
  position: fixed;
  z-index: 850;
  top: calc(4vh + env(safe-area-inset-top));
  right: max(12px, calc((100vw - 430px) / 2 + 12px));
  left: max(12px, calc((100vw - 430px) / 2 + 12px));
  height: min(92dvh, 780px);
  max-width: 410px;
  margin: 0 auto;
}

@media (max-height: 720px), (max-width: 380px) {
  .app {
    padding-top: calc(8px + env(safe-area-inset-top));
    padding-inline: 10px;
  }

  .map-shell {
    min-height: 280px;
  }

  .journey-context {
    max-width: min(236px, calc(100% - 62px));
    padding: 8px 9px;
  }

  .stop-panel {
    padding: 10px;
  }

  .day-swipe-card {
    flex-basis: min(60vw, 208px);
    height: 90px;
    padding: 9px 11px;
  }

  .day-swipe-card h3 {
    font-size: 0.9rem;
    margin: 5px 0 0;
  }

  .day-date {
    font-size: 0.64rem;
  }

  .context-weather {
    max-width: 98px;
  }

  .context-weather span {
    max-width: 98px;
  }
}

@media (orientation: portrait) and (max-width: 699px) {
  .leaflet-popup {
    display: none !important;
  }
}

@media (orientation: landscape) and (min-width: 700px), (min-width: 900px) and (min-height: 700px) {
  .app {
    display: grid;
    grid-template-columns: minmax(0, 70fr) minmax(280px, 30fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 12px;
    max-width: none;
    padding:
      calc(10px + env(safe-area-inset-top))
      12px
      calc(10px + env(safe-area-inset-bottom));
  }

  .trip-header,
  .compact-weather,
  .day-rail,
  .map-toolbar {
    display: none;
  }

  .weather-chip {
    display: none;
  }

  .stop-panel {
    display: none !important;
  }

  .map-tab {
    grid-column: 1;
    grid-row: 1;
    margin-top: 0;
    gap: 0;
  }

  .map-shell {
    min-height: 0;
    height: 100%;
    border-radius: 32px;
  }

  .map-control-stack {
    display: flex;
    flex-direction: column;
  }

  .map-control-button {
    width: 50px;
    height: 50px;
  }

  .rmk-popover {
    right: 72px;
  }

  .wide-panel {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    overflow-y: auto;
    padding: 14px;
    border: 2px solid var(--ink);
    border-radius: 32px;
    background: rgba(255, 247, 232, 0.94);
    box-shadow: 0 10px 24px rgba(31, 27, 22, 0.12);
    scrollbar-width: none;
  }

  .wide-panel-section {
    flex: 0 0 auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.46);
  }

  .wide-day-summary h2 {
    margin: 3px 0 4px;
    font-size: 1.28rem;
    line-height: 1;
  }

  .wide-panel-section p {
    margin: 4px 0 0;
    color: var(--soft);
    font-size: 0.86rem;
    font-weight: 750;
    line-height: 1.24;
  }

  .wide-inline-weather {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
  }

  .wide-next-event {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    min-height: 48px;
    font-size: 0.96rem;
    font-weight: 900;
  }

  .wide-next-event b {
    color: var(--coral);
    font-variant-numeric: tabular-nums;
  }

  .wide-weather strong,
  .wide-navigation strong {
    display: block;
    margin-top: 4px;
    font-size: 1rem;
    line-height: 1.08;
  }

  .wide-weather-meta {
    display: flex;
    gap: 6px;
    margin-top: 8px;
  }

  .wide-weather-meta span {
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--cream);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
  }

  .wide-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .wide-section-heading button {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--cream);
    color: var(--ink);
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 950;
  }

  .wide-section-heading > span:last-child {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 950;
  }

  .wide-location-list {
    display: grid;
    gap: 7px;
    max-height: 310px;
    margin-top: 8px;
    overflow-y: auto;
    scrollbar-width: none;
  }

  .wide-days-section {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 180px;
  }

  .wide-day-list {
    display: grid;
    gap: 7px;
    flex: 1 1 auto;
    max-height: none;
    margin-top: 9px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-snap-type: y proximity;
    scrollbar-width: none;
  }

  .wide-day-list::-webkit-scrollbar {
    display: none;
  }

  .wide-day-tile {
    display: grid;
    gap: 3px;
    min-height: 62px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 250, 240, 0.68);
    color: var(--ink);
    cursor: pointer;
    scroll-snap-align: center;
    text-align: left;
  }

  .wide-day-tile.active-day {
    border-color: var(--ink);
    background: var(--lime);
  }

  .wide-day-tile span {
    color: var(--olive);
    font-size: 0.66rem;
    font-weight: 950;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .wide-day-tile strong {
    overflow: hidden;
    font-size: 0.9rem;
    line-height: 1.08;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .wide-day-tile small {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .wide-location-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 54px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 250, 240, 0.68);
    color: var(--ink);
    text-align: left;
    cursor: pointer;
  }

  .wide-location-row.selected {
    border-color: var(--ink);
    background: var(--lime);
  }

  .wide-location-row strong,
  .wide-location-row small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .wide-location-row strong {
    font-size: 0.88rem;
    line-height: 1.08;
  }

  .wide-location-row small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 850;
  }

  .wide-location-row b {
    color: var(--coral);
    font-size: 0.76rem;
    font-variant-numeric: tabular-nums;
  }

  .wide-navigation .nav-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 10px;
  }

  .wide-navigation .nav-action {
    min-width: 0;
    min-height: 54px;
  }

  .wide-itinerary-button {
    flex: 0 0 auto;
    min-height: 54px;
    border: 2px solid var(--ink);
    border-radius: 999px;
    background: var(--lime);
    color: var(--ink);
    cursor: pointer;
    font-weight: 950;
    box-shadow: 2px 2px 0 var(--ink);
  }

  .wide-empty {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
  }

  .itinerary-panel {
    right: 24px;
    left: auto;
    width: min(430px, calc(100vw - 48px));
  }

  body.map-expanded .map-shell {
    right: 4vw;
    left: 4vw;
    max-width: none;
  }
}

@media (orientation: landscape) and (max-height: 430px) {
  .map-control-stack {
    top: 6px;
    right: 6px;
    gap: 4px;
  }

  .map-control-button {
    width: 41px;
    height: 41px;
    min-width: 41px;
    min-height: 41px;
    border-radius: 13px;
    font-size: 0.94rem;
  }

  .rmk-menu-button {
    font-size: 0.58rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
