:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-strong: #e8eff1;
  --ink: #102125;
  --muted: #5d6c70;
  --brand: #0b2f35;
  --brand-2: #0f766e;
  --accent: #d97706;
  --danger: #b42318;
  --success: #117a45;
  --border: #d8e1e4;
  --shadow: 0 14px 34px rgba(11, 47, 53, 0.12);
  /* Capacitor SystemBars populates these custom properties on Android;
     Safari uses the env() fallback. */
  --safe-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-right: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
  --safe-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --safe-left: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

body.mobile-menu-active {
  overflow: hidden;
}

img,
video {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 20;
  transform: translateY(-160%);
  background: var(--brand);
  color: #fff;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
}

.skip-link:focus {
  transform: translateY(0);
}

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

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
  padding: calc(0.75rem + var(--safe-top)) max(1rem, var(--safe-left)) 0.75rem max(1rem, var(--safe-right));
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

html[data-native-platform="android"] .app-header::before {
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  left: 0;
  height: var(--safe-top);
  background: #fff;
  content: "";
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  html[data-native-platform="android"] .app-header::before {
    background: #000;
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--brand);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
}

.top-nav {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.2rem;
  background: var(--surface-strong);
  border-radius: 8px;
}

.top-nav a {
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.top-nav a[aria-current="page"] {
  background: var(--surface);
  color: var(--brand);
  box-shadow: 0 1px 6px rgba(16, 33, 37, 0.08);
}

.navigation-drawer {
  display: contents;
}

.mobile-menu-backdrop {
  display: none;
}

.mobile-menu-toggle {
  display: none;
}

.account-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--brand);
  font-size: 0.9rem;
  font-weight: 750;
}

.account-nav form {
  margin: 0;
}

.account-menu {
  position: relative;
}

.account-menu summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.4rem;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

.account-menu summary::-webkit-details-marker {
  display: none;
}

.account-menu-name::after {
  content: '⌄';
  margin-left: 0.35rem;
  color: var(--muted);
}

.account-menu-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.45rem);
  right: 0;
  display: grid;
  min-width: 12rem;
  gap: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 0.5rem;
}

.account-menu-panel > a,
.account-menu-panel button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--brand);
  padding: 0.55rem;
  text-align: left;
  font-weight: 750;
  text-decoration: none;
}

.account-menu-panel form {
  display: block;
}

.account-menu-panel button {
  width: 100%;
}

.account-menu-panel > a:hover,
.account-menu-panel > a[aria-current="page"],
.account-menu-panel button:hover {
  background: #eefaf6;
}

.language-switcher {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.language-switcher a {
  padding: 0.32rem 0.4rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1;
  text-decoration: none;
}

.language-switcher a[aria-current="true"] {
  background: var(--brand);
  color: #fff;
}

.guest-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 0.35rem 0.55rem;
}

.account-link,
.link-button {
  border: 0;
  background: transparent;
  color: var(--brand-2);
  padding: 0;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.app-main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 1rem 1rem calc(2.5rem + var(--safe-bottom));
}

.app-main-editor {
  width: 100%;
  max-width: none;
}

.screen-title {
  display: grid;
  gap: 0.65rem;
  margin: 0.5rem 0 1rem;
}

.screen-title h1,
.detail-heading h1,
.tour-topbar h1,
.panel h1 {
  margin: 0;
  color: var(--brand);
  font-size: 2rem;
  line-height: 1.08;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--brand-2);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.muted,
.form-note {
  color: var(--muted);
}

.gps-hint {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(180, 83, 9, 0.2);
  border-radius: 8px;
  background: #fffaf0;
  color: #7c4a03;
  font-size: 0.92rem;
  font-weight: 750;
  line-height: 1.35;
}

.readiness-feature-icons {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.readiness-feature-icon {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.readiness-feature-icon svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.readiness-feature[data-permission-state="granted"] .readiness-feature-icon {
  border-color: rgba(17, 122, 69, 0.25);
  background: rgba(17, 122, 69, 0.12);
  color: var(--success);
}

.info-tooltip {
  position: relative;
  width: fit-content;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
}

.info-tooltip > summary:not(.readiness-feature-icon) {
  display: inline-grid;
  width: 1.25rem;
  height: 1.25rem;
  place-items: center;
  border: 1px solid rgba(15, 118, 170, 0.3);
  border-radius: 50%;
  background: rgba(15, 118, 170, 0.1);
  color: #0f76aa;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  list-style: none;
}

.info-tooltip > summary::-webkit-details-marker {
  display: none;
}

.info-tooltip > summary:focus-visible {
  outline: 3px solid rgba(15, 118, 170, 0.25);
  outline-offset: 2px;
}

.info-tooltip-content {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  z-index: 20;
  display: block;
  width: min(20rem, calc(100vw - 3rem));
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(15, 118, 170, 0.24);
  border-radius: 8px;
  background: #f7fcff;
  box-shadow: 0 8px 24px rgba(13, 42, 47, 0.18);
  color: var(--text);
}

.info-tooltip-dialog {
  width: min(24rem, calc(100vw - 2rem));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  background: var(--surface);
  color: var(--text);
}

.info-tooltip-dialog::backdrop { background: rgba(10, 44, 50, 0.35); }
.info-tooltip-dialog p { margin: 0 0 0.9rem; }

.search-panel,
.panel,
.purchase-panel,
.tour-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.search-panel {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 1rem;
}

.search-panel label,
.admin-form label {
  display: grid;
  gap: 0.4rem;
  color: var(--brand);
  font-weight: 750;
}

.search-row {
  display: grid;
  gap: 0.65rem;
}

.search-filters {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.search-filters summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 750;
}

.filter-grid {
  display: grid;
  gap: 0.75rem;
  margin: 0.85rem 0;
}

.filter-grid label {
  font-size: 0.9rem;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}

.field-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 999px;
  background: #ecfdf3;
  color: var(--success);
  padding: 0.18rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.field-badge.optional {
  border-color: var(--border);
  background: #f3f7f8;
  color: var(--muted);
}

.field-badge.conditional {
  border-color: rgba(178, 107, 0, 0.24);
  background: #fff7ed;
  color: #9a5b00;
}

input,
textarea,
select {
  width: 100%;
  min-height: 2.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0.72rem 0.8rem;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.3);
  outline-offset: 2px;
}

.field-error {
  display: block;
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 750;
}

[aria-invalid="true"] {
  border-color: var(--danger);
}

.advanced-fields {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  background: #f8fbfc;
}

.advanced-fields summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 750;
}

