/* TEMP: freeze bootstrap layout */
/* Default = light mode */
:root {
    --bg: #ffffff;
    --fg: #111111;
    --panel: #f5f5f5;
    --border: #333333;
    color-scheme: light dark;
}

body {
    background-color: #fff;
    color: #222;
    font-size: 0.8rem;
    font-family:
            system-ui,
            -apple-system,
            BlinkMacSystemFont,
            "Segoe UI",
            Roboto,
            Helvetica,
            Arial,
            sans-serif;

}

/* Dark mode override */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121212;
        --fg: #eaeaea;
        --panel: #1e1e1e;
        --border: #CCCCCC;
    }

    body {
        background-color: #444;
        color: #e6e6e6;
    }

    input,
    select,
    textarea {
        background-color: #1a1a1a;
        color: #e6e6e6;
        border-color: #444;
    }

    .eg-button {
        background-color: #2b2b2b;
        color: #e6e6e6;
        border-color: #555;
    }

    .eg-button:hover {
        background-color: #3a3a3a;
        color: #919191;
    }

    .eg-button:active {
        background-color: #444;
    }

    .eg-primary {
        background-color: #303030;
    }

    .eg-secondary {
        background-color: #262626;
    }

    #ajaxOverlay {
        background: rgba(0,0,0,0.35);
    }

}

html, body {
    height: 100%;
    margin: 0;
}

h1 {
    padding-left: 20px;
}

.hidden {
    display: none;
}

.bold {
    font-weight: bold;
}


.eg-button {
    display: inline-block;
    width: 100%;
    padding: 0.55rem 0.8rem;

    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 0.9rem;
    font-weight: 500;

    border: 1px solid #888;
    border-radius: 3px;

    background-color: #f2f2f2;
    color: #222;

    cursor: pointer;
    user-select: none;
}

.eg-button + .eg-button {
    margin-top: 0.4rem;
}

/* "Save" and "Save as…" side by side under the sidebar */
.eg-save-buttons {
    display: flex;
    gap: 0.4rem;
}

.eg-save-buttons .eg-button + .eg-button {
    margin-top: 0;
}

#settings {
    padding-left: 12px;
    padding-right: 12px;
    text-align: left;
    display: table;
    width: 100%;
    /* The padding within the width, so the table stays inside the sidebar */
    box-sizing: border-box;
    table-layout: auto;
}

/* Not the 0 width of "table td" below: the columns follow the labels and fields */
#settings td {
    width: auto;
}

/* The calculated lines of Performance and Engine may wrap, "Clutch holds …" is longer than the sidebar is wide */
#settings td:has(.max-power-rpm, .max-torque-rpm, .max-bmep-rpm, .max-airflow-rpm, .piston-speed, .clutch-temp-rise,
    .clutch-capacity, .perf-sprint, .perf-quarter-mile, .perf-top-speed,
    .whatif-displacement, .whatif-valve, .whatif-compression, .whatif-knock, .whatif-engine, .whatif-note) {
    white-space: normal;
}

/* A field and its unit (kg, teeth, mm) side by side within the cell, see templates/SideBar.php */
.settings-value {
    display: flex;
    align-items: center;
    gap: 4px;
}

.settings-value input[type="text"],
.settings-value input[type="range"] {
    flex: 1;
    min-width: 0;
}

/* The fields of the sidebar all as wide as 6 characters, the longest value (176.37 lb, 0.4989 m²).
   With #settings: "#settings input" below gives every input the full width */
#settings .settings-value input[type="text"].m {
    flex: 0 0 auto;
    box-sizing: content-box;
    width: 6ch;
}

#settings input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#settings .checkbox {
    width: 20px;
}

#settings th {
    font-weight: bold;
}

#settings td {
    text-overflow: ellipsis;
    white-space: nowrap;
}


.layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    /* Not narrower than its fields with their units; collapsed it is 0 (#sidebar.collapsed) */
    width: max(20%, 260px);
    min-width: 0;   /* ← this is critical */
    flex-shrink: 0;
    border: 1px solid;
    border-color: var(--border);
    padding: 2px;
    margin: 2px;
    padding-left: 5px;
    /*overflow-x: hidden;*/
}

