:root {
    color-scheme: dark;
    --black: #020202;
    --charcoal: #08090a;
    --panel: #121315;
    --panel-high: #202225;
    --stone: #2a2b2d;
    --stone-dark: #070708;
    --red: #b81e12;
    --red-hot: #f04421;
    --red-deep: #4f0805;
    --ember: #f36a18;
    --gold: #aa7a3a;
    --gold-soft: #d5b079;
    --text: #f2e3cc;
    --muted: #c0ad91;
    --shadow: rgba(0, 0, 0, .84);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(90deg, rgba(0, 0, 0, .58) 0%, rgba(0, 0, 0, .28) 34%, rgba(0, 0, 0, .04) 66%, rgba(0, 0, 0, .26) 100%),
        linear-gradient(180deg, rgba(0, 0, 0, .1) 0%, rgba(0, 0, 0, .08) 58%, rgba(20, 2, 0, .3) 100%),
        url("../images/draconic-heritage-reference_background-clean.png");
    background-attachment: fixed;
    background-color: var(--black);
    background-position: center top;
    background-repeat: no-repeat;
    background-size: cover;
    color: var(--text);
    font: 16px/1.5 "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body::before,
body::after {
    content: "";
    pointer-events: none;
    position: fixed;
    z-index: -1;
}

body::before {
    inset: 0;
    background:
        radial-gradient(circle at 24% 43%, rgba(224, 176, 116, .16), rgba(175, 85, 38, .08) 8rem, transparent 20rem),
        radial-gradient(circle at 75% 24%, rgba(246, 72, 24, .1), transparent 19rem),
        linear-gradient(90deg, rgba(0, 0, 0, .24), transparent 22%, transparent 74%, rgba(0, 0, 0, .2));
}

body::after {
    inset: auto 0 0;
    height: 26vh;
    background:
        linear-gradient(0deg, rgba(18, 1, 0, .42), transparent);
    opacity: .55;
}

a {
    color: #ff6740;
    text-decoration: none;
}

a:hover {
    color: #ffad87;
    text-decoration: underline;
}

.topbar {
    align-items: center;
    background:
        linear-gradient(180deg, rgba(8, 8, 9, .98), rgba(5, 5, 6, .94)),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, .026) 0 1px, transparent 1px 7px);
    border-bottom: 1px solid rgba(170, 122, 58, .42);
    box-shadow:
        0 18px 46px rgba(0, 0, 0, .68),
        inset 0 -1px 0 rgba(184, 30, 18, .62),
        inset 0 1px 0 rgba(255, 255, 255, .04);
    display: flex;
    justify-content: space-between;
    min-height: 84px;
    padding: .85rem clamp(1rem, 4vw, 3.25rem);
    position: relative;
}

.topbar::before {
    background:
        linear-gradient(90deg, rgba(155, 24, 14, .96), rgba(155, 24, 14, .18) 35%, transparent 58%, rgba(155, 24, 14, .74)),
        linear-gradient(90deg, transparent, rgba(170, 122, 58, .38), transparent);
    bottom: 0;
    content: "";
    height: 2px;
    left: 2.75rem;
    position: absolute;
    right: 2.75rem;
}

.brand {
    align-items: center;
    color: #d42a1b;
    display: inline-flex;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.9rem, 3.7vw, 3.35rem);
    font-weight: 700;
    gap: .75rem;
    letter-spacing: .09em;
    line-height: 1;
    position: relative;
    text-shadow:
        0 0 7px rgba(240, 68, 33, .82),
        0 0 22px rgba(110, 10, 5, .95),
        0 3px 0 #000;
    text-transform: uppercase;
}

.brand::before {
    background:
        radial-gradient(circle at 50% 50%, rgba(240, 68, 33, .28), transparent 68%),
        url("../images/draconic-heritage-dragon.svg") center / 180% auto no-repeat;
    border-radius: 50%;
    content: "";
    display: inline-block;
    flex: 0 0 auto;
    height: 52px;
    opacity: .9;
    width: 52px;
}

.brand:hover {
    color: #ff4f2d;
    text-decoration: none;
}

.topbar nav {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 1.6rem;
    justify-content: flex-end;
    position: relative;
}

.topbar nav a {
    color: #dcc5a3;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .06em;
    padding: .35rem .25rem;
    text-transform: uppercase;
}