.quick-actions,
.purchase-actions,
.tour-actions,
.answer-grid,
.editor-actions,
.location-helper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--brand);
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  padding: 0.7rem 1rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  white-space: normal;
}

.button:hover {
  background: #13464f;
}

.button.secondary {
  border-color: var(--brand-2);
  background: var(--brand-2);
}

.button.ghost {
  background: #fff;
  color: var(--brand);
}

.google-login-button {
  gap: 0.65rem;
}

.google-login-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
}

.button.ghost.danger {
  border-color: rgba(180, 35, 24, 0.35);
  color: var(--danger);
}

.button.disabled,
.button:disabled {
  border-color: #aab8bc;
  background: #aab8bc;
  color: #f7fbfc;
  cursor: not-allowed;
}

.button.compact {
  min-height: 2.35rem;
  padding: 0.45rem 0.7rem;
}

.adventure-list {
  display: grid;
  gap: 1rem;
}

.catalog-results-summary {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-weight: 750;
}

.catalog-load-more {
  display: flex;
  justify-content: center;
  padding: 1rem 0 0;
}

.adventure-card {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(16, 33, 37, 0.08);
}

.adventure-card[hidden] {
  display: none;
}

.card-media {
  min-height: 100%;
  background: var(--surface-strong);
}

.card-media img {
  width: 100%;
  height: 100%;
  min-height: 8rem;
  object-fit: cover;
}

.card-body {
  display: grid;
  gap: 0.3rem;
  padding: 0.7rem 0.75rem;
  min-width: 0;
}

.card-body h2,
.purchase-panel h2,
.step-preview h2,
.admin-form h2,
.panel h2,
.tour-step h2 {
  margin: 0;
  color: var(--brand);
  font-size: 1.25rem;
  line-height: 1.15;
}

.card-body h2 a {
  text-decoration: none;
}

.card-body h2 {
  font-size: 1.08rem;
}

.card-body > p {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-body p,
.purchase-panel p,
.panel p,
.detail-body p,
.tour-step p,
.admin-item p {
  margin: 0;
}

.card-meta,
.card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.card-footer strong {
  color: var(--accent);
}

.library-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.25rem;
}

.detail {
  display: grid;
  gap: 1rem;
}

.detail-media {
  position: relative;
  overflow: hidden;
  margin: -1rem -1rem 0;
  background: var(--surface-strong);
  aspect-ratio: 4 / 3;
}

.detail-media img,
.detail-media video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-body {
  display: grid;
  gap: 1rem;
}

.detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.back-link {
  color: var(--brand-2);
  font-weight: 800;
  width: fit-content;
}

.lead {
  color: var(--brand);
  font-size: 1.08rem;
  font-weight: 700;
}

.price-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-radius: 8px;
  background: #fff7ed;
  color: var(--accent);
  padding: 0.4rem 0.65rem;
  font-weight: 850;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin: 0;
}

