
.rpc-calculator,
.rpc-calculator * {
    box-sizing: border-box;
}

.rpc-calculator {
    --rpc-bg: #f6f8fc;
    --rpc-card: #ffffff;
    --rpc-text: #0f172a;
    --rpc-muted: #64748b;
    --rpc-border: #dfe5ee;
    --rpc-accent: #2563eb;
    --rpc-accent-hover: #1d4ed8;
    --rpc-soft: #eff6ff;
    --rpc-danger: #dc2626;
    --rpc-shadow: 0 14px 34px rgba(15, 23, 42, .08);
    width: 100%;
    color: var(--rpc-text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.rpc-shell {
    width: min(1140px, 100%);
    margin: 0 auto;
    padding: clamp(16px, 2.8vw, 32px);
    background: var(--rpc-bg);
    border: 1px solid var(--rpc-border);
    border-radius: 24px;
}


.rpc-mode-switcher {
    display: inline-grid;
    grid-template-columns: repeat(3, auto);
    gap: 4px;
    padding: 4px;
    margin-bottom: 14px;
    background: #e9edf3;
    border-radius: 12px;
}

.rpc-mode-btn {
    appearance: none;
    min-height: 38px;
    border: 0;
    background: transparent;
    color: #475569;
    padding: 8px 14px;
    border-radius: 9px;
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.rpc-mode-btn:hover {
    color: var(--rpc-text);
}

.rpc-mode-btn.is-active {
    background: #fff;
    color: var(--rpc-accent);
    box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}

.rpc-grid {
    display: grid;
    grid-template-columns: minmax(320px, .86fr) minmax(0, 1.14fr);
    gap: 14px;
    align-items: start;
}

.rpc-input-panel,
.rpc-result-panel {
    min-width: 0;
    background: var(--rpc-card);
    border: 1px solid var(--rpc-border);
    border-radius: 18px;
    box-shadow: var(--rpc-shadow);
}

.rpc-input-panel {
    padding: clamp(18px, 2.5vw, 24px);
    align-self: start;
}

.rpc-result-panel {
    padding: clamp(18px, 2.5vw, 24px);
}

.rpc-unit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.rpc-unit-row label,
.rpc-field label {
    display: block;
    color: #334155;
    font-size: 13px;
    font-weight: 750;
}

.rpc-unit-row select {
    width: min(180px, 58%);
    min-height: 44px;
    border: 1px solid var(--rpc-border);
    border-radius: 10px;
    padding: 0 34px 0 12px;
    background: #fff;
    color: var(--rpc-text);
    font: inherit;
    font-size: 14px;
    outline: none;
}

.rpc-unit-row select:focus,
.rpc-input-wrap:focus-within {
    border-color: #93b4ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}

.rpc-mode-panel[hidden] {
    display: none !important;
}

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

.rpc-field label {
    margin-bottom: 7px;
}

.rpc-field label small {
    color: var(--rpc-muted);
    font-weight: 500;
}

.rpc-input-wrap {
    display: flex;
    align-items: center;
    overflow: hidden;
    min-height: 50px;
    border: 1px solid var(--rpc-border);
    border-radius: 10px;
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.rpc-input-wrap input {
    width: 100%;
    min-width: 0;
    height: 48px;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    background: transparent !important;
    color: var(--rpc-text);
    padding: 0 12px !important;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
}

.rpc-input-wrap span {
    flex: 0 0 auto;
    padding: 0 12px 0 2px;
    color: var(--rpc-muted);
    font-size: 12px;
    font-weight: 750;
}

.rpc-calculate-btn,
.rpc-reset-btn {
    width: 100%;
    min-height: 46px;
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}

.rpc-calculate-btn {
    margin-top: 14px;
    border: 1px solid var(--rpc-accent);
    background: var(--rpc-accent);
    color: #fff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .20);
}

.rpc-calculate-btn:hover {
    background: var(--rpc-accent-hover);
    border-color: var(--rpc-accent-hover);
    transform: translateY(-1px);
}

.rpc-reset-btn {
    margin-top: 6px;
    border: 1px solid var(--rpc-border);
    background: #fff;
    color: #475569;
}

.rpc-reset-btn:hover {
    background: #f8fafc;
}

.rpc-error {
    min-height: 18px;
    margin: 8px 0 0;
    color: var(--rpc-danger);
    font-size: 12px;
    font-weight: 700;
}

.rpc-roof-visual {
    display: grid;
    place-items: center;
    min-height: 188px;
    margin: -2px -2px 16px;
    border-radius: 14px;
    background:
        radial-gradient(circle at 70% 18%, rgba(37,99,235,.10), transparent 34%),
        linear-gradient(180deg, #f8fbff 0%, #f1f5ff 100%);
    color: var(--rpc-accent);
}

.rpc-roof-visual svg {
    width: min(100%, 390px);
    height: auto;
    overflow: visible;
}

.rpc-roof-line,
.rpc-base-line,
.rpc-run-line,
.rpc-rise-line {
    fill: none;
    stroke: currentColor;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rpc-run-line,
.rpc-rise-line {
    opacity: .42;
    stroke-dasharray: 7 7;
    stroke-width: 2.25;
}

.rpc-roof-visual text {
    fill: #64748b;
    font-size: 13px;
    font-weight: 700;
}

.rpc-primary-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 2px 0 16px;
    border-bottom: 1px solid var(--rpc-border);
}

.rpc-primary-result span {
    color: var(--rpc-muted);
    font-size: 13px;
    font-weight: 750;
}

.rpc-primary-result strong {
    text-align: right;
    color: var(--rpc-text);
    font-size: clamp(30px, 4.5vw, 42px);
    line-height: 1;
    letter-spacing: -.04em;
}

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

.rpc-result-card {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid var(--rpc-border);
    border-radius: 11px;
    background: #fff;
}

.rpc-result-card span {
    display: block;
    margin-bottom: 4px;
    color: var(--rpc-muted);
    font-size: 11px;
    font-weight: 750;
}

.rpc-result-card strong {
    display: block;
    overflow-wrap: anywhere;
    color: var(--rpc-text);
    font-size: clamp(16px, 2.3vw, 21px);
}

.rpc-result-note {
    margin: 10px 0 0;
    color: var(--rpc-muted);
    font-size: 12px;
    line-height: 1.5;
}

@media (max-width: 900px) {
    .rpc-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .rpc-input-panel,
    .rpc-result-panel {
        width: 100%;
    }

    .rpc-result-panel {
        order: 2;
    }

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


@media (max-width: 640px) {
    .rpc-shell {
        padding: 10px;
        border-radius: 15px;
    }

    .rpc-eyebrow {
        margin-bottom: 5px;
        font-size: 10px;
    }

    .rpc-mode-switcher {
        width: 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 3px;
        padding: 4px;
        margin-bottom: 10px;
    }

    .rpc-mode-btn {
        min-width: 0;
        width: 100%;
        min-height: 40px;
        padding: 7px 4px;
        font-size: 11px;
        white-space: nowrap;
    }

    .rpc-grid {
        gap: 10px;
    }

    .rpc-input-panel,
    .rpc-result-panel {
        padding: 13px;
        border-radius: 13px;
        box-shadow: 0 10px 24px rgba(15, 23, 42, .07);
    }

    .rpc-unit-row {
        align-items: stretch;
        flex-direction: column;
        gap: 6px;
        margin-bottom: 12px;
    }

    .rpc-unit-row label,
    .rpc-field label {
        font-size: 12px;
    }

    .rpc-unit-row select {
        width: 100%;
        min-height: 44px;
        font-size: 14px;
    }

    .rpc-field-grid {
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .rpc-field label {
        margin-bottom: 6px;
    }

    .rpc-input-wrap,
    .rpc-input-wrap input {
        min-height: 46px;
    }

    .rpc-input-wrap input {
        height: 46px;
        font-size: 15px;
    }

    .rpc-calculate-btn,
    .rpc-reset-btn {
        min-height: 46px;
        font-size: 13px;
    }

    .rpc-calculate-btn {
        margin-top: 12px;
    }

    .rpc-reset-btn {
        margin-top: 6px;
    }

    .rpc-error {
        min-height: 14px;
        margin-top: 6px;
        font-size: 11px;
    }

    .rpc-roof-visual {
        min-height: 158px;
        margin: 0 0 11px;
        border-radius: 11px;
    }

    .rpc-roof-visual svg {
        width: min(100%, 330px);
    }

    .rpc-roof-visual text {
        font-size: 12px;
    }

    .rpc-primary-result {
        align-items: center;
        flex-direction: row;
        gap: 10px;
        padding-bottom: 12px;
    }

    .rpc-primary-result span {
        font-size: 12px;
    }

    .rpc-primary-result strong {
        margin-left: auto;
        text-align: right;
        font-size: 30px;
    }

    .rpc-result-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
        margin-top: 9px;
    }

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

    .rpc-result-card span {
        margin-bottom: 3px;
        font-size: 10px;
    }

    .rpc-result-card strong {
        font-size: 16px;
    }

    .rpc-result-note {
        margin-top: 8px;
        font-size: 11px;
        line-height: 1.4;
    }
}

@media (max-width: 360px) {
    .rpc-mode-btn {
        font-size: 10px;
        padding-left: 2px;
        padding-right: 2px;
    }

    .rpc-primary-result strong {
        font-size: 27px;
    }

    .rpc-result-grid {
        gap: 6px;
    }

    .rpc-result-card {
        padding: 9px;
    }
}

@media (max-width: 330px) {
    .rpc-mode-switcher {
        display: flex;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .rpc-mode-switcher::-webkit-scrollbar {
        display: none;
    }

    .rpc-mode-btn {
        flex: 0 0 auto;
        min-width: 96px;
    }

    .rpc-primary-result {
        align-items: flex-start;
        flex-direction: column;
    }

    .rpc-primary-result strong {
        margin-left: 0;
        text-align: left;
    }

    .rpc-result-grid {
        grid-template-columns: 1fr;
    }
}


/* Strongly scoped button styles to prevent WordPress/theme overrides. */
.rpc-calculator button.rpc-calculate-btn,
.rpc-calculator button.rpc-calculate-btn:visited,
.rpc-calculator button.rpc-calculate-btn:focus {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: #2563eb !important;
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    color: #ffffff !important;
    text-decoration: none !important;
    outline: none !important;
}

.rpc-calculator button.rpc-calculate-btn:hover,
.rpc-calculator button.rpc-calculate-btn:active {
    background: #1d4ed8 !important;
    background-color: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    color: #ffffff !important;
}

.rpc-calculator button.rpc-reset-btn,
.rpc-calculator button.rpc-reset-btn:visited,
.rpc-calculator button.rpc-reset-btn:focus {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    border-color: #dfe5ee !important;
    color: #475569 !important;
    text-decoration: none !important;
    outline: none !important;
}

.rpc-calculator button.rpc-reset-btn:hover,
.rpc-calculator button.rpc-reset-btn:active {
    background: #f8fafc !important;
    background-color: #f8fafc !important;
    color: #334155 !important;
}

/* =========================================================
   RAFTER LENGTH CALCULATOR
========================================================= */
.rlc-calculator,
.rlc-calculator * {
    box-sizing: border-box;
}

.rlc-calculator {
    --rlc-bg: #f6f8fc;
    --rlc-card: #ffffff;
    --rlc-text: #0f172a;
    --rlc-muted: #64748b;
    --rlc-border: #dfe5ee;
    --rlc-accent: #2563eb;
    --rlc-accent-hover: #1d4ed8;
    --rlc-soft: #eff6ff;
    --rlc-danger: #dc2626;
    --rlc-shadow: 0 14px 34px rgba(15, 23, 42, .08);
    width: 100%;
    color: var(--rlc-text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.rlc-shell {
    width: min(1140px, 100%);
    margin: 0 auto;
    padding: clamp(16px, 2.8vw, 32px);
    background: var(--rlc-bg);
    border: 1px solid var(--rlc-border);
    border-radius: 24px;
}

.rlc-grid {
    display: grid;
    grid-template-columns: minmax(330px, .88fr) minmax(0, 1.12fr);
    gap: 14px;
    align-items: start;
}

.rlc-input-panel,
.rlc-result-panel {
    min-width: 0;
    background: var(--rlc-card);
    border: 1px solid var(--rlc-border);
    border-radius: 18px;
    box-shadow: var(--rlc-shadow);
}

.rlc-input-panel {
    padding: clamp(18px, 2.5vw, 24px);
    align-self: start;
}

.rlc-result-panel {
    padding: clamp(18px, 2.5vw, 24px);
}

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

.rlc-field-grid--top {
    margin-bottom: 14px;
}

.rlc-field {
    min-width: 0;
}

.rlc-field > label {
    display: block;
    margin-bottom: 7px;
    color: #334155;
    font-size: 13px;
    font-weight: 750;
}

.rlc-field label small {
    color: var(--rlc-muted);
    font-weight: 500;
}

.rlc-field select {
    width: 100%;
    min-height: 50px;
    border: 1px solid var(--rlc-border);
    border-radius: 10px;
    padding: 0 36px 0 12px;
    background: #fff;
    color: var(--rlc-text);
    font: inherit;
    font-size: 14px;
    outline: none;
}

.rlc-field select:focus,
.rlc-input-wrap:focus-within {
    border-color: #93b4ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}

.rlc-measurement-type-field {
    margin-bottom: 14px;
}

.rlc-measurement-type-field small {
    display: block;
    margin-top: 7px;
    color: var(--rlc-muted);
    font-size: 11px;
    line-height: 1.45;
}

.rlc-input-wrap {
    display: flex;
    align-items: center;
    overflow: hidden;
    min-height: 50px;
    border: 1px solid var(--rlc-border);
    border-radius: 10px;
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.rlc-input-wrap input {
    width: 100%;
    min-width: 0;
    height: 48px;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    background: transparent !important;
    color: var(--rlc-text);
    padding: 0 12px !important;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
}

.rlc-input-wrap span {
    flex: 0 0 auto;
    padding: 0 12px 0 2px;
    color: var(--rlc-muted);
    font-size: 12px;
    font-weight: 750;
}

.rlc-calculate-btn,
.rlc-reset-btn {
    width: 100%;
    min-height: 46px;
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}

.rlc-calculate-btn {
    margin-top: 14px;
    border: 1px solid var(--rlc-accent);
    background: var(--rlc-accent);
    color: #fff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .20);
}

.rlc-calculate-btn:hover {
    background: var(--rlc-accent-hover);
    border-color: var(--rlc-accent-hover);
    transform: translateY(-1px);
}

.rlc-reset-btn {
    margin-top: 6px;
    border: 1px solid var(--rlc-border);
    background: #fff;
    color: #475569;
}

.rlc-reset-btn:hover {
    background: #f8fafc;
}

.rlc-error {
    min-height: 18px;
    margin: 8px 0 0;
    color: var(--rlc-danger);
    font-size: 12px;
    font-weight: 700;
}

.rlc-roof-visual {
    display: grid;
    place-items: center;
    min-height: 205px;
    margin: -2px -2px 16px;
    border-radius: 14px;
    background:
        radial-gradient(circle at 72% 18%, rgba(37,99,235,.10), transparent 34%),
        linear-gradient(180deg, #f8fbff 0%, #f1f5ff 100%);
    color: var(--rlc-accent);
}

.rlc-roof-visual svg {
    width: min(100%, 430px);
    height: auto;
    overflow: visible;
}

.rlc-rafter-line,
.rlc-base-line,
.rlc-wall-line,
.rlc-run-line,
.rlc-rise-line,
.rlc-overhang-line {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rlc-rafter-line {
    stroke-width: 4.5;
}

.rlc-base-line {
    stroke-width: 2.25;
    opacity: .30;
}

.rlc-wall-line {
    stroke-width: 3;
    opacity: .65;
}

.rlc-run-line,
.rlc-rise-line,
.rlc-overhang-line {
    opacity: .42;
    stroke-dasharray: 7 7;
    stroke-width: 2.25;
}

.rlc-roof-visual text {
    fill: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.rlc-primary-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 2px 0 16px;
    border-bottom: 1px solid var(--rlc-border);
}

.rlc-primary-result span {
    color: var(--rlc-muted);
    font-size: 13px;
    font-weight: 750;
}

.rlc-primary-result strong {
    text-align: right;
    color: var(--rlc-text);
    font-size: clamp(28px, 4.2vw, 40px);
    line-height: 1;
    letter-spacing: -.04em;
}

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

.rlc-result-card {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid var(--rlc-border);
    border-radius: 11px;
    background: #fff;
}

.rlc-result-card span {
    display: block;
    margin-bottom: 4px;
    color: var(--rlc-muted);
    font-size: 11px;
    font-weight: 750;
}

.rlc-result-card strong {
    display: block;
    overflow-wrap: anywhere;
    color: var(--rlc-text);
    font-size: clamp(16px, 2.3vw, 21px);
}

.rlc-result-note {
    margin: 10px 0 0;
    color: var(--rlc-muted);
    font-size: 11px;
    line-height: 1.5;
}

/* Strongly scoped button styles to prevent WordPress/theme overrides. */
.rlc-calculator button.rlc-calculate-btn,
.rlc-calculator button.rlc-calculate-btn:visited,
.rlc-calculator button.rlc-calculate-btn:focus {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: #2563eb !important;
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    color: #ffffff !important;
    text-decoration: none !important;
    outline: none !important;
}

.rlc-calculator button.rlc-calculate-btn:hover,
.rlc-calculator button.rlc-calculate-btn:active {
    background: #1d4ed8 !important;
    background-color: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    color: #ffffff !important;
}

.rlc-calculator button.rlc-reset-btn,
.rlc-calculator button.rlc-reset-btn:visited,
.rlc-calculator button.rlc-reset-btn:focus {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    border-color: #dfe5ee !important;
    color: #475569 !important;
    text-decoration: none !important;
    outline: none !important;
}

.rlc-calculator button.rlc-reset-btn:hover,
.rlc-calculator button.rlc-reset-btn:active {
    background: #f8fafc !important;
    background-color: #f8fafc !important;
    color: #334155 !important;
}

@media (max-width: 900px) {
    .rlc-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .rlc-input-panel,
    .rlc-result-panel {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .rlc-shell {
        padding: 10px;
        border-radius: 15px;
    }

    .rlc-grid {
        gap: 10px;
    }

    .rlc-input-panel,
    .rlc-result-panel {
        padding: 13px;
        border-radius: 13px;
        box-shadow: 0 10px 24px rgba(15, 23, 42, .07);
    }

    .rlc-field-grid,
    .rlc-field-grid--top {
        grid-template-columns: 1fr;
        gap: 9px;
        margin-bottom: 9px;
    }

    .rlc-field > label {
        margin-bottom: 6px;
        font-size: 12px;
    }

    .rlc-field select,
    .rlc-input-wrap,
    .rlc-input-wrap input {
        min-height: 46px;
    }

    .rlc-field select {
        height: 46px;
        font-size: 14px;
    }

    .rlc-input-wrap input {
        height: 46px;
        font-size: 15px;
    }

    .rlc-measurement-type-field {
        margin-bottom: 9px;
    }

    .rlc-measurement-type-field small {
        margin-top: 5px;
        font-size: 10.5px;
    }

    .rlc-calculate-btn,
    .rlc-reset-btn {
        min-height: 46px;
        font-size: 13px;
    }

    .rlc-calculate-btn {
        margin-top: 12px;
    }

    .rlc-error {
        min-height: 14px;
        margin-top: 6px;
        font-size: 11px;
    }

    .rlc-roof-visual {
        min-height: 170px;
        margin: 0 0 11px;
        border-radius: 11px;
    }

    .rlc-roof-visual svg {
        width: min(100%, 350px);
    }

    .rlc-roof-visual text {
        font-size: 11px;
    }

    .rlc-primary-result {
        gap: 10px;
        padding-bottom: 12px;
    }

    .rlc-primary-result span {
        font-size: 11px;
    }

    .rlc-primary-result strong {
        margin-left: auto;
        font-size: 27px;
    }

    .rlc-result-grid {
        gap: 7px;
        margin-top: 9px;
    }

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

    .rlc-result-card span {
        margin-bottom: 3px;
        font-size: 10px;
    }

    .rlc-result-card strong {
        font-size: 16px;
    }

    .rlc-result-note {
        margin-top: 8px;
        font-size: 10.5px;
        line-height: 1.45;
    }
}

@media (max-width: 360px) {
    .rlc-primary-result {
        align-items: flex-start;
        flex-direction: column;
    }

    .rlc-primary-result strong {
        margin-left: 0;
        text-align: left;
        font-size: 26px;
    }

    .rlc-result-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   ROOF AREA CALCULATOR
========================================================= */
.rac-calculator,
.rac-calculator * {
    box-sizing: border-box;
}

.rac-calculator {
    --rac-bg: #f6f8fc;
    --rac-card: #ffffff;
    --rac-text: #0f172a;
    --rac-muted: #64748b;
    --rac-border: #dfe5ee;
    --rac-accent: #2563eb;
    --rac-accent-hover: #1d4ed8;
    --rac-soft: #eff6ff;
    --rac-danger: #dc2626;
    --rac-shadow: 0 14px 34px rgba(15, 23, 42, .08);
    width: 100%;
    color: var(--rac-text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.rac-shell {
    width: min(1140px, 100%);
    margin: 0 auto;
    padding: clamp(16px, 2.8vw, 32px);
    background: var(--rac-bg);
    border: 1px solid var(--rac-border);
    border-radius: 24px;
}

.rac-grid {
    display: grid;
    grid-template-columns: minmax(350px, .9fr) minmax(0, 1.1fr);
    gap: 14px;
    align-items: start;
}

.rac-input-panel,
.rac-result-panel {
    min-width: 0;
    background: var(--rac-card);
    border: 1px solid var(--rac-border);
    border-radius: 18px;
    box-shadow: var(--rac-shadow);
}

.rac-input-panel,
.rac-result-panel {
    padding: clamp(18px, 2.5vw, 24px);
}

.rac-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.rac-field-grid--top {
    margin-bottom: 14px;
}

.rac-field {
    min-width: 0;
}

.rac-field > label {
    display: block;
    margin-bottom: 7px;
    color: #334155;
    font-size: 13px;
    font-weight: 750;
}

.rac-field label small {
    color: var(--rac-muted);
    font-weight: 500;
}

.rac-field select {
    width: 100%;
    min-height: 50px;
    border: 1px solid var(--rac-border);
    border-radius: 10px;
    padding: 0 36px 0 12px;
    background: #fff;
    color: var(--rac-text);
    font: inherit;
    font-size: 14px;
    outline: none;
}

.rac-field select:focus,
.rac-input-wrap:focus-within {
    border-color: #93b4ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}

.rac-input-wrap {
    display: flex;
    align-items: center;
    overflow: hidden;
    min-height: 50px;
    border: 1px solid var(--rac-border);
    border-radius: 10px;
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.rac-input-wrap input {
    width: 100%;
    min-width: 0;
    height: 48px;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    background: transparent !important;
    color: var(--rac-text);
    padding: 0 12px !important;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
}

.rac-input-wrap span {
    flex: 0 0 auto;
    padding: 0 12px 0 2px;
    color: var(--rac-muted);
    font-size: 12px;
    font-weight: 750;
}

.rac-roof-type-note {
    margin: 2px 0 10px;
    padding: 11px 12px;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    background: var(--rac-soft);
    color: #475569;
    font-size: 11px;
    line-height: 1.45;
}

.rac-roof-type-note strong {
    color: #1e3a8a;
}

.rac-calculate-btn,
.rac-reset-btn {
    width: 100%;
    min-height: 46px;
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}

.rac-calculate-btn {
    margin-top: 10px;
    border: 1px solid var(--rac-accent);
    background: var(--rac-accent);
    color: #fff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .20);
}

.rac-calculate-btn:hover {
    background: var(--rac-accent-hover);
    border-color: var(--rac-accent-hover);
    transform: translateY(-1px);
}

.rac-reset-btn {
    margin-top: 6px;
    border: 1px solid var(--rac-border);
    background: #fff;
    color: #475569;
}

.rac-reset-btn:hover {
    background: #f8fafc;
}

.rac-error {
    min-height: 18px;
    margin: 8px 0 0;
    color: var(--rac-danger);
    font-size: 12px;
    font-weight: 700;
}

.rac-roof-visual {
    display: grid;
    place-items: center;
    min-height: 210px;
    margin: -2px -2px 16px;
    border-radius: 14px;
    background:
        radial-gradient(circle at 72% 18%, rgba(37,99,235,.10), transparent 34%),
        linear-gradient(180deg, #f8fbff 0%, #f1f5ff 100%);
    color: var(--rac-accent);
}

.rac-roof-visual svg {
    width: min(100%, 440px);
    height: auto;
    overflow: visible;
}

.rac-roof-outline,
.rac-ridge-line,
.rac-width-line,
.rac-length-line {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rac-roof-outline {
    stroke-width: 3.5;
    opacity: .85;
}

.rac-ridge-line {
    stroke-width: 3;
    opacity: .78;
}

.rac-width-line,
.rac-length-line {
    stroke-width: 2;
    stroke-dasharray: 6 6;
    opacity: .42;
}

.rac-roof-visual text {
    fill: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.rac-primary-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 2px 0 16px;
    border-bottom: 1px solid var(--rac-border);
}

.rac-primary-result span {
    color: var(--rac-muted);
    font-size: 13px;
    font-weight: 750;
}

.rac-primary-result strong {
    text-align: right;
    color: var(--rac-text);
    font-size: clamp(28px, 4vw, 38px);
    line-height: 1;
    letter-spacing: -.04em;
}

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

.rac-result-card {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid var(--rac-border);
    border-radius: 11px;
    background: #fff;
}

.rac-result-card span {
    display: block;
    margin-bottom: 4px;
    color: var(--rac-muted);
    font-size: 11px;
    font-weight: 750;
}

.rac-result-card strong {
    display: block;
    overflow-wrap: anywhere;
    color: var(--rac-text);
    font-size: clamp(16px, 2.3vw, 21px);
}

.rac-result-note {
    margin: 10px 0 0;
    color: var(--rac-muted);
    font-size: 11px;
    line-height: 1.5;
}

.rac-calculator button.rac-calculate-btn,
.rac-calculator button.rac-calculate-btn:visited,
.rac-calculator button.rac-calculate-btn:focus {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: #2563eb !important;
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    color: #ffffff !important;
    text-decoration: none !important;
    outline: none !important;
}

.rac-calculator button.rac-calculate-btn:hover,
.rac-calculator button.rac-calculate-btn:active {
    background: #1d4ed8 !important;
    background-color: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    color: #ffffff !important;
}

.rac-calculator button.rac-reset-btn,
.rac-calculator button.rac-reset-btn:visited,
.rac-calculator button.rac-reset-btn:focus {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    border-color: #dfe5ee !important;
    color: #475569 !important;
    text-decoration: none !important;
    outline: none !important;
}

.rac-calculator button.rac-reset-btn:hover,
.rac-calculator button.rac-reset-btn:active {
    background: #f8fafc !important;
    background-color: #f8fafc !important;
    color: #334155 !important;
}

@media (max-width: 900px) {
    .rac-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .rac-input-panel,
    .rac-result-panel {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .rac-shell {
        padding: 10px;
        border-radius: 15px;
    }

    .rac-grid {
        gap: 10px;
    }

    .rac-input-panel,
    .rac-result-panel {
        padding: 13px;
        border-radius: 13px;
        box-shadow: 0 10px 24px rgba(15, 23, 42, .07);
    }

    .rac-field-grid,
    .rac-field-grid--top {
        grid-template-columns: 1fr;
        gap: 9px;
        margin-bottom: 9px;
    }

    .rac-field > label {
        margin-bottom: 6px;
        font-size: 12px;
    }

    .rac-field select,
    .rac-input-wrap,
    .rac-input-wrap input {
        min-height: 46px;
    }

    .rac-field select {
        height: 46px;
        font-size: 14px;
    }

    .rac-input-wrap input {
        height: 46px;
        font-size: 15px;
    }

    .rac-roof-type-note {
        margin-top: 2px;
        font-size: 10.5px;
    }

    .rac-calculate-btn,
    .rac-reset-btn {
        min-height: 46px;
        font-size: 13px;
    }

    .rac-error {
        min-height: 14px;
        margin-top: 6px;
        font-size: 11px;
    }

    .rac-roof-visual {
        min-height: 170px;
        margin: 0 0 11px;
        border-radius: 11px;
    }

    .rac-roof-visual svg {
        width: min(100%, 350px);
    }

    .rac-roof-visual text {
        font-size: 10.5px;
    }

    .rac-primary-result {
        gap: 10px;
        padding-bottom: 12px;
    }

    .rac-primary-result span {
        font-size: 11px;
    }

    .rac-primary-result strong {
        margin-left: auto;
        font-size: 25px;
    }

    .rac-result-grid {
        gap: 7px;
        margin-top: 9px;
    }

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

    .rac-result-card span {
        margin-bottom: 3px;
        font-size: 10px;
    }

    .rac-result-card strong {
        font-size: 15px;
    }

    .rac-result-note {
        margin-top: 8px;
        font-size: 10.5px;
        line-height: 1.45;
    }
}

@media (max-width: 360px) {
    .rac-primary-result {
        align-items: flex-start;
        flex-direction: column;
    }

    .rac-primary-result strong {
        margin-left: 0;
        text-align: left;
        font-size: 25px;
    }

    .rac-result-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Roof Rise / Ridge Height Calculator
========================================================= */
.rhc-calculator,
.rhc-calculator * {
    box-sizing: border-box;
}

.rhc-calculator {
    --rhc-bg: #f6f8fc;
    --rhc-card: #ffffff;
    --rhc-text: #0f172a;
    --rhc-muted: #64748b;
    --rhc-border: #dfe5ee;
    --rhc-accent: #2563eb;
    --rhc-accent-hover: #1d4ed8;
    --rhc-soft: #eff6ff;
    --rhc-danger: #dc2626;
    --rhc-shadow: 0 14px 34px rgba(15, 23, 42, .08);
    width: 100%;
    color: var(--rhc-text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.rhc-shell {
    width: min(1140px, 100%);
    margin: 0 auto;
    padding: clamp(16px, 2.8vw, 32px);
    background: var(--rhc-bg);
    border: 1px solid var(--rhc-border);
    border-radius: 24px;
}

.rhc-grid {
    display: grid;
    grid-template-columns: minmax(320px, .86fr) minmax(0, 1.14fr);
    gap: 14px;
    align-items: start;
}

.rhc-input-panel,
.rhc-result-panel {
    min-width: 0;
    padding: clamp(18px, 2.5vw, 24px);
    background: var(--rhc-card);
    border: 1px solid var(--rhc-border);
    border-radius: 18px;
    box-shadow: var(--rhc-shadow);
}

.rhc-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.rhc-field {
    min-width: 0;
    margin-bottom: 11px;
}

.rhc-field > label {
    display: block;
    margin-bottom: 7px;
    color: #334155;
    font-size: 13px;
    font-weight: 750;
}

.rhc-field > label small {
    color: var(--rhc-muted);
    font-weight: 500;
}

.rhc-field select {
    width: 100%;
    min-height: 50px;
    border: 1px solid var(--rhc-border);
    border-radius: 10px;
    padding: 0 34px 0 12px;
    background: #fff;
    color: var(--rhc-text);
    font: inherit;
    font-size: 14px;
    outline: none;
}

.rhc-field select:focus,
.rhc-input-wrap:focus-within {
    border-color: #93b4ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}

.rhc-input-wrap {
    display: flex;
    align-items: center;
    min-height: 50px;
    overflow: hidden;
    border: 1px solid var(--rhc-border);
    border-radius: 10px;
    background: #fff;
}

.rhc-input-wrap input {
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 0 12px !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    background: transparent !important;
    color: var(--rhc-text);
    font: inherit;
    font-size: 16px;
    font-weight: 700;
}

.rhc-input-wrap span {
    flex: 0 0 auto;
    padding: 0 12px 0 2px;
    color: var(--rhc-muted);
    font-size: 12px;
    font-weight: 750;
}

.rhc-helper {
    display: block;
    margin-top: 6px;
    color: var(--rhc-muted);
    font-size: 11px;
    line-height: 1.45;
}

.rhc-roof-type-note {
    margin: 2px 0 12px;
    padding: 10px 12px;
    border-radius: 9px;
    background: var(--rhc-soft);
    color: #475569;
    font-size: 11px;
}

.rhc-calculate-btn,
.rhc-reset-btn {
    width: 100%;
    min-height: 46px;
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.rhc-calculate-btn {
    border: 1px solid var(--rhc-accent);
    background: var(--rhc-accent);
    color: #fff;
}

.rhc-reset-btn {
    margin-top: 8px;
    border: 1px solid var(--rhc-border);
    background: #fff;
    color: #475569;
}

.rhc-error {
    min-height: 16px;
    margin: 8px 0 0;
    color: var(--rhc-danger);
    font-size: 12px;
    line-height: 1.4;
}

.rhc-roof-visual {
    display: grid;
    place-items: center;
    min-height: 220px;
    margin-bottom: 14px;
    overflow: hidden;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    background: linear-gradient(145deg, #eff6ff, #fff);
    color: var(--rhc-accent);
}

.rhc-roof-visual svg {
    width: min(100%, 420px);
    height: auto;
}

.rhc-base-line,
.rhc-roof-line,
.rhc-rise-line,
.rhc-run-line {
    fill: none;
    stroke: currentColor;
}

.rhc-roof-line {
    stroke-width: 7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rhc-base-line {
    stroke-width: 2;
    opacity: .25;
}

.rhc-rise-line,
.rhc-run-line {
    stroke-width: 2;
    stroke-dasharray: 6 6;
    opacity: .48;
}

.rhc-roof-visual text {
    fill: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.rhc-primary-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 2px 0 16px;
    border-bottom: 1px solid var(--rhc-border);
}

.rhc-primary-result span {
    color: var(--rhc-muted);
    font-size: 13px;
    font-weight: 750;
}

.rhc-primary-result strong {
    margin-left: auto;
    text-align: right;
    color: var(--rhc-text);
    font-size: clamp(28px, 4vw, 38px);
    line-height: 1;
    letter-spacing: -.04em;
}

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

.rhc-result-card {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid var(--rhc-border);
    border-radius: 11px;
    background: #fff;
}

.rhc-result-card span {
    display: block;
    margin-bottom: 4px;
    color: var(--rhc-muted);
    font-size: 11px;
    font-weight: 750;
}

.rhc-result-card strong {
    display: block;
    overflow-wrap: anywhere;
    color: var(--rhc-text);
    font-size: clamp(16px, 2.3vw, 21px);
}

.rhc-result-note {
    margin: 10px 0 0;
    color: var(--rhc-muted);
    font-size: 11px;
    line-height: 1.5;
}

.rhc-calculator button.rhc-calculate-btn,
.rhc-calculator button.rhc-calculate-btn:visited,
.rhc-calculator button.rhc-calculate-btn:focus {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: #2563eb !important;
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    color: #fff !important;
    text-decoration: none !important;
    outline: none !important;
}

.rhc-calculator button.rhc-calculate-btn:hover,
.rhc-calculator button.rhc-calculate-btn:active {
    background: #1d4ed8 !important;
    background-color: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    color: #fff !important;
}

.rhc-calculator button.rhc-reset-btn,
.rhc-calculator button.rhc-reset-btn:visited,
.rhc-calculator button.rhc-reset-btn:focus {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: #fff !important;
    background-color: #fff !important;
    border-color: #dfe5ee !important;
    color: #475569 !important;
    text-decoration: none !important;
    outline: none !important;
}

.rhc-calculator button.rhc-reset-btn:hover,
.rhc-calculator button.rhc-reset-btn:active {
    background: #f8fafc !important;
    background-color: #f8fafc !important;
    color: #334155 !important;
}

@media (max-width: 900px) {
    .rhc-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (max-width: 640px) {
    .rhc-shell {
        padding: 10px;
        border-radius: 15px;
    }

    .rhc-input-panel,
    .rhc-result-panel {
        padding: 13px;
        border-radius: 13px;
        box-shadow: 0 10px 24px rgba(15, 23, 42, .07);
    }

    .rhc-field-grid,
    .rhc-field-grid--top {
        grid-template-columns: 1fr;
        gap: 9px;
        margin-bottom: 9px;
    }

    .rhc-field > label {
        margin-bottom: 6px;
        font-size: 12px;
    }

    .rhc-field select,
    .rhc-input-wrap,
    .rhc-input-wrap input {
        min-height: 46px;
    }

    .rhc-field select {
        height: 46px;
        font-size: 14px;
    }

    .rhc-input-wrap input {
        height: 46px;
        font-size: 15px;
    }

    .rhc-roof-visual {
        min-height: 170px;
        margin: 0 0 11px;
        border-radius: 11px;
    }

    .rhc-roof-visual svg {
        width: min(100%, 350px);
    }

    .rhc-roof-visual text {
        font-size: 10.5px;
    }

    .rhc-primary-result {
        gap: 10px;
        padding-bottom: 12px;
    }

    .rhc-primary-result span {
        font-size: 11px;
    }

    .rhc-primary-result strong {
        font-size: 25px;
    }

    .rhc-result-grid {
        gap: 7px;
        margin-top: 9px;
    }

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

    .rhc-result-card span {
        margin-bottom: 3px;
        font-size: 10px;
    }

    .rhc-result-card strong {
        font-size: 15px;
    }

    .rhc-result-note {
        margin-top: 8px;
        font-size: 10.5px;
        line-height: 1.45;
    }
}

@media (max-width: 360px) {
    .rhc-primary-result {
        align-items: flex-start;
        flex-direction: column;
    }

    .rhc-primary-result strong {
        margin-left: 0;
        text-align: left;
    }

    .rhc-result-grid {
        grid-template-columns: 1fr;
    }
}