#sidebar.collapsed {
    width: 0;
    overflow: hidden;
}

/* Only the rows of the chart that is shown (ChartManager.markSidebar()); the fields stay in the form */
#sidebar[data-chart="power"] [data-chart="acceleration"],
#sidebar[data-chart="acceleration"] [data-chart="power"] {
    display: none;
}

#chart {
    flex: 1;
    min-width: 0; /* important for charts */
    border: 1px solid;
    border-color: var(--border);
    padding: 2px;
    margin: 2px;
}


/*#settings td {*/
/*    padding-left: 10px;*/
/*}*/

.indent-15 {
    padding-left: 15px;
}

.fat-red-border {
    border: 4px solid red;
}

table td {
    width: 0px;
}

#ajaxOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.15);
    z-index: 9998;
}

#spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2147483647; /* deliberately extreme */
}

input[type="number"],
input[type="text"].m {
    text-align: right;
    padding-right: 5px;
}
.torque-modifier {
    display: grid;
    grid-template-columns: auto 1fr 1fr auto auto;
    gap: 0.5rem 1rem;
    align-items: center;
}

.tm-rpm,
.tm-strength {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tm-rpm input[type="range"] {
    width: 8rem;
}

.tm-rpm-readout {
    white-space: nowrap;
}

.tm-remove {
    background: none;
    border: none;
    cursor: pointer;
}

.tm-rpm-from,
.tm-rpm-to {
    pointer-events: auto;
}

/* The run editor: save the modified curve into the primary run */
.tm-save {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tm-save .eg-button {
    width: auto;
}

/* Grey and not clickable without a modification, in light and dark mode */
.eg-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.tm-add-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}



@media (pointer: coarse) {
    .layout {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
    }

    #chart {
        width: 100%;
        height: 60vh;
        min-height: 300px;
    }

    .sidebar-button {
        display: none;
    }
}


/* Start page */
.eg-home {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
    font-size: 0.95rem;
    line-height: 1.55;
}

.eg-home h1 {
    padding-left: 0;
    margin: 0 0 0.5rem;
    font-size: 2rem;
}

.eg-home h2 {
    font-size: 1.15rem;
    margin: 1.5rem 0 0.5rem;
}

.eg-home-lead {
    font-size: 1.1rem;
    max-width: 60ch;
    margin: 0;
}

.eg-home-hero {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.eg-home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 2.5rem;
    align-items: start;
}

.eg-home-intro ol {
    padding-left: 1.25rem;
}

.eg-home-intro li {
    margin-bottom: 0.4rem;
}

.eg-home-cta {
    width: auto;
    text-decoration: none;
}

.eg-home-account {
    margin-top: 1.5rem;
}

.eg-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1rem 1.25rem 1.25rem;
}

.eg-card h2 {
    margin-top: 0;
}

.eg-card .eg-button {
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
}

.eg-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.eg-tab {
    flex: 1;
    padding: 0.5rem;
    font: inherit;
    font-weight: 500;
    background: none;
    color: inherit;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
}

.eg-tab[aria-selected="true"] {
    border-bottom-color: currentColor;
}

.eg-form label {
    display: block;
    margin: 0.75rem 0 0.25rem;
}

.eg-form input[type="text"],
.eg-form input[type="email"],
.eg-form input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    padding: 0.45rem 0.5rem;
    font: inherit;
    border: 1px solid #888;
    border-radius: 3px;
}

.eg-form .eg-checkbox {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.eg-form .eg-button {
    margin-top: 1rem;
}

.eg-small {
    font-size: 0.85rem;
    margin: 0.5rem 0 0;
}

.eg-home a:not(.eg-button) {
    color: inherit;
}

.eg-notice {
    border-radius: 3px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
}

.eg-notice p {
    margin: 0.2rem 0;
}

.eg-card .eg-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.eg-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0 0.5rem;
    font-size: 0.85rem;
}