.stats-grid div {
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.stats-grid dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.stats-grid dd {
  margin: 0.2rem 0 0;
  color: var(--brand);
  font-weight: 850;
}

.purchase-panel {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.tour-readiness {
  display: grid;
  gap: 0.65rem;
  padding: 1rem;
}

.readiness-list {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
}

.step-preview {
  display: grid;
  gap: 0.65rem;
}

.step-preview ol {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding-left: 1.25rem;
}

.step-preview li {
  padding-left: 0.2rem;
}

.step-preview span,
.item-status {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.step-preview strong {
  display: block;
}

.tour-shell {
  display: grid;
  gap: 1rem;
  max-width: 760px;
  margin: 0 auto;
}

.tour-topbar {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  justify-content: space-between;
}

.tour-topbar h1 {
  font-size: 1.45rem;
}

.progress-track {
  height: 0.6rem;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-strong);
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 8px;
  background: var(--brand-2);
  transition: width 180ms ease;
}

.tour-progress-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.permission-help {
  margin-top: 0.6rem !important;
  padding: 0.65rem;
  border-radius: 8px;
  background: #fff7ed;
  color: #7c4a03;
}

.tour-step {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.tour-media {
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-strong);
}

.tour-media img,
.tour-media video,
.tour-media audio,
.camera-frame video {
  width: 100%;
  max-height: 26rem;
  object-fit: cover;
}

.tour-media audio {
  display: block;
  padding: 0.75rem;
}

.answer-grid {
  display: grid;
}

.answer-field {
  display: grid;
  gap: 0.45rem;
  color: var(--brand);
  font-weight: 750;
}

.answer-button {
  justify-content: flex-start;
  width: 100%;
  background: #fff;
  color: var(--brand);
}

.answer-button.is-correct {
  border-color: var(--success);
  background: #ecfdf3;
  color: var(--success);
}

.answer-button.is-wrong {
  border-color: var(--danger);
  background: #fff1f0;
  color: var(--danger);
}

.image-mark {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  touch-action: manipulation;
}

.image-mark img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
}

.image-mark-pin {
  position: absolute;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: rgba(15, 118, 110, 0.88);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.28), var(--shadow);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.geofence-panel {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 8px;
  background: #eefaf6;
}

.geofence-panel h3,
.geofence-panel p {
  margin: 0;
}

.location-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.location-distance {
  color: var(--brand);
  font-size: 1.15rem;
  font-weight: 800;
}

.location-details {
  color: var(--muted);
  font-size: 0.9rem;
}

.location-details summary {
  width: fit-content;
  color: var(--brand-2);
  cursor: pointer;
  font-weight: 750;
}

.location-details p {
  margin: 0.65rem 0 0;
}

.feedback {
  min-height: 1.5rem;
  color: var(--muted);
  font-weight: 750;
}

.feedback.success {
  color: var(--success);
}

.feedback.error {
  color: var(--danger);
}

.permission-prompt {
  display: grid;
  gap: 0.8rem;
  width: min(1120px, calc(100% - 2rem));
  margin: 1rem auto 0;
  padding: 0.9rem;
  border: 1px solid rgba(15, 118, 110, 0.26);
  border-radius: 8px;
  background: #f8fbfc;
  box-shadow: 0 10px 28px rgba(13, 42, 47, 0.1);
}

.permission-prompt h2,
.permission-prompt p {
  margin: 0;
}

.permission-prompt h2 {
  color: var(--brand);
  font-size: 1.05rem;
}

.permission-prompt-actions,
.settings-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.settings-grid {
  align-items: stretch;
}

.settings-section {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.settings-section-heading {
  display: grid;
  gap: 0.2rem;
}

.settings-section-heading h2,
.settings-section-heading p {
  margin: 0;
}

.settings-section-heading h2 {
  color: var(--brand);
  font-size: 1.1rem;
}

.settings-form {
  display: grid;
  gap: 0.55rem;
}

.settings-form label {
  color: var(--brand);
  font-size: 0.9rem;
  font-weight: 750;
}

.settings-form-row {
  display: grid;
  gap: 0.65rem;
}

.settings-panel {
  display: grid;
  flex: 1 1 18rem;
  gap: 0.9rem;
  align-content: space-between;
  min-width: min(100%, 18rem);
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.settings-panel h2,
.settings-panel h3,
.settings-panel p {
  margin: 0;
}

.settings-panel h2,
.settings-panel h3 {
  color: var(--brand);
  font-size: 1.05rem;
}

@media (min-width: 640px) {
  .settings-form-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

.camera-frame {
  position: relative;
  display: grid;
  gap: 0.75rem;
}

.camera-frame video {
  border-radius: 8px;
  background: #06191d;
  aspect-ratio: 4 / 3;
}

.camera-frame.is-starting video,
.camera-frame.is-starting .scan-reticle {
  opacity: 0;
}

.scan-reticle {
  position: absolute;
  inset: 18%;
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(6, 25, 29, 0.2);
  pointer-events: none;
}

.scanner-note {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem;
  border: 1px solid rgba(217, 119, 6, 0.28);
  border-radius: 8px;
  background: #fff7ed;
  color: var(--brand);
}

.match-meter {
  display: grid;
  gap: 0.35rem;
  color: var(--brand);
  font-weight: 750;
}

.match-meter span:first-child,
.match-confidence {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.match-confidence {
  color: var(--muted);
  font-size: 0.86rem;
}

.match-meter progress {
  width: 100%;
  height: 0.8rem;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: var(--surface-strong);
}

.match-meter progress::-webkit-progress-bar {
  background: var(--surface-strong);
}

.match-meter progress::-webkit-progress-value,
.match-meter progress::-moz-progress-bar {
  background: var(--brand-2);
}

.target-map {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 40;
  display: grid;
  width: min(18rem, calc(100vw - 4rem));
  align-content: start;
  gap: 1rem;
  padding: 1rem;
  border-left: 1px solid rgba(15, 118, 110, 0.28);
  background: #f8fbfc;
  box-shadow: -12px 0 30px rgba(13, 42, 47, 0.18);
  animation: slide-in-blade 160ms ease-out;
}

.target-map-grab {
  position: fixed;
  top: 50%;
  right: 0;
  z-index: 34;
  display: grid;
  width: 2.65rem;
  height: 4.5rem;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(15, 118, 110, 0.32);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: #ffffff;
  box-shadow: -6px 8px 18px rgba(13, 42, 47, 0.2);
  color: var(--brand);
  cursor: grab;
  transform: translateY(-50%);
  touch-action: pan-y;
}

.target-map-grab span {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: rgba(14, 165, 164, 0.12);
  font-size: 1.15rem;
  line-height: 1;
}

.target-map-grab:focus-visible {
  outline: 3px solid rgba(14, 165, 164, 0.35);
  outline-offset: 3px;
}

.target-map-grab.is-open {
  opacity: 0;
  pointer-events: none;
}

.target-map[hidden],
.target-map-backdrop[hidden] {
  display: none;
}

.target-map-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.target-map h3 {
  margin: 0;
  color: var(--brand);
}

.target-map-close {
  display: grid;
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 8px;
  background: #fff;
  color: var(--brand);
  font-size: 1.45rem;
  line-height: 1;
}

.target-map-close:hover {
  background: var(--surface-strong);
}

.target-map-close span {
  display: block;
  transform: translateY(-0.05rem);
}

.target-map-actions {
  display: grid;
  gap: 0.65rem;
}

.target-map-actions .button {
  width: 100%;
}

.target-compass {
  display: grid;
  width: 3.2rem;
  height: 3.2rem;
  margin-inline: auto;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 50%;
  background: #fff;
  color: var(--brand-2);
  cursor: pointer;
  font-size: 1.8rem;
  line-height: 1;
}

.target-compass:hover {
  background: var(--surface-strong);
}

.target-compass:focus-visible {
  outline: 3px solid rgba(14, 165, 164, 0.35);
  outline-offset: 3px;
}

.target-compass span {
  display: block;
  transform-origin: 50% 50%;
  transition: transform 180ms ease;
}

.target-compass-mini {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0;
  font-size: 1.35rem;
}

.target-map-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  border: 0;
  background: rgba(13, 42, 47, 0.28);
}

.gps-debug-blade {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 42;
  display: grid;
  width: min(22rem, calc(100vw - 4rem));
  align-content: start;
  gap: 1rem;
  overflow-y: auto;
  padding: 1rem;
  border-right: 1px solid rgba(180, 83, 9, 0.28);
  background: #fffaf0;
  box-shadow: 12px 0 30px rgba(61, 46, 20, 0.18);
  animation: slide-in-debug-blade 160ms ease-out;
}

.gps-debug-grab {
  position: fixed;
  top: calc(50% + 5.1rem);
  left: 0;
  z-index: 34;
  display: grid;
  width: 2.65rem;
  height: 4.5rem;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(180, 83, 9, 0.34);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: #ffffff;
  box-shadow: 6px 8px 18px rgba(61, 46, 20, 0.18);
  color: #92400e;
  cursor: pointer;
  transform: translateY(-50%);
  touch-action: pan-y;
}

.gps-debug-grab span {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: rgba(217, 119, 6, 0.14);
  font-size: 1.15rem;
  line-height: 1;
}

.gps-debug-grab:focus-visible {
  outline: 3px solid rgba(217, 119, 6, 0.32);
  outline-offset: 3px;
}

.gps-debug-grab.is-open {
  opacity: 0;
  pointer-events: none;
}

.gps-debug-blade[hidden],
.gps-debug-backdrop[hidden] {
  display: none;
}

.gps-debug-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.gps-debug-header h3 {
  margin: 0;
  color: #92400e;
}

.gps-debug-close {
  display: grid;
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(180, 83, 9, 0.28);
  border-radius: 8px;
  background: #fff;
  color: #92400e;
  font-size: 1.45rem;
  line-height: 1;
}

.gps-debug-close:hover {
  background: #fff4dc;
}

.gps-debug-close span {
  display: block;
  transform: translateY(-0.05rem);
}

.gps-debug-grid {
  display: grid;
  gap: 0.45rem;
  margin: 0;
}

.gps-debug-grid div {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(180, 83, 9, 0.16);
  border-radius: 8px;
  background: #ffffff;
}

.gps-debug-grid dt {
  color: #8a5a18;
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.gps-debug-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.35;
}

.gps-debug-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

.gps-debug-actions .button {
  min-width: 0;
  padding-inline: 0.65rem;
}

.gps-debug-backdrop {
  position: fixed;
  inset: 0;
  z-index: 37;
  border: 0;
  background: rgba(61, 46, 20, 0.22);
}

@keyframes slide-in-blade {
  from {
    transform: translateX(100%);
  }

  to {
    transform: translateX(0);
  }
}

@keyframes slide-in-debug-blade {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(0);
  }
}

.location-helper {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #f8fbfc;
}

.location-helper-actions .button {
  flex: 1 1 10rem;
}

.location-paste-field {
  display: grid;
  gap: 0.35rem;
  color: var(--brand);
  font-weight: 750;
}

.location-paste-field textarea {
  min-height: 4.75rem;
}

.location-coordinate-preview {
  min-height: 2.6rem;
  min-width: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.location-coordinate-preview.is-ready {
  border-color: rgba(15, 118, 110, 0.35);
  background: #eefaf6;
  color: var(--brand);
}

.location-helper .form-note {
  margin: 0;
}

.location-helper-dialog {
  width: min(34rem, calc(100vw - 2rem));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.location-helper-dialog::backdrop {
  background: rgba(16, 33, 37, 0.42);
}

.location-helper-dialog-panel {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--surface);
}

.location-helper-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.location-helper-dialog-heading h3 {
  margin: 0;
  color: var(--brand);
  font-size: 1.1rem;
  line-height: 1.2;
}

.upload-preview {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
  margin: 0;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fbfc;
}

.upload-preview figcaption {
  color: var(--brand);
  font-weight: 800;
}

.upload-preview img,
.upload-preview video {
  width: 100%;
  max-height: 24rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  object-fit: contain;
}

.upload-preview audio {
  width: 100%;
}

.upload-preview-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.upload-preview.is-media-error {
  border-color: var(--danger);
}

.upload-preview.is-media-error .upload-preview-status {
  color: var(--danger);
  font-weight: 700;
}

.image-upload-section {
  display: grid;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fbfc;
}

.image-upload-section .upload-preview {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.hero-media-upload h3 {
  margin: 0;
  color: var(--brand);
  font-size: 1.05rem;
}

.media-upload-control {
  display: grid;
  gap: 0.45rem;
}

.step-media-slots {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.step-media-slots > legend { padding: 0 0.25rem; font-weight: 800; }

.step-media-slot {
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  align-items: center;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
}

.step-media-slot-label {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  color: var(--brand);
  background: var(--surface);
  font-weight: 900;
}

.step-media-slot .media-slot-remove { grid-column: 3; grid-row: 1; min-width: 2.25rem; }
.step-media-slot [data-media-dialog-trigger] { grid-column: 2; grid-row: 1; justify-self: start; }
.step-media-slot [data-media-dialog-trigger].is-set { border-color: #117a45; color: #117a45; }

.field-heading {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: fit-content;
}

.field-heading > label,
.field-heading > .field-label,
.field-heading > .info-tooltip {
  display: inline-flex;
  align-items: center;
  width: auto;
}

.field-heading .field-label {
  justify-content: flex-start;
}

.media-capture-dialog { width: min(24rem, calc(100vw - 2rem)); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; background: var(--surface); }
.media-capture-dialog::backdrop { background: rgba(10, 44, 50, 0.35); }
.media-capture-dialog h3 { margin: 0 0 0.8rem; color: var(--brand); }
.media-capture-choices { display: grid; gap: 0.65rem; margin-bottom: 0.8rem; }

.audio-recorder-dialog { width: min(24rem, calc(100vw - 2rem)); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; background: var(--surface); }
.audio-recorder-dialog::backdrop { background: rgba(10, 44, 50, 0.35); }
.audio-recorder-dialog h3 { margin: 0 0 0.8rem; color: var(--brand); }
.audio-recorder-dialog audio { width: 100%; }
.audio-recorder-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }
.audio-recorder-status { margin: 0; color: var(--muted); }

.media-picker-label {
  display: block;
}

.upload-preview-actions {
  display: flex;
  justify-content: flex-end;
}

.editor-file-picker {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  min-height: 2.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 0.35rem;
  cursor: pointer;
}

.editor-file-input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.editor-file-button {
  display: inline-flex;
  min-height: 2.25rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--brand);
  border-radius: 6px;
  color: var(--brand);
  padding: 0.45rem 0.7rem;
  font-weight: 800;
}

.editor-file-name {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-file-input:focus-visible ~ .editor-file-button {
  outline: 3px solid rgba(15, 118, 110, 0.3);
  outline-offset: 2px;
}

.image-mark-picker {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fbfc;
}

.image-mark-picker-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  touch-action: manipulation;
}

.image-mark-picker-frame img {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
  user-select: none;
}

.image-mark-picker-frame img[hidden] {
  display: none;
}

.image-mark-picker .form-note {
  margin: 0;
}

.qr-manual {
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.panel {
  min-width: 0;
  padding: 1rem;
}

.empty-state {
  display: grid;
  gap: 0.9rem;
}

.panel.narrow {
  max-width: 640px;
  margin: 2rem auto;
}

.auth-panel {
  display: grid;
  gap: 1rem;
  max-width: 520px;
  margin: 2rem auto;
}

.auth-panel.empty-state {
  gap: 0.9rem;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  color: var(--brand-2);
  font-weight: 800;
}

.notice {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
}

.notice.success {
  border-color: rgba(17, 122, 69, 0.35);
  color: var(--success);
}

.notice.error {
  border-color: rgba(180, 35, 24, 0.35);
  color: var(--danger);
}

.notice ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.admin-grid {
  display: grid;
  gap: 1rem;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  min-width: 0;
}

.editor-sidebar {
  display: grid;
  align-content: start;
  gap: 0.35rem;
}

.editor-mobile-nav {
  display: none;
}

.editor-desktop-nav {
  display: grid;
  align-content: start;
  gap: 0.35rem;
}

.editor-sidebar-heading {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  color: var(--brand);
  font-weight: 850;
}

.editor-nav-steps {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  width: 100%;
  list-style: none;
}

.editor-nav-steps li {
  width: 100%;
}

.editor-nav-link {
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: 6px;
  color: var(--brand);
  padding: 0.5rem 0.6rem;
  font-weight: 750;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-nav-link:hover,
.editor-nav-link:focus-visible,
.editor-nav-link.is-active {
  background: #eefaf6;
}

.step-nav-icon {
  display: inline-grid;
  width: 1.2rem;
  place-items: center;
  margin-right: 0.15rem;
  color: var(--brand-2);
}

.step-type-heading {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  color: var(--brand);
  font-weight: 850;
}

.step-type-heading span,
.step-type-choice > span:first-child {
  display: inline-grid;
  width: 1.8rem;
  height: 1.8rem;
  place-items: center;
  border-radius: 50%;
  background: #eefaf6;
  color: var(--brand-2);
}

.step-type-dialog {
  width: min(40rem, calc(100% - 2rem));
  max-height: calc(100dvh - 1rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  color: inherit;
}

.step-type-dialog::backdrop {
  background: rgba(18, 32, 37, 0.46);
}

.step-type-dialog form {
  display: grid;
  gap: 0;
}

.step-type-dialog-heading {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  background: #fff;
  padding: 0.85rem 1rem;
}

.step-type-dialog-heading h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}

.step-type-dialog-heading .button {
  width: auto;
  flex: 0 0 auto;
}

.step-type-dialog-note {
  margin: 0;
  padding: 0.8rem 1rem 0.65rem;
}

.step-type-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem;
  padding: 0 1rem 1rem;
}

.step-type-choice {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--brand);
  padding: 0.75rem;
  text-align: left;
  font-weight: 800;
  cursor: pointer;
}

.step-type-choice > span:last-child {
  display: grid;
  gap: 0.2rem;
}

.step-type-choice small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
}

.step-type-choice:hover,
.step-type-choice:focus-visible {
  border-color: var(--brand-2);
  background: #eefaf6;
}

.app-main-editor .screen-title,
.editor-layout .form-pair {
  grid-template-columns: minmax(0, 1fr);
}

.editor-stack {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.approval-status-panel,
.approval-card,
.approval-login-form {
  padding: 1rem;
}

.approval-status-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.approval-status-panel h2,
.approval-card h2,
.approval-login-form h2 {
  margin-bottom: 0.35rem;
}

.approval-status-actions,
.approval-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.approval-feedback {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-left: 3px solid var(--brand-2);
  background: var(--surface-strong);
}

.approval-feedback p {
  margin: 0.25rem 0 0;
}

.approval-screen-title {
  align-items: center;
}

.approval-login-form {
  display: grid;
  gap: 1rem;
  width: min(32rem, 100%);
}

.approval-queue {
  display: grid;
  gap: 1rem;
}

.approval-card {
  display: grid;
  gap: 1rem;
}

.approval-card-summary {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 1rem;
}

.approval-card-summary img {
  width: 7rem;
  height: 7rem;
  border-radius: 8px;
  object-fit: cover;
}

.approval-review-form {
  display: grid;
  gap: 0.75rem;
}

/* The workspace deliberately presents one editing surface at a time. */
.editor-layout[data-editor-pane="base"] .editor-stack,
.editor-layout[data-editor-pane="add"] .editor-main-panel,
.editor-layout[data-editor-pane="step"] .editor-main-panel,
.editor-layout[data-editor-pane="add"] .approval-status-panel,
.editor-layout[data-editor-pane="step"] .approval-status-panel {
  display: none;
}

.editor-layout[data-editor-pane="add"] .editor-stack > :not(.add-step-form),
.editor-layout[data-editor-pane="step"] .editor-stack > :not(.route-steps-panel) {
  display: none;
}

.editor-layout[data-editor-pane="step"] .editor-step-item:not(.is-selected) {
  display: none;
}

.editor-layout[data-editor-pane="step"] .editor-step-item.is-selected .editor-step-summary {
  cursor: default;
}

#adventure-details,
#add-step,
.editor-step-item {
  scroll-margin-top: 5rem;
}

.editor-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.admin-form {
  display: grid;
  gap: 0.9rem;
  min-width: 0;
}

.form-validation-summary {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(180, 35, 24, 0.28);
  border-radius: 8px;
  background: #fff1f0;
  color: var(--danger);
}

.form-validation-summary strong {
  color: var(--danger);
}

.form-validation-summary ul {
  margin: 0;
  padding-left: 1.15rem;
}

.route-health {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
  order: 1;
}

.route-steps-panel {
  order: 2;
}

.add-step-form {
  order: 3;
}

.route-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0;
}

.route-stats div {
  min-width: 0;
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fbfc;
}

.route-stats dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.route-stats dd {
  margin: 0.1rem 0 0;
  color: var(--brand);
  font-size: 1.35rem;
  font-weight: 850;
}

.ability-grid,
.step-manage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.ability-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 0.35rem 0.55rem;
  font-size: 0.84rem;
  font-weight: 800;
}

.ability-pill.is-used {
  border-color: rgba(15, 118, 110, 0.32);
  background: #eefaf6;
  color: var(--brand);
}

.ability-pill strong {
  color: var(--brand-2);
}

.map-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0.85rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

fieldset.map-fieldset {
  display: grid;
  gap: 0.75rem;
}

.map-fieldset summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--brand);
  cursor: pointer;
  font-weight: 800;
}

.map-fieldset-collapsible summary::after {
  content: '⌄';
  margin-left: auto;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  transition: transform 160ms ease;
}

.map-fieldset-collapsible[open] summary::after {
  transform: rotate(180deg);
}

.map-fieldset-collapsible > :not(summary) {
  margin-top: 0.75rem;
}

.map-fieldset legend {
  padding: 0 0.25rem;
  color: var(--brand);
  font-weight: 800;
}

.form-pair {
  display: grid;
  gap: 0.75rem;
}

.form-field {
  display: grid;
  align-content: start;
  gap: 0.4rem;
  min-width: 0;
}

.arrival-target-fields {
  display: grid;
  gap: 0.75rem;
}

.admin-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.adventure-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
}

