:root {
    --oa-bg: #101216;
    --oa-bg-2: #171a20;
    --oa-panel: rgba(27, 31, 38, .96);
    --oa-panel-strong: #222833;
    --oa-surface: #1b2028;
    --oa-line: rgba(184, 190, 181, .25);
    --oa-line-hot: rgba(210, 112, 103, .42);
    --oa-red: #d27067;
    --oa-red-dark: #9e4d49;
    --oa-ember: #d99b68;
    --oa-green: #8fbf9a;
    --oa-green-dark: #587c63;
    --oa-portal: #8bb8c8;
    --oa-text: #f3f1ea;
    --oa-muted: #b8b4aa;
    --oa-shadow: 0 18px 54px rgba(0, 0, 0, .34);
}

.oa-body {
    min-height: 100vh;
    color: var(--oa-text);
    background:
        linear-gradient(120deg, rgba(210, 112, 103, .14), transparent 30rem),
        linear-gradient(300deg, rgba(143, 191, 154, .15), transparent 28rem),
        linear-gradient(180deg, #12151a 0%, var(--oa-bg) 48%, #15181d 100%);
    font-family: "Trebuchet MS", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
    letter-spacing: 0;
}

.oa-body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
    background-size: 56px 56px;
    opacity: .28;
}

.oa-navbar {
    position: sticky;
    top: 0;
    z-index: 10;
    border-color: var(--oa-line) !important;
    background: rgba(18, 21, 26, .9);
    backdrop-filter: blur(18px);
}

.oa-brand {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: var(--oa-text);
    font-family: Constantia, "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.oa-brand::before {
    content: "";
    position: absolute;
    inset: -.28rem -1.18rem;
    z-index: -1;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(84, 205, 151, .44), rgba(58, 142, 220, .42));
    filter: blur(8px);
    opacity: .72;
}

.site-logo {
    display: block;
    width: auto;
    height: 2.75rem;
    object-fit: contain;
    filter:
        drop-shadow(-.35rem 0 .7rem rgba(84, 205, 151, .34))
        drop-shadow(.5rem 0 .95rem rgba(58, 142, 220, .28));
}

a {
    color: var(--oa-text);
    text-decoration: none;
}

a:hover,
a:focus {
    color: var(--oa-green);
    text-decoration: none;
}

.nav-link {
    color: var(--oa-muted);
}

.nav-link:hover,
.nav-link:focus,
.dropdown-item:hover,
.dropdown-item:focus {
    color: var(--oa-green);
}

.dropdown-menu {
    border: 1px solid var(--oa-line);
    border-radius: 8px;
    background: #202630;
    box-shadow: var(--oa-shadow);
}

.fw-black {
    font-weight: 900;
}

h1,
h2,
h3,
h4,
h5,
h6,
.display-3,
.display-4,
.display-5,
.display-6 {
    color: var(--oa-portal);
    font-family: Constantia, "Palatino Linotype", "Book Antiqua", Georgia, serif;
    letter-spacing: .02em;
}

.eyebrow,
.tracking-label {
    color: var(--oa-green);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.oa-hero,
.oa-panel,
.oa-card,
.oa-reader,
.workspace-panel,
.author-shell {
    position: relative;
    border: 1px solid var(--oa-line);
    border-radius: 8px;
    background: linear-gradient(160deg, var(--oa-panel), rgba(22, 25, 31, .96));
    box-shadow: var(--oa-shadow), inset 0 1px 0 rgba(255, 255, 255, .05);
}

.oa-hero {
    overflow: hidden;
    padding: clamp(2rem, 5vw, 4.5rem);
}

.oa-hero::before,
.workspace-panel::before,
.oa-panel::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--oa-red), var(--oa-green), var(--oa-portal), transparent);
    opacity: .62;
}

.oa-panel,
.oa-card,
.oa-reader,
.workspace-panel,
.author-shell {
    padding: clamp(1.25rem, 3vw, 2rem);
}

.oa-card {
    transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}

.oa-card:hover {
    transform: translateY(-3px);
    border-color: rgba(143, 191, 154, .42);
    box-shadow: 0 22px 64px rgba(0, 0, 0, .42), 0 0 0 1px rgba(143, 191, 154, .12);
}

