body {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    background: #f5f1e8;
    color: #222;
    line-height: 1.6;
}

header {
    border-bottom: 2px solid #2f2f2f;
    padding: 24px;
    background: #eee8dc;
}

header h1 {
    margin: 0;
    font-size: 2.4rem;
    letter-spacing: 1px;
}

header p {
    margin: 4px 0 16px;
    font-style: italic;
}

nav a {
    margin-right: 20px;
    color: #222;
    text-decoration: none;
    font-weight: bold;
}

nav a:hover {
    text-decoration: underline;
}

main {
    max-width: 850px;
    margin: 40px auto;
    padding: 0 20px;
}

h2 {
    border-bottom: 1px solid #888;
    padding-bottom: 8px;
}

form {
    display: flex;
    gap: 10px;
    margin-bottom: 40px;
}

input {
    flex: 1;
    padding: 12px;
    font-size: 1rem;
    border: 1px solid #777;
    background: #fffdf8;
}

button {
    padding: 12px 20px;
    border: 1px solid #222;
    background: #222;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

button:hover {
    background: #444;
}

article {
    border: 1px solid #aaa;
    background: #fffdf8;
    padding: 22px;
    margin-top: 20px;
}

article h3 {
    margin-top: 0;
    font-size: 1.5rem;
}article h3 a {
    color: #222;
    text-decoration: none;
}

article h3 a:hover {
    text-decoration: underline;
}

article a {
    color: #5f3b52;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tags a {
    border: 1px solid #9a8d95;
    padding: 4px 9px;
    text-decoration: none;
    background: #f4edf1;
    font-size: 0.9rem;
}

.tags a:hover {
    background: #e8dce3;
}

.story-info {
    font-size: 0.95rem;
    color: #555;
}
header h1 a {
    color: #222;
    text-decoration: none;
}

.story-header {
    background: #fffdf8;
    border: 1px solid #aaa;
    padding: 25px;
    margin-bottom: 35px;
}

.story-header h2 {
    font-size: 2rem;
    margin-top: 0;
}

.story-header a,
.chapters a {
    color: #5f3b52;
}

.chapters ol {
    padding-left: 30px;
}

.chapters li {
    padding: 8px 0;
}
/* Chapter reading page */

.chapter-header {
    max-width: 700px;
    margin: 0 auto 30px;
    text-align: center;
}

.chapter-header > p:first-child {
    text-align: left;
}

.chapter-header a {
    color: #5f3b52;
}

.chapter-header h2 {
    font-size: 2rem;
    margin-top: 30px;
}

.chapter-text {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 50px;
    font-size: 1.1rem;
    line-height: 1.8;
}

.chapter-text p {
    margin-top: 0;
    margin-bottom: 1.5em;
}

.chapter-navigation {
    max-width: 700px;
    margin: 35px auto 60px;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #aaa;
    padding-top: 20px;
}

.chapter-navigation a {
    color: #5f3b52;
    text-decoration: none;
    font-weight: bold;
}

.chapter-navigation a:hover {
    text-decoration: underline;
}

/* Make the chapter easier to read on phones */

@media (max-width: 600px) {
    .chapter-text {
        padding: 25px 20px;
        font-size: 1rem;
    }

    .chapter-navigation {
        padding-left: 20px;
        padding-right: 20px;
    }
}/* Dark mode */

body.dark-mode {
    background: #1c1b1a;
    color: #eee8dc;
    --card-bg: #252321;
}

body.dark-mode header {
    background: #252321;
    border-bottom-color: #777;
}

body.dark-mode header h1 a,
body.dark-mode nav a {
    color: #eee8dc;
}

body.dark-mode h2 {
    border-bottom-color: #666;
}

body.dark-mode .chapter-text {
    background: #252321;
    color: #eee8dc;
    border-color: #555;
}

body.dark-mode .chapter-header a,
body.dark-mode .chapter-navigation a {
    color: #d5a9c2;
}

body.dark-mode .chapter-navigation {
    border-top-color: #555;
}

body.dark-mode #theme-toggle {
    background: #eee8dc;
    color: #222;
}
/* Dark mode - story cards and forms */

