:root {
    color-scheme: dark;
    font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --page: #06111b;
    --surface: #0c1c2a;
    --surface-2: #102536;
    --surface-3: #142c3f;
    --border: #24435a;
    --border-bright: #35637f;
    --text: #edf7ff;
    --muted: #a7bdd0;
    --accent: #2dd4bf;
    --accent-2: #22d3ee;
    --blue: #0ea5e9;
    --danger: #fb7185;
    --warning: #fbbf24;
    --shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: var(--page);
    color: var(--text);
}

body {
    min-width: 320px;
    background:
        radial-gradient(circle at 15% 0%, rgba(14, 165, 233, .10), transparent 32rem),
        radial-gradient(circle at 90% 18%, rgba(45, 212, 191, .07), transparent 28rem),
        var(--page);
}

button,
input,
select {
    font: inherit;
}

button,
label.file-button {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
label.file-button:focus-within {
    outline: 2px solid var(--accent-2);
    outline-offset: 2px;
}

button:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.app-shell {
    width: min(1760px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    padding: 18px;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 82px;
    padding: 15px 18px;
    border: 1px solid var(--border-bright);
    border-radius: 15px;
    background:
        linear-gradient(115deg, rgba(14, 165, 233, .12), transparent 36%),
        #0b2133;
    box-shadow: var(--shadow);
}

.brand {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 14px;
}

.brand-mark {
    display: block;
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    border-radius: 13px;
    box-shadow:
        inset 0 1px rgba(255, 255, 255, .18),
        0 12px 30px rgba(0, 118, 168, .24);
    object-fit: contain;
}

.brand h1 {
    margin: 0;
    font-size: clamp(1.35rem, 2vw, 1.85rem);
    letter-spacing: .035em;
}

.brand h1:focus,
.brand h1:focus-visible,
.brand:focus,
.brand:focus-visible {
    border: 0;
    outline: 0 !important;
    box-shadow: none !important;
}

.brand p {
    margin: 3px 0 0;
    color: #c8dceb;
    font-size: .9rem;
}

.project-name {
    display: grid;
    flex: 0 1 300px;
    gap: 5px;
    margin-left: 24px;
    color: #b7cede;
    font-size: .72rem;
    letter-spacing: .03em;
}

input,
select {
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    background: #091825;
}

input:hover,
select:hover {
    border-color: var(--border-bright);
}

input[type="number"] {
    min-width: 0;
}

input[type="checkbox"] {
    min-height: auto;
    accent-color: var(--accent);
}

input[type="color"] {
    width: 48px;
    min-height: 38px;
    padding: 3px;
    cursor: pointer;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: rgba(12, 28, 42, .95);
}

.toolbar-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.toolbar-group.right {
    justify-content: flex-end;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 7px 13px;
    border: 1px solid #2c4b61;
    border-radius: 8px;
    color: #e9f5fc;
    background: #132b3d;
    cursor: pointer;
    font-weight: 650;
    text-decoration: none;
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.button:hover:not(:disabled),
.file-button:hover {
    border-color: #4e7c98;
    background: #19384f;
}

.button:active:not(:disabled),
.file-button:active {
    transform: translateY(1px);
}

.button.primary {
    border-color: #4de6d2;
    color: #03241f;
    background: linear-gradient(180deg, #5eead4, #2dd4bf);
    box-shadow: 0 7px 20px rgba(45, 212, 191, .16);
}

.button.primary:hover:not(:disabled) {
    border-color: #99f6e4;
    background: linear-gradient(180deg, #99f6e4, #49ddc9);
}

.button-icon {
    margin-right: 7px;
    font-size: .8rem;
}

.file-button {
    position: relative;
    overflow: hidden;
}

.file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    opacity: 0;
    cursor: pointer;
}

.icon-button {
    width: 38px;
    padding: 0;
    border-radius: 50%;
    color: #9fe9ff;
    font-family: Georgia, serif;
    font-size: 1.1rem;
}

.separator {
    align-self: stretch;
    width: 1px;
    min-height: 30px;
    margin: 4px 3px;
    background: var(--border);
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: .82rem;
}

.speed-control input {
    width: 125px;
    min-height: auto;
    padding: 0;
    accent-color: var(--accent);
}

.speed-control strong {
    width: 34px;
    color: var(--accent);
    text-align: right;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 2.1fr) minmax(360px, 1fr);
    align-items: start;
    gap: 14px;
    margin-top: 14px;
}

.visual-column {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.panel {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: rgba(12, 28, 42, .94);
    box-shadow: 0 15px 42px rgba(0, 0, 0, .13);
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 58px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    background: #102536;
}

.panel-heading > div {
    display: grid;
    gap: 2px;
}

.panel-heading strong {
    font-size: .94rem;
}

.eyebrow {
    color: #79cce6;
    font-size: .66rem;
    font-weight: 750;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.state-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    background: #0b1c29;
    font-size: .7rem;
    font-weight: 700;
}

.state-pill.running {
    border-color: rgba(45, 212, 191, .45);
    color: #8af0e1;
    background: rgba(18, 84, 76, .38);
}

.state-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #7890a1;
}

.state-pill.running .state-dot {
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(45, 212, 191, .11);
}

.canvas-wrap {
    position: relative;
    width: 100%;
    background: #07131e;
}

.habitat-wrap {
    min-height: 310px;
}

.chart-wrap {
    min-height: 155px;
}

canvas {
    display: block;
    width: 100%;
    touch-action: manipulation;
}

.habitat-canvas {
    min-height: 310px;
    cursor: crosshair;
}

.chart-canvas {
    min-height: 155px;
}

.habitat-hint {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 7px 14px;
    border-top: 1px solid #1b3549;
    color: #819bad;
    background: #0a1a27;
    font-size: .7rem;
}

.muted {
    color: var(--muted);
    font-size: .75rem;
}

.detail-panel {
    position: sticky;
    top: 12px;
    min-height: 716px;
}

.tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    padding: 7px;
    border-bottom: 1px solid var(--border);
    background: #0a1b28;
}

.tabs button {
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #aac0d0;
    background: transparent;
    cursor: pointer;
    font-weight: 700;
}

.tabs button:hover {
    color: white;
    background: #132b3d;
}

.tabs button.active {
    border-color: #4fcde2;
    color: white;
    background: linear-gradient(180deg, #1079a4, #0b668c);
    box-shadow: inset 0 1px rgba(255, 255, 255, .15);
}

.tab-content {
    padding: 16px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.section-heading h2 {
    margin: 2px 0 0;
    font-size: 1.22rem;
}

.total-population {
    color: #d8f8ff;
    font-size: 1.55rem;
}

.population-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.population-card {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-width: 0;
    padding: 9px;
    border: 1px solid #27465c;
    border-radius: 10px;
    color: var(--text);
    background: #102536;
    cursor: pointer;
    text-align: left;
}

.population-card:hover {
    border-color: #3d718e;
    background: #142d40;
}

.species-symbol {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 9px;
    font-family: "Segoe UI Symbol", sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
}

.species-symbol.large {
    width: 48px;
    height: 48px;
    font-size: 1.45rem;
}

.population-name {
    display: grid;
    min-width: 0;
}

.population-name strong,
.population-name small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.population-name strong {
    font-size: .84rem;
}

.population-name small {
    margin-top: 2px;
    color: var(--muted);
    font-size: .64rem;
}

.population-value {
    color: white;
    font-size: 1.05rem;
    font-weight: 750;
}

.info-card,
.warning-card {
    display: flex;
    gap: 12px;
    margin-top: 15px;
    padding: 13px;
    border: 1px solid #245169;
    border-radius: 10px;
    color: #c9dfec;
    background: rgba(12, 67, 89, .25);
}

.info-card p,
.warning-card p {
    margin: 4px 0 0;
    color: #a9c1d1;
    font-size: .78rem;
    line-height: 1.5;
}

.info-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    color: #7de9f8;
    background: rgba(14, 165, 233, .18);
    font-size: 1.2rem;
}

.sample-card {
    margin-top: 15px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #0d202f;
}

.sample-card h3 {
    margin: 3px 0 11px;
    font-size: .98rem;
}

.sample-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.species-list {
    display: grid;
    gap: 5px;
    max-height: 246px;
    padding-right: 3px;
    overflow-y: auto;
}

.species-row {
    display: grid;
    grid-template-columns: 12px 20px minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 6px 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #c4d9e6;
    background: #0e2131;
    cursor: pointer;
    text-align: left;
}

.species-row:hover {
    border-color: #2f5972;
}

.species-row.selected {
    border-color: #54c8df;
    color: white;
    background: #10384c;
}

.species-row strong {
    overflow: hidden;
    font-size: .8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 50%;
}

.species-state {
    color: #8da8ba;
    font-size: .68rem;
}

.editor-card {
    margin-top: 14px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #0d202f;
}

.editor-title {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    padding-bottom: 12px;
    border-bottom: 1px solid #203d52;
}

.editor-title h3 {
    overflow: hidden;
    margin: 2px 0 0;
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #bed1df;
    font-size: .74rem;
}

.switch input {
    width: 0;
    height: 0;
    opacity: 0;
}

.switch span {
    position: relative;
    width: 34px;
    height: 19px;
    border-radius: 999px;
    background: #355064;
    transition: background .15s;
}

.switch span::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: white;
    content: "";
    transition: transform .15s;
}

.switch input:checked + span {
    background: #13a994;
}

.switch input:checked + span::after {
    transform: translateX(15px);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.form-grid > label {
    display: grid;
    gap: 4px;
    min-width: 0;
    color: #a9c1d0;
    font-size: .69rem;
}

.form-grid > label:first-child {
    grid-column: span 2;
}

.form-grid input {
    width: 100%;
}

.symbol-input {
    text-align: center;
}

.color-input-row {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
}

.form-grid .color-input-row input[type="color"] {
    width: 72px;
    min-width: 72px;
    height: 38px;
    min-height: 38px;
    padding: 3px;
}

.color-input-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input-row input[type="color"]::-webkit-color-swatch {
    border: 0;
    border-radius: 4px;
}

.color-input-row input[type="color"]::-moz-color-swatch {
    border: 0;
    border-radius: 4px;
}

.color-input-row code {
    overflow: hidden;
    padding: 7px 9px;
    color: #0f172a;
    background: #f8fafc;
    border: 1px solid #94a3b8;
    border-radius: 6px;
    font-size: .7rem;
    font-weight: 600;
    text-overflow: ellipsis;
}

.checkbox-field {
    display: flex !important;
    grid-column: span 2;
    align-items: center;
    flex-direction: row;
    gap: 8px !important;
    min-height: 38px;
}

.checkbox-field input {
    width: auto;
}

.hunt-fieldset {
    margin: 14px 0 0;
    padding: 10px;
    border: 1px solid #27475d;
    border-radius: 9px;
}

.hunt-fieldset legend {
    padding: 0 6px;
    color: #8fb1c5;
    font-size: .7rem;
}

.hunt-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.hunt-option {
    display: grid;
    grid-template-columns: auto 10px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    overflow: hidden;
    color: #c6dae6;
    font-size: .7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-grid > label:first-child {
    grid-column: auto;
}

.toggle-list {
    display: grid;
    gap: 3px;
    margin-top: 14px;
}

.toggle-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 11px 4px;
    border-top: 1px solid #203e52;
}

.toggle-row > span {
    display: grid;
    gap: 2px;
}

.toggle-row strong {
    font-size: .78rem;
}

.toggle-row small {
    color: var(--muted);
    font-size: .65rem;
    line-height: 1.4;
}

.toggle-row input {
    width: 18px;
    height: 18px;
}

.warning-card {
    display: block;
    border-color: rgba(251, 191, 36, .28);
    background: rgba(120, 73, 10, .18);
}

.warning-card strong {
    color: #ffe19a;
}

.statusbar {
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 38px;
    margin-top: 14px;
    padding: 8px 12px;
    border: 1px solid #1f3b4f;
    border-radius: 10px;
    color: #88a3b5;
    background: rgba(9, 24, 37, .96);
    font-size: .7rem;
}

.status-message {
    flex: 1;
    overflow: hidden;
    color: #bcd0dd;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.statusbar strong {
    color: #e6f5fc;
}

.storage-state::before {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--accent);
    content: "";
}

.modal-backdrop {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(1, 8, 13, .78);
    backdrop-filter: blur(6px);
}

.modal {
    position: relative;
    width: min(620px, 100%);
    overflow: hidden;
    border: 1px solid #37647d;
    border-radius: 17px;
    background: #0b1d2b;
    box-shadow: 0 32px 90px rgba(0, 0, 0, .5);
}

.info-modal {
    display: flex;
    width: min(840px, 100%);
    max-height: min(900px, calc(100vh - 40px));
    flex-direction: column;
}

.modal-close {
    position: absolute;
    z-index: 1;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: 1px solid #3b6076;
    border-radius: 50%;
    color: white;
    background: #102d40;
    cursor: pointer;
    font-size: 1.4rem;
}

.modal-hero {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 25px;
    border-bottom: 1px solid #2a4b61;
    background:
        radial-gradient(circle at 88% 0%, rgba(45, 212, 191, .14), transparent 14rem),
        linear-gradient(135deg, #12334a, #0b2435);
}

.modal-mark {
    width: 60px;
    height: 60px;
    font-size: 2rem;
}

.modal-hero h2 {
    margin: 3px 0 0;
    font-size: 1.7rem;
}

.modal-hero p {
    margin: 2px 0 0;
    color: #bad4e3;
}

.modal-tabs {
    display: flex;
    flex: 0 0 auto;
    gap: 5px;
    padding: 10px 18px 0;
    border-bottom: 1px solid #2a4b61;
    background: #0c2130;
}

.modal-tab {
    padding: 9px 14px 10px;
    border: 1px solid transparent;
    border-bottom: 3px solid transparent;
    color: #b9d0dd;
    background: transparent;
    cursor: pointer;
    font: 650 .8rem/1.2 "Segoe UI", sans-serif;
}

.modal-tab:hover {
    color: white;
    background: #143348;
}

.modal-tab.active {
    border-bottom-color: var(--accent);
    color: white;
    background: #123047;
}

.modal-scroll {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-color: #4f829f #0b1d2b;
}

.modal-content {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 18px;
}

.modal-card {
    padding: 14px;
    border: 1px solid #2c5067;
    border-radius: 10px;
    background: #10283a;
}

.modal-card h3 {
    margin: 0 0 6px;
    color: #f0f8fc;
    font-size: .9rem;
}

.modal-card p {
    margin: 0;
    color: #b9d0dd;
    font-size: .76rem;
    line-height: 1.55;
}

.article-teaser {
    grid-column: span 2;
    border-color: #81633f;
    background: #1c3040;
}

.historical-article {
    padding: 22px 26px 28px;
    color: #d6e4f0;
}

.article-header {
    padding: 20px 22px;
    border: 1px solid #9a7044;
    border-radius: 11px;
    background:
        linear-gradient(135deg, rgba(177, 116, 58, .13), transparent 55%),
        #152a3b;
}

.article-publication,
.article-author {
    display: block;
}

.article-publication {
    color: #e4b984;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.article-author {
    margin-top: 14px;
    color: #c7d8e8;
    font-size: .84rem;
    font-style: italic;
}

.article-header h3 {
    margin: 3px 0 0;
    color: white;
    font-size: clamp(1.55rem, 4vw, 2.2rem);
    line-height: 1.12;
}

.article-subtitle {
    max-width: 650px;
    margin: 10px 0 0;
    color: #d6e4f0;
    font-size: .96rem;
    font-style: italic;
    line-height: 1.55;
}

.article-editorial-note {
    margin: 18px 0;
    padding: 16px 18px;
    border-left: 4px solid #5d859f;
    border-radius: 5px;
    background: #12283a;
}

.article-editorial-note strong {
    color: #e4b984;
    font-size: .92rem;
}

.article-editorial-note p {
    margin: 7px 0 0;
    color: #c7d8e8;
    font-size: .85rem;
    font-style: italic;
    line-height: 1.65;
}

.article-lead,
.article-section p {
    color: #d6e4f0;
    font-size: .9rem;
    line-height: 1.72;
}

.article-lead {
    margin: 0 2px 20px;
    color: #e5edf8;
    font-size: .94rem;
}

.article-section {
    margin: 0 2px 21px;
}

.article-section h4,
.article-figures h4 {
    margin: 0 0 8px;
    color: white;
    font-size: 1.12rem;
}

.article-section p {
    margin: 0 0 11px;
}

.article-figures {
    margin-top: 4px;
    padding: 17px 18px 7px;
    border: 1px solid #31536a;
    border-radius: 9px;
    background: #10283a;
}

.article-figure {
    margin: 13px 0 18px;
}

.article-figure-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 12px;
}

.article-figure a {
    display: block;
    overflow: hidden;
    padding: 5px;
    border: 1px solid #9a7044;
    border-radius: 7px;
    background: #f3efe7;
}

.article-figure a:focus-visible {
    outline: 3px solid #67d5ef;
    outline-offset: 3px;
}

.article-figure img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 3px;
}

.article-figure a > span {
    display: block;
    padding: 7px 4px 3px;
    color: #44311f;
    font-size: .72rem;
    font-weight: 700;
    text-align: center;
}

.article-figure figcaption {
    margin-top: 9px;
    color: #bfd2de;
    font-size: .82rem;
    font-style: italic;
    line-height: 1.6;
}

.article-figure strong {
    color: #e4b984;
    font-style: normal;
}

.article-closing-note {
    margin: 14px 0 0;
    padding: 13px 15px;
    border: 1px solid #9a7044;
    border-radius: 7px;
    color: #f1d0a7;
    background: #1a3142;
    font-size: .84rem;
    font-weight: 650;
}

.shortcut-grid {
    display: grid;
    grid-column: span 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 2px;
}

.shortcut-grid span {
    color: #a9c2d1;
    font-size: .72rem;
}

kbd {
    display: inline-block;
    min-width: 57px;
    margin-right: 5px;
    padding: 4px 6px;
    border: 1px solid #3a6178;
    border-bottom-width: 2px;
    border-radius: 5px;
    color: #d8f5ff;
    background: #0a1b28;
    font: 650 .66rem/1 "Segoe UI", sans-serif;
    text-align: center;
}

.modal-actions {
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-end;
    padding: 12px 18px 18px;
    border-top: 1px solid #203e51;
    background: #0b1d2b;
}

.loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 16px;
    color: #dbeef8;
}