.topbar nav a + a {
    border-left: 1px solid rgba(170, 122, 58, .36);
    padding-left: 1.6rem;
}

.topbar nav a:hover {
    color: #ff6b43;
    text-decoration: none;
    text-shadow: 0 0 12px rgba(240, 68, 33, .5);
}

.shell {
    margin: 0 auto;
    max-width: 1440px;
    min-height: calc(100vh - 86px);
    padding: clamp(3rem, 9vh, 6rem) clamp(1rem, 3vw, 2.5rem) 4rem;
    position: relative;
}

.shell::before {
    background-image: url("../images/dragon-realms-logo-panel.png");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    content: "";
    height: 560px;
    left: clamp(1rem, 2.8vw, 3rem);
    opacity: 1;
    pointer-events: none;
    position: fixed;
    top: clamp(8.25rem, 17vh, 10.75rem);
    width: 535px;
    z-index: 0;
}

.shell::after {
    content: none;
}

.hero,
.panel {
    background:
        linear-gradient(180deg, rgba(31, 33, 35, .94), rgba(11, 11, 12, .97)),
        radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .05), transparent 18rem),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, .026) 0 1px, transparent 1px 8px);
    border: 1px solid rgba(170, 122, 58, .42);
    border-radius: 8px;
    box-shadow:
        0 30px 88px var(--shadow),
        0 0 0 2px rgba(0, 0, 0, .85),
        0 0 0 3px rgba(117, 18, 10, .62),
        0 0 48px rgba(240, 68, 33, .17),
        inset 0 0 0 1px rgba(255, 255, 255, .04),
        inset 0 0 60px rgba(0, 0, 0, .74);
    overflow: visible;
    padding: clamp(1.45rem, 3vw, 2.75rem);
    position: relative;
}

.hero::before,
.panel::before {
    background:
        linear-gradient(90deg, transparent, rgba(113, 16, 8, .95) 13%, rgba(240, 68, 33, .72) 50%, rgba(113, 16, 8, .9) 87%, transparent);
    content: "";
    height: 2px;
    left: 5rem;
    position: absolute;
    right: 5rem;
    top: 0;
}

.hero::after,
.panel::after {
    border: 1px solid rgba(170, 122, 58, .25);
    border-radius: 5px;
    box-shadow: inset 0 0 28px rgba(0, 0, 0, .45);
    content: "";
    inset: .65rem;
    pointer-events: none;
    position: absolute;
}

.hero {
    margin: 0 auto;
    max-width: 650px;
    min-height: 430px;
    padding: clamp(4rem, 6vw, 5.4rem) clamp(1.4rem, 4vw, 3.6rem) clamp(2.2rem, 4vw, 3rem);
}

.hero .dragon-sigil {
    background:
        radial-gradient(circle at 50% 50%, rgba(240, 68, 33, .36), transparent 68%),
        url("../images/draconic-heritage-dragon.svg") center / 185% auto no-repeat;
    border: 1px solid rgba(170, 122, 58, .34);
    border-radius: 50%;
    box-shadow: inset 0 0 28px rgba(0, 0, 0, .95), 0 0 22px rgba(184, 30, 18, .28);
    height: 70px;
    left: 50%;
    opacity: .92;
    position: absolute;
    top: -35px;
    transform: translateX(-50%);
    width: 70px;
    z-index: 1;
}

.hero h1 {
    color: #f4e5ce;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.3rem, 4vw, 3.25rem);
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1.16;
    margin-bottom: 1.85rem;
    text-align: center;
    text-shadow: 0 2px 0 #000;
    text-transform: none;
}

.hero h1::after {
    background:
        linear-gradient(90deg, transparent, rgba(117, 18, 10, .92), rgba(170, 122, 58, .58), rgba(117, 18, 10, .92), transparent);
    content: "";
    display: block;
    height: 2px;
    margin: 1.1rem auto 0;
    max-width: 420px;
}

.hero p {
    color: #c8b9a3;
    font-size: clamp(1rem, 2vw, 1.14rem);
    max-width: 560px;
}

.hero + .panel,
.panel + .panel {
    margin-top: 1.25rem;
}

h1,
h2 {
    color: #f4e5ce;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.15;
    margin: 0 0 1rem;
    text-shadow: 0 2px 0 #000;
}

h1 {
    font-size: clamp(1.85rem, 5vw, 3rem);
}

