.species-layout { max-width: 1160px; margin: auto; padding: 38px 28px 56px; }
.species-heading { max-width: 760px; margin-bottom: 30px; }
.species-heading h1 { font-size: clamp(30px, 4vw, 46px); letter-spacing: -.045em; margin-bottom: 12px; }
.species-heading p, .comparison-section > p { color: var(--muted); line-height: 1.65; }
.species-toolbar { display: flex; gap: 22px; align-items: center; margin-bottom: 30px; }
.species-toolbar .field { flex: 1; max-width: 440px; margin: 0; }
.map-link { color: var(--green); font-weight: 700; font-size: 14px; }
.species-summary { display: flex; justify-content: space-between; gap: 24px; border-top: 1px solid var(--line); padding: 28px 0 16px; }
.species-summary p { color: var(--muted); margin: 7px 0; font-size: 14px; }
.reading-key { display: flex; align-items: flex-start; gap: 7px; flex-wrap: wrap; }
.source-status { display: inline-block; padding: 4px 8px; border-radius: 5px; font-size: 11px; font-weight: 700; background: var(--soft); color: var(--green); }
.source-status.H { background: #f8efd7; color: #76602c; }
.source-status.I { background: #ececea; color: #696e69; }
.model-equation { display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 18px; background: var(--deep); color: white; padding: 24px; border-radius: 14px; margin: 12px 0 38px; }
.model-equation div { display: grid; gap: 6px; text-align: center; }
.model-equation strong { font-size: 27px; }
.model-equation span { font-size: 13px; }
.model-equation p { flex-basis: 100%; margin: 0; text-align: center; color: #d5e2d7; font-size: 12px; }
.model-equation p strong { font-size: inherit; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-heading > a { color: var(--green); font-size: 12px; }
.section-heading .field { margin: 0; min-width: 180px; }
.species-factors, .habitat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.species-factor, .habitat-card { padding: 22px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.species-factor header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.species-factor h3, .habitat-card h3 { margin: 0; font-size: 17px; }
.factor-kind { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.species-factor .factor-input, .factor-evidence { font-size: 12px; line-height: 1.6; color: var(--muted); margin: 12px 0 0; overflow-wrap: anywhere; }
.factor-evidence .source-status { margin-right: 6px; }
.species-factor svg, #comparison-chart svg, .habitat-card svg { width: 100%; height: auto; display: block; margin: 18px 0 12px; }
.curve-grid { stroke: var(--line); stroke-width: 1; }
svg .curve-label { font: 10px ui-sans-serif, system-ui, sans-serif; fill: var(--muted); }
.parameter-list { display: flex; flex-wrap: wrap; gap: 7px 14px; margin: 13px 0 0; font-size: 11px; }
.parameter-list div { display: flex; gap: 5px; }
.parameter-list dt { color: var(--muted); }
.parameter-list dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.habitat-section, .season-section, .comparison-section, .calibration-section, .replay-section { margin-top: 40px; }
.habitat-bars { display: grid; gap: 10px; margin: 20px 0; }
.habitat-bar { display: grid; grid-template-columns: 150px 1fr 32px; gap: 10px; align-items: center; font-size: 12px; }
.habitat-track { height: 7px; border-radius: 8px; background: var(--soft); overflow: hidden; }
.habitat-track span { display: block; height: 100%; background: var(--green); }
.season-section, .calibration-section, .replay-section { padding: 26px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.season-section p, .calibration-section p, .replay-section p { line-height: 1.65; font-size: 13px; color: var(--muted); margin: 12px 0 0; }
.comparison-legend { display: flex; flex-wrap: wrap; gap: 12px 18px; font-size: 12px; margin: 0 0 22px; }
.comparison-legend span { display: inline-flex; gap: 7px; align-items: center; }
.comparison-legend i { width: 18px; height: 3px; display: inline-block; }
.comparison-section .table-scroll td { max-width: 210px; white-space: normal; text-align: left; font-size: 12px; line-height: 1.5; }
.comparison-section .table-scroll th { text-align: left; }
.replay-scores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 20px 0; }
.replay-scores div { padding: 14px; background: var(--soft); border-radius: 8px; }
.replay-scores strong { display: block; font-size: 28px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.replay-scores span { font-size: 12px; color: var(--muted); }
@media(max-width: 640px) {
	.species-layout { padding: 26px 16px 40px; }
	.species-toolbar, .species-summary, .section-heading { align-items: flex-start; flex-wrap: wrap; gap: 14px; }
	.species-toolbar .field { flex-basis: 100%; max-width: none; }
	.species-factors, .habitat-grid { grid-template-columns: 1fr; }
	.species-factor, .habitat-card { padding: 18px; }
	.model-equation { gap: 12px; padding: 20px 10px; }
	.model-equation div { max-width: 83px; }
	.model-equation div span { font-size: 11px; }
	.habitat-bar { grid-template-columns: 126px 1fr 30px; font-size: 11px; }
	.replay-scores { grid-template-columns: repeat(2, 1fr); }
}
.season-section p, .calibration-section dd, .replay-section p { overflow-wrap: anywhere; }
.species-toolbar .field, .species-toolbar select { min-width: 0; }
.species-domain { font-size: 12px; line-height: 1.6; color: var(--muted); max-width: 720px; overflow-wrap: anywhere; }
.species-domain summary { cursor: pointer; color: var(--green); }
.species-domain dt { font-weight: 700; margin-top: 10px; }
.species-domain dd { margin: 4px 0 0; }
.diagnostic-factors small { display: block; max-width: 240px; font-weight: 400; overflow-wrap: anywhere; }
.diagnostic-inputs dd { margin: 0 0 12px; overflow-wrap: anywhere; font-size: 12px; }
.diagnostic-inputs dt { font-weight: 700; }
.history-controls { display: flex; gap: 18px; flex-wrap: wrap; margin: 20px 0; }
.history-chart { max-width: 900px; }
.history-chart svg { width: 100%; height: auto; display: block; }
.history-chart text { font: 14px system-ui, sans-serif; fill: var(--muted); }
.history-date { display: grid; gap: 10px; font-size: 13px; }
.history-date output { font-weight: 700; margin-left: 10px; }
.history-date input { width: 100%; accent-color: var(--green); }
.history-section p { overflow-wrap: anywhere; }
.comparison-habitat th { min-width: 100px; }
.comparison-habitat th[scope="row"] { min-width: 150px; }
@media(max-width: 640px) {
	.history-chart text { font-size: 21px; }
}

.species-identity { display: flex; gap: 16px; align-items: flex-start; min-width: 0; }
.species-icon { flex-shrink: 0; width: 56px; height: 56px; color: var(--deep); }
.species-icon svg { width: 100%; height: 100%; display: block; }
#species-variant { color: var(--deep); font-weight: 600; }
#species-variant a { color: var(--green); }
.factor-more { margin: 10px 0 0; font-size: 12px; }
.factor-more a, .season-section a, .model-equation a { color: var(--green); }
.model-equation a { color: #d5e2d7; }
#habitat-evidence { margin: 0 2px 16px; }
.calibration-section summary { margin-top: 10px; color: var(--green); font-size: 13px; cursor: pointer; }
.diagnostic-summary { color: var(--deep) !important; }
.season-section h3 { margin: 18px 0 6px; font-size: 14px; }
.season-rules { margin: 0; padding-left: 20px; color: var(--deep); font-size: 13px; line-height: 1.65; }
.comparison-note { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.legend-line { display: inline-block; width: 22px; height: 0; margin-right: 4px; border-top: 1px solid #b7c3b9; vertical-align: middle; }
.legend-line.chosen { border-top: 1px solid #1f6b47; }
.comparison-species { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 22px; }
.comparison-species button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 10px 4px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--deep); font-size: 12px; font-weight: 600; }
.comparison-species button svg { width: 22px; height: 22px; }
.comparison-species button[aria-pressed="true"] { border-color: var(--forest); background: var(--forest); color: white; }
.comparison-section td.chosen, .comparison-section th.chosen, .comparison-habitat tr.chosen th, .comparison-habitat tr.chosen td { background: #e7f0e6; color: var(--deep); }
.comparison-section td.same { max-width: none; background: #f6f3e6; }
.comparison-section td.same > div { position: sticky; left: 10px; width: fit-content; max-width: min(520px, calc(100vw - 150px)); white-space: normal; }
.comparison-section td.same .parameter-list { margin-top: 6px; }
.replay-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 16px 0 6px; }
.replay-controls a { color: var(--green); font-size: 13px; font-weight: 700; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.segmented button { min-height: 36px; padding: 4px 12px; border: 1px solid #c9d6c9; border-radius: 8px; background: white; color: var(--deep); font-size: 12px; font-weight: 700; }
.segmented button[aria-pressed="true"] { border-color: var(--forest); background: var(--forest); color: white; }
.replay-section .replay-origin { color: var(--deep); font-weight: 600; }
.replay-section details, .history-section details { margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.replay-section summary, .history-section summary { cursor: pointer; color: var(--green); }
.history-section, .data-section { margin-top: 40px; padding: 26px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.history-section p, .data-section p { margin: 12px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.data-links { display: grid; gap: 12px; margin: 16px 0 0; padding: 0; list-style: none; }
.data-links li { display: grid; gap: 2px; }
.data-links a { color: var(--green); font-weight: 700; }
.data-links span { color: var(--muted); font-size: 13px; line-height: 1.55; }
#load-state { margin: 14px 2px 0; color: var(--muted); font-size: 11px; }
@media(max-width: 640px) {
	.species-icon { width: 44px; height: 44px; }
	.history-section, .data-section { padding: 18px; }
}
.calibration-section h3 { margin: 18px 0 6px; font-size: 14px; }
.model-limits { margin: 0; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.conventions { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 4px 24px; margin: 12px 0 0; font-size: 12px; }
.conventions div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.conventions dt { color: var(--muted); }
.conventions dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

.topbar .species-pick { margin-left: auto; }
.topbar .species-pick select { min-height: 36px; width: min(300px, 25vw); }
.response-chart { position: relative; }
.response-chart svg:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.curve-cursor { stroke: var(--muted); stroke-width: .5; stroke-dasharray: 2 3; pointer-events: none; }
.curve-cursor[hidden] { display: none; }
.curve-tooltip { position: absolute; top: 100%; left: 24px; right: 0; z-index: 3; pointer-events: none; display: block; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); color: var(--deep); font-size: 11px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.curve-tooltip[hidden] { display: none; }
.curve-legend { color: var(--muted); font-size: 10px; margin: 0; }
.legend-line.applied { border-top: 1px dashed #1f6b47; }
@media(max-width: 800px) {
	.topbar .species-pick > span { display: none; }
}
@media(max-width: 640px) {
	.topbar { height: auto; min-height: 100px; flex-wrap: wrap; padding-block: 10px; gap: 8px 14px; }
	.topbar .brand { font-size: 18px; }
	.topbar nav { margin-left: auto; gap: 10px; }
	.topbar .bar-link { font-size: 12px; }
	.topbar .species-pick { flex-basis: 100%; margin: 0; }
	.topbar .species-pick > span { display: inline; font-size: 11px; }
	.topbar .species-pick select { flex: 1; width: 0; max-width: none; font-size: 12px; }
	.curve-legend { font-size: 10px; line-height: 1.6; }
}

.species-layout h2[id] { scroll-margin-top: 120px; }

.response-chart .response-line, .response-chart .curve-grid { vector-effect: non-scaling-stroke; }
.response-chart .curve-label { font-size: var(--curve-text-size, 10px); }