body.dark-mode article {
    background: #252321;
    color: #eee8dc;
    border-color: #555;
}

body.dark-mode article h3 a {
    color: #eee8dc;
}

body.dark-mode .story-info {
    color: #c9c2b8;
}

body.dark-mode .tags a {
    background: #332d31;
    color: #d5a9c2;
    border-color: #665761;
}

body.dark-mode input {
    background: #252321;
    color: #eee8dc;
    border-color: #666;
}

body.dark-mode input::placeholder {
    color: #aaa;
}

body.dark-mode .story-header {
    background: #252321;
    color: #eee8dc;
    border-color: #555;
}

body.dark-mode .story-header a,
body.dark-mode .chapters a {
    color: #d5a9c2;
}
/* Browse filters */

.filters {
    background: #fffdf8;
    border: 1px solid #aaa;
    padding: 24px;
    margin-bottom: 35px;
}

.filters h3 {
    margin-top: 0;
}

.filters label {
    display: block;
    margin-top: 16px;
    margin-bottom: 6px;
    font-weight: bold;
}

.filters input,
.filters select {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    font-size: 1rem;
    border: 1px solid #888;
    background: #fffdf8;
}

.word-count {
    display: flex;
    align-items: center;
    gap: 10px;
}

.word-count input {
    flex: 1;
}

.word-count span {
    font-weight: bold;
}

.filters button {
    margin-top: 22px;
}

.browse-results {
    margin-top: 35px;
}

/* Dark mode - browse filters */

body.dark-mode .filters {
    background: #252321;
    color: #eee8dc;
    border-color: #555;
}

body.dark-mode .filters input,
body.dark-mode .filters select {
    background: #1f1e1c;
    color: #eee8dc;
    border-color: #666;
}

body.dark-mode .filters input::placeholder {
    color: #aaa;
}
/* Saved exclusions */

.saved-exclusions {
    margin-top: 14px;
    padding: 10px 0 2px;
}

.saved-exclusions label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: bold;
}

.saved-exclusions input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.filter-note {
    margin: 6px 0 0 24px;
    font-size: 0.9rem;
    color: #666;
}

body.dark-mode .filter-note {
    color: #bbb;
}
/* Force saved exclusions layout */

.saved-exclusions {
    display: block !important;
    margin-top: 12px !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

.saved-exclusions label {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
}

.saved-exclusions input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
}

.saved-exclusions .filter-note {
    margin: 6px 0 0 26px !important;
    text-align: left !important;
    font-size: 0.9rem;
    color: #666;
}

body.dark-mode .saved-exclusions {
    background: transparent !important;
}

body.dark-mode .saved-exclusions .filter-note {
    color: #bbb;
}
/* Search results */


/* New Work form layout */

.new-work {
    max-width: 1200px;
    margin: 0 auto;
}

#new-work-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-section {
    background: #fffdf8;
    border: 1px solid #c8bfb2;
    padding: 22px;
}

.form-section h3 {
    margin-top: 0;
    margin-bottom: 18px;
    font-size: 1.25rem;
}

.form-grid {
    display: grid;
    gap: 18px;
}

.two-column {
    grid-template-columns: 1fr 1fr;
}

.three-column {
    grid-template-columns: repeat(3, 1fr);
}

.split-sections {
    grid-template-columns: 1fr;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field label {
    font-weight: bold;
    margin-bottom: 6px;
}

.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    box-sizing: border-box;
    padding: 11px;
    font-size: 1rem;
    border: 1px solid #999;
    background: #fffdf8;
    font-family: inherit;
}

.form-field textarea {
    resize: vertical;
}

.field-note {
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: #666;
}

.relationship-category {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid #aaa;
}

.relationship-category legend {
    font-weight: bold;
    padding: 0 6px;
}

.relationship-options {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 24px;
}

.relationship-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: normal;
}

.relationship-options input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 4px;
}

.form-actions button {
    min-width: 180px;
}

.form-actions button:last-child {
    margin-left: auto;
}

