/* extracted from 14-trail-c.css during pass182; load immediately after 14-trail-c.css to preserve cascade order */

/* ===== Trail polish phase AJ ===== */
/* Trail branch/authoring window controls intentionally use the global .std-panel-controls contract. */
.trail-branch-panel-body,
.trail-mp-decision-panel-body {
  gap: 10px;
}
.trail-branch-summary,
#trail-mp-decision-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.trail-branch-meta-pill,
.trail-mp-choice-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(140, 205, 255, 0.28);
  background: rgba(38, 73, 109, 0.32);
  color: #d8f2ff;
  font-size: 11px;
  line-height: 1.2;
}
.trail-branch-choice-btn,
.trail-mp-choice-btn {
  text-align: left;
}
.trail-branch-choice-title {
  font-size: 14px;
  margin-bottom: 6px;
}
.trail-branch-choice-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  font-size: 11px;
  color: #dff5ff;
}
.trail-branch-choice-copy,
.trail-mp-choice-preview,
.trail-mp-choice-voters {
  margin-top: 6px;
}
.trail-mp-status-callout {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  color: #eef8ff;
  font-size: 12px;
  line-height: 1.35;
}

/* ===== Trail MP final cleanup polish ===== */
.trail-mp-status-pill.is-hold {
  border-color: rgba(255, 184, 107, 0.42);
  color: #ffd7a3;
}
.trail-mp-inline-muted {
  display: block;
  margin-top: 2px;
  opacity: 0.82;
  font-size: 11px;
}
.trail-mp-interlude-copy-sub {
  margin-top: 2px;
  opacity: 0.82;
  font-size: 11px;
}
.trail-mp-decision-waiting {
  margin-top: 6px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  font-size: 12px;
  line-height: 1.3;
}