.adventure-tile {
  display: grid;
  overflow: hidden;
  min-height: 13rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.adventure-tile:hover,
.adventure-tile:focus-visible {
  border-color: var(--brand-2);
  box-shadow: 0 8px 22px rgba(15, 118, 110, 0.16);
  transform: translateY(-2px);
}

.adventure-tile img {
  width: 100%;
  height: 8rem;
  object-fit: cover;
  background: var(--surface-strong);
}

.adventure-tile > span {
  display: grid;
  align-content: center;
  gap: 0.3rem;
  padding: 0.85rem;
}

.adventure-tile strong {
  color: var(--brand);
  font-size: 1.05rem;
}

.adventure-tile small {
  color: var(--muted);
}

.adventure-create-tile {
  place-items: center;
  border-style: dashed;
  border-width: 2px;
  background: color-mix(in srgb, var(--surface) 88%, var(--brand) 12%);
  text-align: center;
}

.adventure-create-tile > span {
  justify-items: center;
}

.adventure-create-icon {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 2rem;
  font-weight: 500;
  line-height: 1;
}

.admin-item {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.admin-item img {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-strong);
}

.admin-item h3 {
  margin: 0.15rem 0;
  color: var(--brand);
}

.session-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 750;
}

.rating-panel,
.comments-panel {
  display: grid;
  gap: 1rem;
}

