:root {
    color-scheme: dark;
    --page: #101820;
    --shell: #071724;
    --shell-deep: #06131e;
    --panel: #0e1f2c;
    --panel-raised: #132633;
    --panel-input: #081824;
    --line: #344653;
    --line-soft: rgba(91, 111, 124, .36);
    --text: #f4f6f7;
    --muted: #aab4be;
    --orange: #ff981f;
    --orange-soft: #ffc36e;
    --green: #68e2a3;
    --green-deep: #0b503d;
    --cyan: #45d7d2;
    --red: #ff8177;
    --shadow: 0 24px 64px rgba(0, 0, 0, .32);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    background: var(--page);
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 50% 12%, rgba(48, 75, 92, .24), transparent 38rem),
        #101820;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.45;
}

button,
input,
select {
    font: inherit;
}

button,
input:not([type="checkbox"]):not([type="radio"]),
select,
summary {
    min-height: 44px;
}

button,
select,
summary {
    cursor: pointer;
}

a {
    color: inherit;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 3.4vw, 2.75rem);
    line-height: 1.05;
    letter-spacing: -.035em;
}

h2 {
    margin-bottom: .16rem;
    font-size: 1.12rem;
    line-height: 1.25;
}

h2 small {
    color: var(--muted);
    font-size: .75em;
    font-weight: 500;
}

p {
    color: var(--muted);
}

.app-frame {
    width: min(1680px, calc(100% - 72px));
    margin: 32px auto 18px;
    overflow: clip;
    border: 1px solid #52616b;
    border-radius: 18px;
    background:
        radial-gradient(circle at 48% 17%, rgba(23, 66, 83, .16), transparent 36rem),
        var(--shell);
    box-shadow: var(--shadow);
}

.app-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    align-items: center;
    min-height: 92px;
    padding: 0 34px;
    border-bottom: 1px solid var(--line);
    background: rgba(6, 20, 31, .96);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .62rem;
    width: max-content;
    color: var(--text);
    text-decoration: none;
}

.brand-emblem {
    display: block;
    width: 92px;
    height: 70px;
    flex: 0 0 92px;
    overflow: hidden;
    background-image: url("../images/hatchly-emblem.webp");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    filter:
        drop-shadow(0 0 7px rgba(69, 215, 210, .26))
        drop-shadow(0 6px 12px rgba(0, 0, 0, .58));
}

.brand-wordmark {
    display: block;
    width: 128px;
    height: 28px;
    flex: 0 0 128px;
    background-image: url("../images/hatchly-wordmark.webp");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .58));
}

.desktop-nav {
    align-self: stretch;
    display: flex;
    justify-content: center;
    gap: 2.15rem;
}

.desktop-nav a {
    position: relative;
    display: grid;
    min-width: 72px;
    place-items: center;
    padding: .7rem .25rem;
    color: #b6bec5;
    font-size: .9rem;
    text-align: center;
    text-decoration: none;
}

.desktop-nav a::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    background: transparent;
    content: "";
}

.desktop-nav a.active {
    color: var(--orange);
}

.desktop-nav a.active::after {
    background: var(--orange);
}

.server-picker {
    display: flex;
    align-items: center;
    justify-self: end;
    gap: .55rem;
}

.server-picker label {
    display: none;
}

.server-picker select {
    min-width: 166px;
}

.app-main {
    width: 100%;
    padding: 42px 36px 44px;
}

.site-footer {
    display: grid;
    width: min(1040px, calc(100% - 48px));
    gap: .35rem;
    margin: 0 auto 42px;
    color: #c8d0d7;
    font-size: .78rem;
    line-height: 1.5;
    text-align: center;
}

.site-footer p {
    max-width: 980px;
    margin: 0 auto;
    color: inherit;
}

.page-heading {
    margin: 0 10px 26px;
}

.page-heading .eyebrow,
.page-heading p,
.page-heading .rate-summary {
    display: none;
}