h2 {
    color: #d7b37a;
    font-size: clamp(1.35rem, 3vw, 2rem);
}

p {
    color: var(--muted);
    margin: 0 0 1rem;
}

strong {
    color: #fff2dd;
}

.grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.actions {
    display: grid;
    gap: 1.4rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 2rem;
    max-width: 470px;
}

.button,
button {
    background: linear-gradient(180deg, #b72a18, #7e130c 60%, #3c0604);
    border: 1px solid rgba(240, 68, 33, .84);
    border-radius: 4px;
    box-shadow:
        0 10px 24px rgba(0, 0, 0, .5),
        inset 0 1px 0 rgba(255, 255, 255, .15),
        inset 0 -2px 0 rgba(38, 3, 2, .74);
    color: #fff1df;
    cursor: pointer;
    display: inline-block;
    font-weight: 800;
    letter-spacing: .045em;
    line-height: 1.2;
    min-height: 52px;
    min-width: 0;
    padding: .95rem 1.25rem;
    text-align: center;
    text-shadow: 0 2px 0 #000;
    text-transform: uppercase;
}

.hero .button.secondary {
    grid-column: 1 / 2;
}

.button:hover,
button:hover {
    box-shadow:
        0 12px 28px rgba(0, 0, 0, .58),
        0 0 25px rgba(240, 68, 33, .35),
        inset 0 1px 0 rgba(255, 255, 255, .2);
    filter: brightness(1.1);
    text-decoration: none;
}

.button.download {
    background: linear-gradient(180deg, #d33a20, #95180e 58%, #4c0805);
    border-color: rgba(255, 98, 58, .9);
    box-shadow:
        0 10px 24px rgba(0, 0, 0, .5),
        0 0 22px rgba(240, 68, 33, .18),
        inset 0 1px 0 rgba(255, 255, 255, .18),
        inset 0 -2px 0 rgba(38, 3, 2, .74);
}

.button.download span {
    color: #e6c8aa;
    display: block;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
    margin-top: .15rem;
}

.button.secondary,
button.secondary {
    background: linear-gradient(180deg, #242426, #151515 60%, #070707);
    border-color: rgba(170, 122, 58, .34);
    color: #f4e5ce;
}

.button.danger,
button.danger {
    background: linear-gradient(180deg, #c2351e, #7b140c);
    border-color: rgba(240, 68, 33, .85);
    color: #fff4e7;
}

form {
    display: grid;
    gap: 1rem;
}

label {
    color: #d7c5ab;
    display: grid;
    font-weight: 700;
    gap: .4rem;
}

input,
select {
    background: linear-gradient(180deg, #111214, #070707);
    border: 1px solid rgba(170, 122, 58, .34);
    border-radius: 4px;
    box-shadow: inset 0 2px 12px rgba(0, 0, 0, .64);
    color: var(--text);
    min-height: 44px;
    padding: .75rem;
    width: 100%;
}

input:focus,
select:focus {
    border-color: rgba(240, 68, 33, .85);
    box-shadow:
        0 0 0 3px rgba(240, 68, 33, .16),
        inset 0 2px 12px rgba(0, 0, 0, .64);
    outline: none;
}

.notice,
.error-list {
    background: linear-gradient(180deg, rgba(24, 25, 27, .94), rgba(8, 8, 9, .96));
    border: 1px solid rgba(170, 122, 58, .32);
    border-radius: 5px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .36), inset 0 0 20px rgba(0, 0, 0, .38);
    margin-bottom: 1rem;
    padding: .85rem 1rem;
}

.notice.info {
    border-color: rgba(170, 122, 58, .4);
}

.notice.success {
    border-color: rgba(58, 128, 76, .7);
    color: #d8f1d4;
}

.notice.error,
.error-list {
    border-color: rgba(240, 68, 33, .7);
    color: #ffe3dd;
}

.table {
    background:
        linear-gradient(180deg, rgba(22, 23, 25, .96), rgba(8, 8, 9, .98)),
        repeating-linear-gradient(0deg, transparent 0 32px, rgba(255, 255, 255, .018) 32px 33px),
        repeating-linear-gradient(90deg, transparent 0 48px, rgba(255, 255, 255, .015) 48px 49px);
    border: 1px solid rgba(170, 122, 58, .38);
    border-radius: 5px;
    box-shadow: inset 0 0 32px rgba(0, 0, 0, .62);
    overflow: hidden;
}

.row {
    align-items: center;
    background: linear-gradient(90deg, rgba(124, 20, 10, .14), rgba(0, 0, 0, .12));
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr auto;
    padding: .95rem 1rem;
}

.row + .row {
    border-top: 1px solid rgba(170, 122, 58, .22);
}

.row strong {
    color: #f4e5ce;
    display: block;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.12rem;
}

.muted {
    color: var(--muted);
}

.page-panel { margin: 0 auto; max-width: 1050px; }
.page-heading { align-items: end; display: flex; gap: 2rem; justify-content: space-between; margin-bottom: 1.25rem; }
.page-heading p { margin-bottom: 0; }
.filter-form { min-width: 220px; }
.table-scroll { border: 1px solid rgba(170, 122, 58, .38); border-radius: 5px; overflow-x: auto; }
.data-table { border-collapse: collapse; min-width: 620px; width: 100%; }
.data-table th, .data-table td { border-bottom: 1px solid rgba(170, 122, 58, .2); padding: .85rem 1rem; text-align: left; }
.data-table th { background: rgba(84, 12, 7, .72); color: #e6c89d; font-size: .82rem; text-transform: uppercase; }
.data-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, .025); }
.empty-state { border: 1px solid rgba(170, 122, 58, .3); color: var(--muted); padding: 2rem; text-align: center; }
.search-form { margin-bottom: 1.5rem; }
.search-row { display: grid; gap: .75rem; grid-template-columns: minmax(0, 1fr) auto; }
.search-row button { min-height: 44px; }
.character-sheet { border-top: 1px solid rgba(170, 122, 58, .35); padding-top: 1.5rem; }
.character-title { align-items: center; display: flex; gap: 1rem; justify-content: space-between; }
.status { border: 1px solid; border-radius: 4px; font-size: .8rem; font-weight: 800; padding: .3rem .6rem; text-transform: uppercase; }
.status.online { border-color: #4f9f64; color: #9fe2ae; }
.status.offline { border-color: #766b5d; color: #b9aa95; }
.character-details { border: 1px solid rgba(170, 122, 58, .3); margin: 0; }
.character-details div { display: grid; grid-template-columns: minmax(120px, 30%) 1fr; }
.character-details div + div { border-top: 1px solid rgba(170, 122, 58, .2); }
.character-details dt, .character-details dd { margin: 0; padding: .8rem 1rem; }
.character-details dt { background: rgba(84, 12, 7, .35); color: #d7b37a; font-weight: 700; }

@media (max-width: 780px) {
    body {
        background:
            linear-gradient(180deg, rgba(0, 0, 0, .48), rgba(0, 0, 0, .78)),
            url("../images/draconic-heritage-reference_background-clean.png");
        background-attachment: scroll;
        background-position: 68% center;
        background-repeat: no-repeat;
        background-size: cover;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: .75rem;
        min-height: 0;
    }

    .topbar nav {
        justify-content: flex-start;
        width: 100%;
    }

    .topbar nav a {
        padding-left: 0;
    }

    .topbar nav a + a {
        padding-left: .9rem;
    }

    .brand {
        font-size: clamp(1.45rem, 9vw, 2.3rem);
    }

    .brand::before {
        height: 46px;
        width: 46px;
    }

    .shell {
        min-height: auto;
        padding-top: 4rem;
    }

    .shell::before {
        background-size: 250px auto;
        background-position: center top;
        height: 250px;
        left: -1.75rem;
        opacity: 1;
        top: 10rem;
        width: 250px;
    }

    .shell::after {
        display: none;
    }

    .hero,
    .panel {
        padding: 1.2rem;
    }

    .hero {
        min-height: 0;
    }

    .hero .dragon-sigil {
        height: 58px;
        top: -29px;
        width: 58px;
    }

    .hero::before,
    .panel::before {
        left: 2rem;
        right: 2rem;
    }

    .actions,
    .row,
    .search-row {
        grid-template-columns: 1fr;
    }

    .page-heading { align-items: stretch; flex-direction: column; gap: 1rem; }

    .actions {
        gap: .85rem;
    }

    .actions .button,
    .actions button,
    .row .button {
        min-width: 0;
        width: 100%;
    }
}