/* New Work dark mode */

body.dark-mode .form-section {
    background: #252321;
    border-color: #555;
}

body.dark-mode .form-field input,
body.dark-mode .form-field textarea,
body.dark-mode .form-field select {
    background: #1f1e1c;
    color: #eee8dc;
    border-color: #666;
}

body.dark-mode .relationship-category {
    border-color: #666;
}

body.dark-mode .field-note {
    color: #bbb;
}

/* New Work mobile */

@media (max-width: 800px) {
    .two-column,
    .three-column,
    .split-sections {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions button {
        width: 100%;
    }
    .new-chapter .form-actions #save-chapter-changes,
.new-chapter .form-actions #delete-edit-chapter-button {
    width: 180px;
    }
}
/* New Work final polish */

.basics-section input[type="text"] {
    min-height: 54px;
}

.basics-section textarea {
    min-height: 150px;
}

.three-column {
    grid-template-columns: 1.05fr 1.35fr 1fr;
}
.three-column select {
    min-width: 0;
    width: 100%;
}

/* New Chapter page */

.new-chapter {
    max-width: 1200px;
    margin: 0 auto;
}

#new-chapter-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

#new-chapter-form .form-section {
    width: 100%;
    box-sizing: border-box;
}

#chapter-text {
    width: 100%;
    min-height: 500px;
    box-sizing: border-box;
    resize: vertical;
}

#chapter-notes {
    width: 100%;
    min-height: 100px;
    box-sizing: border-box;
    resize: vertical;
}

#new-chapter-form .form-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
}

#new-chapter-form .form-actions button {
    width: auto;
    min-width: 160px;
    height: auto;
    min-height: 54px;
    padding: 12px 24px;
}

#new-chapter-form .form-actions button:last-child {
    margin-left: auto;
}

#draft-saved-message {
    display: inline-block;
    min-width: 110px;
    margin-left: 10px;
    font-size: 0.9rem;
    color: #666;
}

body.dark-mode #draft-saved-message {
    color: #bbb;
}/* Published Work Page */

.work-header {
    margin-bottom: 3rem;
}

.work-header > h2 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

#published-work-summary {
    font-size: 1.1rem;
    line-height: 1.7;
    margin: 1rem 0 2rem;
    max-width: 850px;
}

.work-meta {
    border-top: 1px solid #aaa;
    border-bottom: 1px solid #aaa;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.work-meta p {
    margin: 0.5rem 0;
    
}

.work-details {
    background: var(--card-bg, #fffdf8);
    border: 1px solid #bbb;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
}

.work-details p {
    margin: 0.75rem 0;
    line-height: 1.5;
}

.work-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}

.work-actions a {
    display: inline-block;
    background: #222;
    color: #fff;
    padding: 0.7rem 1.1rem;
    text-decoration: none;
    font-weight: bold;
    border: 1px solid #222;
}

.work-actions a:hover {
    background: transparent;
    color: inherit;
}

.story-chapters {
    margin-top: 2.5rem;
}

.story-chapters h2 {
    border-bottom: 1px solid #aaa;
    padding-bottom: 0.6rem;
    margin-bottom: 1.25rem;
}

#published-work-chapters p {
    margin: 0;
    padding: 1rem 0;
    border-bottom: 1px solid #ccc;
}

#published-work-chapters a {
    font-size: 1.1rem;
}
/* Reader chapter page */

.chapter-header {
    max-width: 900px;
    margin: 0 auto 2rem;
    text-align: center;
}

.reader-controls {
    max-width: 780px;
    margin: 1rem auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
}

.chapter-header {
    max-width: 780px;
    margin: 1.25rem auto 0;
    padding-bottom: 1rem;
    text-align: center;
}

#published-work-title {
    display: block;
    text-align: left;
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.chapter-header {
    max-width: 780px;
    margin: 1.5rem auto 0;
    padding-bottom: 1rem;
    text-align: center;
}

#published-work-title {
    display: block;
    text-align: left;
    margin-bottom: 1rem;
    font-size: 1rem;
}