.eyebrow {
    display: block;
    margin-bottom: .25rem;
    color: var(--orange);
    font-size: .7rem;
    font-weight: 820;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.planner-grid {
    display: grid;
    grid-template-columns: minmax(340px, 370px) minmax(0, 1fr);
    align-items: start;
    gap: 22px;
}

.trough-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(310px, .72fr);
    align-items: start;
    gap: 16px;
}

.results-column,
.trough-inputs,
.trough-results {
    display: grid;
    gap: 16px;
}

.dashboard-grid {
    grid-template-columns:
        minmax(225px, 1.08fr)
        minmax(235px, 1.08fr)
        minmax(205px, .9fr);
    grid-template-areas:
        "hero hero timeline"
        "actions daily summary";
    align-items: stretch;
}

.dashboard-grid > .empty-state {
    grid-column: 1 / -1;
}

.feeding-result {
    grid-area: hero;
}

.lifecycle-card {
    grid-area: timeline;
}

.next-actions {
    grid-area: actions;
}

.daily-food-card {
    grid-area: daily;
}

.summary-card {
    grid-area: summary;
}

.trough-results,
.setup-card {
    position: sticky;
    top: 106px;
}

.mobile-quick-setup {
    display: none;
}

.card {
    overflow: hidden;
    padding: 22px;
    border: 1px solid #43535e;
    border-radius: 14px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, .025), transparent 30%),
        var(--panel);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .13);
}

.section-title {
    display: flex;
    align-items: center;
    gap: .72rem;
    margin-bottom: 1.15rem;
}

.section-title.compact {
    margin-bottom: .8rem;
}

.section-title p {
    margin: 0;
    font-size: .77rem;
}

.section-title p strong {
    color: var(--orange);
}

.section-icon {
    display: grid;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    place-items: center;
    color: var(--orange);
    font-size: 1.15rem;
}

.row-title .compact-button {
    margin-left: auto;
}

.form-stack,
.editor-list {
    display: grid;
    gap: .9rem;
}

label,
fieldset {
    min-width: 0;
}

label > span,
fieldset legend,
.row-readout span {
    display: block;
    margin-bottom: .38rem;
    color: #c1c8ce;
    font-size: .81rem;
    font-weight: 520;
}

fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

input,
select {
    width: 100%;
    min-height: 50px;
    padding: .72rem .85rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    outline: 0;
    color: var(--text);
    background: var(--panel-input);
}

select {
    padding-right: 2.25rem;
    color-scheme: dark;
}

select option,
select optgroup {
    color: var(--text);
    background-color: var(--panel-input);
}

input:hover,
select:hover {
    border-color: #657582;
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(255, 152, 31, .32);
    outline-offset: 2px;
}

input[type="checkbox"],
input[type="radio"] {
    width: 20px;
    min-height: 20px;
    accent-color: var(--orange);
}

.input-with-suffix {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel-input);
}

.input-with-suffix:focus-within {
    outline: 3px solid rgba(255, 152, 31, .32);
    outline-offset: 2px;
}

.input-with-suffix input {
    min-width: 0;
    border: 0;
    background: transparent;
}

.input-with-suffix input:focus-visible {
    outline: 0;
}

.input-with-suffix > span {
    padding: 0 .85rem;
    color: var(--muted);
    font-weight: 700;
}

.buffer-fieldset,
.unofficial-rates,
.special-settings {
    padding: 0;
}

.unofficial-rates,
.special-settings {
    margin-bottom: 1rem;
    padding: 14px;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: rgba(6, 19, 30, .46);
}

.duration-fields,
.three-column-fields {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .65rem;
}

.three-column-fields {
    grid-template-columns: repeat(3, 1fr);
}

.field-help {
    margin: .55rem 0 0;
    font-size: .72rem;
}

.check-row {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: .6rem;
    margin-top: .8rem;
}

.check-row > span {
    margin: 0;
    color: var(--text);
}

.feeding-result {
    position: relative;
    isolation: isolate;
    padding: 0;
    border-color: #326050;
    background: var(--panel);
}

.feeding-result::after,
.trough-hero::after {
    position: absolute;
    z-index: -1;
    right: -70px;
    top: -55px;
    width: 210px;
    height: 210px;
    border-radius: 50%;
    background: rgba(63, 207, 142, .08);
    content: "";
}

