/* ── Tokens ───────────────────────────────────────────────────────── */

:root {
  color-scheme: light;
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --bg: #e8eae7;
  --panel: #ffffff;
  --panel-sunk: #f3f4f2;
  --raised: #ffffff;
  --line: #e3e6e2;
  --line-strong: #cdd2cc;
  --text: #192026;
  --text-2: #4b5560;
  --text-3: #79838c;
  --accent: #1f3b63;
  --accent-hover: #162d4d;
  --accent-soft: #e7edf6;
  --on-accent: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --focus: #2f6fdd;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-2: 0 10px 28px rgba(16, 24, 40, 0.16), 0 2px 6px rgba(16, 24, 40, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0e1114;
    --panel: #161a1e;
    --panel-sunk: #1d2227;
    --raised: #2a3037;
    --line: #262c32;
    --line-strong: #39414a;
    --text: #e7eaed;
    --text-2: #b1bac3;
    --text-3: #858f99;
    --accent: #8db3ea;
    --accent-hover: #a8c5ef;
    --accent-soft: #1d2a3b;
    --on-accent: #0c1522;
    --danger: #f97066;
    --danger-soft: #3a1c1a;
    --focus: #7aa7f0;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0e1114;
  --panel: #161a1e;
  --panel-sunk: #1d2227;
  --raised: #2a3037;
  --line: #262c32;
  --line-strong: #39414a;
  --text: #e7eaed;
  --text-2: #b1bac3;
  --text-3: #858f99;
  --accent: #8db3ea;
  --accent-hover: #a8c5ef;
  --accent-soft: #1d2a3b;
  --on-accent: #0c1522;
  --danger: #f97066;
  --danger-soft: #3a1c1a;
  --focus: #7aa7f0;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.5);
}

/* ── Base ─────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font: 14px/1.45 var(--font-ui);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

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

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ── Layout ───────────────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: 384px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 14px; }
/* Link back to the hosting site's home page; deploy scripts add it (see deploy/usaf-survy.sh). */
.home-link { flex: none; font-size: 12.5px; font-weight: 600; color: var(--text-2); text-decoration: none; }
.home-link:hover { color: var(--accent); }

.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-mark rect { fill: #1f3b63; }
.brand-mark path { fill: #ffcc01; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand-tag { font-size: 12px; color: var(--text-3); }

/* Viewing someone else's shared map: read-only */
[data-view-only] { display: none; }
body.is-viewing [data-view-only] { display: inline; }
body.is-viewing :is([data-edit-only], #add-assignment, .a-actions, #assignment-form, #assignment-empty, .honor-open, .honor-form, .honor-remove) {
  display: none !important;
}
.viewer-bar {
  margin: 0 12px 10px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: 12.5px;
}
.viewer-bar p { margin: 0 0 8px; color: var(--text-2); }
.viewer-bar strong { color: var(--text); }
.viewer-bar .btn-row { margin: 0; }

.backup-bar {
  margin: 0 12px 10px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, #d18b00 45%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, #d18b00 10%, var(--panel));
  font-size: 12.5px;
}
.backup-bar p { margin: 0 0 8px; color: var(--text-2); }
.backup-bar strong { color: var(--text); }
.backup-bar .btn-row { margin: 0; }

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  flex: 1 1 auto;
  padding: 10px 6px 11px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tabs button:hover { color: var(--text-2); }
.tabs button[aria-selected='true'] { color: var(--text); border-bottom-color: var(--accent); }
.tabs button:focus-visible { outline-offset: -2px; border-radius: 6px 6px 0 0; }

.panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

.panel-foot {
  padding: 10px 20px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--text-3);
}

.section { padding: 18px 20px 8px; border-bottom: 1px solid var(--line); }
.section:last-child { border-bottom: 0; }
.section-title {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-head .section-title { margin: 0; }

.count {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--panel-sunk);
  color: var(--text-2);
  font-size: 11px;
  letter-spacing: 0;
  vertical-align: 1px;
}
.count:empty { display: none; }

.hint { margin: 0 0 12px; font-size: 12.5px; color: var(--text-3); }

/* ── Form controls ────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span, .field > label, .field-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field em { font-style: normal; font-weight: 400; color: var(--text-3); }

.field-inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.field-inline select { width: auto; min-width: 58%; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

input:not([type]), input[type='text'], input[type='month'], select, textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  font-size: 13.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 56px; }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
input:not([type]):focus, input[type='text']:focus, input[type='month']:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent);
}
input:disabled { opacity: 0.5; }

select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 8l4 4 4-4' fill='none' stroke='%237a848d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  cursor: pointer;
}

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.a-form .check { margin: -2px 0 12px; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin: 2px 0 14px; }
.check:has(input:disabled) { opacity: 0.45; cursor: default; }

.range-field > span { display: flex; justify-content: space-between; }
.range-field output { font-weight: 500; color: var(--text-3); font-variant-numeric: tabular-nums; }
input[type='range'] { width: 100%; margin: 4px 0 0; accent-color: var(--accent); }

fieldset.plain { min-width: 0; margin: 0; padding: 0; border: 0; transition: opacity 0.15s; }
fieldset.plain:disabled { opacity: 0.45; }

.segmented {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
  padding: 3px;
  border-radius: 10px;
  background: var(--panel-sunk);
}
.segmented label { position: relative; flex: 1; cursor: pointer; }
.segmented input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.segmented span {
  display: block;
  padding: 6px 6px;
  border-radius: 7px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span { background: var(--raised); color: var(--text); box-shadow: var(--shadow-1); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 0; }
.segmented-sm { margin-bottom: 0; min-width: 58%; }

/* Basemap tiles */
.tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 10px; margin-bottom: 14px; }
.tile-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  color: var(--text-2);
  cursor: pointer;
}
.tile-choice input { position: absolute; opacity: 0; pointer-events: none; }
.tile-choice img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 2px solid transparent;
  border-radius: 9px;
  background: var(--panel-sunk);
  box-shadow: 0 0 0 1px var(--line);
  transition: border-color 0.15s, transform 0.15s;
}
.tile-choice:hover img { transform: translateY(-1px); }
.tile-choice input:checked ~ img { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tile-choice input:checked ~ span { color: var(--text); }
.tile-choice input:focus-visible ~ img { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Palette swatches */
.swatch-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px 4px; margin-bottom: 14px; }
.swatch-choice { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.swatch-choice input { position: absolute; opacity: 0; pointer-events: none; }
.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--a) 0 50%, var(--b) 50% 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
  transition: box-shadow 0.15s;
}
.swatch-auto { position: relative; }
.swatch-auto::after {
  content: 'A';
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--panel);
  box-shadow: 0 0 0 1px var(--line-strong);
  font-size: 9px;
  font-weight: 700;
  color: var(--text-2);
}
.swatch-choice input:checked + .swatch { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14), 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.swatch-choice input:focus-visible + .swatch { outline: 2px solid var(--focus); outline-offset: 5px; }
.swatch-label { font-size: 10.5px; line-height: 1.2; text-align: center; color: var(--text-2); }