.eg-divider::before,
.eg-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--border);
}

/* The pages about the site: privacy, terms, credits (templates with .eg-legal) */
.eg-legal ul {
    max-width: 75ch;
    padding-left: 1.25rem;
}

.eg-legal p {
    max-width: 75ch;
}

.eg-legal li {
    margin-bottom: 0.4rem;
}

/* The contact form: the field for spam robots, out of sight (not display: none, which some robots skip) */
.eg-contact-trap {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Below every page (footer.php of the theme) */
.eg-site-footer {
    max-width: 1100px;
    margin: 2rem auto 0;
    padding: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
}

.eg-site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
}

.eg-site-footer a {
    color: inherit;
}

/* The gearing of a garage vehicle for the catalog (templates/CatalogGearing.php) */
.eg-gearing-table {
    border-collapse: collapse;
    margin: 1rem 0;
}

.eg-gearing-table th,
.eg-gearing-table td {
    text-align: left;
    padding: 0.25rem 1rem 0.25rem 0;
    border-bottom: 1px solid var(--border);
}

/* A value the copy would change */
.eg-gearing-differs td:first-of-type {
    font-weight: bold;
}

/* Page not found */
.eg-404-cartoon {
    display: block;
    width: 100%;
    max-width: 760px;
    height: auto;
    margin-top: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.eg-404-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.eg-404-actions .eg-button {
    width: auto;
    margin: 0;
    text-decoration: none;
}

/* The closest models of an unknown model, see Frontend\LegacyUrls */
.eg-404-suggestions h2 {
    font-size: 1.1rem;
    margin: 1rem 0 0.25rem;
}

.eg-404-suggestions ul {
    margin: 0 0 0.5rem;
    padding-left: 1.25rem;
}

.eg-link-button {
    padding: 0;
    font: inherit;
    color: inherit;
    text-decoration: underline;
    background: none;
    border: none;
    cursor: pointer;
}

.eg-notice-error {
    background: #fde8e8;
    color: #8a1c1c;
    border: 1px solid #e5a3a3;
}

.eg-notice-success {
    background: #e6f4ea;
    color: #1e5631;
    border: 1px solid #9fd1ae;
}

@media (prefers-color-scheme: dark) {
    /* The base .eg-button rule comes after the dark mode block at the top, so repeat it here */
    .eg-home .eg-button,
    .eg-unsaved-dialog .eg-button,
    .eg-photo-viewer .eg-button {
        background-color: #2b2b2b;
        color: #e6e6e6;
        border-color: #555;
    }

    .eg-home .eg-button:hover,
    .eg-unsaved-dialog .eg-button:hover,
    .eg-photo-viewer .eg-button:hover {
        background-color: #3a3a3a;
    }

    .eg-notice-error {
        background: #3a1d1d;
        color: #f3b4b4;
        border-color: #7a3a3a;
    }

    .eg-notice-success {
        background: #1d3324;
        color: #b4e3c3;
        border-color: #3f7a52;
    }
}

/* Brand and model selection */
.eg-select [hidden] {
    /* Grid and flex rules below would otherwise override the hidden attribute */
    display: none;
}

.eg-select-back {
    margin: 0 0 0.5rem;
}

.eg-select-search {
    margin: 1.25rem 0;
    max-width: 420px;
}

.eg-select-search label {
    display: block;
    margin-bottom: 0.25rem;
}

.eg-select-search input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.45rem 0.5rem;
    font: inherit;
    border: 1px solid #888;
    border-radius: 3px;
}