.feeding-result.success {
    border-color: #31745b;
}

.feeding-result.attention {
    border-color: rgba(255, 152, 31, .6);
}

.result-heading {
    display: flex;
    align-items: start;
    gap: .85rem;
    padding: 18px 20px 8px;
}

.result-heading h2 {
    margin-bottom: .25rem;
    color: var(--green);
    font-size: clamp(1.15rem, 2.1vw, 1.45rem);
    letter-spacing: -.02em;
}

.result-heading p {
    margin: 0;
    font-size: .83rem;
}

.feeding-result .result-heading .eyebrow {
    display: none;
}

.status-symbol {
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    place-items: center;
    clip-path: polygon(50% 0, 92% 20%, 86% 74%, 50% 100%, 14% 74%, 8% 20%);
    color: #063426;
    background: var(--green);
    font-size: 1.15rem;
    font-weight: 900;
}

.attention .status-symbol {
    color: #34200a;
    background: var(--orange-soft);
}

.hero-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: 4px 20px 0;
    border-bottom: 1px solid rgba(87, 118, 111, .42);
}

.hero-metrics > div {
    min-width: 0;
    padding: 13px 16px 16px;
    border-right: 1px solid rgba(87, 118, 111, .42);
}

.hero-metrics > div:first-child {
    padding-left: 0;
}

.hero-metrics > div:last-child {
    border-right: 0;
}

.hero-metrics span {
    display: block;
    color: #bdc8c8;
    font-size: .78rem;
}

.hero-metrics strong {
    display: block;
    overflow-wrap: anywhere;
    margin: .2rem 0;
    color: var(--text);
    font-size: clamp(1.5rem, 3.4vw, 2rem);
    line-height: 1;
    letter-spacing: -.04em;
}

.hero-metrics small {
    color: #c0c9cd;
    font-size: .7rem;
}

.feeding-details {
    margin: 0 20px 15px;
}

.feeding-details summary {
    min-height: 44px;
    padding: .62rem 0;
    color: var(--muted);
    font-size: .76rem;
    font-weight: 700;
}

.feeding-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem 1rem;
    margin: .15rem 0 .45rem;
}

.feeding-facts > div {
    min-width: 0;
}

.feeding-facts dt {
    margin-bottom: .12rem;
}

.feeding-facts dd {
    overflow-wrap: anywhere;
    font-size: .8rem;
    text-align: left;
}

.lifecycle-track {
    display: grid;
    gap: .5rem;
    margin: 18px 20px 0;
}

.track-captions {
    display: flex;
    justify-content: space-between;
    color: #c2c9ce;
    font-size: .72rem;
    font-weight: 720;
}

.track-captions span:first-child {
    color: var(--orange);
}

.phase-rail {
    position: relative;
    height: 18px;
}

.phase-rail::before {
    position: absolute;
    top: 6px;
    right: 0;
    left: 0;
    height: 6px;
    border-radius: 999px;
    background: #657078;
    content: "";
}

.track-progress {
    position: absolute;
    z-index: 1;
    top: 6px;
    left: 0;
    max-width: 100%;
    height: 6px;
    border-radius: 999px;
    background: var(--orange);
}

.phase-boundary {
    position: absolute;
    z-index: 2;
    top: 1px;
    width: 16px;
    height: 16px;
    border: 3px solid var(--panel);
    border-radius: 50%;
    background: #79858d;
    box-shadow: 0 0 0 2px #79858d;
    transform: translateX(-50%);
}

.phase-boundary.juvenile {
    left: var(--point-left, 10%);
}

.phase-boundary.adolescent {
    left: 50%;
}

.phase-boundary.adult {
    left: 100%;
}

.phase-boundary.active {
    background: var(--orange);
    box-shadow: 0 0 0 2px var(--orange);
}

.phase-labels {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .45rem;
}

.phase-label {
    min-width: 0;
    padding: .52rem .6rem;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: rgba(255, 255, 255, .018);
}