.color-row { display: flex; gap: 18px; margin-bottom: 14px; }
.color-field { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.color-field input {
  width: 34px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
}
.color-field input::-webkit-color-swatch-wrapper { padding: 3px; }
.color-field input::-webkit-color-swatch { border: 0; border-radius: 5px; }
.color-field input::-moz-color-swatch { border: 0; border-radius: 5px; }

/* ── Buttons ──────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; }
.btn-block { width: 100%; }

.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--panel); border-color: var(--line-strong); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--panel-sunk); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-sunk); color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger:hover { background: var(--danger-soft); }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.section > .btn-block { margin-bottom: 12px; }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
  border: 0;
  background: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.link-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}
.icon-btn:hover { background: var(--panel); color: var(--text); }
.icon-btn[data-action='delete']:hover { color: var(--danger); }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.share-output { margin: -4px 0 12px; font-size: 12px !important; color: var(--text-2); }

/* ── Assignment form ──────────────────────────────────────────────── */

.a-form {
  margin-bottom: 14px;
  padding: 14px 14px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-sunk);
}
.a-form-title { margin: 0 0 12px; font-size: 14px; font-weight: 700; }
.form-error { margin: 0 0 10px; font-size: 12.5px; font-weight: 500; color: var(--danger); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

#loc-search .link-btn { margin-top: 7px; }

.combo { position: relative; }
.combo-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 330px;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-2);
}
.combo-heading {
  padding: 8px 10px 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.combo-opt { display: flex; align-items: flex-start; gap: 10px; padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.combo-opt:hover, .combo-opt[aria-selected='true'] { background: var(--accent-soft); }
.combo-opt strong { display: block; font-size: 13px; font-weight: 600; }
.combo-opt small { display: block; margin-top: 1px; font-size: 11.5px; color: var(--text-3); }
.combo-action { margin-top: 4px; padding-top: 9px; border-top: 1px solid var(--line); border-radius: 0 0 7px 7px; color: var(--accent); }
.combo-action span { font-weight: 600; font-size: 13px; }
.combo-action svg { flex: none; width: 18px; height: 18px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.combo-note { padding: 8px 10px; font-size: 12px; color: var(--text-3); }
.combo-note.is-error { color: var(--danger); }

.loc-chosen {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
}
.loc-chosen div { flex: 1; min-width: 0; }
.loc-chosen strong { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc-chosen small { display: block; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.loc-pin { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ── Assignment list ──────────────────────────────────────────────── */

.a-list { display: flex; flex-direction: column; gap: 2px; margin: 0 -8px 10px; padding: 0; list-style: none; }
.a-item { position: relative; display: flex; align-items: flex-start; border-radius: 10px; transition: background 0.12s; }
.a-item:hover { background: var(--panel-sunk); }
.a-item.is-editing { background: var(--accent-soft); }
.a-item.is-excursion { margin-left: 24px; }
.a-item.is-excursion::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -11px;
  width: 9px;
  height: 25px;
  border-left: 1.5px dashed var(--line-strong);
  border-bottom: 1.5px dashed var(--line-strong);
  border-bottom-left-radius: 7px;
}

.a-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 4px 9px 8px;
  border: 0;
  border-radius: 10px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.a-num {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  margin-top: 1px;
  padding: 0 5px;
  border-radius: 12px;
  background: var(--c);
  color: var(--t);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.a-body { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.a-name, .a-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-name { font-size: 13.5px; font-weight: 600; }
.a-sub { font-size: 12.5px; color: var(--text-2); }
.a-meta { font-size: 12px; color: var(--text-3); }
.a-meta em { font-style: normal; }
.a-type { color: var(--text-2); white-space: nowrap; }
.a-type::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--tc);
  vertical-align: 1px;
}
.a-actions { display: flex; padding: 6px 4px 0 0; }
.a-honors { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.a-honors .honor-icon { width: 12px; height: 12px; margin: 0; }

.music-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.music-name { overflow: hidden; font-size: 12.5px; color: var(--text-2); text-overflow: ellipsis; white-space: nowrap; }
.video-captions { margin-bottom: 12px; }
.print-summary { margin-top: -4px; }
.print-qr-check { margin-bottom: 10px; }
.print-qr #print-qr-url { margin: -4px 0 8px; }

.promo-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 0; padding: 0; list-style: none; }
.promo-list:empty { display: none; }
.promo-row { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.1fr) auto; align-items: center; gap: 6px; }
.promo-arrow { color: var(--text-3); font-weight: 600; }
#add-promotion { margin-top: 7px; }

.form-honors {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 12px;
  padding: 9px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text-2);
  font-size: 12.5px;
}
.form-honors .link-btn { flex: none; }

/* Decorations tab */
.hp-summary { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 10px; }
.hp-stat { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-2); }
.hp-stat strong { color: var(--text); font-variant-numeric: tabular-nums; }
.hp-title { display: flex; align-items: center; gap: 7px; }
.hp-list { display: flex; flex-direction: column; gap: 1px; margin: 0 -8px 10px; padding: 0; list-style: none; }
.hp-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.hp-row:hover { background: var(--panel-sunk); }
.hp-text { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text); }
.hp-ribbon { flex: none; width: auto; height: 11px; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.3); }
.hp-meta { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; color: var(--text-3); }
.hp-num {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--c);
  color: var(--t);
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.empty.hp-empty .honor-icon { width: 40px; height: 40px; fill: currentColor; stroke: none; }