#published-chapter-heading {
    margin: 0 0 0.5rem;
    font-size: 2.2rem;
}

.chapter-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

#published-date {
    opacity: 0.7;
}

#edit-chapter-link {
    font-size: 0.9rem;
}

#published-notes:empty {
    display: none;
}

#published-chapter-text {
    max-width: 780px;
    margin: 0 auto;
    padding: 1.5rem 0 2rem;
    line-height: 1.8;
    font-size: 1.08rem;
    white-space: pre-wrap;
}

.chapter-navigation {
    max-width: 780px;
    margin: 2.5rem auto;
    padding-top: 1.25rem;
    border-top: 1px solid #aaa;

    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
}

.chapter-navigation a:nth-child(1) {
    justify-self: start;
}

.chapter-navigation a:nth-child(2) {
    justify-self: center;
}

.chapter-navigation a:nth-child(3) {
    justify-self: end;
}

@media (max-width: 700px) {
    #published-chapter-text {
        padding: 1.25rem;
    }

    .chapter-navigation {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .chapter-navigation a {
        justify-self: center !important;
    }
}
#published-chapter-text {
    border: none;
    background: transparent;
    padding: 1rem 0;
}
.chapter-navigation {
    max-width: 780px;
    margin: 2.5rem auto;
    padding-top: 1.25rem;
    border-top: 1px solid #aaa;

    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
}

.chapter-navigation a:nth-child(1) {
    justify-self: start;
}

.chapter-navigation a:nth-child(2) {
    justify-self: center;
}

.chapter-navigation a:nth-child(3) {
    justify-self: end;
}
.reader-controls {
    max-width: 700px;
    margin: 20px auto 35px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    font-size: 0.9rem;
}

.reader-controls button {
    padding: 6px 10px;
    border: 1px solid #aaa;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-family: inherit;
}

.reader-controls button:hover {
    border-color: #5f3b52;
}
/* Edit Chapter Page */

#edit-chapter-form {
    display: block;
}

#edit-chapter-form .form-section {
    margin-bottom: 1.5rem;
}

#edit-chapter-form .two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

#edit-chapter-form .form-field {
    display: block;
}

#edit-chapter-form input,
#edit-chapter-form textarea {
    width: 100%;
    box-sizing: border-box;
}

#edit-chapter-text {
    min-height: 420px;
}

#edit-chapter-notes {
    min-height: 120px;
}

#edit-chapter-form .form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

#edit-chapter-form .form-actions button {
    width: auto;
    min-width: 180px;
    padding: 0.9rem 1.25rem;
}

@media (max-width: 700px) {
    #edit-chapter-form .two-column {
        grid-template-columns: 1fr;
    }
}
#favorite-tags-shortcuts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 10px 0 14px;
}

#favorite-tags-shortcuts span {
    margin-right: 4px;
    font-weight: 600;
}

#favorite-tags-shortcuts button {
    padding: 5px 10px;
    border: 1px solid #8c8c8c;
    background: transparent;
    color: inherit;
    border-radius: 999px;
    font: inherit;
    cursor: pointer;
}

#favorite-tags-shortcuts button:hover {
    background: #e8e1d5;
}

#save-current-favorites {
    padding: 7px 12px;
    margin-bottom: 18px;
    font-size: 0.9rem;
}

#favorite-save-message {
    margin: -10px 0 14px;
    font-size: 0.9rem;
}
body.dark-mode .settings-box button {
    background: #3a3835;
    color: #f5efe4;
    border: 1px solid #68635c;
}

body.dark-mode .settings-box button:hover {
    background: #4a4742;
}

/* Chapter reader links - dark mode */
body.dark-mode .chapter-reader a {
    color: #e6a9c3;
}

body.dark-mode .chapter-reader a:visited {
    color: #e6a9c3;
}

body.dark-mode .chapter-reader a:hover {
    color: #f2c4d7;
}
/* Published chapter links - dark mode */
body.dark-mode main a {
    color: #e6a9c3;
}

body.dark-mode main a:visited {
    color: #e6a9c3;
}