.phase-label strong,
.phase-label small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.phase-label strong {
    color: #d3dbe0;
    font-size: .76rem;
}

.phase-label small {
    margin-top: .08rem;
    color: var(--muted);
    font-size: .67rem;
}

.phase-label.active {
    border-color: rgba(255, 152, 31, .66);
    background: rgba(255, 152, 31, .1);
}

.phase-label.active strong {
    color: var(--orange);
}

.timeline-list,
.detail-grid {
    display: grid;
    gap: 0;
    margin: 0;
}

.timeline-list > div,
.detail-grid > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: .72rem 0;
    border-bottom: 1px solid var(--line-soft);
}

.timeline-list > div:last-child,
.detail-grid > div:last-child {
    border-bottom: 0;
}

dt {
    color: #c1c8cd;
    font-size: .78rem;
}

dd {
    margin: 0;
    font-weight: 760;
    text-align: right;
}

.timeline-list .emphasis dd {
    color: var(--text);
}

.timeline-list .timeline-total {
    display: grid;
    justify-content: stretch;
    padding: 1rem 0 .8rem;
}

.timeline-total dt {
    color: var(--text);
    font-weight: 700;
}

.timeline-total dd {
    margin-top: .18rem;
    color: var(--orange);
    font-size: 1.75rem;
    text-align: left;
}

.summary-food dd {
    color: var(--orange);
    font-size: 1.25rem;
}

.next-actions {
    display: flex;
    flex-direction: column;
}

.action-item {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: .72rem;
    margin-bottom: .65rem;
    padding: .75rem;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: rgba(255, 255, 255, .018);
}

.action-item:last-child {
    margin-bottom: 0;
}

.action-item strong,
.action-item span {
    display: block;
}

.action-item strong {
    font-size: .8rem;
}

.action-item span {
    margin-top: .15rem;
    color: var(--muted);
    font-size: .7rem;
}

.action-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    color: var(--orange);
    font-size: 1.15rem;
    font-weight: 900;
}

.action-icon.green {
    color: var(--green);
}

.action-icon.teal {
    color: var(--cyan);
}

.daily-bars {
    display: grid;
    gap: .7rem;
    margin-top: .7rem;
}

.daily-bar-row {
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    gap: .55rem;
    color: var(--muted);
    font-size: .7rem;
}

.daily-bar-row strong {
    color: var(--orange);
    text-align: right;
}

.bar-track {
    display: block;
    height: 10px;
    overflow: hidden;
    border-radius: 2px;
    background: #263642;
}

.bar-fill {
    display: block;
    height: 100%;
    background: linear-gradient(180deg, #ffad3c, #f58212);
}

.details-panel {
    margin-top: 1rem;
    padding-top: .75rem;
    border-top: 1px solid var(--line-soft);
}

.details-panel summary {
    min-height: 44px;
    padding: .6rem 0;
    color: var(--orange);
    font-size: .78rem;
    font-weight: 720;
}

.detail-grid {
    grid-template-columns: 1fr;
}

.loss-field {
    display: block;
    margin-top: .8rem;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: .65rem 1rem;
    border: 1px solid transparent;
    border-radius: 9px;
    font-weight: 800;
    text-decoration: none;
}

.button.primary {
    margin: 0 20px 20px;
    color: #281600;
    background: var(--orange);
}

.button.secondary {
    border-color: var(--line);
    color: var(--text);
    background: var(--panel-input);
}

.compact-button {
    min-height: 38px;
    padding: .45rem .72rem;
    font-size: .74rem;
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .65rem;
}

.choice-card {
    position: relative;
}

.choice-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice-card > span {
    display: grid;
    min-height: 76px;
    align-content: center;
    margin: 0;
    padding: .7rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--muted);
    background: var(--panel-input);
}

.choice-card strong,
.choice-card small {
    display: block;
}

.choice-card small {
    margin-top: .15rem;
    color: var(--muted);
    font-size: .68rem;
}

.choice-card input:checked + span {
    border-color: var(--orange);
    color: var(--text);
    background: rgba(255, 152, 31, .08);
    box-shadow: inset 0 0 0 1px rgba(255, 152, 31, .2);
}