/* ===== Trail authoring validation panel ===== */
.trail-authoring-panel-body {
  display:flex; flex-direction:column; gap:10px; min-height:0; overflow-y:auto;
}
.trail-authoring-toolbar { display:flex; gap:8px; flex-wrap:wrap; }
.trail-authoring-btn {
  border:1px solid rgba(255,255,255,.16); border-radius:10px; padding:8px 12px;
  background: rgba(34,68,102,.42); color:#e9f7ff; font:inherit; cursor:pointer;
}
.trail-authoring-btn:disabled { opacity:.6; cursor:default; }
.trail-authoring-status-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.trail-authoring-card {
  border:1px solid rgba(255,255,255,.12); background: rgba(7,20,34,.32); border-radius:12px; padding:10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.trail-authoring-card-title { font-size:12px; text-transform:uppercase; letter-spacing:.06em; color:#bfe8ff; margin-bottom:8px; }
.trail-authoring-status-line { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.trail-authoring-subtext { font-size:12px; color:#cfe6f7; opacity:.88; margin-top:6px; word-break:break-word; }
.trail-authoring-badge { display:inline-flex; align-items:center; padding:4px 8px; border-radius:999px; font-size:11px; font-weight:700; letter-spacing:.03em; }
.trail-authoring-badge.ok { background: rgba(62,145,84,.35); border:1px solid rgba(120,220,140,.35); color:#dffff0; }
.trail-authoring-badge.warn { background: rgba(148,124,44,.35); border:1px solid rgba(255,219,117,.28); color:#fff1bf; }
.trail-authoring-badge.error { background: rgba(138,54,54,.38); border:1px solid rgba(255,138,138,.35); color:#ffe2e2; }
.trail-authoring-current-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px 14px; }
.trail-authoring-key { display:block; font-size:11px; text-transform:uppercase; letter-spacing:.05em; opacity:.8; color:#a8d5f2; }
.trail-authoring-value { display:block; margin-top:3px; color:#eef8ff; font-size:13px; word-break:break-word; }
.trail-authoring-chip-row { display:flex; flex-wrap:wrap; gap:6px; }
.trail-authoring-chip { display:inline-flex; align-items:center; padding:5px 9px; border-radius:999px; background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.12); font-size:11px; color:#dff5ff; }
.trail-authoring-chip.active { border-color: rgba(141, 215, 255, 0.45); background: rgba(65, 123, 175, 0.3); }
.trail-authoring-chip[data-route-id] { cursor:pointer; }
.trail-authoring-graph-toolbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:10px; }
.trail-authoring-graph-label { font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:#a8d5f2; }
.trail-authoring-graph-select {
  min-width: 220px; max-width: 340px; border-radius: 10px; padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.15); background: rgba(15,34,52,.72); color:#eef8ff; font:inherit;
}
.trail-authoring-graph-meta { font-size:12px; color:#d7ecfa; opacity:.9; }
.trail-authoring-graph-wrap {
  border:1px solid rgba(255,255,255,.1); border-radius:14px; background: rgba(7,20,34,.24);
  overflow:auto; max-height: 360px;
}
.trail-authoring-graph-view { min-width: 760px; min-height: 220px; padding: 8px; }
.trail-authoring-graph-svg { width:100%; height:auto; display:block; }
.trail-authoring-graph-edge { fill:none; stroke: rgba(157, 213, 255, .5); stroke-width: 3; }
.trail-authoring-graph-edge-label { font-size: 11px; fill:#d9efff; letter-spacing:.02em; }
.trail-authoring-graph-node circle { stroke: rgba(255,255,255,.14); stroke-width: 2; }
.trail-authoring-graph-node.start circle { fill: rgba(84, 186, 133, .42); }
.trail-authoring-graph-node.end circle { fill: rgba(173, 103, 208, .4); }
.trail-authoring-graph-node.branch circle { fill: rgba(230, 188, 88, .4); }
.trail-authoring-graph-node.fort circle { fill: rgba(94, 146, 226, .42); }
.trail-authoring-graph-node.river circle { fill: rgba(79, 180, 204, .42); }
.trail-authoring-graph-node.landmark circle { fill: rgba(129, 132, 208, .4); }
.trail-authoring-graph-node.default circle { fill: rgba(255,255,255,.14); }
.trail-authoring-graph-node-type { font-size: 9px; fill:#9dd5ff; letter-spacing:.08em; font-weight:700; }
.trail-authoring-graph-node-label { font-size: 10px; fill:#f4fbff; font-weight:700; }
@media (max-width: 900px) {
  .trail-authoring-graph-toolbar { align-items:flex-start; }
  .trail-authoring-graph-meta { width:100%; }
}
.trail-authoring-issues { display:flex; flex-direction:column; gap:6px; max-height:280px; overflow:auto; }
.trail-authoring-issue { display:grid; grid-template-columns:auto auto 1fr; gap:8px; align-items:start; padding:7px 8px; border-radius:10px;   }
.trail-authoring-issue.error { border-color: rgba(255,138,138,.24); }
.trail-authoring-issue.warning { border-color: rgba(255,219,117,.18); }
.trail-authoring-issue-badge { font-size:10px; font-weight:800; letter-spacing:.04em; }
.trail-authoring-issue-badge.error { color:#ffd4d4; }
.trail-authoring-issue-badge.warning { color:#ffeab7; }
.trail-authoring-issue-scope { font-size:11px; color:#9ad9ff; }
.trail-authoring-issue-msg { font-size:12px; color:#eef8ff; }
.trail-authoring-empty { font-size:12px; color:#cfe6f7; opacity:.82; }
@media (max-width: 900px) {
  .trail-authoring-status-grid, .trail-authoring-current-grid { grid-template-columns:1fr; }
}

.trail-authoring-action-status { min-height: 18px; font-size:12px; color:#dff5ff; margin:2px 0 10px; }
.trail-authoring-action-status.ok,
.trail-authoring-graph-issue-meta.ok { color:#d8ffe8; }
.trail-authoring-action-status.warn,
.trail-authoring-graph-issue-meta.warn { color:#ffeeb9; }
.trail-authoring-action-status.error,
.trail-authoring-graph-issue-meta.error { color:#ffd5d5; }
.trail-authoring-graph-issue-meta { font-size:12px; opacity:.92; }
.trail-authoring-graph-edge.has-warning { stroke: rgba(255, 219, 117, .85); stroke-width: 4; }
.trail-authoring-graph-edge.has-error { stroke: rgba(255, 138, 138, .95); stroke-width: 5; }
.trail-authoring-graph-node.has-warning circle { stroke: rgba(255,219,117,.95); stroke-width:4; }
.trail-authoring-graph-node.has-error circle { stroke: rgba(255,138,138,.98); stroke-width:5; }

.trail-authoring-draft {
  width: 100%; min-height: 120px; resize: vertical; box-sizing: border-box;
  border-radius: 12px; border: 1px solid rgba(130,190,230,.28);
  background: rgba(7,18,28,.72); color: #eaf7ff; padding: 10px 12px;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; margin: 4px 0 10px;
}
.trail-authoring-issue { cursor:pointer; width:100%; text-align:left; background: rgba(255,255,255,.03); border:1px solid rgba(255,255,255,.06); }
.trail-authoring-issue:hover { background: rgba(255,255,255,.07); }
.trail-authoring-graph-edge.focused { stroke: #ffffff; stroke-width: 6; filter: drop-shadow(0 0 8px rgba(255,255,255,.35)); }
.trail-authoring-graph-node.focused circle { stroke: #ffffff; stroke-width: 6; filter: drop-shadow(0 0 10px rgba(255,255,255,.4)); }

/* Trail Authoring phase AR */
.trail-authoring-file-input { display:none; }
.trail-authoring-draft-toolbar,
.trail-authoring-issues-toolbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:6px 0 8px; }
.trail-authoring-toggle { display:inline-flex; align-items:center; gap:6px; padding:4px 8px; border-radius:999px; background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.10); font-size:12px; }
.trail-authoring-toggle input { margin:0; }
.trail-authoring-issues-toolbar { justify-content:space-between; }
.trail-authoring-issues-meta { margin-left:auto; }

.trail-authoring-issues-search {
  min-width: 220px;
  flex: 1 1 240px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.22);
  color: inherit;
}

.trail-authoring-issues-search::placeholder {
  color: rgba(255,255,255,0.58);
}

.trail-authoring-preset-row,
.trail-authoring-bucket-row {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:8px;
}
.trail-authoring-bucket-chip {
  border:1px solid rgba(255,255,255,.18);
  background:rgba(255,255,255,.08);
  color:#fff;
  border-radius:999px;
  padding:5px 10px;
  font:inherit;
  cursor:pointer;
}
.trail-authoring-bucket-chip span {
  display:inline-block;
  min-width:18px;
  margin-left:6px;
  padding:1px 6px;
  border-radius:999px;
  background:rgba(0,0,0,.25);
}
.trail-authoring-bucket-chip.active {
  background:rgba(94,203,200,.22);
  border-color:rgba(94,203,200,.55);
  box-shadow:0 0 0 1px rgba(94,203,200,.18) inset;
}


/* ============================================================
   Migrated from 99-legacy-overrides-a.css — trail utility minigame shell contract
   ============================================================ */
:is(#tree-shake-panel,
    #toy-hunt-panel,
    #bubble-pop-panel,
    #chaoregon-setup-panel) {
  padding: 0 !important;
  overflow: hidden !important;
}

:is(#tree-shake-panel,
    #toy-hunt-panel,
    #bubble-pop-panel,
    #chaoregon-setup-panel) > .panel-header {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0 12px;
  background: rgba(8, 18, 32, 0.84);
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

:is(#tree-shake-panel,
    #toy-hunt-panel,
    #bubble-pop-panel,
    #chaoregon-setup-panel) > .panel-header .panel-title {
  flex: 1 1 auto;
  min-width: 0;
  color: #fff6cf;
}

:is(#tree-shake-panel,
    #toy-hunt-panel,
    #bubble-pop-panel,
    #chaoregon-setup-panel) > .panel-header .panel-header-controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  min-width: 0;
}

:is(#tree-shake-panel,
    #toy-hunt-panel,
    #bubble-pop-panel,
    #chaoregon-setup-panel) > .panel-body {
  box-sizing: border-box;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: auto;
  padding: 10px 12px 12px;
  overflow: auto;
}

#tree-shake-panel #treeGameZone,
#bubble-pop-panel #bubbleZone,
#toy-hunt-panel #bushGrid,
#chaoregon-setup-panel .setup-body {
  min-width: 0;
}

/* Pass 58dd — Chaoregon Trail custom map + full travel screen fit */
#trail-screen-panel > .panel-body.trail-screen-panel-body {
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

#trail-screen-panel .trail-screen-top-row {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  align-items: stretch !important;
}

#trail-screen-panel .trail-screen-main-view {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: flex !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  overflow: hidden !important;
}

#trail-screen-panel #trail-canvas {
  flex: 1 1 auto !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 360px !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  object-fit: fill !important;
  box-sizing: border-box !important;
}

#trail-screen-panel #trail-hud {
  flex: 0 0 250px !important;
  min-height: 220px !important;
  max-height: 300px !important;
}

.trail-map-area.trail-map-area-customized,
#chaoregon-map-panel .map-area.trail-map-area-customized {
  background: linear-gradient(180deg, rgba(16, 36, 58, 0.96), rgba(7, 17, 30, 0.98)) !important;
  overflow: hidden !important;
}

.trail-custom-map {
  position: absolute;
  inset: 8px;
  display: grid;
  grid-template-columns: repeat(var(--trail-map-cols, 24), minmax(0, 1fr));
  grid-template-rows: repeat(var(--trail-map-rows, 12), minmax(0, 1fr));
  gap: 1px;
  padding: 2px;
  border: 2px solid rgba(255,255,255,0.28);
  border-radius: 8px;
  background: rgba(0,0,0,0.30);
  box-sizing: border-box;
  image-rendering: pixelated;
  z-index: 1;
  will-change: transform, width, height;
}

.trail-custom-map-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18);
  color: #fff;
  font-size: clamp(8px, 1.4vw, 15px);
  line-height: 1;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.75);
  overflow: hidden;
}

.trail-custom-map-cell.terrain-grass { background: linear-gradient(135deg, #4fa64a, #267437); }
.trail-custom-map-cell.terrain-mountain { background: linear-gradient(135deg, #8a7659, #4f4137); }
.trail-custom-map-cell.terrain-snow { background: linear-gradient(135deg, #dcefff, #9fc5df); color: #123; text-shadow: 1px 1px 0 rgba(255,255,255,0.5); }
.trail-custom-map-cell.terrain-water { background: linear-gradient(135deg, #39a7df, #17639e); }

.trail-custom-map-cell.placeable-road::after,
.trail-custom-map-cell.placeable-start::after,
.trail-custom-map-cell.placeable-end::after,
.trail-custom-map-cell.placeable-fork::after,
.trail-custom-map-cell.placeable-outpost::after,
.trail-custom-map-cell.placeable-monument::after,
.trail-custom-map-cell.placeable-event::after,
.trail-custom-map-cell.placeable-river::after {
  content: '';
  position: absolute;
  inset: 35% 0;
  background: rgba(210, 164, 86, 0.88);
  box-shadow: 0 1px 0 rgba(80,44,16,0.75), 0 -1px 0 rgba(255,230,156,0.5);
  z-index: 0;
}

.trail-custom-map-cell.placeable-start,
.trail-custom-map-cell.placeable-end,
.trail-custom-map-cell.placeable-fork,
.trail-custom-map-cell.placeable-outpost,
.trail-custom-map-cell.placeable-monument,
.trail-custom-map-cell.placeable-event,
.trail-custom-map-cell.placeable-river {
  border: 1px solid rgba(255,255,255,0.65);
}

.trail-custom-map-cell.placeable-start,
.trail-custom-map-cell.placeable-end,
.trail-custom-map-cell.placeable-fork,
.trail-custom-map-cell.placeable-outpost,
.trail-custom-map-cell.placeable-monument,
.trail-custom-map-cell.placeable-event,
.trail-custom-map-cell.placeable-river {
  z-index: 2;
}

.trail-custom-map-cell.placeable-start { outline: 2px solid rgba(80, 255, 130, 0.9); }
.trail-custom-map-cell.placeable-end { outline: 2px solid rgba(255, 221, 86, 0.95); }
.trail-custom-map-cell.placeable-fork { outline: 2px solid rgba(255, 160, 64, 0.95); }
.trail-custom-map-cell.placeable-river { outline: 2px solid rgba(80, 220, 255, 0.95); }

.trail-custom-map-marker {
  position: absolute;
  width: 28px;
  height: 22px;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255,255,255,0.95);
  border-radius: 8px 8px 5px 5px;
  background: linear-gradient(180deg, #ffdf73, #b46a23);
  box-shadow: 0 2px 8px rgba(0,0,0,0.65), inset 0 -4px 0 rgba(60,32,10,0.32);
  pointer-events: none;
  z-index: 5;
}

.trail-custom-map-marker::before,
.trail-custom-map-marker::after {
  content: '';
  position: absolute;
  bottom: -6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1f1712;
  border: 1px solid rgba(255,255,255,0.65);
}

.trail-custom-map-marker::before { left: 3px; }
.trail-custom-map-marker::after { right: 3px; }

/* Pass 58ef — lock Trail Screen layout after custom map injection.
   The travel scene and route map are render surfaces, not layout drivers. */
#trail-screen-panel {
  overflow: hidden !important;
}

#trail-screen-panel > .panel-body.trail-screen-panel-body {
  flex: 1 1 auto !important;
  height: 100% !important;
  max-height: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

#trail-screen-panel .trail-screen-top-row {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  max-height: calc(100% - 260px) !important;
  overflow: hidden !important;
}

#trail-screen-panel .trail-embedded-map,
#trail-screen-panel .trail-screen-main-view {
  min-height: 0 !important;
  max-height: 100% !important;
  overflow: hidden !important;
}

#trail-screen-panel .trail-map-area,
#trail-screen-panel .map-area {
  min-height: 0 !important;
  height: auto !important;
  overflow: hidden !important;
}

#trail-screen-panel #trail-canvas {
  flex: 1 1 auto !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: block !important;
  margin: 0 !important;
}

#trail-screen-panel #trail-hud {
  flex: 0 0 250px !important;
  min-height: 0 !important;
  height: 250px !important;
  max-height: 250px !important;
  overflow: hidden !important;
}