body.dark-mode main a:hover {
    color: #f2c4d7;
}
/* LOGIN / ACCOUNT PAGES */

.account-box {
    max-width: 600px;
    margin: 3rem auto;
    padding: 2rem;
    border: 1px solid #b8b1a5;
}

.account-box h2 {
    margin-top: 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #b8b1a5;
}

.account-box form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.account-box label {
    font-weight: bold;
    margin-top: 0.75rem;
}

.account-box input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.8rem;
    font-size: 1rem;
}

.account-box form button {
    align-self: flex-start;
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
}

.account-switch {
    margin-top: 1.5rem;
}
/* DASHBOARD */

.dashboard-actions {
    margin: 1.25rem 0 2rem;
}

.dashboard-actions a {
    display: inline-block;
    padding: 0.65rem 1rem;
    border: 1px solid #8c857a;
    text-decoration: none;
    font-weight: 600;
}

.dashboard-work {
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    border: 1px solid #b8b1a5;
}

.dashboard-work h3 {
    margin-top: 0;
}

.work-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
}

.work-actions a {
    display: inline-block;
    padding: 0.55rem 0.9rem;
    border: 1px solid #8c857a;
    background: transparent;
    color: inherit;
    text-decoration: none;
}

.work-actions a:hover {
    background: #e8e1d5;
}

#logout-button {
    padding: 0.45rem 0.8rem;
    background: transparent;
    color: inherit;
    border: 1px solid #8c857a;
}
.work-likes {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

#like-work-button,
#report-work-button {
    padding: 3px 7px;
    border: 1px solid #aaa;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: normal;
    cursor: pointer;
}

#like-work-button:hover,
#report-work-button:hover {
    background: rgba(0, 0, 0, 0.06);
}
.edit-work-chapter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #ccc;
}

.edit-work-chapter-row span {
    font-size: 1.05rem;
}

.edit-work-chapter-button {
    padding: 6px 12px;
    background: transparent;
    color: inherit;
    border: 1px solid #aaa;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: normal;
}

.edit-work-chapter-button:hover {
    background: rgba(0, 0, 0, 0.06);
}

.edit-work-chapters > .button-link {
    display: inline-block;
    margin-top: 16px;
}
.browse-relationship-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    padding: 16px;
}

.browse-relationship-filter legend {
    padding: 0 6px;
}

.browse-relationship-filter label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    width: auto;
}

.browse-relationship-filter input[type="checkbox"] {
    width: auto;
    margin: 0;
}
.browse-quick-filter {
    margin-top: 8px;
    padding: 8px 10px;
}

.quick-filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
}
.quick-filter-options label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    margin: 0;
}

.quick-filter-options input[type="checkbox"] {
    width: auto;
    margin: 0;
}
.popular-tags {
    margin: 0px 0;
}

.popular-tags h3 {
    margin: 0 0 2px 0;
}

.popular-tag-list {
    display: flex;
    flex-wrap: wrap;
    column-gap: 10px;
    row-gap: 4px;
}
.popular-tag {
    width: auto;
    padding: 8px 14px;
    margin: 0 !important;
    border: 1px solid #aaa;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.popular-tag {
    width: auto;
    padding: 4px 8px;
    border: 1px solid #aaa;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.popular-tag:hover {
    border-color: currentColor;
}

.favorite-tags-browse h3 {
    margin-bottom: -20px;
}

.favorite-tags-browse {
    margin-top: 0;
}

#favorite-tags-list {
    margin-top: 0;
}

/* Tighter browse filter spacing */

.filters fieldset {
    border: 1px solid #aaa;
    padding: 12px 16px;
    margin: 12px 0 16px;
    min-width: 0;
}

.filters fieldset legend {
    padding: 0;
    margin-bottom: 8px;
    font-weight: bold;
}

.filters h3 {
    margin-top: 6px;
    margin-bottom: 8px;
}

.popular-tag-list {
    margin-top: 6px;
    margin-bottom: 12px;
}

#browse-favorite-tags {
    margin-top: -20px;
    margin-bottom: -20px;
}