.choice-card input:focus-visible + span {
    outline: 3px solid rgba(255, 152, 31, .32);
    outline-offset: 2px;
}

.container-count-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(170px, .7fr);
    align-items: end;
    gap: .75rem;
    margin-top: 1rem;
    padding: 13px;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: rgba(5, 18, 28, .52);
}

.container-count-row .row-readout {
    min-height: 46px;
}

.editor-row {
    display: grid;
    align-items: end;
    gap: .65rem;
    padding: 13px;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: rgba(5, 18, 28, .52);
}

.creature-editor {
    grid-template-columns: minmax(180px, 1.5fr) minmax(100px, .7fr) minmax(85px, .5fr) 44px;
}

.food-editor {
    grid-template-columns: minmax(180px, 1.5fr) minmax(100px, .6fr) minmax(90px, .6fr) 44px;
}

.row-readout {
    min-height: 46px;
    padding: .35rem .6rem;
    border-left: 1px solid var(--line);
}

.row-readout span {
    margin: 0;
}

.row-readout strong {
    display: block;
    margin-top: .1rem;
}

.row-readout small {
    display: block;
    margin-top: .12rem;
    color: var(--muted);
    font-size: .68rem;
}

.capacity-panel {
    margin-top: 1rem;
    padding: 13px;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: rgba(5, 18, 28, .52);
}

.capacity-heading {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
    font-size: .78rem;
}

.capacity-heading strong {
    color: var(--text);
}

.capacity-track {
    display: block;
    height: 8px;
    margin-top: .65rem;
    overflow: hidden;
    border-radius: 999px;
    background: #263944;
}

.capacity-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--orange);
}

.capacity-panel p {
    margin: .55rem 0 0;
    font-size: .72rem;
}

.capacity-panel.over-capacity {
    border-color: rgba(255, 129, 119, .58);
    background: rgba(91, 30, 26, .28);
}

.capacity-panel.over-capacity .capacity-fill {
    background: var(--red);
}

.capacity-panel.over-capacity p,
.capacity-panel.over-capacity .capacity-heading strong {
    color: #ffd0cc;
}

.icon-button {
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--muted);
    background: var(--panel-input);
    font-size: 1.25rem;
}

.icon-button.danger:hover:not(:disabled) {
    border-color: var(--red);
    color: var(--red);
}

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

.rate-summary {
    display: grid;
    min-width: 180px;
    padding: .85rem 1rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
}

.rate-summary span,
.rate-summary strong {
    font-size: .78rem;
}

.trough-hero {
    position: relative;
    isolation: isolate;
    min-height: 205px;
    border-color: rgba(255, 152, 31, .48);
}

.coverage-value {
    display: block;
    margin: .2rem 0;
    color: var(--orange);
    font-size: clamp(3rem, 8vw, 5rem);
    line-height: .95;
    letter-spacing: -.06em;
}

.trough-hero p {
    margin: .75rem 0 0;
}

.global-notice {
    width: calc(100% - 56px);
    margin: 12px auto 0;
    padding: .7rem 1rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: .8rem;
}

.global-notice.warning {
    border-color: rgba(255, 152, 31, .5);
    color: #ffe0b0;
    background: rgba(105, 57, 8, .42);
}

.global-notice.error,
.empty-state.error {
    border-color: rgba(255, 129, 119, .5);
    color: #ffd0cc;
    background: rgba(91, 30, 26, .38);
}

.inline-notice {
    width: auto;
    margin-top: 1rem;
}

.global-notice.contextual-warning {
    display: flex;
    width: 100%;
    align-items: flex-start;
    gap: .8rem;
    margin: 0 0 18px;
    padding: .9rem 1rem;
}

.contextual-warning-icon {
    display: grid;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 50%;
    color: #2e1b05;
    background: var(--orange-soft);
    font-weight: 900;
}

.contextual-warning strong {
    display: block;
    color: #ffe0b0;
    font-size: .88rem;
}

