/* AquaDzannn aquarium glass calculator */

:root {
    --radius-lg: 22px;
    --button-radius: 14px;
    --font: Roboto, Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-bs-theme="light"] {
    --body-color: #16231f;
    --heading: #173d34;
    --muted: #697771;

    --page-bg: radial-gradient(circle at top left, rgba(30, 127, 104, .10), transparent 26rem),
    linear-gradient(180deg, #f3f8f5 0%, #eef4f1 100%);

    --surface: rgba(255, 255, 255, .90);
    --surface-solid: #ffffff;
    --surface-muted: #f6faf8;
    --input-bg: #fbfdfc;
    --floating-bg: rgba(255, 255, 255, .90);
    --table-head: #f0f6f3;

    --border: #d8e3de;
    --border-strong: #9bcfbc;

    --accent: #1e7f68;
    --accent-alt: #3b9078;
    --accent-rgb: 30, 127, 104;
    --accent-text: #0f5d4b;
    --glow: rgba(30, 127, 104, .16);

    --warning-bg: #fff5ea;
    --warning-border: #e5c99f;
    --warning-text: #87561c;

    --danger-bg: #fff2f2;
    --danger-border: #e3bcbc;
    --danger-text: #963f3f;

    --shadow-sm: 0 16px 42px rgba(22, 35, 31, .08);
}

:root[data-bs-theme="dark"] {
    --body-color: #dce8e3;
    --heading: #edf5f1;
    --muted: #99aaa3;

    --page-bg: radial-gradient(circle at top left, rgba(55, 126, 103, .12), transparent 28rem),
    linear-gradient(180deg, #111b17 0%, #0c1512 100%);

    --surface: rgba(20, 32, 28, .92);
    --surface-solid: #17251f;
    --surface-muted: #1b2b25;
    --input-bg: #14211c;
    --floating-bg: rgba(19, 31, 27, .94);
    --table-head: #1d3028;

    --border: #2b4037;
    --border-strong: #4e7f6d;

    --accent: #52977f;
    --accent-alt: #39765f;
    --accent-rgb: 82, 151, 127;
    --accent-text: #a8d3c3;
    --glow: rgba(48, 111, 90, .18);

    --warning-bg: #30271b;
    --warning-border: #665238;
    --warning-text: #d9b77f;

    --danger-bg: #312020;
    --danger-border: #633d3d;
    --danger-text: #dca1a1;

    --shadow-sm: 0 16px 42px rgba(0, 0, 0, .22);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--page-bg);
    background-attachment: fixed;
    color: var(--body-color);
    font-family: var(--font);
    line-height: 1.6;
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
}

body.theme-transition,
body.theme-transition * {
    transition: background-color .35s ease, color .2s ease, border-color .35s ease, box-shadow .35s ease !important;
}

.app-shell {
    width: min(1180px, calc(100% - 24px));
    margin: 0 auto;
    padding: 0 0 60px;
}

/* Brand */

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    text-decoration: none;
}

.app-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 7px;
    overflow: hidden;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent-alt));
    box-shadow: 0 12px 30px var(--glow);
}

.app-brand-logo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.app-brand-title {
    display: block;
    color: #f4faf7;
    font-weight: 850;
    line-height: 1.05;
    letter-spacing: -.03em;
}

.app-brand-subtitle {
    display: block;
    margin-top: 3px;
    color: rgba(244, 250, 247, .68);
    font-size: .76rem;
    line-height: 1.1;
}

/* Buttons */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: var(--button-radius);
    font-weight: 800;
    letter-spacing: -.01em;
    cursor: pointer;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(0);
}

.button--primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-alt));
    color: #fff;
    box-shadow: 0 12px 26px rgba(var(--accent-rgb), .20);
}

.button--primary:hover {
    box-shadow: 0 16px 34px rgba(var(--accent-rgb), .26);
}

.button--ghost {
    border-color: var(--border);
    background: var(--surface-muted);
    color: var(--heading);
}