.loading-mark {
    animation: loading-pulse 1.5s ease-in-out infinite;
}

.loading-screen > div {
    display: grid;
    gap: 9px;
}

.loading-bar {
    display: block;
    width: 210px;
    height: 4px;
    overflow: hidden;
    border-radius: 99px;
    background: #183448;
}

.loading-bar i {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    animation: loading-slide 1.25s ease-in-out infinite;
}

@keyframes loading-slide {
    from {
        transform: translateX(-110%);
    }
    to {
        transform: translateX(340%);
    }
}

@keyframes loading-pulse {
    50% {
        box-shadow: 0 0 0 8px rgba(45, 212, 191, .08);
    }
}

#blazor-error-ui {
    position: fixed;
    z-index: 2000;
    right: 16px;
    bottom: 16px;
    display: none;
    max-width: 480px;
    padding: 13px 44px 13px 15px;
    border: 1px solid #f59e0b;
    border-radius: 9px;
    color: #fff4d3;
    background: #482b09;
    box-shadow: var(--shadow);
}

#blazor-error-ui .reload {
    margin-left: 7px;
    color: white;
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: 8px;
    right: 12px;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
}

.toast {
    position: fixed;
    z-index: 2100;
    right: 18px;
    bottom: 18px;
    max-width: min(440px, calc(100vw - 36px));
    padding: 12px 15px;
    border: 1px solid #37647d;
    border-radius: 9px;
    color: white;
    background: #123047;
    box-shadow: var(--shadow);
    animation: toast-in .2s ease-out;
}

