:root {
    color-scheme: dark;
    --ink: #f1f1f1;
    --muted: #929292;
    --surface: #101010;
    --surface-raised: #181818;
    --line: #2d2d2d;
    --green: #df2029;
    --gold: #f05a61;
    --danger: #df2029;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #050505; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: #050505; font-family: "Segoe UI", Arial, sans-serif; line-height: 1.5; }
a { color: var(--green); }
a:hover { color: var(--gold); }
button, input, select, textarea { font: inherit; }
label { display: block; margin-top: 12px; font-weight: 700; }

.site-header { min-height: 66px; padding: 0 max(28px, calc((100% - 1140px) / 2)); display: flex; align-items: center; gap: 30px; border-bottom: 1px solid #171717; background: #030303; }
.brand { color: var(--ink); font-size: 18px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.site-header nav a, .site-header ul a, .site-header ul button { display: inline-flex; min-height: 40px; align-items: center; padding: 6px 10px; color: var(--muted); background: transparent; border: 0; text-decoration: none; cursor: pointer; }
.site-header ul { display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; list-style: none; }
.site-header form { margin: 0; }
.nav-command { min-height: 40px; padding: 6px 10px; border: 0; color: var(--muted); background: transparent; font-weight: 400; }
.site-banner { width: min(640px, calc(100% - 32px)); margin: 0 auto; display: block; }
.site-banner img { width: 100%; height: auto; display: block; }
.site-main { width: min(1140px, calc(100% - 32px)); min-height: calc(100vh - 336px); margin: 0 auto; padding: 54px 0 44px; }
.site-footer { width: min(1140px, calc(100% - 32px)); min-height: 56px; margin: 0 auto; padding: 16px 0; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); }

h1, h2 { font-family: Georgia, serif; font-weight: 600; }
h1 { margin: 0; font-size: 38px; }
h2 { font-size: 21px; }
.eyebrow { margin: 0 0 2px; color: var(--gold); font-size: 13px; font-weight: 700; text-transform: uppercase; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.button, button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; padding: 8px 14px; border: 1px solid var(--green); border-radius: 4px; color: #08110b; background: var(--green); font-weight: 700; text-decoration: none; cursor: pointer; }
.button, button { color: #fff; }
.button.secondary { color: var(--ink); background: transparent; }
button.danger { border-color: var(--danger); background: var(--danger); color: #170503; }

.home-intro { max-width: 720px; padding: clamp(40px, 9vh, 92px) 0 70px; }
.home-intro h1 { margin-bottom: 12px; font-size: clamp(44px, 7vw, 78px); line-height: 1; }
.home-intro > p:not(.eyebrow) { max-width: 590px; margin: 0 0 28px; color: var(--muted); font-size: 20px; }
.home-actions { display: flex; gap: 10px; }
.home-feature { display: grid; grid-template-columns: 1fr 240px; align-items: center; gap: 36px; padding: 28px 0; border-block: 1px solid var(--line); }
.home-feature h2 { margin: 2px 0 8px; font-size: 28px; }
.home-feature p:last-child { margin: 0; color: var(--muted); }
.home-dish { aspect-ratio: 2 / 1; display: grid; align-content: center; justify-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--gold); }
.home-dish span { font: 600 38px Georgia, serif; }
.home-dish small { color: var(--muted); }
.legacy-copy { padding: 26px 0 6px; }
.legacy-copy h1 { margin: 0 0 8px; font-family: "Segoe UI", Arial, sans-serif; font-size: 56px; font-weight: 300; line-height: 1.15; }
.legacy-copy h2 { margin: 0 0 8px; font-family: "Segoe UI", Arial, sans-serif; font-size: 44px; font-weight: 300; line-height: 1.2; }
.legacy-copy > p { margin: 0; color: var(--muted); font-size: 20px; }
.contact-copy h1 { font-size: 42px; }
.contact-copy h2 { font-size: 32px; }
.contact-copy address { margin: 14px 0 24px; color: var(--muted); font-style: normal; }
.contact-copy address strong { color: var(--ink); }
.contact-copy > p { margin-top: 14px; font-size: 15px; }

/* Identity UI is supplied by ASP.NET Core and shares this compact form treatment. */
.row { display: grid; grid-template-columns: minmax(0, 520px); gap: 26px; }
.col-md-4, .col-md-6 { width: 100%; }
.form-floating { margin-bottom: 14px; }
.form-floating label { margin-bottom: 5px; }
.form-control { display: block; }
.form-check { display: flex; align-items: center; gap: 8px; margin: 14px 0; }
.form-check input { width: 18px; height: 18px; }
.form-check label { margin: 0; }
.w-100 { width: 100%; }
.text-danger { color: #ff9a91; }
hr { border: 0; border-top: 1px solid var(--line); }

.recipe-filters { display: grid; grid-template-columns: auto minmax(180px, 1fr) auto minmax(150px, 220px) auto auto; align-items: center; gap: 9px; padding: 14px 0; border-block: 1px solid var(--line); }
input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink); background: var(--surface); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.result-count, .field-note { color: var(--muted); }
.recipe-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.recipe-card { min-width: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
.recipe-card > a { display: block; color: var(--ink); text-decoration: none; }
.recipe-card img, .recipe-placeholder { width: 100%; aspect-ratio: 4 / 3; display: grid; place-items: center; object-fit: cover; background: #273029; color: var(--gold); font: 700 34px Georgia, serif; }
.recipe-card h2 { margin: 12px 12px 4px; font-size: 18px; }
.recipe-card p { min-height: 24px; margin: 0 12px 13px; color: var(--muted); font-size: 13px; }

.back-link { display: inline-block; margin-bottom: 22px; }
.recipe-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 46%); gap: 40px; align-items: start; }
.recipe-detail img { width: 100%; max-height: 600px; object-fit: contain; background: var(--surface); }
.recipe-detail > .recipe-placeholder { aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: 6px; }
.ingredient-list { padding-left: 20px; }
.ingredient-list li { padding: 5px 0; border-bottom: 1px solid #252c28; }

.management-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 32px; align-items: start; }
.management-layout aside { position: sticky; top: 16px; }
.management-list { display: grid; border-top: 1px solid var(--line); }
.management-list a { padding: 9px 5px; border-bottom: 1px solid var(--line); color: var(--muted); text-decoration: none; }
.management-list a[aria-current="page"] { color: var(--ink); border-left: 3px solid var(--gold); padding-left: 10px; }
.edit-form { display: grid; gap: 8px; max-width: 1000px; }
.edit-form > label, .delete-form label { margin-top: 8px; font-weight: 700; }
fieldset { margin: 10px 0; padding: 14px; border: 1px solid var(--line); }
.category-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.category-options label { display: flex; gap: 8px; align-items: center; }
.category-options input { width: 18px; height: 18px; }
.validation-summary, [data-valmsg-for]:not(:empty) { color: #ff9a91; }
.status-message { padding: 10px 12px; border-left: 3px solid var(--green); background: var(--surface); }
.delete-form { max-width: 720px; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--danger); }
.error-message { border-left-color: var(--danger); }
.ingredient-editor { display: grid; gap: 10px; }
.ingredient-column-headings, .ingredient-row { display: grid; grid-template-columns: 90px 100px minmax(150px, 1.35fr) minmax(130px, 1fr) minmax(110px, .8fr) 112px; gap: 8px; align-items: start; }
.ingredient-column-headings { padding: 0 2px; color: var(--muted); font-size: 12px; font-weight: 700; }
.ingredient-row { padding: 10px 0; border-top: 1px solid var(--line); }
.ingredient-row label { margin: 0; }
.ingredient-row label > span { display: none; }
.ingredient-row-actions { display: grid; grid-template-columns: repeat(3, 32px); gap: 5px; }
.ingredient-row-actions button { width: 32px; min-height: 38px; padding: 0; font-size: 18px; }
.ingredient-remove { border-color: var(--danger); background: transparent; color: #ff9a91; }
.ingredient-error { grid-column: 3 / -1; }
.ingredient-add { justify-self: start; }
.ingredient-section { margin: 24px 0 4px; color: var(--gold); font-size: 17px; }
.ingredient-list strong { display: inline-block; min-width: 36px; color: var(--ink); }
.ingredient-list small { color: var(--muted); }
.ingredient-list small::before { content: " - "; }

.crew-list { border-top: 1px solid var(--line); }
.crew-row { display: grid; grid-template-columns: minmax(210px, 1fr) minmax(360px, 1.6fr); gap: 18px 34px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.crew-identity h2 { margin: 0 0 10px; overflow-wrap: anywhere; }
.crew-email { margin: -5px 0 10px; color: var(--muted); overflow-wrap: anywhere; }
.account-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.flag { padding: 3px 7px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font-size: 12px; }
.flag.confirmed { border-color: var(--green); color: var(--green); }
.flag.pending, .flag.locked { border-color: var(--gold); color: var(--gold); }
.role-form fieldset { margin: 0 0 10px; }
.role-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; }
.role-options label { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0; }
.role-options input { width: 19px; height: 19px; }
.crew-delete-form { grid-column: 2; padding-top: 14px; border-top: 1px solid #342b29; }
.crew-delete-form label { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.crew-delete-form > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.identity-form { display: grid; gap: 7px; margin-top: 22px; }
.identity-form button { margin-top: 12px; }
.remember-option { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.remember-option input { width: 18px; height: 18px; }
.account-links { display: flex; justify-content: space-between; gap: 14px; margin-top: 8px; }
.library-search { display: grid; grid-template-columns: auto minmax(180px, 420px) auto auto; align-items: center; gap: 9px; padding: 14px 0; border-block: 1px solid var(--line); }
.library-search label { margin: 0; }
.empty-state { padding: 40px 0; color: var(--muted); }
.library-list { display: grid; gap: 18px; margin-top: 22px; }
.library-item { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(330px, .8fr); gap: 30px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.library-summary { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 18px; align-items: start; }
.library-summary h2 { margin: 0 0 6px; }
.library-summary p { white-space: pre-line; color: var(--muted); }
.game-placeholder { width: 120px; aspect-ratio: 1; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; color: var(--gold); background: var(--surface); font: 700 30px Georgia, serif; }
.movie-placeholder { width: 120px; aspect-ratio: 2 / 3; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; color: var(--gold); background: var(--surface); font: 700 20px Georgia, serif; }
.game-cover { width: 120px; aspect-ratio: 1; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.movie-cover { width: 120px; aspect-ratio: 2 / 3; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.manage-image-preview { width: min(220px, 100%); height: auto; margin-top: 10px; }
.preference-form { display: grid; gap: 8px; }
.preference-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 20px; }
.preference-options label { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0; }
.preference-options input { width: 18px; height: 18px; }
.preference-rating { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 4px 0; padding: 10px 12px; }
.preference-rating legend { padding: 0 5px; font-weight: 700; }
.preference-rating label { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-weight: 400; }
.preference-rating input { width: 18px; height: 18px; }
.library-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.library-filters a { border: 1px solid #777; color: inherit; padding: 7px 12px; text-decoration: none; }
.library-filters a[aria-current="page"] { background: #2e5540; border-color: #2e5540; color: #fff; font-weight: 700; }
.link-directory { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.link-directory a { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 14px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.link-directory a:hover { background: var(--surface); }
.link-directory small { color: var(--green); white-space: nowrap; }
.battle-heading { align-items: center; }
.battle-status { display: flex; align-items: baseline; gap: 14px; padding: 18px 0; border-block: 1px solid var(--gold); }
.battle-status strong { color: var(--gold); font: 600 25px Georgia, serif; }
.battle-status span, .battle-health { color: var(--muted); }
.battle-report { max-width: 780px; margin: 24px 0; padding: 0; list-style: none; }
.battle-report li { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 2px 22px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.battle-report h2 { grid-row: 1 / span 4; margin: 0; color: var(--gold); font-size: 18px; }
.battle-report p { margin: 0 0 5px; }
.battle-outcome { color: var(--gold); font-weight: 700; }

@media (max-width: 900px) {
    .recipe-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .recipe-filters { grid-template-columns: auto 1fr; }
    .management-layout { grid-template-columns: 1fr; }
    .management-layout aside { position: static; }
    .crew-row { grid-template-columns: 1fr; }
    .crew-delete-form { grid-column: 1; }
    .library-item { grid-template-columns: 1fr; }
    .link-directory { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ingredient-column-headings { display: none; }
    .ingredient-row { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px 0; }
    .ingredient-row label > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
    .ingredient-row-actions, .ingredient-error { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
    .site-header { padding: 12px 16px; align-items: flex-start; flex-wrap: wrap; gap: 8px 14px; }
    .site-header nav { order: 3; width: 100%; }
    .site-main { width: min(100% - 24px, 1140px); padding-top: 30px; }
    .site-banner { width: 100%; }
    .legacy-copy h1 { font-size: 40px; }
    .legacy-copy h2 { font-size: 29px; }
    .legacy-copy > p { font-size: 17px; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .recipe-detail { grid-template-columns: 1fr; }
    .category-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-feature { grid-template-columns: 1fr; }
    .home-dish { max-width: 240px; }
    .library-search { grid-template-columns: auto 1fr; }
    .library-summary { grid-template-columns: 82px minmax(0, 1fr); }
    .game-placeholder { width: 82px; }
    .movie-placeholder { width: 82px; }
    .game-cover, .movie-cover { width: 82px; }
    .battle-status { align-items: flex-start; flex-direction: column; }
    .battle-report li { grid-template-columns: 1fr; }
    .battle-report h2 { grid-row: auto; }
    .ingredient-row { grid-template-columns: 1fr; }
    .ingredient-row-actions, .ingredient-error { grid-column: 1; }
}

@media (max-width: 420px) {
    .recipe-grid, .category-options, .link-directory { grid-template-columns: 1fr; }
}
