/* Original design: Carola Jiménez, dragons-wiki.com */
.dw-ecc.dw-ecc {
        --bg: #000000;
        --panel: #230000;
        --card: #230000;
        --edge: #5b3333;
        --gold: #efc27e;
        --text: #f5e9e5;
        --muted: #c7afb0;
        --pressed: #025606;
        color-scheme: dark;
        accent-color: var(--gold);
        box-sizing: border-box;
        max-width: 1200px;
        margin: 4px auto;
        padding: 28px;
        border: 1px solid #5b3333;
        border-radius: 20px;
        background: var(--bg);
        color: var(--text);
        font: 16px/1.5 system-ui,-apple-system,Segoe UI,sans-serif;
        box-shadow: 0 24px 60px #0005
    }

        .dw-ecc.dw-ecc * {
            box-sizing: border-box
        }

        .dw-ecc.dw-ecc .ecc-head {
            margin-bottom: 26px
        }

        .dw-ecc.dw-ecc .ecc-kicker {
            color: var(--gold);
            font-size: 12px;
            font-weight: 700;
            letter-spacing: .16em
        }

        .dw-ecc.dw-ecc h2 {
            font-size: clamp(28px,4vw,42px);
            line-height: 1.1;
            margin: 8px 0 9px;
            color: var(--text)
        }

        .dw-ecc.dw-ecc p {
            margin: 0
        }

        .dw-ecc.dw-ecc .ecc-head p, .dw-ecc.dw-ecc .ecc-hint, .dw-ecc.dw-ecc .ecc-note, .dw-ecc.dw-ecc footer {
            color: var(--muted)
        }

        .dw-ecc.dw-ecc .ecc-grid {
            display: grid;
            grid-template-columns: minmax(0,460px) minmax(0,1fr);
            gap: 20px
        }

        .dw-ecc.dw-ecc .ecc-info, .dw-ecc.dw-ecc .ecc-panel {
            border: 1px solid var(--edge);
            border-radius: 14px;
            background: var(--panel);
            padding: 20px
        }

        .dw-ecc.dw-ecc label {
            display: block;
            margin-bottom: 16px;
            font-size: 14px;
            font-weight: 600
        }

        .dw-ecc.dw-ecc input, .dw-ecc.dw-ecc select {
            display: block;
            width: 100%;
            margin-top: 6px;
            min-height: 46px;
            padding: 10px 12px;
            border: 1px solid var(--edge);
            border-radius: 8px;
            background: var(--bg);
            color: var(--text);
            font: inherit
        }

            .dw-ecc.dw-ecc input:focus, .dw-ecc.dw-ecc select:focus {
                outline: 2px solid var(--gold);
                outline-offset: 2px
            }

        .dw-ecc.dw-ecc .ecc-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px
        }

        .dw-ecc.dw-ecc .ecc-hint {
            font-size: 13px;
            min-height: 21px
        }

            .dw-ecc.dw-ecc .ecc-hint.ecc-error {
                color: #ffb8ad
            }

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

            .dw-ecc.dw-ecc .ecc-metrics > div {
                min-width: 0;
                padding: 13px;
                border: 1px solid var(--edge);
                border-radius: 9px;
                background: var(--bg)
            }

            .dw-ecc.dw-ecc .ecc-metrics small, .dw-ecc.dw-ecc .ecc-metrics span {
                display: block;
                color: var(--muted);
                font-size: 12px
            }

            .dw-ecc.dw-ecc .ecc-metrics strong {
                display: block;
                color: var(--gold);
                font-size: 24px;
                overflow-wrap: anywhere
            }

        .dw-ecc.dw-ecc .ecc-note {
            font-size: 12px;
            margin: 18px 0 9px
        }

        .dw-ecc.dw-ecc .ecc-table-wrap {
            max-height: 350px;
            overflow: auto;
            border: 1px solid var(--edge);
            border-radius: 8px
        }

        .dw-ecc.dw-ecc table {
            width: 100%;
            border-collapse: collapse;
            font-size: 14px;
            font-variant-numeric: tabular-nums
        }

        .dw-ecc.dw-ecc th {
            position: sticky;
            top: 0;
            background: var(--card);
            text-align: right;
            color: var(--gold)
        }

            .dw-ecc.dw-ecc td:first-child, .dw-ecc.dw-ecc th:first-child {
                text-align: left
            }

        .dw-ecc.dw-ecc td, .dw-ecc.dw-ecc th {
            padding: 9px 12px;
            border-bottom: 1px solid var(--edge)
        }

        .dw-ecc.dw-ecc tbody tr:nth-child(2n+1) {
            background: var(--bg)
        }

        .dw-ecc.dw-ecc tbody tr:nth-child(2n) {
            background: var(--card)
        }

        .dw-ecc.dw-ecc .ecc-info {
            margin-top: 18px
        }

        .dw-ecc.dw-ecc summary {
            cursor: pointer;
            color: var(--gold);
            font-weight: 700
        }

        .dw-ecc.dw-ecc .ecc-info div {
            white-space: pre-wrap;
            margin-top: 12px;
            color: var(--muted)
        }

        .dw-ecc.dw-ecc footer {
            font-size: 12px;
            margin-top: 15px
        }

    @media(max-width:960px) {
        .dw-ecc.dw-ecc {
            padding: 16px;
            margin: 12px auto
        }

            .dw-ecc.dw-ecc .ecc-grid {
                grid-template-columns: 1fr
            }

            .dw-ecc.dw-ecc .ecc-row {
                grid-template-columns: 1fr 1fr
            }

            .dw-ecc.dw-ecc .ecc-panel {
                padding: 16px
            }
    }

    .dw-ecc.dw-ecc .ecc-visual {
        display: flex;
        align-items: center;
        gap: 20px;
        margin: 0 0 20px;
        padding: 12px;
        background: var(--card);
        border: 1px solid #5b3333;
        border-radius: 14px;
        min-height: 170px
    }

        .dw-ecc.dw-ecc .ecc-visual img {
            display: block;
            width: min(46%,150px);
            max-height: 220px;
            object-fit: contain;
            border-radius: 9px;
            background: var(--bg)
        }

        .dw-ecc.dw-ecc .ecc-visual figcaption {
            font-size: clamp(17px,2.4vw,26px);
            font-weight: 700;
            color: #efc27e
        }

    .dw-ecc.dw-ecc .ecc-profile-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 7px;
        margin: -5px 0 17px
    }

        .dw-ecc.dw-ecc .ecc-profile-actions button {
            padding: 8px 10px;
            border: 2px solid var(--edge);
            border-radius: 7px;
            background: var(--bg);
            color: #fff;
            font: 600 12px/1.3 system-ui,sans-serif;
            cursor: pointer;
            transition: border-color .12s ease;
            box-shadow: none;
            text-shadow: none
        }

            .dw-ecc.dw-ecc .ecc-profile-actions button:not(:disabled):hover {
                border-color: var(--gold);
                background: var(--bg);
                color: #fff
            }

            .dw-ecc.dw-ecc .ecc-profile-actions button:focus-visible {
                outline: 2px solid var(--gold);
                outline-offset: 3px
            }

            .dw-ecc.dw-ecc .ecc-profile-actions button:not(:disabled):active {
                background: var(--pressed);
                border-color: var(--gold);
                color: #fff
            }

            .dw-ecc.dw-ecc .ecc-profile-actions button:disabled {
                opacity: .45;
                cursor: not-allowed
            }

    .dw-ecc.dw-ecc [hidden] {
        display: none !important
    }

    .dw-ecc.dw-ecc .ecc-profile-status {
        margin: -8px 0 14px;
        color: #c7afb0;
        font-size: 12px;
        min-height: 18px
    }

    .dw-ecc.dw-ecc .ecc-table-wrap table {
        table-layout: fixed;
        min-width: 420px
    }

        .dw-ecc.dw-ecc .ecc-table-wrap table td:first-child, .dw-ecc.dw-ecc .ecc-table-wrap table th:first-child {
            text-align: left !important
        }

        .dw-ecc.dw-ecc .ecc-table-wrap table td:nth-child(n+2), .dw-ecc.dw-ecc .ecc-table-wrap table th:nth-child(n+2) {
            text-align: left !important;
            white-space: nowrap
        }

    @media(max-width:560px) {
        .dw-ecc.dw-ecc .ecc-visual {
            display: block;
            text-align: center
        }

            .dw-ecc.dw-ecc .ecc-visual img {
                width: 100%;
                max-height: 230px;
                margin: 0 auto 10px
            }
    }