.empty { padding: 18px 8px 18px; text-align: center; color: var(--text-2); }
.empty svg { width: 54px; height: 54px; fill: none; stroke: var(--text-3); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.empty p { margin: 8px 0 16px; font-size: 13px; }
.empty strong { color: var(--text); }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* ── Stage ────────────────────────────────────────────────────────── */

.stage-area { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.stage-toolbar { display: flex; align-items: center; gap: 4px; padding: 10px 16px; }
.stage-toolbar .btn-ghost:hover:not(:disabled) { background: var(--panel); }
.toolbar-spacer { flex: 1; }
.toolbar-brand { display: none; font-weight: 700; margin-right: 6px; }
.only-narrow { display: none; }
#play-journey .ico-stop, #play-journey.is-playing .ico-play { display: none; }
#play-journey.is-playing .ico-stop { display: block; }
#play-journey svg path, #play-journey svg rect { fill: currentColor; stroke: none; }

.stage-wrap {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0 16px 16px;
}

/* Poster colors follow the basemap, not the UI theme, so exports look the same everywhere. */
.stage {
  --card-bg: rgba(255, 255, 255, 0.94);
  --card-text: #161a1e;
  --card-muted: #5b6670;
  --card-line: rgba(20, 25, 30, 0.1);
  --card-shadow: 0 4px 18px rgba(16, 24, 40, 0.16);
  --gutter: 16px;

  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  background: #dfe3e6;
  box-shadow: var(--shadow-1);
  container-type: size;
  font-family: var(--font-ui);
}
.stage.is-framed { box-shadow: var(--shadow-2); }
.stage[data-dark='true'] {
  --card-bg: rgba(16, 19, 23, 0.88);
  --card-text: #f1f3f5;
  --card-muted: #a7b1bb;
  --card-line: rgba(255, 255, 255, 0.12);
  --card-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  background: #1a1e22;
}

.map { position: absolute; inset: 0; }

/* Title block */
.title-block {
  position: absolute;
  z-index: 1000;
  top: var(--gutter);
  left: var(--gutter);
  width: max-content;
  max-width: min(540px, calc(100% - 96px));
  overflow: hidden;
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--card-text);
  box-shadow: var(--card-shadow);
  --eyebrow: var(--p);
}
.stage[data-dark='true'] .title-block { --eyebrow: var(--s); }

.title-ribbon { display: grid; grid-template-columns: 2fr 1fr 2fr; height: 6px; }
.title-ribbon i { background: var(--p); }
.title-ribbon i:nth-child(2) { background: var(--s); }

.title-main { padding: 14px 18px 0; }
.title-main:last-child { padding-bottom: 16px; }
.title-eyebrow { margin-bottom: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--eyebrow); }
.title-name {
  margin: 0;
  font-family: var(--title-font);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0.005em;
  font-synthesis: none;
  overflow-wrap: anywhere;
}
.title-name .is-placeholder { opacity: 0.4; }
.title-sub { margin-top: 6px; font-size: 13px; color: var(--card-muted); }