.filter-note {
    margin-top: 4px;
    margin-bottom: 12px;
}
.favorite-tags-browse h3 {
    margin: 0 0 8px 0;
}

#browse-favorite-tags {
    margin-top: 0 !important;
}
.browse-work-type-filter,
.browse-status-filter,
.browse-rating-filter,
.browse-relationship-filter,
.browse-quick-filter {
    padding: 10px 14px;
    margin: 10px 0;
}

.browse-work-type-filter label,
.browse-status-filter label,
.browse-rating-filter label,
.browse-relationship-filter label,
.browse-quick-filter label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    margin: 4px 14px 4px 0;
}

#add-exclude-tag {
    margin-top: 4px;
    margin-bottom: 8px;
}
#exclude-tags {
    margin-bottom: 4px;
}

#add-exclude-tag {
    margin-top: 0;
    margin-bottom: 8px;
}

.saved-exclusions {
    margin-top: 0;
}

.tag-input-row {
    display: flex;
    gap: 6px;
    align-items: stretch;
}

.tag-input-row input {
    flex: 1;
    min-width: 0;
    margin: 0;
}

.tag-input-row button {
    width: auto;
    margin: 0;
    padding: 6px 14px;
    background: transparent;
    color: inherit;
    border: 1px solid #aaa;
    font: inherit;
    font-weight: bold;
    cursor: pointer;
}
.tag-helper {
    margin: 4px 0 8px;
    font-size: 0.9rem;
    opacity: 0.7;
}
#favorite-tags-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 12px;
    align-items: center;
}

#favorite-tags-shortcuts span {
    display: none;
}

#favorite-tags-shortcuts button {
    margin: 0;
}

.settings-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    margin-bottom: 16px;
}

.settings-tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid #aaa;
    border-radius: 999px;
    width: auto;
}

.settings-tag-pill button {
    background: none;
    border: none;
    padding: 0;
    margin-left: 4px;
    color: #555;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
}

.settings-tag-pill button:hover {
    color: #000;
}
/* Bookmark + Read Later */

.work-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.bookmark-browse-button,
.read-later-browse-button,
.read-later-result-button,
#bookmark-work-button,
#read-later-button {
    width: auto;
    margin: 0;
    padding: 6px 12px;

    background: transparent;
    color: inherit;

    border: 1px solid #999;
    border-radius: 6px;

    font: inherit;
    font-weight: normal;

    cursor: pointer;
}

.bookmark-browse-button:hover,
.read-later-browse-button:hover,
.read-later-result-button:hover,
#bookmark-work-button:hover,
#read-later-button:hover {
    background: rgba(0, 0, 0, 0.06);
}
#theme-toggle {
    background: transparent;
    color: inherit;
    border: 1px solid #999;
    border-radius: 6px;

    padding: 5px 10px;
    margin-left: 8px;

    font: inherit;
    font-weight: normal;

    cursor: pointer;
    width: auto;
}

#theme-toggle:hover {
    background: rgba(0, 0, 0, 0.06);
}
.delete-work-button {
    background: transparent;
    color: inherit;
    border: 1px solid #999;
    border-radius: 6px;
    padding: 6px 12px;
    font: inherit;
    font-weight: normal;
    cursor: pointer;
    width: auto;
}

.delete-work-button:hover {
    background: rgba(0, 0, 0, 0.06);
}
.work-meta {
    background: #fffdf8;
    border: 1px solid #c9c3b8;
    padding: 18px 22px;
    margin: 18px 0 24px;
}
.edit-work-chapter-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 90px 90px;
    gap: 12px;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #ccc;
}

.edit-work-chapter-button,
.delete-work-chapter-button {
    width: 90px;
    min-width: 90px;
    margin: 0;
    padding: 10px 8px;
    text-align: center;
}

.delete-work-chapter-button {
    background: transparent;
    color: inherit;
    border: 1px solid #999;
}
#delete-edit-chapter-button {
    margin-top: 24px;
    padding: 10px 16px;
    background: transparent;
    color: inherit;
    border: 1px solid #999;
    cursor: pointer;
}