/* Keep wide result tables inside their scroll area on mobile. */
.dw-ecc.dw-ecc .ecc-panel { min-width: 0; }
.dw-ecc.dw-ecc .ecc-visual { margin-inline: 0; }

/* Consistent dark controls and keyboard feedback within the calculator. */
.dw-ecc.dw-ecc input::placeholder { color: var(--muted); opacity: 1; }
.dw-ecc.dw-ecc select option { background: var(--bg); color: var(--text); }
.dw-ecc.dw-ecc summary:hover { color: #fff; }
.dw-ecc.dw-ecc summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 4px; }
.dw-ecc.dw-ecc .ecc-profile-status { color: var(--muted); }
.dw-ecc.dw-ecc .ecc-table-wrap { scrollbar-color: var(--edge) var(--bg); }

/* Storage controls belong below the chest target, in the requested reading order. */
.dw-ecc.dw-ecc .ecc-storage-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.dw-ecc.dw-ecc .ecc-storage-actions button { min-width: 0; }

/* Give the damage and chest inputs a distinct, prominent group. */
.dw-ecc.dw-ecc .ecc-damage-box {
    min-width: 0;
    margin: 6px 0 24px;
    padding: 16px 18px 18px;
    border: 1px solid var(--gold);
    border-radius: 12px;
    background: var(--bg);
}
.dw-ecc.dw-ecc .ecc-damage-box legend {
    padding: 0 8px;
    color: var(--gold);
    font-size: 17px;
    font-weight: 700;
}
.dw-ecc.dw-ecc .ecc-damage-box input,
.dw-ecc.dw-ecc .ecc-damage-box select {
    font-size: 18px;
    font-weight: 600;
}
.dw-ecc.dw-ecc .ecc-damage-box > label { margin-bottom: 0; }
.dw-ecc.dw-ecc .ecc-damage-box .ecc-hint:empty { display: none; }
.dw-ecc.dw-ecc .ecc-damage-box .ecc-hint:not(:empty) { margin-top: 12px; }
@media(min-width:961px) {
    .dw-ecc.dw-ecc .ecc-profile-edit-actions { flex-wrap: nowrap; }
    .dw-ecc.dw-ecc .ecc-profile-edit-actions button { white-space: nowrap; }
}
@media(max-width:560px) {
    .dw-ecc.dw-ecc .ecc-damage-box { padding: 12px; }
}

.dw-ecc.dw-ecc .ecc-info hr {
    border: 0;
    border-top: 1px solid var(--gold);
    margin: 16px 0;
    opacity: .5;
}

.dw-ecc.dw-ecc .ecc-storage-actions [data-ecc="autoConsent"] { grid-column: 1 / -1; display: flex; justify-content: center; align-items: center; gap: 10px; }
.dw-ecc.dw-ecc .ecc-consent-icon { color: #ed4545; font-size: 22px; line-height: 1; }
.dw-ecc.dw-ecc .ecc-consent-icon.is-allowed { color: #5ec962; }
.dw-ecc.dw-ecc .ecc-storage-actions button.ecc-consent-flash { animation: ecc-consent-flash .5s; }
@keyframes ecc-consent-flash { 0%, 99% { background: #025606; border-color: #efc27e; } 100% { background: #000; border-color: #5b3333; } }