.contextual-warning p {
    margin: .18rem 0 0;
    color: #e8cda4;
    font-size: .78rem;
}

.empty-state,
.loading-card {
    min-height: 170px;
    text-align: center;
}

.loading-card {
    display: grid;
    place-content: center;
}

.loading-card p {
    margin: .75rem 0 0;
}

.loading-dot {
    width: 18px;
    height: 18px;
    margin: auto;
    border: 3px solid var(--line);
    border-top-color: var(--orange);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.mobile-nav {
    display: none;
}

.startup-shell {
    min-height: min(820px, calc(100vh - 96px));
}

.startup-nav {
    align-items: stretch;
}

.startup-nav span {
    position: relative;
    display: grid;
    min-width: 72px;
    place-items: center;
    color: #b6bec5;
    font-size: .9rem;
}

.startup-nav span.active {
    color: var(--orange);
}

.startup-nav span.active::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--orange);
    content: "";
}

.startup-server {
    min-width: 166px;
    min-height: 44px;
    display: grid;
    place-items: center;
    justify-self: end;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--muted);
    background: var(--panel-input);
    font-size: .86rem;
}

.startup-heading {
    width: min(360px, 55%);
    height: 42px;
    margin: 0 10px 22px;
}

.startup-grid {
    display: grid;
    grid-template-columns: 344px minmax(0, 1fr);
    align-items: start;
    gap: 18px;
}

.startup-results,
.startup-card-row {
    display: grid;
    gap: 14px;
}

.startup-card-row {
    grid-template-columns: repeat(3, 1fr);
}

.startup-panel {
    min-height: 180px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(21, 42, 55, .82), rgba(8, 25, 37, .88));
}

.startup-setup {
    min-height: 525px;
}

.startup-hero {
    min-height: 330px;
}

.startup-title {
    width: 42%;
    height: 24px;
    margin-bottom: 30px;
}

.startup-field {
    width: 100%;
    height: 48px;
    margin: 0 0 28px;
}

.startup-result {
    width: 56%;
    height: 72px;
    margin-bottom: 58px;
}

.startup-timeline {
    width: 88%;
    height: 12px;
}

.skeleton-block {
    overflow: hidden;
    border-radius: 9px;
    background: #1b3443;
}

.skeleton-block::after {
    display: block;
    width: 55%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .08), transparent);
    content: "";
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
    transform: translateX(-120%);
}

@keyframes skeleton-shimmer {
    to { transform: translateX(240%); }
}

#blazor-error-ui {
    position: fixed;
    z-index: 1000;
    right: 16px;
    bottom: 16px;
    left: 16px;
    display: none;
    max-width: 680px;
    margin: auto;
    padding: 1rem 3rem 1rem 1rem;
    border: 1px solid var(--red);
    border-radius: 10px;
    color: var(--text);
    background: #421c18;
    box-shadow: var(--shadow);
}

#blazor-error-ui .reload {
    color: var(--orange);
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: .75rem;
    right: 1rem;
    cursor: pointer;
}

.blazor-error-boundary {
    padding: 1rem;
    border-radius: 10px;
    color: white;
    background: #8d2921;
}

.blazor-error-boundary::after {
    content: "An unexpected error occurred.";
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1120px) {
    .app-frame {
        width: calc(100% - 24px);
        margin: 12px auto 16px;
    }

    .app-header {
        grid-template-columns: 230px 1fr 220px;
        padding: 0 20px;
    }

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

    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "hero hero"
            "timeline actions"
            "daily summary";
    }

    .feeding-result {
        min-height: auto;
    }
}

@media (min-width: 1500px) {
    body {
        font-size: 17px;
    }

    .brand-emblem {
        width: 100px;
        height: 76px;
        flex-basis: 100px;
    }

    .brand-wordmark {
        width: 142px;
        height: 31px;
        flex-basis: 142px;
    }

    .server-picker select {
        min-width: 188px;
    }
}