.eg-select-brands {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.eg-home .eg-select-brands a {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    text-decoration: none;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.eg-home .eg-select-brands a:hover,
.eg-home .eg-select-brands a:focus-visible {
    text-decoration: underline;
}

.eg-select-count {
    opacity: 0.6;
    font-variant-numeric: tabular-nums;
}

.eg-select-models {
    columns: 3 220px;
    column-gap: 2rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.eg-select-models li {
    break-inside: avoid;
    padding: 0.2rem 0;
}

/* My garage */
.eg-garage-list {
    display: grid;
    gap: 0.5rem;
    max-width: 640px;
    margin: 1.25rem 0 0;
    padding: 0;
    list-style: none;
}

.eg-garage-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.eg-garage-share {
    flex-basis: 100%;
    font-size: 0.9em;
}

.eg-garage-share-link {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.eg-garage-share-link input {
    flex: 1 1 16rem;
    min-width: 0;
    padding: 0.2rem 0.4rem;
    font: inherit;
    border: 1px solid #888;
    border-radius: 3px;
}

.eg-garage-share-link .eg-button {
    width: auto;
    margin-top: 0;
    padding: 0.2rem 0.6rem;
    font-size: 0.85em;
}

/* The two lists of the catalog (Select.php, Brand.php): with the acceleration, and power and torque only */
.eg-select-heading {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.eg-select-heading .eg-select-count {
    font-size: 0.85rem;
    font-weight: normal;
}

.eg-select-heading + .eg-small {
    margin: -0.25rem 0 0.75rem;
}

.eg-garage-note {
    opacity: 0.6;
    font-size: 0.9em;
}

.eg-garage-empty {
    margin-top: 1.25rem;
}

.eg-garage-add {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.eg-garage-actions {
    display: flex;
    gap: 0.4rem;
    margin-left: auto;
}

/* Manage catalog: the brand and the search above the list */
.eg-catalog-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 0.75rem;
    margin-top: 1rem;
}

.eg-catalog-filter label {
    display: grid;
    gap: 0.2rem;
}

.eg-catalog-filter select,
.eg-catalog-filter input {
    max-width: 100%;
    padding: 0.2rem 0.4rem;
    font: inherit;
}

.eg-catalog-filter .eg-button {
    width: auto;
    margin-top: 0;
}

.eg-catalog-count {
    margin: 0.75rem 0 0;
    opacity: 0.6;
}

.eg-garage-add .eg-button,
.eg-garage-actions .eg-button {
    width: auto;
    margin-top: 0;
    text-decoration: none;
}

.eg-garage-actions .eg-button {
    padding: 0.2rem 0.6rem;
    font-size: 0.85em;
}

/* Create or edit an own motorcycle */
.eg-vehicle-form {
    max-width: 640px;
}

.eg-vehicle-form [hidden] {
    display: none;
}

.eg-vehicle-form fieldset {
    margin: 0 0 1rem;
    padding: 0.5rem 1rem 1rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.eg-vehicle-form legend {
    padding: 0 0.25rem;
    font-weight: 600;
}

.eg-vehicle-form select,
.eg-vehicle-form input[type="text"] {
    box-sizing: border-box;
    padding: 0.45rem 0.5rem;
    font: inherit;
    border: 1px solid #888;
    border-radius: 3px;
}

.eg-vehicle-form select,
.eg-vehicle-form .eg-vf-brand-name input,
.eg-vehicle-form #eg-model {
    width: 100%;
}

.eg-vf-input {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.eg-vehicle-form .eg-vf-input input,
.eg-vehicle-form #eg-year {
    width: 8rem;
}

.eg-vf-unit {
    opacity: 0.7;
}

.eg-vehicle-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.45rem 0.5rem;
    font-family: ui-monospace, Consolas, monospace;
    border: 1px solid #888;
    border-radius: 3px;
}

.eg-vehicle-form fieldset .eg-button {
    width: auto;
}

.eg-vf-invalid input,
.eg-vf-invalid select {
    border-color: #c0392b;
}

.eg-vf-error {
    margin: 0.25rem 0 0;
    color: #c0392b;
    font-size: 0.9em;
}

@media (prefers-color-scheme: dark) {
    .eg-vf-error {
        color: #f3b4b4;
    }
}

/* The avatar with its menu at the top right of every page, see Frontend\Profile::renderUserMenu() */
.eg-user-menu {
    position: absolute;
    top: 0.6rem;
    right: 1rem;
    z-index: 100;
    font-size: 0.9rem;
}

.eg-user-menu summary {
    list-style: none;
    cursor: pointer;
}

.eg-user-menu summary::-webkit-details-marker {
    display: none;
}

.eg-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: #1f77b4;
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.02em;
    user-select: none;
}

/* The picture itself, in the same circle */
img.eg-avatar {
    object-fit: cover;
    background: var(--panel);
}

.eg-avatar-large {
    width: 6rem;
    height: 6rem;
    font-size: 2rem;
}

.eg-profile-picture-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
}

.eg-profile-picture-row > div {
    flex: 1 1 16rem;
}

.eg-profile-picture form + form {
    margin-top: 0.5rem;
}

.eg-profile-picture input[type="file"] {
    display: block;
    margin: 0.25rem 0;
    font: inherit;
}

.eg-user-menu summary:focus-visible .eg-avatar {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.eg-user-menu-items {
    position: absolute;
    right: 0;
    margin-top: 0.4rem;
    min-width: 11rem;
    padding: 0.4rem 0;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.eg-user-menu-items a,
.eg-user-menu-name {
    padding: 0.35rem 0.9rem;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.eg-user-menu-items a:hover {
    background: var(--panel);
}

.eg-user-menu-name {
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.25rem;
}

/* The public profiles (/riders/) and one of them, see Frontend\Riders */
.eg-riders {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 0.75rem;
    margin: 1.25rem 0 0;
    padding: 0;
    list-style: none;
}

.eg-rider-card {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    height: 100%;
    box-sizing: border-box;
    padding: 0.75rem;
    color: inherit;
    text-decoration: none;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.eg-home .eg-rider-card {
    text-decoration: none;
}

.eg-rider-card:hover .eg-rider-name {
    text-decoration: underline;
}

.eg-rider-card .eg-avatar {
    flex: none;
}

.eg-rider-name {
    display: block;
    font-weight: 600;
}

.eg-rider-about {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.9em;
    opacity: 0.8;
    overflow-wrap: anywhere;
}

.eg-rider {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: flex-start;
    max-width: 640px;
    margin-top: 1.25rem;
}

.eg-rider > div {
    flex: 1 1 16rem;
}

.eg-rider h1 {
    margin: 0;
}

.eg-rider-since {
    margin: 0.25rem 0 0.75rem;
    opacity: 0.7;
}

.eg-rider-text {
    overflow-wrap: anywhere;
}

/* The motorcycles on a public profile, see Frontend\VehicleProfile */
.eg-rider-motorcycles {
    max-width: 640px;
    margin-top: 1.5rem;
}

.eg-rider-motorcycles > ul {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.eg-rider-motorcycle {
    padding: 0.75rem 1rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.eg-rider-motorcycle h3 {
    margin: 0;
}

.eg-rider-motorcycle p {
    margin: 0.3rem 0;
}

.eg-rider-max {
    opacity: 0.8;
}

.eg-home .eg-rider-motorcycle .eg-button {
    display: inline-block;
    width: auto;
    margin-top: 0.4rem;
    text-decoration: none;
}

/* Photos of a motorcycle: thumbnails on its profile page and on the public profile, see Frontend\VehiclePhotos */
.eg-photo-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0;
    padding: 0;
    list-style: none;
}

.eg-photo-list img {
    display: block;
    width: 8rem;
    height: 8rem;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid var(--border);
}

.eg-photo-list a:focus-visible img {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.eg-vehicle-photos {
    margin-top: 1.5rem;
}

.eg-vehicle-photos .eg-photo-list li {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.eg-vehicle-photos .eg-photo-list .eg-button {
    width: 100%;
    margin: 0;
}

.eg-vehicle-photos input[type="file"] {
    display: block;
    margin: 0.25rem 0;
    font: inherit;
}

/* The large photo, see assets/js/PhotoViewer.js */
.eg-photo-viewer {
    max-width: min(96vw, 1600px);
    max-height: 96vh;
    padding: 0.75rem;
    color: var(--fg);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.eg-photo-viewer::backdrop {
    background: rgba(0, 0, 0, 0.7);
}

.eg-photo-viewer img {
    display: block;
    max-width: 100%;
    max-height: calc(96vh - 6rem);
    margin: 0 auto;
}

.eg-photo-viewer-count {
    margin: 0.5rem 0;
    text-align: center;
    font-size: 0.9rem;
}

.eg-photo-viewer-buttons {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.eg-photo-viewer-buttons .eg-button {
    width: auto;
    margin: 0;
}

.eg-pages {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1rem;
}

/* The path at the top of every page, see Frontend\Breadcrumb */
.eg-breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    margin: 0 0 0.75rem;
    padding: 0;
    list-style: none;
    font-size: 0.9rem;
}

.eg-breadcrumb li + li::before {
    content: "\203A";
    padding: 0 0.4rem;
    opacity: 0.6;
}

.eg-breadcrumb [aria-current="page"] {
    opacity: 0.75;
}

.eg-breadcrumb a {
    color: inherit;
}

/* The chart pages are not in .eg-home: in line with their title */
body > .eg-breadcrumb ol {
    margin: 0.75rem 20px 0;
}

/* The warning before leaving a page with unsaved changes, see assets/js/UnsavedChanges.js */
.eg-unsaved-dialog {
    max-width: 28rem;
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    color: var(--fg);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.eg-unsaved-dialog::backdrop {
    background: rgba(0, 0, 0, 0.4);
}

.eg-unsaved-dialog p {
    margin: 0 0 1rem;
}

.eg-unsaved-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.eg-unsaved-buttons .eg-button {
    width: auto;
    margin: 0;
}

/* Tabs of the input page: without JavaScript all groups are below each other */
.eg-vf-tab-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.eg-vf-tab {
    padding: 0.4rem 0.7rem;
    color: inherit;
    text-decoration: none;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
}

.eg-vf-tab.is-active {
    background: var(--panel);
    border-color: var(--border);
    font-weight: 600;
}

/* Direct children only: a tab can hold tabs of its own (the ways to make a torque curve) */
.eg-vf-tabs-js > .eg-vf-tab-panel:not(.is-active) {
    display: none;
}

/* A tab that cannot be opened yet: the torque curve of a vehicle that is not saved */
.eg-vf-tab.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* The ways to make a torque curve, inside the Torque curve tab: smaller tabs */
.eg-vf-method-tabs .eg-vf-tab {
    padding: 0.3rem 0.6rem;
    font-size: 0.9em;
}

.eg-vf-tab-status {
    font-weight: 700;
}

.eg-vf-tab-complete {
    color: #1e8e3e;
}

.eg-vf-tab-incomplete {
    color: #c0392b;
}

.eg-garage-incomplete {
    color: #c0392b;
    opacity: 1;
}

/* The clutch slips under the torque of the engine, see updateClutchCapacityLabel() in templates/Chart.php, and a BMEP
   above what naturally aspirated engines reach, see updatePerformanceLabel(), and an engine field in the sidebar above
   what the head allows, see updateEngineLabels() */
.clutch-slips,
.bmep-too-high,
.whatif-over-limit,
.eg-mcs-table .eg-mcs-warn td {
    color: #c0392b;
    font-weight: bold;
}

@media (prefers-color-scheme: dark) {
    .eg-vf-tab-complete {
        color: #7fd69a;
    }

    .eg-vf-tab-incomplete,
    .eg-garage-incomplete,
    .clutch-slips,
    .bmep-too-high,
    .whatif-over-limit,
    .eg-mcs-table .eg-mcs-warn td {
        color: #f3b4b4;
    }
}

/* Chart page: copy a catalog model, and where a garage vehicle comes from */
.eg-copy-vehicle {
    display: inline-block;
    margin-left: 1rem;
}

/* Run overview */
.eg-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.eg-runs-table {
    width: 100%;
    max-width: 900px;
    border-collapse: collapse;
    margin-top: 1.25rem;
}

.eg-runs-table th,
.eg-runs-table td {
    /* Not the width: 0 of "table td", which is for the sidebar */
    width: auto;
    padding: 0.4rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.eg-runs-table th:nth-child(-n+2),
.eg-runs-table td:nth-child(-n+2) {
    text-align: center;
}

.eg-runs-table input[type="text"] {
    width: 100%;
    min-width: 8rem;
    box-sizing: border-box;
    padding: 0.3rem 0.4rem;
    font: inherit;
    border: 1px solid #888;
    border-radius: 3px;
}

.eg-runs-table .eg-vf-invalid input[type="text"],
.eg-runs-table tr.eg-vf-invalid input[type="text"] {
    border-color: #c0392b;
}

/* Brands: the name left, the checkboxes in the middle */
.eg-brands-table {
    max-width: 640px;
}

.eg-brands-table th:nth-child(1),
.eg-brands-table td:nth-child(1) {
    text-align: left;
}

.eg-brands-table th:nth-child(3),
.eg-brands-table td:nth-child(3) {
    text-align: center;
}

/* Add brand: the checkboxes next to their label, a wrong name with a red border */
.eg-catalog-filter .eg-brands-check {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.eg-catalog-filter.eg-vf-invalid input[type="text"] {
    border-color: #c0392b;
}

.eg-run-curve {
    font-size: 0.9em;
    opacity: 0.8;
}

.eg-run-curve {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Small torque curve, in the color of the text so it works in dark mode too */
.eg-run-spark {
    flex: 0 0 auto;
}

.eg-run-spark path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.eg-run-changed {
    white-space: nowrap;
    font-size: 0.9em;
}

/* Power and torque each on a line of their own, not broken up */
.eg-run-curve > span > span {
    display: block;
    white-space: nowrap;
}

.eg-run-actions {
    white-space: nowrap;
}

.eg-run-actions .eg-button,
.eg-runs-buttons .eg-button {
    width: auto;
    margin-top: 0;
    text-decoration: none;
}

.eg-run-actions .eg-button {
    padding: 0.2rem 0.6rem;
    font-size: 0.85em;
}

.eg-runs-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* On a phone every run is a block, its cells with their column name */
@media (max-width: 640px) {
    .eg-runs-table thead {
        display: none;
    }

    .eg-runs-table,
    .eg-runs-table tbody {
        display: block;
    }

    .eg-runs-table tr {
        display: block;
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--border);
    }

    /* A column for the label, one for the content: text in a cell is one item, not a word per line */
    .eg-runs-table td {
        display: grid;
        grid-template-columns: 5.5rem 1fr;
        align-items: center;
        gap: 0.5rem;
        border: none;
        padding: 0.2rem 0;
    }

    .eg-runs-table td.eg-run-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
        padding-top: 0.4rem;
    }

    .eg-runs-table td > input {
        justify-self: start;
    }

    /* Label, small curve, maxima */
    .eg-runs-table td.eg-run-curve {
        grid-template-columns: 5.5rem auto 1fr;
    }

    .eg-runs-table td:nth-child(-n+2) {
        text-align: left;
    }

    .eg-runs-table td[data-label]::before {
        content: attr(data-label);
        opacity: 0.7;
    }
}

#save-status {
    margin-left: 0.5rem;
}

.eg-based-on,
.eg-source {
    margin: 0 0 0.5rem;
    opacity: 0.8;
}

/* Linking catalog models to motorcyclespecs.co.za (/catalog/mcs/): per model the name, then each on a line of its own
   the suggestions, another page and the buttons; the rows of the model list are flex, see .eg-garage-list li */
.eg-mcs-list > li > :not(.eg-garage-name):not(span.eg-garage-note) {
    flex-basis: 100%;
}

.eg-mcs-list form {
    margin: 0;
}

.eg-mcs-list .eg-button {
    width: auto;
    margin-top: 0;
    padding: 0.2rem 0.6rem;
    font-size: 0.85em;
}

.eg-mcs-candidates {
    display: grid;
    gap: 0.2rem;
    margin: 0.25rem 0;
    padding: 0;
    list-style: none;
}

.eg-garage-list .eg-mcs-candidates li {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0;
    background: none;
    border: 0;
}

.eg-mcs-candidates form {
    margin-left: auto;
}

.eg-mcs-score {
    min-width: 2.75rem;
    font-variant-numeric: tabular-nums;
    opacity: 0.8;
}

.eg-mcs-linked {
    margin: 0.25rem 0;
}

.eg-mcs-list .eg-mcs-other {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem;
}

.eg-mcs-other label {
    display: flex;
    flex: 1 1 20rem;
    align-items: baseline;
    gap: 0.4rem;
}

.eg-mcs-other input {
    flex: 1;
    min-width: 0;
    padding: 0.2rem 0.4rem;
    font: inherit;
    color: inherit;
    background: var(--panel);
    border: 1px solid #888;
    border-radius: 3px;
}

.eg-mcs-other .eg-vf-error {
    flex-basis: 100%;
}

.eg-mcs-actions {
    display: flex;
    gap: 0.4rem;
}

/* Pages without a model, each with its button to add it */
.eg-garage-list.eg-mcs-pages li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.75rem;
}

.eg-mcs-pages form {
    margin-left: auto;
}

/* Adding a model from a page of the site */
.eg-mcs-add {
    margin: 0.75rem 0;
}

.eg-mcs-add summary {
    cursor: pointer;
    font-weight: 600;
}

.eg-mcs-add-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem;
}

.eg-mcs-add-form label {
    display: flex;
    flex: 1 1 10rem;
    flex-direction: column;
    gap: 0.2rem;
}

.eg-mcs-add-form label:first-of-type {
    flex-basis: 100%;
}

.eg-mcs-add-form input,
.eg-mcs-add-form select {
    min-width: 0;
    padding: 0.2rem 0.4rem;
    font: inherit;
    color: inherit;
    background: var(--panel);
    border: 1px solid #888;
    border-radius: 3px;
}

/* Errors of motorcyclespecs.co.za: marking them on the compare page, the list (/catalog/mcs/errors/) */
.eg-mcs-error summary,
.eg-mcs-marked {
    font-size: 0.85em;
}

.eg-mcs-error summary {
    cursor: pointer;
    opacity: 0.7;
}

.eg-mcs-error label {
    display: block;
    margin: 0.25rem 0;
}

.eg-mcs-error input,
.eg-mcs-mail {
    padding: 0.2rem 0.4rem;
    font: inherit;
    color: inherit;
    background: var(--panel);
    border: 1px solid #888;
    border-radius: 3px;
}

.eg-mcs-marked {
    margin: 0 0 0.25rem;
    color: #c0392b;
}

.eg-mcs-suggestion {
    font-weight: bold;
}

.eg-mcs-mail {
    width: 100%;
    max-width: 48rem;
    box-sizing: border-box;
}

.eg-mcs-table td.eg-mcs-wrap,
.eg-mcs-table td.eg-mcs-error-cell {
    white-space: normal;
}

/* Below the buttons of the sidebar: the result of "Match top speed", wrapped within the sidebar */
.perf-match-status {
    margin: 0.25rem 0 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

.perf-match-status:empty {
    display: none;
}

.eg-mcs-actions a.eg-button {
    text-decoration: none;
}

/* A catalog model next to its page on motorcyclespecs.co.za (/catalog/mcs/{id}/) */
.eg-mcs-table td {
    white-space: nowrap;
}

/* On a phone the table scrolls within its part, not the page */
.eg-mcs-compare .eg-gearing-part {
    overflow-x: auto;
}

.eg-mcs-compare form > .eg-button {
    width: auto;
}

.eg-mcs-table .eg-mcs-status {
    opacity: 0.7;
    font-size: 0.9em;
}

.eg-mcs-table .eg-mcs-fills .eg-mcs-status {
    opacity: 1;
}

/* .eg-mcs-warn: red with .whatif-over-limit */

.eg-mcs-compare pre {
    overflow-x: auto;
    white-space: pre-wrap;
}

@media (max-width: 800px) {
    .eg-home-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
}