.title-stats {
  display: flex;
  flex-wrap: nowrap;
  row-gap: 8px;
  margin: 14px 0 0;
  padding: 11px 18px 14px;
  border-top: 1px solid var(--card-line);
}
.title-stats div { display: flex; flex-direction: column-reverse; padding-right: 14px; margin-right: 14px; border-right: 1px solid var(--card-line); }
.title-stats div:last-child { padding-right: 0; margin-right: 0; border-right: 0; }
.title-stats dd { margin: 0; font-family: var(--title-font); font-size: 22px; font-weight: 700; line-height: 1.1; font-synthesis: none; font-variant-numeric: tabular-nums; }
.title-stats dt { margin-top: 3px; font-size: 9.5px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--card-muted); }

/* Banner variant: a full-width band in the primary color */
.title-block[data-variant='banner'] {
  top: 0;
  left: 0;
  right: 0;
  width: auto;
  max-width: none;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 28px;
  padding: 16px 22px 20px;
  border-radius: 0;
  background: var(--p);
  color: var(--on-p);
  --card-muted: color-mix(in srgb, var(--on-p) 72%, transparent);
  --card-line: color-mix(in srgb, var(--on-p) 22%, transparent);
  --eyebrow: var(--s);
}
.title-block[data-variant='banner'] .title-ribbon { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; }
.title-block[data-variant='banner'] .title-ribbon i { background: var(--s); }
.title-block[data-variant='banner'] .title-ribbon i:nth-child(2) { background: var(--on-p); }
.title-block[data-variant='banner'] .title-main { padding: 0; }
.title-block[data-variant='banner'] .title-stats { margin: 0; padding: 0; border: 0; }
.stage[data-title='banner'] .leaflet-top { top: var(--title-h, 0px); }

/* Legend + timeline stack along the bottom edge */
/* Decorations card: a column on the right of wide frames, a block above the legend on narrower ones */
.honors-card {
  position: absolute;
  z-index: 1000;
  right: var(--gutter);
  width: 290px;
  overflow: hidden;
  padding: 11px 14px 10px;
  border-top: 3px solid var(--p);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--card-text);
  box-shadow: var(--card-shadow);
}
.stage[data-honors='side'] .honors-card { top: var(--gutter); }
.stage[data-honors='side'][data-title='banner'] .honors-card { top: calc(var(--title-h, 0px) + var(--gutter)); }
.stage[data-honors='side'] .honors-card.is-wide { width: 470px; }
.stage[data-honors='side'] .stage-bottom { right: calc(var(--honors-w, 290px) + 2 * var(--gutter)); }
.stage[data-honors='side'][data-title='card'] .title-block { max-width: min(540px, calc(100% - var(--honors-w, 290px) - 3 * var(--gutter))); }
.stage[data-honors='side'] .leaflet-top.leaflet-right { right: calc(var(--honors-w, 290px) + var(--gutter)); }
.stage[data-honors='bottom'] .honors-card { left: var(--gutter); width: auto; bottom: calc(var(--stack-h, 0px) + 8px); }
.stage[data-honors='bottom'] .hc-groups { columns: 190px; column-gap: 16px; }
.hc-title { margin-bottom: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--card-muted); }
.hc-group + .hc-group { margin-top: 8px; }
.hc-group-title { margin: 0 0 3px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--card-muted); }
.hc-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  padding: 2.5px 0;
  font-size: 12px;
  line-height: 1.3;
  break-inside: avoid;
}
.hc-mark { display: flex; justify-content: center; }
.hc-ribbon { display: block; width: 32px; height: auto; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.35); }
.hc-mark .honor-icon { width: 13px; height: 13px; margin: 0; }
.hc-when { display: flex; align-items: center; gap: 5px; color: var(--card-muted); font-size: 10.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.honors-card.is-compact .hc-year { display: none; }
.hc-ranks { display: flex; align-items: flex-start; gap: 8px; padding: 2px 0 2px 9px; font-size: 11.5px; font-weight: 600; line-height: 1.45; }
.hc-ranks .honor-icon { width: 13px; height: 13px; margin-top: 2px; }
.hc-ranks i { margin: 0 1px; font-style: normal; color: var(--card-muted); font-weight: 400; }
.hc-num {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--c);
  color: var(--t);
  font-size: 9.5px;
  font-weight: 700;
}
.honors-card.is-compact { padding: 9px 12px 8px; }
.honors-card.is-compact .hc-row { padding: 1px 0; font-size: 11px; line-height: 1.25; }
.honors-card.is-compact .hc-group + .hc-group { margin-top: 5px; }
.honors-card.is-wide .hc-groups { columns: 210px; column-gap: 18px; }
.honors-card.is-tiny .hc-row { grid-template-columns: 26px minmax(0, 1fr) auto; column-gap: 6px; font-size: 10px; }
.honors-card.is-tiny .hc-ribbon { width: 26px; }
.honors-card.is-tiny .hc-num { min-width: 14px; height: 14px; font-size: 8.5px; }
.honors-card .is-pending { visibility: hidden; }
.honors-card.is-clipped { mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); }