.story-row {
    color: var(--oa-text);
}

.story-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border: 1px solid var(--oa-line);
    border-radius: 6px;
    margin-bottom: 1rem;
    background: #161a20;
}

.story-detail-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(14rem, 22rem);
    align-items: center;
    gap: clamp(1.5rem, 4vw, 3rem);
}

.story-detail-cover {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border: 1px solid var(--oa-line);
    border-radius: 6px;
    background: #161a20;
}

.story-authors {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: .25rem 0 1rem;
}

.story-authors-detail {
    margin: .25rem 0 1.25rem;
}

.story-author {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--oa-muted);
    font-size: .92rem;
    font-weight: 750;
}

.story-author-avatar {
    display: inline-grid;
    place-items: center;
    width: 1.8rem;
    height: 1.8rem;
    overflow: hidden;
    border: 1px solid rgba(143, 191, 154, .42);
    border-radius: 50%;
    color: var(--oa-text);
    background: linear-gradient(145deg, #253025, #1a2028);
    font-size: .78rem;
}

.story-author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.oa-reader {
    max-width: 880px;
    margin-inline: auto;
    font-size: 1.08rem;
    line-height: 1.82;
}

.oa-reader .markdown {
    font-family: Georgia, Cambria, "Times New Roman", serif;
}

.oa-reader .markdown p {
    margin-bottom: 1.25rem;
}

.markdown img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.markdown blockquote {
    border-left: 3px solid var(--oa-green);
    margin-left: 0;
    padding: .5rem 0 .5rem 1rem;
    color: var(--oa-muted);
}

.author-shell {
    display: grid;
    gap: 1.25rem;
}

.author-header,
.workspace-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.workspace-toolbar {
    margin-bottom: 1.25rem;
}

.workspace-toolbar .btn {
    flex: 0 0 auto;
    padding: .65rem 1rem;
}

.author-header h1,
.workspace-toolbar h2 {
    margin: 0;
}

.workspace-toolbar p {
    margin: .35rem 0 0;
    color: var(--oa-muted);
}

.author-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.author-tabs a {
    border: 1px solid var(--oa-line);
    border-radius: 6px;
    padding: .45rem .75rem;
    color: var(--oa-text);
    text-decoration: none;
    background: rgba(255, 255, 255, .025);
}

.author-tabs a:hover,
.author-tabs a:focus {
    border-color: rgba(143, 191, 154, .46);
    color: var(--oa-green);
}

.story-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    border-bottom: 1px solid var(--oa-line);
    margin-bottom: 1rem;
}

.story-tabs a {
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    padding: .65rem 1rem;
    color: var(--oa-muted);
    background: rgba(255, 255, 255, .02);
}

.story-tabs a:hover,
.story-tabs a:focus {
    color: var(--oa-green);
}

.story-tabs a.active {
    border-color: var(--oa-line);
    color: var(--oa-text);
    background: var(--oa-panel-strong);
}

.story-table {
    display: grid;
    gap: .5rem;
}

.story-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--oa-line);
    border-radius: 6px;
    padding: .9rem 1rem;
    text-decoration: none;
    background: rgba(255, 255, 255, .025);
}

.story-row:hover,
.story-row:focus {
    border-color: rgba(143, 191, 154, .46);
    color: var(--oa-green);
    background: rgba(143, 191, 154, .07);
}

.story-row small {
    display: block;
    margin-top: .15rem;
    color: var(--oa-muted);
}

.chapter-row {
    grid-template-columns: minmax(0, 1fr) auto;
}

.empty-state {
    border: 1px dashed var(--oa-line);
    border-radius: 6px;
    padding: 1.25rem;
    color: var(--oa-muted);
}

.story-editor-form {
    margin-top: 1.25rem;
}

.chapter-editor-form {
    margin-top: 1.25rem;
}

.story-editor-topline {
    display: grid;
    grid-template-columns: minmax(16rem, 34rem);
    align-items: end;
    gap: 1rem;
    margin-bottom: 1rem;
}

.story-settings-grid {
    display: grid;
    grid-template-columns: minmax(16rem, 34rem) minmax(10rem, 14rem);
    align-items: end;
    gap: 1rem;
}