.button--ghost:hover {
    border-color: rgba(var(--accent-rgb), .42);
    background: rgba(var(--accent-rgb), .09);
    color: var(--accent-text);
}

.button--small {
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: .8rem;
    white-space: nowrap;
}

.button--calculate {
    min-height: 52px;
    padding-inline: 24px;
    border-radius: 18px;
    font-size: .98rem;
}

/* Header */

.tool-header {
    padding: 32px 0 22px;
}

.tool-header-card {
    position: relative;
    overflow: hidden;
    padding: 34px;
    border-radius: 32px;
    background: linear-gradient(135deg, #173d34 0%, #1c6757 100%);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.tool-header-card::before {
    content: "";
    position: absolute;
    right: -120px;
    top: -90px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .09);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tool-header h1 {
    max-width: 820px;
    margin: 16px 0 12px;
    color: #fff;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.03;
}

.tool-header p {
    max-width: 820px;
    margin: 0;
    color: rgba(255, 255, 255, .83);
    font-size: 17px;
}

/* Main calculator */

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

.panel {
    padding: clamp(18px, 3vw, 28px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.form {
    display: grid;
    gap: 18px;
}

.form-step {
    display: grid;
    gap: 18px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.form-step:last-of-type {
    padding-bottom: 0;
    border-bottom: 0;
}

.form-step__heading {
    display: flex;
    align-items: flex-start;
    gap: 13px;
}

.form-step__heading--action {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    align-items: start;
}

.form-step__heading h2 {
    margin: 0 0 5px;
    color: var(--heading);
    font-size: 1.28rem;
    font-weight: 900;
    letter-spacing: -.035em;
}

.form-step__heading p {
    max-width: 820px;
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.55;
}

.step-number {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--accent), var(--accent-alt));
    color: #fff;
    font-size: .83rem;
    font-weight: 900;
    box-shadow: 0 8px 20px rgba(var(--accent-rgb), .18);
}

.form-grid {
    display: grid;
    gap: 12px;
}

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

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

.field {
    display: grid;
    gap: 8px;
}

.field > span,
.field-legend {
    color: var(--heading);
    font-size: .9rem;
    font-weight: 800;
}

.field small {
    color: var(--muted);
    font-size: .78rem;
    line-height: 1.45;
}

.field--seam {
    max-width: 420px;
}

.field--compact {
    max-width: 350px;
}

input[type="number"] {
    width: 100%;
    min-height: 48px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--input-bg);
    color: var(--body-color);
    outline: none;
    font-weight: 680;
    box-shadow: none;
}

input[type="number"]:focus {
    border-color: rgba(var(--accent-rgb), .60);
    box-shadow: 0 0 0 .22rem rgba(var(--accent-rgb), .11);
}

/* Configuration */

.config-section {
    display: grid;
    gap: 14px;
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface-muted);
}

.config-section--neutral {
    background: var(--surface-solid);
}

.legend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.legend-row > div:first-child {
    display: grid;
    gap: 5px;
}

.config-section__hint {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 520;
    line-height: 1.4;
}

.recommend-badge,
.result-chip {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 6px 10px;
    border: 1px solid rgba(var(--accent-rgb), .18);
    border-radius: 999px;
    background: rgba(var(--accent-rgb), .10);
    color: var(--accent-text);
    font-size: .73rem;
    font-weight: 850;
}

.recommend-badge {
    flex: 0 0 auto;
    transition: .18s ease;
}

.recommend-badge.is-different {
    border-color: var(--warning-border);
    background: var(--warning-bg);
    color: var(--warning-text);
}

.choice-grid {
    display: grid;
    gap: 10px;
}

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

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

.radio-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: var(--surface-solid);
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.radio-card:hover {
    border-color: rgba(var(--accent-rgb), .34);
    transform: translateY(-1px);
}

.radio-card input {
    margin-top: 3px;
    accent-color: var(--accent);
}

.radio-card > span {
    display: grid;
    gap: 5px;
}

