.shell { width: min(1380px, calc(100% - 40px)); margin: 0 auto; padding: 46px 0 70px; }
.hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 28px; margin-bottom: 28px; }
h1 { margin: 5px 0 10px; font-size: clamp(2rem, 4vw, 3.35rem); }
h2 { margin: 5px 0 0; }
p { max-width: 900px; color: var(--muted); line-height: 1.6; }




.actions { display: flex; gap: 12px; align-items: center; }



.warning { margin: 16px 0; border: 1px solid var(--warn); color: var(--warn); background: rgba(243,181,98,.06); padding: 12px 14px; border-radius: 10px; }
.hidden { display: none !important; }
.source-info { margin-top: 16px; padding: 10px 14px; border-radius: 8px; background: var(--panel-2); color: var(--muted); font-size: .86rem; word-break: break-word; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 22px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 18px; min-width: 0; }
.stat-card span { display: block; color: var(--muted); font-size: .82rem; margin-bottom: 7px; }
.stat-card strong { display: block; font-size: 1.55rem; overflow: hidden; text-overflow: ellipsis; }
.section-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 18px; }
.status { color: var(--muted); font-size: .88rem; }
.compact-copy { max-width: none; margin-bottom: 0; }
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 16px; align-items: end; }
label { display: block; color: var(--muted); font-size: .8rem; margin-bottom: 7px; }
input, select { width: 100%; background: var(--panel-3); border: 1px solid var(--border); color: var(--text); padding: 11px 13px; border-radius: 8px; font-size: .92rem; }
input:focus, select:focus { outline: none; border-color: var(--accent); }
select option:disabled { color: var(--muted); }
.source-status { margin-top: 8px; }
.run-cell { display: flex; align-items: end; }
.progress-track { width: 100%; height: 8px; margin-top: 18px; background: var(--panel-3); border-radius: 999px; overflow: hidden; }
.progress-bar { width: 0; height: 100%; background: var(--accent); transition: width .12s ease; }
.progress-label { margin-top: 8px; }
.map-header { align-items: flex-start; }
.map-controls { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.segmented { display: flex; background: var(--panel-3); border: 1px solid var(--border); border-radius: 10px; padding: 4px; gap: 3px; }
.segmented button { background: transparent; color: var(--muted); padding: 8px 12px; border-radius: 7px; }
.segmented button.active { background: var(--panel-2); color: white; }
.check { display: flex; align-items: center; gap: 7px; margin: 0; cursor: pointer; }
.check input { width: auto; margin: 0; }
.map-layout { display: grid; grid-template-columns: minmax(0,1fr) 120px; gap: 18px; align-items: stretch; }
.canvas-wrap { position: relative; width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #08101c; }
#mapCanvas { width: 100%; height: auto; display: block; aspect-ratio: 1.58 / 1; cursor: crosshair; }
.map-tooltip { position: absolute; pointer-events: none; min-width: 190px; max-width: 280px; padding: 10px 12px; border-radius: 9px; background: rgba(8,14,24,.96); border: 1px solid var(--border); color: var(--text); font-size: .8rem; line-height: 1.5; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.legend-panel { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--panel-3); }
.legend-title { font-size: .82rem; color: var(--muted); margin-bottom: 12px; }
.legend-row { display: flex; gap: 9px; height: 330px; }
.legend-gradient { width: 24px; border-radius: 7px; border: 1px solid rgba(255,255,255,.08); background: linear-gradient(to top, #172554 0%, #2563eb 25%, #14b8a6 50%, #facc15 75%, #ef4444 100%); }
.legend-labels { display: flex; flex-direction: column; justify-content: space-between; font-size: .78rem; color: var(--muted); }
.legend-unit { margin-top: 10px; font-size: .78rem; color: var(--muted); }
.legend-note { margin-top: 20px; font-size: .72rem; line-height: 1.55; color: var(--muted); }
.table-wrap { overflow-x: auto; max-height: 450px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); font-size: .83rem; }
th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--panel); }
.row-good td:first-child { border-left: 3px solid var(--good); }
.row-bad { background: rgba(239,111,108,.05); }
.row-bad td:first-child { border-left: 3px solid var(--bad); }
.good { color: var(--good); font-weight: 650; }
.bad { color: var(--bad); font-weight: 650; }
.footer-note { color: var(--muted); font-size: .84rem; text-align: center; padding-top: 8px; }
@media (max-width: 900px) {
  .hero { flex-direction: column; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .map-layout { grid-template-columns: 1fr; }
  .legend-row { height: 180px; }
  .legend-panel { display: grid; grid-template-columns: auto 1fr; gap: 12px; }
}
@media (max-width: 650px) {
  .shell { width: min(100% - 20px, 1380px); padding-top: 24px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .config-grid { grid-template-columns: 1fr 1fr; }
  .config-grid > div:nth-child(4),
  .config-grid > div:nth-child(5) { grid-column: span 1; }
  .run-cell { grid-column: 1 / -1; }
  .run-cell button { width: 100%; }
  .section-header { flex-direction: column; align-items: stretch; }
  .map-controls { justify-content: flex-start; }
}
.zoom-controls { display: flex; align-items: center; gap: 6px; }
.zoom-btn { width: 36px; min-width: 36px; padding: 8px 0; font-size: 1rem; }
.zoom-reset { padding: 8px 11px; }
.zoom-label { min-width: 50px; text-align: center; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
#mapCanvas { touch-action: none; }
#mapCanvas.dragging { cursor: grabbing; }

.region-filter { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.region-filter-head { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 18px; align-items: end; }
.region-status { padding-bottom: 10px; }
.region-values { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; max-height: 150px; overflow: auto; padding: 2px; }
.region-chip { margin: 0; }
.region-chip input { position: absolute; opacity: 0; pointer-events: none; }
.region-chip span { display: inline-flex; align-items: center; min-height: 34px; padding: 7px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel-3); color: var(--muted); cursor: pointer; font-size: .82rem; }
.region-chip input:checked + span { border-color: var(--accent); background: rgba(78,161,255,.12); color: var(--text); }
.region-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.pan-hint { color: var(--muted); font-size: .78rem; white-space: nowrap; }
@media (max-width: 650px) {
  .region-filter-head { grid-template-columns: 1fr; }
  .region-status { padding-bottom: 0; }
}

.section-controls { display: flex; gap: 6px; align-items: center; }
.section-controls button { padding: 8px 11px; }
button.active-tool { background: var(--accent); border-color: var(--accent); color: white; }
#mapCanvas.section-drawing { cursor: crosshair; }
.cross-section-wrap { width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #08101c; }
#crossSectionCanvas { width: 100%; height: 360px; display: block; }

#mapCanvas.editing-section { cursor: grabbing; }

#mapCanvas.moving-section { cursor: move; }

.cross-section-wrap { position: relative; }
#crossSectionCanvas { cursor: crosshair; }

.well-source { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.well-source .status { margin-top: 7px; }
.keyword-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.keyword-chip { display: inline-flex; align-items: center; min-height: 30px; padding: 5px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel-3); color: var(--muted); font-size: .75rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.check:has(input:disabled) { opacity: .45; cursor: not-allowed; }

.difference-summary { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin: 0 0 16px; padding: 13px 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-3); }
.difference-summary-values { display: grid; grid-template-columns: repeat(4, minmax(110px, auto)); gap: 10px; }
.difference-summary-values > div { padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); }
.difference-summary-values span { display: block; color: var(--muted); font-size: .72rem; margin-bottom: 3px; }
.difference-summary-values strong { font-size: .9rem; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .difference-summary { align-items: stretch; flex-direction: column; }
  .difference-summary-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Optional representative-map comparison; existing map layout is retained. */
.representative-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 14px 0; }
.representative-card { min-width: 0; padding: 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-3); }
.representative-card.selected { border-color: var(--accent); }
.representative-card h3 { margin: 0 0 8px; }
.representative-card p { overflow-wrap: anywhere; }
.representative-source { max-height: 4.5em; overflow: auto; }
.representative-views { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.representative-views[hidden] { display: none; }
.representative-views button[aria-pressed="true"] { border-color: var(--accent); background: var(--panel-2); }
@media(max-width:850px) { .representative-cards { grid-template-columns: 1fr; } }