@media (max-width: 820px) {
    html,
    body {
        background: var(--shell-deep);
    }

    .app-frame {
        width: 100%;
        min-height: 100vh;
        margin: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .app-header {
        grid-template-columns: 1fr auto;
        min-height: 74px;
        padding: 0 13px;
    }

    .brand {
        gap: .4rem;
    }

    .brand-emblem {
        width: 70px;
        height: 53px;
        flex-basis: 70px;
    }

    .brand-wordmark {
        width: 104px;
        height: 23px;
        flex-basis: 104px;
    }

    .desktop-nav {
        display: none;
    }

    .startup-shell {
        min-height: 100vh;
    }

    .startup-server {
        min-width: 124px;
        min-height: 44px;
        font-size: .75rem;
    }

    .startup-main {
        padding-top: 12px;
    }

    .startup-heading {
        width: 68%;
        height: 54px;
        margin: 0 0 10px;
    }

    .startup-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .startup-setup {
        min-height: 270px;
    }

    .startup-setup .startup-field:nth-last-child(-n + 2) {
        display: none;
    }

    .startup-hero {
        min-height: 245px;
    }

    .startup-card-row {
        grid-template-columns: 1fr;
    }

    .startup-card-row .startup-panel {
        min-height: 76px;
    }

    .server-picker select {
        min-width: 132px;
        max-width: 42vw;
        min-height: 44px;
        padding: .55rem .7rem;
        font-size: .75rem;
    }

    .app-main {
        padding: 10px 12px 92px;
    }

    .site-footer {
        width: calc(100% - 32px);
        margin: 0 auto;
        padding: 0 0 92px;
        font-size: .72rem;
        text-align: left;
    }

    .page-heading {
        display: none;
    }

    .mobile-quick-setup {
        display: grid;
        gap: 8px;
        margin-bottom: 8px;
    }

    .mobile-creature-card,
    .mobile-buffer-card,
    .mobile-settings {
        border: 1px solid var(--line);
        border-radius: 10px;
        background: var(--panel);
    }

    .mobile-creature-card {
        display: grid;
        grid-template-columns: 48px 1fr;
        align-items: center;
        gap: .65rem;
        padding: 8px 12px;
    }

    .mobile-creature-icon {
        display: grid;
        width: 44px;
        height: 44px;
        place-items: center;
        border-right: 1px solid var(--line);
        color: var(--orange);
        font-size: 1.35rem;
    }

    .mobile-creature-card label > span {
        display: none;
    }

    .mobile-creature-card select {
        min-height: 44px;
        padding: 0 1.75rem 0 0;
        border: 0;
        background: transparent;
        font-weight: 750;
    }

    .mobile-creature-meta {
        grid-column: 2;
        margin-top: -8px;
        color: var(--muted);
        font-size: .71rem;
    }

    .mobile-buffer-card {
        padding: 10px 12px 12px;
    }

    .mobile-buffer-card legend {
        margin-bottom: .45rem;
    }

    .mobile-buffer-card .duration-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mobile-buffer-card input {
        min-height: 44px;
    }

    .mobile-settings {
        display: grid;
        gap: .85rem;
        padding: 12px;
    }

    .mobile-settings-title h2 {
        margin: 0;
        font-size: 1rem;
    }

    .mobile-settings-title p {
        margin: .12rem 0 0;
        font-size: .72rem;
    }

    .mobile-settings .form-stack {
        gap: .75rem;
    }

    .planner-grid,
    .trough-grid {
        grid-template-columns: 1fr;
    }

    .setup-card {
        display: none;
    }

    .trough-results {
        position: static;
    }

    .dashboard-grid {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-areas:
            "hero"
            "timeline"
            "summary"
            "actions"
            "daily";
        gap: 8px;
    }

    .card {
        padding: 14px;
        border-radius: 10px;
    }

    .feeding-result {
        padding: 0;
        border-color: #3f735f;
    }

    .result-heading {
        min-height: 82px;
        align-items: center;
        padding: 14px 15px;
        background:
            radial-gradient(circle at 94% 50%, rgba(82, 223, 159, .14), transparent 90px),
            linear-gradient(135deg, rgba(16, 92, 67, .94), rgba(10, 66, 51, .94));
    }

    .result-heading h2 {
        margin: 0;
        font-size: 1.28rem;
    }

    .result-heading p {
        margin-top: .22rem;
        color: #c3ded4;
        font-size: .76rem;
    }

    .hero-metrics {
        grid-template-columns: 1fr;
        gap: 7px;
        margin: 10px 0 0;
        padding: 0 0 8px;
        border: 0;
        background: var(--shell);
    }

    .hero-metrics > div,
    .hero-metrics > div:first-child {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        min-height: 58px;
        margin: 0 10px;
        padding: 9px 12px;
        border: 1px solid var(--line);
        border-radius: 9px;
        background: var(--panel);
    }

    .hero-metrics > div:last-child {
        border-right: 1px solid var(--line);
    }

    .hero-metrics strong {
        grid-column: 2;
        grid-row: 1 / span 2;
        font-size: 1.35rem;
        text-align: right;
    }

    .hero-metrics small {
        grid-column: 1;
    }

    .lifecycle-track {
        margin: 8px 15px 0;
    }

    .feeding-details {
        margin: 0 14px 8px;
    }

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

    .lifecycle-card .timeline-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 14px;
    }

    .lifecycle-card .timeline-total {
        grid-column: 1;
    }

    .lifecycle-card .emphasis {
        grid-column: 2;
        display: grid;
        align-content: center;
    }

    .lifecycle-card .emphasis dd {
        margin-top: .18rem;
        font-size: 1.4rem;
        text-align: left;
    }

    .daily-food-card,
    .next-actions,
    .summary-card {
        min-height: auto;
    }

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

    .mobile-nav {
        position: fixed;
        z-index: 30;
        right: 0;
        bottom: 0;
        left: 0;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        min-height: 70px;
        padding: 0 16px;
        border-top: 1px solid var(--line);
        background: rgba(6, 19, 30, .97);
        backdrop-filter: blur(16px);
    }

    .mobile-nav a {
        position: relative;
        display: grid;
        min-height: 68px;
        place-content: center;
        color: var(--muted);
        font-size: .7rem;
        font-weight: 700;
        text-align: center;
        text-decoration: none;
    }

    .mobile-nav a.active {
        color: var(--orange);
    }

    .mobile-nav a.active::before {
        position: absolute;
        top: 0;
        left: 25%;
        width: 50%;
        height: 3px;
        background: var(--orange);
        content: "";
    }

    .mobile-nav-icon {
        display: block;
        margin-bottom: .15rem;
        font-size: 1.15rem;
        line-height: 1;
    }

    .global-notice {
        width: calc(100% - 24px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton-block::after {
        animation: none;
    }
}

@media (max-width: 560px) {
    .brand-emblem {
        width: 66px;
        height: 50px;
        flex-basis: 66px;
    }

    .brand-wordmark {
        width: 96px;
        height: 21px;
        flex-basis: 96px;
    }

    .server-picker select {
        max-width: 43vw;
        min-width: 120px;
    }

    .three-column-fields {
        grid-template-columns: 1fr;
    }

    .row-title {
        align-items: start;
        flex-wrap: wrap;
    }

    .row-title .compact-button {
        width: 100%;
        margin: .25rem 0 0;
    }

    .creature-editor,
    .food-editor,
    .container-count-row {
        grid-template-columns: 1fr 1fr;
    }

    .creature-editor > label:first-child,
    .food-editor > label:first-child {
        grid-column: 1 / -1;
    }

    .creature-editor .icon-button,
    .food-editor .icon-button {
        justify-self: end;
    }
}

@media (max-width: 380px) {
    .brand-wordmark {
        width: 82px;
        height: 18px;
        flex-basis: 82px;
    }

    .server-picker select {
        max-width: 68vw;
    }

    .feeding-facts,
    .creature-editor,
    .food-editor,
    .container-count-row {
        grid-template-columns: 1fr;
    }

    .creature-editor > label:first-child,
    .food-editor > label:first-child {
        grid-column: auto;
    }

    .row-readout {
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .creature-editor .icon-button,
    .food-editor .icon-button {
        justify-self: stretch;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