.rating-form,
.comment-form {
  display: grid;
  gap: 0.75rem;
}

.star-rating {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.star-rating legend {
  color: var(--brand);
  font-weight: 800;
}

.star-rating-options {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 0.25rem;
  width: fit-content;
}

.star-rating-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.star-rating-options label {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: #aab8bc;
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.star-rating-options label:hover,
.star-rating-options label:hover ~ label,
.star-rating-options input:checked ~ label {
  border-color: rgba(217, 119, 6, 0.48);
  background: #fff7ed;
  color: var(--accent);
}

.star-rating-options input:focus-visible + label {
  outline: 3px solid rgba(15, 118, 110, 0.3);
  outline-offset: 2px;
}

.star-rating-options label:hover {
  transform: translateY(-1px);
}

.comment-list {
  display: grid;
  gap: 0.75rem;
}

.comment-item {
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.editor-step-list {
  display: grid;
  gap: 0.75rem;
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
}

.editor-step-list li {
  display: grid;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.editor-step-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  padding: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.editor-step-summary > span:first-child {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.editor-step-summary > span:last-child {
  flex: 0 0 auto;
  color: var(--brand-2);
  font-size: 0.86rem;
  font-weight: 850;
}

.editor-step-summary h3 {
  margin: 0;
  color: var(--brand);
  font-size: 1.05rem;
  line-height: 1.2;
}

.editor-step-summary > span:first-child > span:last-child {
  color: var(--muted);
}

.step-edit-form,
.step-manage-actions {
  margin: 0 0.85rem 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.step-manage-actions form {
  margin: 0;
}

@media (min-width: 640px) {
  .app-main {
    padding: 1.5rem 1.25rem 3rem;
  }

  .screen-title {
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 24rem);
    align-items: end;
  }

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

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

  .adventure-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .adventure-card {
    grid-template-columns: 1fr;
  }

  .card-media img {
    height: 10.5rem;
  }

  .purchase-panel {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .form-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .arrival-target-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 919px) {
  .editor-layout {
    gap: 0.75rem;
  }

  .editor-sidebar {
    position: sticky;
    z-index: 9;
    top: calc(4rem + var(--safe-top));
    overflow: visible;
    padding: 0.4rem;
  }

  .editor-desktop-nav {
    display: none;
  }

  .editor-mobile-nav {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.3rem;
  }

  .editor-mobile-nav-link {
    display: flex;
    min-width: 0;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    overflow: hidden;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--brand);
    padding: 0.45rem 0.3rem;
    font-size: 0.88rem;
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
  }

  .editor-mobile-nav-link:hover,
  .editor-mobile-nav-link:focus-visible,
  .editor-mobile-nav-link.is-active,
  .editor-mobile-step-picker[open] > .editor-mobile-nav-link {
    background: #eefaf6;
  }

  .editor-mobile-nav-link.is-disabled {
    color: var(--muted);
    cursor: default;
  }

  .editor-mobile-nav-link strong {
    display: inline-grid;
    min-width: 1.25rem;
    height: 1.25rem;
    place-items: center;
    border-radius: 999px;
    background: #dff5ee;
    color: var(--brand-2);
    font-size: 0.72rem;
  }

  .editor-mobile-step-picker {
    min-width: 0;
  }

  .editor-mobile-step-picker > summary {
    list-style: none;
  }

  .editor-mobile-step-picker > summary::-webkit-details-marker {
    display: none;
  }

  .editor-mobile-step-list {
    position: absolute;
    z-index: 20;
    top: calc(100% + 0.45rem);
    right: 0;
    left: 0;
    display: grid;
    max-height: calc(100dvh - 9rem - var(--safe-top) - var(--safe-bottom));
    gap: 0.2rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(10, 44, 50, 0.2);
    padding: 0.45rem;
    list-style: none;
  }

  .editor-mobile-step-list .editor-nav-link {
    min-height: 2.75rem;
    padding: 0.65rem;
  }

  .info-tooltip-content {
    position: fixed;
    right: 1rem;
    bottom: calc(1rem + var(--safe-bottom));
    left: 1rem;
    width: auto;
    max-height: min(16rem, calc(100dvh - 6rem));
    overflow: auto;
  }

  #adventure-details,
  #add-step,
  .editor-step-item {
    scroll-margin-top: calc(8rem + var(--safe-top));
  }

  .editor-main-panel > .editor-actions,
  .add-step-form > .editor-actions,
  .step-edit-form > .editor-actions {
    position: sticky;
    z-index: 6;
    bottom: 0;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -8px 18px rgba(10, 44, 50, 0.08);
    padding: 0.35rem 0 calc(0.35rem + var(--safe-bottom));
  }

  .editor-main-panel > .editor-actions .button,
  .add-step-form > .editor-actions .button,
  .step-edit-form > .editor-actions .button {
    width: 100%;
    min-height: 2.75rem;
    padding-block: 0.55rem;
  }
}

@media (min-width: 920px) {
  .detail {
    grid-template-columns: minmax(20rem, 0.9fr) minmax(0, 1.1fr);
    align-items: start;
  }

  .detail-media {
    position: sticky;
    top: 5rem;
    margin: 0;
    border-radius: 8px;
  }

  .admin-grid {
    grid-template-columns: minmax(22rem, 0.9fr) minmax(0, 1.1fr);
    align-items: start;
  }

  .editor-layout {
    grid-template-columns: minmax(13rem, 17rem) minmax(0, 1fr);
    align-items: start;
  }

  .editor-sidebar {
    position: sticky;
    top: 5rem;
    max-height: calc(100dvh - 6rem);
    overflow: auto;
  }

  .editor-main-panel,
  .approval-status-panel,
  .editor-stack {
    grid-column: 2;
  }
}

@media (max-width: 639px) {
  .approval-status-panel,
  .approval-card-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .approval-status-panel {
    display: grid;
  }

  .approval-card-summary img {
    width: 100%;
    height: 10rem;
  }

  .detail-primary-action .purchase-actions {
    position: sticky;
    z-index: 4;
    bottom: calc(0.5rem + var(--safe-bottom));
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 26px rgba(16, 33, 37, 0.16);
  }

  .app-header {
    gap: 0.7rem;
    justify-content: flex-start;
    background: #fff;
    backdrop-filter: none;
  }

  .step-type-dialog {
    width: calc(100% - 1rem);
  }

  .step-type-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .step-type-choice {
    min-height: 5.25rem;
    justify-content: flex-start;
    gap: 0.4rem;
    padding: 0.45rem;
    font-size: 0.84rem;
    line-height: 1.15;
    text-align: left;
  }

  .step-type-choice > span:first-child {
    flex: 0 0 auto;
  }

  .app-main-editor .button.compact {
    min-height: 2.75rem;
  }

  .mobile-menu-toggle {
    display: grid;
    width: 2.4rem;
    height: 2.4rem;
    place-items: center;
    border: 1px solid var(--border);
    z-index: 12;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: 1.25rem;
    box-shadow: 0 5px 14px rgba(11, 47, 53, 0.2);
  }

  .mobile-menu-backdrop {
    position: fixed;
    z-index: 10;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(9, 27, 31, 0.42);
    opacity: 0;
    pointer-events: none;
  }

  .navigation-drawer {
    position: fixed;
    z-index: 11;
    top: 0;
    bottom: auto;
    left: 0;
    display: flex;
    width: min(17rem, calc(100vw - 4rem));
    height: 100vh;
    height: 100dvh;
    flex-direction: column;
    gap: 1.25rem;
    padding: calc(5.25rem + var(--safe-top)) 1rem calc(1rem + var(--safe-bottom));
    background-color: var(--brand);
    background-image: linear-gradient(160deg, #103c43 0%, var(--brand) 58%, #08242a 100%);
    box-shadow: 16px 0 42px rgba(9, 27, 31, 0.28);
    transform: translateX(-105%);
  }

  /* Transitions are enabled only for an intentional menu toggle. This keeps
     the desktop-to-mobile breakpoint from sliding the newly positioned drawer. */
  .app-header.mobile-menu-animating .navigation-drawer {
    transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .app-header.mobile-menu-animating .mobile-menu-backdrop {
    transition: opacity 180ms ease;
  }

  body.mobile-menu-animating .app-main {
    transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .app-header.mobile-menu-open .navigation-drawer {
    transform: translateX(0);
  }

  .app-header.mobile-menu-open .mobile-menu-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  body.mobile-menu-active .app-main {
    transform: translateX(0.8rem);
  }

  .top-nav {
    display: grid;
    gap: 0.35rem;
    padding: 0;
    background: transparent;
  }

  .top-nav a {
    border: 1px solid transparent;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.82);
    padding: 0.8rem 0.85rem;
    font-size: 1rem;
  }

  .top-nav a[aria-current="page"] {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.13);
    color: #fff;
    box-shadow: none;
  }

  .account-nav {
    margin-top: auto;
    display: block;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    padding-top: 1rem;
    color: #fff;
  }

  .account-menu {
    position: static;
  }

  .account-menu summary {
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    padding: 0.55rem;
  }

  .account-menu-name::after {
    color: rgba(255, 255, 255, 0.7);
  }

  .account-menu-panel {
    position: static;
    min-width: 0;
    margin-top: 0.45rem;
    border: 0;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.12);
    box-shadow: none;
    padding: 0.35rem;
  }

  .account-menu-panel > a,
  .account-menu-panel button {
    width: 100%;
    color: rgba(255, 255, 255, 0.88);
    padding: 0.7rem;
  }

  .account-menu-panel > a:hover,
  .account-menu-panel > a[aria-current="page"],
  .account-menu-panel button:hover {
    background: rgba(255, 255, 255, 0.14);
  }

}

@media (max-width: 420px) {
  .app-header {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .route-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .language-switcher {
    order: 3;
  }

  .screen-title h1,
  .detail-heading h1,
  .panel h1 {
    font-size: 1.65rem;
  }

  .adventure-card {
    grid-template-columns: 6.25rem minmax(0, 1fr);
  }

  .card-media img {
    min-height: 8rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .detail-heading {
    display: grid;
  }

  .button {
    width: 100%;
  }

  .library-card-actions form {
    width: 100%;
  }

  .library-card-actions form .button {
    width: 100%;
  }

  .editor-step-list li {
    grid-template-columns: 1fr;
  }
}
