/* Intersection simulator teaser */
.sim-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.2rem; }
.sim-search { display: flex; gap: .5rem; flex: 1 1 340px; }
.sim-search input { flex: 1; min-width: 0; padding: .6rem .9rem; border: 1px solid var(--line); border-radius: 999px; font: inherit; font-size: .95rem; }
.sim-presets { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.sim-chip { border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 999px; padding: .3rem .8rem; font: inherit; font-size: .85rem; cursor: pointer; }
.sim-chip:hover, .sim-chip.is-active { border-color: var(--accent); background: rgba(22, 199, 154, .1); }
.sim-profile { display: flex; align-items: center; gap: .4rem; color: var(--muted); }
.sim-profile select, .sim-controls select { font: inherit; padding: .3rem .5rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.sim-results { list-style: none; margin: .8rem 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); max-width: 760px; }
.sim-results button { display: block; width: 100%; text-align: start; border: 0; background: none; padding: .6rem 1rem; font: inherit; font-size: .9rem; cursor: pointer; border-bottom: 1px solid var(--line); }
.sim-results li:last-child button { border-bottom: 0; }
.sim-results button:hover { background: var(--bg-alt); }
.sim-status { min-height: 1.5em; margin: .6rem 0; color: var(--muted); }
.sim-status[data-kind="warn"] { color: #8a5a00; }
.sim-status[data-kind="error"] { color: #8a1c27; }

.sim-stage { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 1.2rem; align-items: start; }
.sim-stage:has(.sim-panel[hidden]) { grid-template-columns: 1fr; }
.sim-canvas-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--bg-alt); }
.sim-canvas { display: block; width: 100%; height: min(70vh, 640px); touch-action: none; }
.sim-tools { position: absolute; top: .6rem; inset-inline-end: .6rem; display: grid; gap: .3rem; }
.sim-tools button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--navy); font-size: 1.1rem; cursor: pointer; box-shadow: var(--shadow); }
.sim-attrib { position: absolute; bottom: 0; inset-inline-end: 0; margin: 0; padding: .1rem .5rem; font-size: .72rem; background: rgba(255, 255, 255, .85); border-start-start-radius: 6px; }
.sim-attrib a { color: var(--muted); text-decoration: none; }
.sim-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem; color: var(--muted); pointer-events: none; }
.sim-placeholder .icon { width: 56px; height: 56px; color: var(--accent-dark); margin-bottom: 1rem; }
.sim-placeholder p { max-width: 30em; }
.sim-placeholder[hidden] { display: none; }

.sim-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; max-height: min(70vh, 640px); overflow: auto; font-size: .92rem; }
.sim-back { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: .85rem; }
.sim-title { font-size: 1.15rem; margin: .5rem 0 .8rem; }
.sim-steps { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: 1rem; }
.sim-steps button { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .25rem .7rem .25rem .3rem; font: inherit; font-size: .82rem; color: var(--navy); cursor: pointer; }
.sim-steps button.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }
.sim-step-n { display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--bg-alt); color: var(--navy); font-size: .72rem; font-weight: 700; }
.sim-steps .is-active .sim-step-n { background: var(--accent); }
.sim-intro { color: var(--muted); }
.sim-table-wrap, .sim-matrix-wrap { overflow-x: auto; }
.sim-table { font-size: .86rem; }
.sim-table th, .sim-table td { padding: .45rem .5rem; }
.sim-arrows { font-size: 1.05rem; letter-spacing: .05em; white-space: nowrap; }
.sim-swatch { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; margin-inline-end: .45rem; vertical-align: -1px; border: 1px solid rgba(11, 37, 69, .2); }
.sim-warnings { margin: 1rem 0; color: var(--muted); }
.sim-warnings summary { cursor: pointer; font-weight: 600; }
.sim-badge { display: inline-block; padding: .3rem .7rem; border-radius: 8px; font-size: .84rem; font-weight: 600; margin: .8rem 0 0; }
.sim-badge.ok { background: #e3f8f1; color: #0b5d48; }
.sim-badge.err { background: #fdecee; color: #8a1c27; }

.sim-matrix { border-collapse: collapse; font-size: .8rem; margin-bottom: .6rem; }
.sim-matrix th, .sim-matrix td { width: 2.1rem; height: 2.1rem; text-align: center; border: 1px solid var(--line); padding: 0; }
.sim-matrix thead th { background: var(--bg-alt); }
.sim-matrix .sim-rowhead { background: var(--bg-alt); cursor: pointer; }
.sim-matrix tr.is-active .sim-rowhead { background: var(--navy); color: #fff; }
.sim-matrix td.full { background: #fde2e4; color: #8a1c27; font-weight: 700; cursor: help; }
.sim-matrix td.partial { background: #fff1d6; color: #8a5a00; cursor: help; }
.sim-matrix td.self { background: repeating-linear-gradient(45deg, #f3f6fa, #f3f6fa 4px, #e6ebf1 4px, #e6ebf1 8px); }
.sim-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; color: var(--muted); }
.lg { display: inline-block; width: .9rem; height: .9rem; border-radius: 3px; }
.lg.full { background: #fde2e4; border: 1px solid #f5b5bc; }
.lg.partial { background: #fff1d6; border: 1px solid #f4d18a; }
.lg.green { background: #22c55e; }
.lg.amber { background: #f4a300; }
.lg.red { background: #f3c4c8; }

.sim-phases { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.sim-phase { display: flex; flex-direction: column; gap: .4rem; text-align: start; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: .5rem; cursor: pointer; font: inherit; font-size: .82rem; color: var(--ink); }
.sim-phase.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(22, 199, 154, .35); }
.sim-mini { width: 100%; aspect-ratio: 1; border-radius: 6px; display: block; }

.sim-trans-tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .6rem; }
.sim-trans-chart { width: 100%; height: 150px; display: block; margin-bottom: .4rem; }
.sim-tau { color: var(--muted); font-variant-numeric: tabular-nums; }
.sim-intermediates { padding-inline-start: 1.2rem; }
.sim-intermediates li { margin-bottom: .3rem; }
.st { display: inline-block; padding: 0 .4rem; border-radius: 4px; font-weight: 600; }
.st.green { background: #dcfce7; color: #166534; }
.st.amber { background: #fff1d6; color: #8a5a00; }
.st.red { background: #fde2e4; color: #8a1c27; }

.sim-controls { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.sim-slider { display: grid; grid-template-columns: 1fr 1.4fr 3rem; align-items: center; gap: .5rem; font-size: .85rem; margin-bottom: .3rem; }
.sim-slider input { width: 100%; accent-color: var(--accent-dark); }
.sim-slider output { text-align: end; color: var(--muted); font-variant-numeric: tabular-nums; }
.sim-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .8rem; margin: 1rem 0 0; }
.sim-stats div { background: var(--bg-alt); border-radius: 8px; padding: .45rem .6rem; }
.sim-stats dt { font-size: .75rem; color: var(--muted); }
.sim-stats dd { margin: 0; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }

.sim-timeline-wrap { margin-top: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: .4rem; }
.sim-timeline-wrap[hidden] { display: none; }
.sim-timeline { display: block; width: 100%; height: 190px; }
.sim-disclaimer { margin-top: 1rem; }

@media (max-width: 1024px) {
  .sim-stage { grid-template-columns: 1fr; }
  .sim-panel { max-height: none; }
}
@media (max-width: 600px) {
  .sim-canvas { height: 60vh; }
  .sim-phases { grid-template-columns: 1fr 1fr; }
}