.radio-card strong {
    color: var(--heading);
    font-size: .9rem;
    font-weight: 880;
}

.radio-card small {
    color: var(--muted);
    font-size: .76rem;
    line-height: 1.42;
}

.radio-card:has(input:checked) {
    border-color: var(--border-strong);
    background: rgba(var(--accent-rgb), .075);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .065);
}

.radio-card.is-recommended::after {
    content: "рекомендуем";
    position: absolute;
    top: 9px;
    right: 9px;
    padding: 4px 7px;
    border-radius: 999px;
    background: rgba(var(--accent-rgb), .10);
    color: var(--accent-text);
    font-size: .59rem;
    font-weight: 900;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.radio-card.is-recommended > span {
    padding-right: 76px;
}

.recommendation-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px dashed rgba(var(--accent-rgb), .32);
    border-radius: 18px;
    background: rgba(var(--accent-rgb), .055);
}

.recommendation-summary span {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 750;
}

.recommendation-summary strong {
    color: var(--heading);
    text-align: right;
    font-size: .9rem;
}

/* Results */

.panel--result {
    overflow: hidden;
}

#calculationResult {
    scroll-margin-top: 18px;
}

.result-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.result-heading h2 {
    margin: 5px 0 0;
    color: var(--heading);
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 900;
    letter-spacing: -.045em;
}

.result-chip {
    padding: 7px 11px;
}

.result-summary {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

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

.metric {
    display: grid;
    gap: 7px;
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-muted);
}

.metric span {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
}

.metric strong {
    color: var(--heading);
    font-size: 1.35rem;
    font-weight: 920;
    letter-spacing: -.035em;
}

.metric--accent {
    background: linear-gradient(145deg, rgba(var(--accent-rgb), .13), rgba(var(--accent-rgb), .055));
}

.metric--glass {
    background: var(--surface-solid);
}

.result-details {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--border);
}

.result-details > div {
    display: grid;
    gap: 5px;
    padding: 14px;
    background: var(--surface-solid);
}

.result-details span,
.secondary-metrics span {
    color: var(--muted);
    font-size: .75rem;
    font-weight: 700;
}

.result-details strong {
    color: var(--heading);
    font-size: .88rem;
    line-height: 1.35;
}

.result-section-title {
    margin: 0 0 10px;
    color: var(--heading);
    font-size: 1rem;
    font-weight: 900;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 18px;
}

table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    background: var(--surface-solid);
}

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

th {
    background: var(--table-head);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .06em;
    text-transform: uppercase;
}

td {
    color: var(--body-color);
    font-size: .88rem;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.secondary-metrics {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.secondary-metrics--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.secondary-metrics > div {
    display: grid;
    gap: 5px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-muted);
}

.secondary-metrics strong {
    color: var(--heading);
    font-size: .95rem;
}

.info-stack {
    display: grid;
    gap: 9px;
    margin-top: 16px;
}

.info-box,
.error-box {
    padding: 15px 16px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: var(--surface-muted);
    line-height: 1.55;
}

.info-box strong {
    color: var(--heading);
}

.error-box {
    margin: 0;
    border-color: var(--danger-border);
    background: var(--danger-bg);
    color: var(--danger-text);
}

.error-box ul {
    margin-bottom: 0;
}

.empty-state {
    display: grid;
    place-content: center;
    min-height: 300px;
    text-align: center;
    color: var(--muted);
}

.empty-state--calculator {
    min-height: 360px;
}

.empty-state__icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin: 0 auto 13px;
    border-radius: 18px;
    background: rgba(var(--accent-rgb), .10);
    color: var(--accent);
    font-size: 2rem;
}

.empty-state strong {
    color: var(--heading);
    font-size: 1.1rem;
}

.empty-state p {
    max-width: 430px;
    margin: 8px auto 0;
    line-height: 1.55;
}

/* Note */

.panel--note {
    margin-top: 18px;
}

.panel--note h2 {
    margin: 0 0 10px;
    color: var(--heading);
    font-size: 1.2rem;
    font-weight: 900;
}