.toast.error {
    border-color: #fb7185;
    background: #4a1721;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

.not-found {
    display: grid;
    place-items: center;
    align-content: center;
    min-height: 100vh;
    gap: 15px;
}

.not-found h1 {
    margin: 0;
}

@media (max-width: 1180px) {
    .workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .detail-panel {
        position: static;
        min-height: 0;
    }

    .population-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .app-shell {
        padding: 10px;
    }

    .app-header {
        align-items: stretch;
        flex-direction: column;
        gap: 13px;
    }

    .project-name {
        flex-basis: auto;
        margin-left: 64px;
    }

    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .toolbar-group.right {
        justify-content: space-between;
        padding-top: 8px;
        border-top: 1px solid var(--border);
    }

    .population-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .storage-state {
        display: none;
    }
}

@media (max-width: 600px) {
    .brand {
        align-items: flex-start;
    }

    .brand-mark {
        width: 44px;
        height: 44px;
    }

    .brand p {
        font-size: .75rem;
        line-height: 1.4;
    }

    .project-name {
        margin-left: 0;
    }

    .toolbar-group {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .toolbar-group.right {
        display: flex;
    }

    .separator {
        display: none;
    }

    .speed-control {
        min-width: 0;
    }

    .speed-control input {
        width: min(120px, 32vw);
    }

    .habitat-wrap,
    .habitat-canvas {
        min-height: 230px;
    }

    .chart-wrap,
    .chart-canvas {
        min-height: 140px;
    }

    .habitat-hint {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .population-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .tab-content {
        padding: 12px;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .form-grid > label:first-child,
    .checkbox-field {
        grid-column: auto;
    }

    .hunt-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .statusbar {
        display: grid;
        grid-template-columns: repeat(2, auto);
        gap: 5px 15px;
    }

    .status-message {
        grid-column: span 2;
    }

    .modal-content,
    .shortcut-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .modal-card,
    .article-teaser,
    .shortcut-grid {
        grid-column: auto;
    }

    .historical-article {
        padding: 16px 15px 22px;
    }

    .article-header {
        padding: 17px 16px;
    }

    .article-figure-pair {
        grid-template-columns: minmax(0, 1fr);
    }

    .modal-tabs {
        padding-left: 10px;
    }

    .modal-tab {
        padding-right: 10px;
        padding-left: 10px;
        font-size: .73rem;
    }
}