/* Caption shown at each stop during Play journey and in the video */
.stage-caption {
  position: absolute;
  z-index: 1001;
  left: var(--gutter);
  bottom: var(--caption-bottom, 140px);
  width: max-content;
  max-width: min(440px, calc(100% - 2 * var(--gutter)));
  padding: 11px 14px 12px;
  border-left: 4px solid var(--p);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--card-text);
  box-shadow: var(--card-shadow);
  animation: caption-in 0.35s ease-out;
}
@keyframes caption-in { from { opacity: 0; transform: translateY(6px); } }
.cap-head { display: flex; align-items: center; gap: 10px; }
.cap-num {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 13px;
  background: var(--c);
  color: var(--t);
  font-size: 12px;
  font-weight: 700;
}
.cap-name { font-family: var(--title-font); font-size: 20px; font-weight: 700; line-height: 1.1; font-synthesis: none; }
.cap-place { margin-top: 2px; font-size: 12px; color: var(--card-muted); }
.cap-line { margin-top: 6px; font-size: 12.5px; color: var(--card-muted); }
.cap-who { margin-top: 2px; color: var(--card-text); font-weight: 600; }
.cap-notes {
  display: -webkit-box;
  margin-top: 5px;
  overflow: hidden;
  font-size: 12px;
  font-style: italic;
  color: var(--card-muted);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cap-honors { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 8px; }
.cap-honors > span { display: flex; }
.cap-ribbon { display: block; width: auto; height: 11px; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.35); }
.cap-honors .honor-icon { width: 13px; height: 13px; margin: 0; }

/* A popup too tall to fit between the overlays gets the whole map (overlays always draw
   above the map, so they hide rather than dim); they fade back when it closes. */
.title-block, .stage-bottom, .honors-card { transition: opacity 0.2s, visibility 0.2s; }
.stage.is-popup-crowded :is(.title-block, .stage-bottom, .honors-card) { opacity: 0; visibility: hidden; }

.stage-bottom {
  position: absolute;
  z-index: 1000;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}

.legend, .timeline {
  pointer-events: auto;
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--card-text);
  box-shadow: var(--card-shadow);
}
/* Spare room on the right: the PNG exporter fixes box sizes, and its text can measure a hair wider. */
.legend { padding: 8px 4px 8px 12px; font-size: 12px; }
.legend ul { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0 12px 0 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px rgba(0, 0, 0, 0.12); }
.lg-line { width: 30px; height: 10px; overflow: visible; }
.lg-gradient span:first-child, .lg-gradient span:last-child { color: var(--card-muted); }
.lg-ramp { width: 90px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--a), var(--b)); }

.timeline { --bar-h: 20px; --bar-gap: 4px; align-self: stretch; padding: 10px 14px 5px; }
.tl-track { position: relative; height: calc(var(--lanes) * (var(--bar-h) + var(--bar-gap)) - var(--bar-gap)); }
.tl-tick { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--card-line); }
.tl-bar {
  position: absolute;
  top: calc(var(--lane) * (var(--bar-h) + var(--bar-gap)));
  display: flex;
  align-items: center;
  gap: 5px;
  height: var(--bar-h);
  min-width: 5px;
  padding: 0 6px 0 5px;
  overflow: hidden;
  border: 0;
  border-right: 2px solid transparent;
  border-radius: 5px;
  background: var(--c);
  background-clip: padding-box;
  color: var(--t);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}