.panel--note p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.panel--note p + p {
    margin-top: 16px;
}

/* Floating tools */

.floating-tools {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 7px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--floating-bg);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.floating-tool {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background-color .18s ease, color .18s ease, transform .18s ease;
}

.floating-tool:hover {
    background: rgba(var(--accent-rgb), .11);
    color: var(--accent-text);
}

.floating-tool:active {
    transform: scale(.92);
}

.floating-tool:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.floating-tool__icon {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-icon--sun {
    display: none;
}

[data-bs-theme="dark"] .theme-icon--moon {
    display: none;
}

[data-bs-theme="dark"] .theme-icon--sun {
    display: block;
}

/* Footer */

.footer {
    padding: 0 0 44px;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

.footer a {
    text-decoration: underline;
    font-weight: 600;
}

/* Responsive */

@media (max-width: 960px) {
    .app-brand-subtitle {
        display: none;
    }

    .result-summary--4,
    .result-details {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .app-shell {
        width: min(100% - 18px, 1180px);
    }

    .tool-header h1 {
        font-size: clamp(2rem, 11vw, 2.8rem);
    }

    .panel {
        padding: 18px;
        border-radius: 20px;
    }

    .form-grid--2,
    .form-grid--3,
    .choice-grid--2,
    .choice-grid--3,
    .result-summary--4,
    .result-details,
    .secondary-metrics--3 {
        grid-template-columns: 1fr;
    }

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

    .form-step__heading--action .button--small {
        grid-column: 2;
        width: fit-content;
    }

    .field--seam,
    .field--compact {
        max-width: none;
    }

    .legend-row,
    .result-heading,
    .recommendation-summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .recommendation-summary strong {
        text-align: left;
    }

    .recommend-badge {
        max-width: 100%;
    }

    .radio-card.is-recommended > span {
        padding-right: 0;
        padding-top: 19px;
    }

    .floating-tools {
        right: max(10px, env(safe-area-inset-right));
        bottom: max(10px, env(safe-area-inset-bottom));
        gap: 6px;
        padding: 6px;
        border-radius: 16px;
    }

    .floating-tool {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .floating-tool__icon {
        width: 20px;
        height: 20px;
    }
}

/* Error pages */

.error-page {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 120px);
    padding: 32px 0;
}

.error-card {
    position: relative;
    width: min(100%, 720px);
    overflow: hidden;
    padding: clamp(28px, 6vw, 54px);
    border-radius: 32px;
    background: linear-gradient(135deg, #173d34 0%, #1c6757 100%);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.error-card::before {
    content: "";
    position: absolute;
    top: -120px;
    right: -130px;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}

.error-brand {
    position: relative;
    z-index: 1;
    display: inline-flex;
}

.error-code {
    position: relative;
    z-index: 1;
    margin-top: 42px;
    color: rgba(255, 255, 255, .18);
    font-size: clamp(82px, 18vw, 150px);
    font-weight: 900;
    line-height: .8;
    letter-spacing: -.07em;
}

.error-card h1 {
    position: relative;
    z-index: 1;
    margin: 28px 0 10px;
    color: #fff;
    font-size: clamp(28px, 5vw, 42px);
    line-height: 1.1;
    letter-spacing: -.04em;
}

.error-card p {
    position: relative;
    z-index: 1;
    max-width: 580px;
    margin: 0;
    color: rgba(255, 255, 255, .76);
    font-size: 1rem;
}

.error-action {
    position: relative;
    z-index: 1;
    margin-top: 28px;
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .18);
    color: #fff;
    box-shadow: none;
}

.error-action:hover {
    background: rgba(255, 255, 255, .20);
    box-shadow: none;
}

@media (max-width: 620px) {
    .error-page {
        min-height: calc(100vh - 90px);
        padding: 18px 0;
    }

    .error-card {
        padding: 26px 22px 32px;
        border-radius: 24px;
    }

    .error-code {
        margin-top: 36px;
    }
}