.chapter-settings-grid {
    display: grid;
    grid-template-columns: minmax(16rem, 34rem) minmax(10rem, 14rem);
    align-items: end;
    gap: 1rem;
}

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

.description-field {
    grid-column: 1 / -1;
}

.markdown-field {
    grid-column: 1 / -1;
}

.markdown-editor {
    overflow: hidden;
    border: 1px solid var(--oa-line);
    border-radius: 6px;
    background: rgba(0, 0, 0, .18);
}

.markdown-editor textarea {
    border: 0;
    border-top: 1px solid var(--oa-line);
    border-radius: 0;
    background: transparent;
}

.markdown-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    padding: .5rem;
}

.markdown-toolbar button,
.markdown-toolbar a {
    width: auto;
    border: 1px solid var(--oa-line);
    border-radius: 5px;
    padding: .35rem .55rem;
    color: var(--oa-text);
    background: rgba(255, 255, 255, .035);
    font-weight: 750;
}

.markdown-toolbar button:hover,
.markdown-toolbar button:focus,
.markdown-toolbar a:hover,
.markdown-toolbar a:focus {
    border-color: rgba(143, 191, 154, .46);
    color: var(--oa-green);
}

.cover-field {
    max-width: 34rem;
}

.cover-preview {
    display: block;
    width: min(100%, 18rem);
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border: 1px solid var(--oa-line);
    border-radius: 6px;
    margin-bottom: .65rem;
    background: #161a20;
}

.toggle-card {
    display: flex;
    align-items: center;
    gap: .7rem;
    justify-self: start;
    min-height: 2rem;
    border: 0;
    padding: 0;
    cursor: pointer;
    background: transparent;
}

.toggle-card:hover,
.toggle-card:focus-within {
    color: var(--oa-green);
}

.toggle-card input {
    position: relative;
    flex: 0 0 auto;
    width: 2.75rem;
    height: 1.45rem;
    margin: 0;
    border: 1px solid rgba(184, 190, 181, .42);
    border-radius: 999px;
    appearance: none;
    background: #555b61;
    cursor: pointer;
}

.toggle-card input::after {
    content: "";
    position: absolute;
    top: .18rem;
    left: .2rem;
    width: .95rem;
    height: .95rem;
    border-radius: 50%;
    background: #d2d0c8;
    transition: transform .14s ease, background .14s ease;
}

.toggle-card input:checked {
    border-color: var(--oa-green);
    background: var(--oa-green-dark);
}

.toggle-card input:checked::after {
    transform: translateX(1.25rem);
    background: #fff;
}

.toggle-card strong,
.toggle-card small {
    display: block;
}

.toggle-card small {
    color: var(--oa-muted);
    font-size: .78rem;
    line-height: 1.25;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
}

.gallery-layout {
    display: grid;
    grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.gallery-upload-form {
    display: grid;
    gap: 1rem;
    margin-top: 1.25rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.gallery-card {
    overflow: hidden;
    border: 1px solid var(--oa-line);
    border-radius: 6px;
    background: rgba(255, 255, 255, .025);
}

.gallery-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-bottom: 1px solid var(--oa-line);
    background: #161a20;
}

.gallery-card-body {
    display: grid;
    gap: .75rem;
    padding: .85rem;
}

.gallery-card-body h3 {
    margin: 0;
    font-size: 1.05rem;
}

.copy-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .45rem;
}

.copy-row input {
    font-size: .82rem;
}

.gallery-delete-button {
    width: 100%;
    border-color: rgba(210, 112, 103, .42);
    color: var(--oa-muted);
}

.gallery-delete-button:hover,
.gallery-delete-button:focus {
    border-color: var(--oa-red);
    color: var(--oa-text);
    background: rgba(210, 112, 103, .12);
}

.chapter-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

.chapter-nav .btn {
    width: 6.5rem;
    max-width: 6.5rem;
}

.chapter-nav a:last-child {
    justify-self: end;
}