.tl-bar.is-excursion {
  background: repeating-linear-gradient(-45deg, var(--c) 0 6px, color-mix(in srgb, var(--c) 72%, #fff) 6px 9px);
  background-clip: padding-box;
}
.tl-bar.is-active { box-shadow: inset 0 0 0 2px var(--card-text); }
.tl-bar:focus-visible { outline-offset: 1px; }
.tl-num { flex: none; font-variant-numeric: tabular-nums; opacity: 0.85; }
.tl-name { overflow: hidden; text-overflow: ellipsis; }
.tl-axis { position: relative; height: 15px; margin-top: 5px; font-size: 10px; color: var(--card-muted); font-variant-numeric: tabular-nums; }

/* Ribbon lane: each assignment's decorations as a small rack under its bar */
.tl-ribbons { position: relative; height: calc(var(--rows) * 12px - 3px); margin-top: 6px; }
.tl-rack {
  position: absolute;
  top: calc(var(--row) * 12px);
  display: flex;
  gap: 1px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.tl-ribbon { display: block; width: auto; height: 9px; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.35); transition: transform 0.12s; }
.tl-ribbon.is-unknown { display: grid; place-items: center; width: 33px; background: var(--card-line); }
.tl-ribbon.is-unknown .honor-icon { width: 8px; height: 8px; margin: 0; }
.tl-rack:hover .tl-ribbon, .tl-rack:focus-visible .tl-ribbon { transform: translateY(-1px); }

/* Rank lane: one segment per rank held, deepening in color with each promotion */
.tl-ranks { position: relative; height: 16px; margin-top: 7px; }
.tl-rank {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  min-width: 3px;
  padding: 0 5px;
  overflow: hidden;
  border-right: 2px solid transparent;
  border-radius: 4px;
  background: var(--c);
  background-clip: padding-box;
  box-shadow: inset 0 0 0 1px var(--card-line);
  color: var(--t);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}
.tl-rank span { overflow: hidden; text-overflow: ellipsis; }
.tl-year { position: absolute; top: 0; transform: translateX(3px); }

.stage-banner {
  position: absolute;
  z-index: 1100;
  top: calc(var(--title-h, 0px) + 14px);
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 10px 8px 16px;
  border-radius: 999px;
  background: #1b2026;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-2);
}
.stage[data-title='card'] .stage-banner { top: 14px; left: auto; right: 64px; transform: none; }
.stage-banner kbd { margin-left: 10px; padding: 2px 7px; border-radius: 5px; background: rgba(255, 255, 255, 0.16); font: 600 11px var(--font-ui); }

.stage-empty { position: absolute; z-index: 900; inset: 0; display: grid; place-items: center; pointer-events: none; }
.stage-empty p { margin: 0; padding: 10px 18px; border-radius: 999px; background: var(--card-bg); color: var(--card-muted); font-size: 13px; box-shadow: var(--card-shadow); }

/* ── Leaflet ──────────────────────────────────────────────────────── */

.leaflet-container { background: #dfe3e6; font-family: var(--font-ui); }
.stage[data-dark='true'] .leaflet-container { background: #1a1e22; }
.leaflet-tile-pane { filter: var(--tile-filter, none); }
.map.is-picking, .map.is-picking.leaflet-grab, .map.is-picking .leaflet-interactive { cursor: crosshair; }

.leaflet-control-zoom.leaflet-bar { overflow: hidden; border: 0; border-radius: 9px; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.22); }
.leaflet-control-zoom.leaflet-bar a { width: 32px; height: 32px; line-height: 31px; color: #2a3138; font-size: 18px; }
.leaflet-top.leaflet-right .leaflet-control { margin: 14px 14px 0 0; }
.leaflet-control-attribution { font-size: 9.5px; }
.leaflet-container .leaflet-control-attribution { background: rgba(255, 255, 255, 0.72); }

/* Markers (divIcons are zero-size anchors; the visible shape is centered on them) */
.mk-anchor { background: none; border: 0; }
.mk { position: absolute; left: 0; top: 0; display: grid; place-items: center; transform: translate(-50%, -50%); }
.mk-num {
  min-width: var(--d);
  height: var(--d);
  padding: 0 calc(var(--d) * 0.22);
  border: 2px solid #fff;
  border-radius: calc(var(--d) / 2);
  background: var(--c);
  color: var(--t);
  font: 700 calc(var(--d) * 0.44) / 1 var(--font-ui);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.32);
}
.mk-dot { width: var(--d); height: var(--d); border: 2.5px solid #fff; border-radius: 50%; background: var(--c); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
.mk-star { width: var(--d); height: var(--d); }
.mk-star svg { width: 100%; height: 100%; overflow: visible; fill: var(--c); stroke: #fff; stroke-width: 1.6; stroke-linejoin: round; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)); }
.mk-pin { width: var(--w); height: var(--h); transform: translate(-50%, -100%); }
.mk-pin svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; fill: var(--c); stroke: #fff; stroke-width: 2; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35)); }
.mk-pin b { position: absolute; top: 0; left: 0; right: 0; display: grid; place-items: center; height: var(--w); color: var(--t); font: 700 calc(var(--w) * 0.4) / 1 var(--font-ui); }

.is-pulse .mk::after {
  content: '';
  position: absolute;
  inset: -7px;
  border: 2px solid var(--c);
  border-radius: 50%;
  animation: marker-pulse 1.4s ease-out infinite;
  pointer-events: none;
}
.is-pulse .mk-pin::after { inset: -7px -7px auto; height: calc(var(--w) + 14px); }
@keyframes marker-pulse {
  from { opacity: 0.9; transform: scale(0.7); }
  to { opacity: 0; transform: scale(1.5); }
}

.leaflet-tooltip.mk-label {
  margin: 0;
  padding: 2px 7px;
  border: 0;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.92);
  color: #1a1f24;
  font: 600 12px/1.35 var(--font-ui);
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.leaflet-tooltip.mk-label::before { display: none; }
.leaflet-tooltip.mk-label.is-collided { visibility: hidden; }
.stage[data-dark='true'] .leaflet-tooltip.mk-label { background: rgba(18, 21, 25, 0.86); color: #f1f3f5; }

.route-line.is-animated { animation: route-dash 1.6s linear infinite; }
@keyframes route-dash { to { stroke-dashoffset: var(--dash-cycle, -20px); } }

.route-arrow-anchor { background: none; border: 0; }
.route-arrow { position: absolute; left: 0; top: 0; width: var(--s); height: var(--s); transform: translate(-50%, -50%) rotate(var(--r)); }
.route-arrow svg { display: block; width: 100%; height: 100%; overflow: visible; fill: var(--c); stroke: #fff; stroke-width: 1.3; stroke-linejoin: round; }

.map-popup .leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: var(--shadow-2); }
.map-popup .leaflet-popup-content { margin: 12px 14px; color: #1a1f24; font: 13px/1.4 var(--font-ui); }
.pop-item + .pop-item { margin-top: 10px; padding-top: 10px; border-top: 1px solid #e6e8ea; }
.pop-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.pop-num {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 700;
}
.pop-place, .pop-when { margin-top: 2px; font-size: 12px; color: #5b6670; }
.pop-who { margin-top: 5px; font-weight: 500; }
.pop-rank { display: flex; align-items: flex-start; gap: 6px; margin-top: 5px; font-weight: 600; }
.pop-rank .honor-icon { margin-top: 2px; }
.pop-notes { margin: 6px 0 0; font-size: 12px; color: #3c454e; }
.map-popup .pop-item:first-child .pop-head { padding-right: 14px; } /* clear the close button */

/* Decorations & accomplishments in popups (popups stay light in both themes) */
.honors {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 184px;
  margin: 8px 0 0;
  padding: 8px 0 0;
  overflow-y: auto;
  list-style: none;
  border-top: 1px solid #e6e8ea;
}
.honor { display: flex; align-items: flex-start; gap: 7px; font-size: 12.5px; line-height: 1.35; color: #252b31; }
.honor-icon { flex: none; width: 14px; height: 14px; margin-top: 1.5px; }
.honor-ribbon { flex: none; width: auto; height: 10px; margin-top: 4px; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.3); }
.honor-suggest li .honor-ribbon { margin-top: 0; }
.honor-text { flex: 1; min-width: 0; }
.honor-remove {
  flex: none;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: #8a939c;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
}
.honor:hover .honor-remove, .honor-remove:focus-visible { opacity: 1; }
.honor-remove:hover { background: #fdecea; color: #b42318; }
@media (hover: none) { .honor-remove { opacity: 1; } }

.honor-open {
  margin-top: 8px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: #1f3b63;
  font: 600 12px var(--font-ui);
  cursor: pointer;
}
.honor-open:hover { text-decoration: underline; }
.honor-form { margin-top: 8px; padding-top: 8px; border-top: 1px solid #e6e8ea; }
.honor-combo { position: relative; z-index: 2; } /* suggestions overlay the row below */
.honor-combo input {
  width: 100%;
  height: 32px;
  padding: 5px 8px;
  border: 1px solid #cdd2cc;
  border-radius: 7px;
  background: #fff;
  color: #192026;
  font: 12.5px var(--font-ui);
}
.honor-combo input::placeholder { color: #8a939c; }
.honor-combo input:focus { outline: none; border-color: #2f6fdd; box-shadow: 0 0 0 3px rgba(47, 111, 221, 0.2); }
.honor-suggest {
  position: absolute;
  z-index: 5;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 3px;
  list-style: none;
  border: 1px solid #cdd2cc;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.16);
}
.honor-suggest li { display: flex; align-items: center; gap: 7px; padding: 5px 7px; border-radius: 5px; color: #192026; font-size: 12.5px; cursor: pointer; }
.honor-suggest li .honor-icon { margin-top: 0; }
.honor-suggest li small { margin-left: auto; padding-left: 6px; color: #79838c; font-size: 11px; font-weight: 600; }
.honor-suggest li:hover, .honor-suggest li[aria-selected='true'] { background: #e7edf6; }
.honor-form-row { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; margin-top: 7px; }

/* While a PNG is captured, editing controls collapse so an open popup fits its content. */
.stage.is-exporting :is(.honor-open, .honor-form, .honor-remove, .leaflet-popup-close-button) { display: none !important; }
.honor-kinds { display: flex; gap: 2px; padding: 2px; border-radius: 7px; background: #f1f3f2; }
.honor-kind { position: relative; display: grid; place-items: center; width: 26px; height: 24px; border-radius: 5px; cursor: pointer; }
.honor-kind .honor-icon { margin: 0; }
.honor-kind input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.honor-kind:has(input:checked) { background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.14); }
.honor-kind:has(input:focus-visible) { outline: 2px solid #2f6fdd; }
.honor-kind-label { flex: 1; color: #5b6670; font-size: 11.5px; white-space: nowrap; }
.honor-submit {
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: #1f3b63;
  color: #fff;
  font: 600 12px var(--font-ui);
  cursor: pointer;
}
.honor-submit:hover { background: #162d4d; }

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

/* ── Toast ────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  z-index: 5000;
  left: 50%;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 32px);
  padding: 10px 12px 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: #1b2026;
  color: #f4f6f8;
  font-size: 13px;
  box-shadow: var(--shadow-2);
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast[data-tone='error'] { background: #7d1d15; }
.toast button { padding: 4px 6px; border: 0; background: none; color: #9cc2ff; font-weight: 600; cursor: pointer; }

/* Confirmation dialog */
.dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 20px 22px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-2);
}
.dialog::backdrop { background: rgba(10, 14, 20, 0.45); }
.dialog h2 { margin: 0 0 8px; font-size: 16px; }
.dialog p { margin: 0 0 10px; font-size: 13px; color: var(--text-2); }
.dialog ul { margin: 0 0 12px; padding-left: 18px; font-size: 13px; font-weight: 600; }
.dialog .check { margin: 4px 0 16px; font-size: 12.5px; color: var(--text-2); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

/* Hidden dates also stay out of a viewer's assignment list */
body.is-viewing.hides-dates .a-date { display: none; }

/* Long-running export progress */
.job {
  position: fixed;
  z-index: 5001;
  left: 50%;
  bottom: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 16px;
  width: min(420px, calc(100vw - 32px));
  padding: 12px 12px 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: #1b2026;
  color: #f4f6f8;
  font-size: 13px;
  box-shadow: var(--shadow-2);
  transform: translateX(-50%);
}
.job-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.job-text span { font-size: 12px; color: #a9b3bd; font-variant-numeric: tabular-nums; }
.job-cancel { background: rgba(255, 255, 255, 0.08); color: #f4f6f8; }
.job-cancel:hover { background: rgba(255, 255, 255, 0.16); }
.job-bar { grid-column: 1 / -1; height: 4px; overflow: hidden; border-radius: 2px; background: rgba(255, 255, 255, 0.14); }
.job-bar i { display: block; width: 0; height: 100%; border-radius: 2px; background: #8db3ea; transition: width 0.2s linear; }
body.has-job .toast { bottom: 122px; }

/* ── Responsive ───────────────────────────────────────────────────── */

@container (max-width: 720px) {
  .stage { --gutter: 10px; }
  .title-block { max-width: calc(100% - 64px); }
  .title-main { padding: 11px 14px 0; }
  .title-name { font-size: 22px; }
  .title-sub { font-size: 12px; }
  .title-stats { flex-wrap: wrap; padding: 9px 14px 11px; margin-top: 11px; }
  .title-stats div { padding-right: 10px; margin-right: 10px; }
  .title-stats dd { font-size: 16px; }
  .title-stats dt { font-size: 8.5px; }
  .title-block[data-variant='banner'] { padding: 12px 14px 16px; }
  .timeline { --bar-h: 17px; padding: 8px 10px 4px; }
  .tl-bar { font-size: 10px; }
  .legend { padding: 6px 10px; font-size: 10.5px; }
  .legend ul { gap: 2px 10px; }
  .lg-line { width: 22px; }
}

@container (max-width: 480px) {
  .title-eyebrow { font-size: 9.5px; }
  .title-name { font-size: 19px; }
  .title-sub { font-size: 11px; margin-top: 3px; }
  .title-stats div { padding-right: 8px; margin-right: 8px; }
  .title-stats dd { font-size: 14px; }
}

@container (min-width: 1250px) {
  .title-name { font-size: 36px; }
  .title-stats dd { font-size: 26px; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); height: auto; }
  .stage-area { order: -1; }
  .stage-wrap { flex: none; height: 64vh; height: 64svh; padding: 0 12px 12px; }
  .stage-toolbar { padding: 8px 12px; }
  .toolbar-brand { display: inline; }
  #fit-map .btn-label, #play-journey .btn-label, .hide-narrow { display: none; }
  .only-narrow { display: inline; }
  .panel { border-right: 0; border-top: 1px solid var(--line); }
  .panel-head { display: none; }
  .panel-body { overflow: visible; }
  .tabs { position: sticky; top: 0; z-index: 40; background: var(--panel); }
}

@media (prefers-reduced-motion: reduce) {
  .route-line.is-animated, .is-pulse .mk::after { animation: none; }
  .toast, .tile-choice img, .job-bar i { transition: none; }
}
