.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 54px;
  padding: 0 22px;
  border-radius: var(--radius-control);
  corner-shape: var(--corner-shape);
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.005em;
  transition: transform 160ms var(--ease-exit),
    box-shadow 200ms var(--ease-exit), background 160ms var(--ease-exit);
  min-width: 48px;
  min-height: 48px;
  user-select: none;
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-cta);
  width: 100%;
}

.btn--primary:active {
  background: var(--color-primary-dark);
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(11, 110, 140, 0.3);
}

.btn--ghost {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-border);
}

.btn--ghost:active {
  background: var(--color-surface-tinted);
  border-color: var(--color-primary);
}

.btn--icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  corner-shape: var(--corner-shape);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--color-primary-dark);
  box-shadow: 0 2px 8px rgba(10, 77, 107, 0.18);
}

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.icon--sm {
  width: 16px;
  height: 16px;
}

.icon--lg {
  width: 22px;
  height: 22px;
}

.pill-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-tinted);
  color: var(--color-primary-dark);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.pill-chip--coral {
  background: #ffe7df;
  color: #c44a2a;
}

.pill-chip--sage {
  background: #e3f1e8;
  color: #2f7a52;
}

.pill-chip--neutral {
  background: var(--color-background);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.difficulty-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.difficulty-dot--easy {
  background: var(--color-sage);
}
.difficulty-dot--medium {
  background: #e8a14a;
}
.difficulty-dot--hard {
  background: var(--color-emergency);
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  corner-shape: var(--corner-shape);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.sheet {
  background: var(--color-surface);
  border-top-left-radius: var(--radius-sheet);
  border-top-right-radius: var(--radius-sheet);
  corner-shape: var(--corner-shape);
  box-shadow: var(--shadow-sheet);
  position: relative;
  width: 100%;
  touch-action: none;
}

.sheet__handle {
  width: 44px;
  height: 5px;
  background: #d8dee0;
  border-radius: 99px;
  margin: 10px auto 4px;
  flex-shrink: 0;
  transition: background 200ms var(--ease-exit);
}

.sheet:active .sheet__handle,
.sheet.is-dragging .sheet__handle {
  background: var(--color-primary);
}

.emergency-pill {
  position: fixed;
  left: 12px;
  bottom: 96px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  height: 48px;
  border-radius: var(--radius-pill);
  background: var(--color-emergency);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: var(--shadow-pill);
  white-space: nowrap;
}

.emergency-pill .icon {
  color: #fff;
}

.emergency-pill::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(217, 58, 43, 0.45);
  animation: emergency-pulse 2.4s var(--ease-exit) infinite;
  pointer-events: none;
}

@keyframes emergency-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(217, 58, 43, 0.45);
  }
  60%,
  100% {
    box-shadow: 0 0 0 14px rgba(217, 58, 43, 0);
  }
}

.coastal-img {
  background: linear-gradient(
      120deg,
      rgba(11, 110, 140, 0.3),
      rgba(74, 155, 114, 0.18) 60%,
      rgba(255, 140, 107, 0.18)
    ),
    #c8e0e8;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}

.coastal-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 50%,
    rgba(10, 77, 107, 0.25)
  );
  pointer-events: none;
}

.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    rgba(221, 227, 224, 0.5) 0%,
    rgba(255, 255, 255, 0.85) 50%,
    rgba(221, 227, 224, 0.5) 100%
  );
  background-size: 220% 100%;
  animation: shimmer 1.6s linear infinite;
}

@keyframes shimmer {
  0% {
    background-position: 220% 0;
  }
  100% {
    background-position: -220% 0;
  }
}

/* ── Danger button (end-session confirm) ───────────────────────────────────── */

.btn--danger {
  background: var(--color-emergency);
  color: #fff;
  box-shadow: 0 4px 12px rgba(217, 58, 43, 0.28);
  width: 100%;
}

.btn--danger:active {
  background: #b52d1f;
  transform: translateY(1px);
  box-shadow: 0 2px 6px rgba(217, 58, 43, 0.2);
}

/* ── Start-route safety modal ──────────────────────────────────────────────── */

.start-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms var(--ease-entrance);
}

.start-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.start-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 28, 28, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.start-modal__card {
  position: relative;
  z-index: 1;
  width: 100%;
  background: #ffffff;
  border-top-left-radius: var(--radius-sheet);
  border-top-right-radius: var(--radius-sheet);
  corner-shape: var(--corner-shape);
  padding: 24px 24px max(env(safe-area-inset-bottom), 24px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-sheet);
  transform: translateY(24px);
  transition: transform 280ms var(--ease-entrance);
}

.start-modal.is-open .start-modal__card {
  transform: none;
}

.start-modal__title {
  font-family: var(--font-display);
  font-size: var(--fs-heading-sm);
  font-weight: 500;
  color: var(--color-text-primary);
  margin: 0;
}

.start-modal__checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.start-modal__check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  cursor: pointer;
}

.start-modal__check-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

.start-modal__check-label {
  font-family: var(--font-body);
  font-size: var(--fs-body-md);
  color: var(--color-text-primary);
  line-height: 1.4;
}

.start-modal__code-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.start-modal__code-label {
  font-family: var(--font-body);
  font-size: var(--fs-body-sm);
  color: var(--color-text-secondary);
}

.start-modal__code-input {
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-control);
  corner-shape: var(--corner-shape);
  background: #ffffff;
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--color-text-primary);
  outline: none;
  transition: border-color 160ms var(--ease-entrance),
    box-shadow 160ms var(--ease-entrance);
}

.start-modal__code-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(27, 107, 138, 0.15);
}

.start-modal__code-input.is-shaking {
  animation: modal-shake 320ms var(--ease-exit);
  border-color: var(--color-emergency);
}

@keyframes modal-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.start-modal__code-error {
  font-family: var(--font-body);
  font-size: var(--fs-body-sm);
  color: var(--color-emergency);
  margin: 0;
  min-height: 1.4em;
}

.start-modal__actions {
  display: flex;
  gap: 12px;
}

.start-modal__btn-cancel {
  width: auto;
}

.start-modal__btn-start {
  flex: 1;
  width: auto;
}