#delete-edit-chapter-button:hover {
    border-color: #333;
}


#delete-edit-chapter-button {
    width: auto;
    min-width: 180px;
    padding: 10px 18px;
    margin-top: 14px;
    border-radius: 6px;
}
#save-chapter-changes {
    width: auto;
    min-width: 180px;
    padding: 10px 18px;
    margin: 0;
    border-radius: 6px;
}
/* Edit Chapter action buttons */
.new-chapter .form-actions {
    justify-content: center;
    align-items: center;
    gap: 14px;
}

.new-chapter .form-actions #save-chapter-changes,
.new-chapter .form-actions #delete-edit-chapter-button {
    width: 180px !important;
    min-width: 180px;
    max-width: 180px;
    flex: 0 0 auto;
    margin: 0;
}

.new-chapter .form-actions #save-chapter-changes {
    padding: 10px 18px;
    border-radius: 6px;
}

.new-chapter .form-actions #delete-edit-chapter-button {
    padding: 10px 18px;
    border-radius: 6px;
}
/* Edit Chapter actions */
#edit-chapter-form .form-actions {
    justify-content: center;
    gap: 14px;
}

#save-chapter-changes,
#delete-edit-chapter-button {
    width: 180px !important;
    min-width: 180px;
    max-width: 180px;
    margin: 0;
    padding: 10px 18px;
    border: 1px solid #999;
    border-radius: 6px;
    font: inherit;
    font-weight: normal;
    cursor: pointer;
}

/* Save is slightly emphasized */
#save-chapter-changes {
    background: #f3f0e8;
    color: inherit;
}

/* Delete stays quieter */
#delete-edit-chapter-button {
    background: transparent;
    color: inherit;
}

#save-chapter-changes:hover,
#delete-edit-chapter-button:hover {
    background: rgba(0, 0, 0, 0.06);
}
.visibility-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.visibility-option input {
    width: auto;
    margin: 4px 0 0;
    flex: 0 0 auto;
}

.visibility-option span {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.visibility-option small {
    font-size: 0.95em;
    font-weight: normal;
}

body.dark-mode button {
    background: #e8e3da;
    color: #222;
    border-color: #aaa;
}

body.dark-mode button:hover {
    background: #d6d0c6;
}
.selected-tag {
    display: inline-block;
    width: auto;
    min-width: 0;
    margin: 8px 6px 8px 0;
    padding: 8px 14px;
    border: 1px solid #aaa;
    border-radius: 20px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

#selected-include-tags,
#selected-exclude-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.site-footer {
    margin-top: 48px;
    padding: 24px;
    text-align: center;
    border-top: 1px solid #aaa;
}

.site-footer a {
    margin: 0 10px;
}
.recent-work-card .tags span {
    display: inline-block;
    margin: 4px 8px 4px 0;
    padding: 6px 10px;
    border: 1px solid #bbb;
    background: #f7f2f6;
}
.recent-work-card {
    padding: 28px;
    margin-bottom: 24px;
}

.recent-work-card h3 {
    margin-top: 0;
    margin-bottom: 18px;
    font-size: 2rem;
}

.recent-work-card > p {
    margin-bottom: 18px;
}

.recent-work-card .story-info {
    margin-top: 18px;
}

.work-meta-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 32px;
}

.work-meta-details p {
    margin: 0;
}

#like-work-button,
#bookmark-work-button,
#read-later-button,
#report-work-button {
    padding: 10px 16px;
    min-width: 120px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: normal;
}
body.dark-mode .work-meta {
    background: #252321;
    color: #eee8dc;
    border-color: #666;
}
body.dark-mode .tags span {
    background: #302d2a;
    color: #eee8dc;
    border-color: #666;
}
.dashboard-work-card {
    padding: 0.8rem 1rem;
    margin-bottom: 0.75rem;
}

.dashboard-work-card h3 {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
}

.dashboard-work-card p {
    margin: 0 0 0.45rem;
    line-height: 1.35;
}

.dashboard-work-card a {
    display: inline-block;
    margin-top: 0.15rem;
}