.account-avatar {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 7rem;
    height: 7rem;
    overflow: hidden;
    border: 1px solid rgba(143, 191, 154, .5);
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(145deg, #253025, #1a2028);
    box-shadow: 0 0 0 4px rgba(143, 191, 154, .1);
    font-size: 2.4rem;
    font-weight: 800;
}

.account-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn {
    border-radius: 6px;
    font-weight: 750;
}

.btn-danger {
    border-color: var(--oa-red);
    background: linear-gradient(180deg, var(--oa-red), var(--oa-red-dark));
}

.btn-outline-light {
    border-color: var(--oa-line);
    color: var(--oa-text);
}

.badge {
    border-radius: 4px;
}

.text-danger {
    color: var(--oa-red) !important;
}

.link-danger {
    color: var(--oa-text) !important;
}

.link-danger:hover,
.link-danger:focus,
.link-underline-danger:hover,
.link-underline-danger:focus {
    color: var(--oa-green) !important;
}

.link-light {
    color: var(--oa-text) !important;
}

.link-light:hover,
.link-light:focus {
    color: var(--oa-green) !important;
}

.text-bg-danger {
    color: #171a20 !important;
    background-color: var(--oa-green) !important;
}

.border-danger-subtle {
    border-color: rgba(210, 112, 103, .28) !important;
}

.btn-danger:hover,
.btn-danger:focus {
    border-color: var(--oa-green);
    background: linear-gradient(180deg, var(--oa-green), var(--oa-green-dark));
}

form p {
    margin-bottom: 1rem;
}

form label {
    display: block;
    margin-bottom: .35rem;
    color: var(--oa-text);
    font-weight: 750;
}

.form-note {
    display: block;
    margin-top: .35rem;
    color: var(--oa-muted);
    font-size: .84rem;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--oa-line);
    border-radius: 6px;
    color: #fff;
    background: rgba(0, 0, 0, .28);
}

input:not([type="checkbox"]):not([type="radio"]),
select {
    min-height: 3rem;
    padding: 0 .9rem;
    line-height: 1.4;
}

input[type="file"] {
    overflow: hidden;
    padding: 0;
    line-height: calc(3rem - 2px);
}

input[type="file"]::file-selector-button {
    height: calc(3rem - 2px);
    margin: 0 .9rem 0 0;
    border: 0;
    border-right: 1px solid var(--oa-line);
    padding: 0 .9rem;
    color: var(--oa-text);
    background: rgba(255, 255, 255, .06);
    font-weight: 750;
    line-height: calc(3rem - 2px);
    cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
    color: var(--oa-green);
}

.custom-file-control {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 3rem;
    overflow: hidden;
    border: 1px solid var(--oa-line);
    border-radius: 6px;
    color: #fff;
    background: rgba(0, 0, 0, .28);
}

.custom-file-input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    pointer-events: none;
}

.custom-file-button {
    display: flex;
    align-items: center;
    height: 100%;
    margin: 0;
    border-right: 1px solid var(--oa-line);
    padding: 0 .95rem;
    color: var(--oa-text);
    background: rgba(255, 255, 255, .06);
    font-weight: 750;
    cursor: pointer;
}

.custom-file-button:hover,
.custom-file-button:focus {
    color: var(--oa-green);
}

.custom-file-name {
    display: flex;
    align-items: center;
    min-width: 0;
    padding: 0 .95rem;
    color: var(--oa-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-file-clear {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-top: .5rem;
    color: var(--oa-muted);
    font-size: .9rem;
}

.custom-file-clear input {
    width: auto;
}

textarea {
    padding: .75rem .9rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: 0;
    border-color: var(--oa-portal);
    box-shadow: 0 0 0 .18rem rgba(143, 191, 154, .16);
}

.helptext,
form ul {
    color: var(--oa-muted);
    font-size: .9rem;
}

@media (max-width: 767.98px) {
    .author-header,
    .workspace-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .story-row {
        grid-template-columns: 1fr;
        gap: .45rem;
    }

    .story-detail-hero,
    .story-editor-topline,
    .story-settings-grid,
    .chapter-settings-grid,
    .gallery-layout,
    .chapter-nav {
        grid-template-columns: 1fr;
    }

    .chapter-nav a:last-child {
        justify-self: start;
    }

    .cover-field,
    .description-field,
    .markdown-field {
        grid-column: auto;
    }

    .toggle-card {
        justify-self: start;
    }
}
