:root {
    color-scheme: light;
    --bg: #f7f8f4;
    --panel: #ffffff;
    --line: #dde4d7;
    --line-strong: #c6d0bf;
    --ink: #223024;
    --muted: #617063;
    --accent: #2f6b47;
    --accent-soft: #edf5ef;
    --warn: #9a4b34;
    --warn-soft: #fff0ea;
}

* {
    box-sizing: border-box;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
textarea,
select {
    font: inherit;
}

body {
    margin: 0;
    font-family: "Noto Serif SC", "Source Han Serif SC", "PingFang SC", serif;
    color: var(--ink);
    background: linear-gradient(180deg, #fbfcf8 0%, var(--bg) 100%);
}

.page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 18px 48px;
}

.hero {
    padding: 24px 26px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 12px 28px rgba(34, 48, 36, 0.05);
}

.hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.hero h1 {
    margin: 0;
    font-size: 32px;
    letter-spacing: 0.02em;
}

.hero-search {
    margin-top: 18px;
    display: grid;
    gap: 10px;
}

.account-corner {
    margin-left: auto;
    width: min(360px, 100%);
    flex: 0 0 auto;
}

.account-shell {
    position: relative;
}

.account-shell summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 210px;
    margin-left: auto;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #f9fbf7;
}

.account-shell summary::-webkit-details-marker,
.fold-summary::-webkit-details-marker,
.title-summary::-webkit-details-marker,
.composer-shell summary::-webkit-details-marker {
    display: none;
}

.account-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.account-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--accent);
}

.account-dot.reader {
    background: #6e7f93;
}

.account-dot.guest {
    background: #9a4b34;
}

.account-label {
    font-size: 14px;
    font-weight: 700;
}

.account-summary-meta {
    color: var(--muted);
    font-size: 13px;
}

.account-popover {
    margin-top: 10px;
    margin-left: auto;
    width: min(360px, 100%);
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
    box-shadow: 0 14px 28px rgba(34, 48, 36, 0.08);
}

.account-stack,
.account-grid,
.audit-log,
.hero-search {
    display: grid;
    gap: 10px;
}

.account-section {
    display: grid;
    gap: 10px;
}

.account-section + .account-section {
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.account-section h3,
.panel h2,
.panel h3 {
    margin-top: 0;
}

.account-section h3 {
    font-size: 15px;
}

.account-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.account-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fcfefb;
}

.account-row strong,
.audit-entry strong {
    display: block;
    font-size: 14px;
}

.account-row span,
.audit-meta {
    color: var(--muted);
    font-size: 13px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
}

.status-pill.off {
    background: #fff0ea;
    color: var(--warn);
}

.admin-panel {
    margin-top: 18px;
}

.audit-entry {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fcfefb;
    padding: 12px 14px;
.composer-body {
    display: none;
    grid-column: 1 / -1;
    justify-self: stretch;
    align-self: stretch;
    padding-top: 10px;
    width: 100%;
}
}


.audit-entry strong {
    margin-bottom: 6px;
}

.audit-meta {
    line-height: 1.6;
}

.search-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(108px, 0.72fr)) minmax(260px, 1.8fr);
    gap: 8px;
    align-items: center;
    height: 58px;
    width: 100%;
    margin: 0;
}

.hero-search {
    min-width: 0;
    display: grid;
    gap: 10px;
}

.search-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
}

.search-form {
    grid-column: 1;
}

.search-form .field {
    margin: 0;
}

.search-form input,
.search-form select {
    height: 58px;
}

.search-query-field {
    position: relative;
}

.search-query-field input {
    padding-right: 42px;
}

.search-clear {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    text-decoration: none;
}

.search-clear:hover {
    background: var(--accent-soft);
    text-decoration: none;
}

.layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 22px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 8px 22px rgba(34, 48, 36, 0.04);
}

.flash {
    padding: 12px 14px;
    border-radius: 14px;
    margin: 18px 0 0;
}

.flash-success {
    border: 1px solid var(--line);
    background: var(--accent-soft);
}

.flash-error {
    border: 1px solid #cb7b5a;
    background: var(--warn-soft);
    color: var(--warn);
}

.blog-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.blog-tab {
    padding: 9px 14px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--ink);
    border: 1px solid transparent;
}

.blog-tab-active {
    background: #f6faf5;
    border-color: var(--line);
    font-weight: 700;
}

.muted {
    color: var(--muted);
}

.tree-board {
    padding: 8px 0 0;
}

.fold-group {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fcfefb;
    overflow: hidden;
}

.fold-group + .fold-group {
    margin-top: 12px;
}

.fold-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 600;
    text-align: left;
}

.fold-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}

.fold-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 7px 10px;
    border-radius: 999px;
    background: #e3eef8;
    color: #245a92;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    flex: 0 0 auto;
}

.fold-meta {
    color: var(--muted);
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
}

.fold-stats {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    font-size: 14px;
    font-weight: 700;
}

.stat-posts {
    color: #245a92;
}

.stat-divider {
    color: var(--line-strong);
}

.stat-words {
    color: var(--accent);
}

.fold-content {
    padding: 0 16px 14px;
}

.title-detail {
    border-top: 1px solid var(--line);
}

.title-detail:first-child {
    border-top: none;
}

.title-summary {
    list-style: none;
    padding: 12px 0;
    cursor: pointer;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: baseline;
}

.title-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
}

.title-summary strong {
    font-size: 16px;
}

.post-summary-stats {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 700;
}

.post-rank {
    color: #9a4b34;
}

.post-words {
    color: var(--accent);
}

.post-shell {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fbfdf9;
    padding: 18px;
    margin-bottom: 8px;
}

.post-shell.is-editing .post-view {
    display: none;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--muted);
    margin-bottom: 16px;
}

.post-content {
    white-space: pre-wrap;
    line-height: 1.95;
    font-size: 18px;
}

.post-content-centered {
    text-align: center;
}

.post-footer {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.post-date {
    color: var(--muted);
    font-size: 14px;
    text-align: right;
}

.post-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.action-button,
.action-link {
    padding: 9px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--accent-soft);
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
}

.danger-button {
    background: #fff6f1;
    border-color: #dfb7aa;
    color: var(--warn);
}

.editor {
    display: none;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.editor.is-open {
    display: block;
}

.editor-form {
    display: grid;
    gap: 12px;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.composer-primary-fields {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr);
    align-items: start;
}

.composer-date-fields {
    grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
}

.composer-date-fields > .field {
    min-width: 0;
    width: 100%;
}

.composer-date-fields input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.field span {
    color: var(--muted);
    font-size: 14px;
}

.field input,
.field textarea,
.field select {
    min-width: 0;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
}

.field-grid > * {
    min-width: 0;
}

input[type="datetime-local"] {
    min-width: 0;
}

.field textarea {
    min-height: 220px;
    resize: vertical;
}

.editor-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    margin-top: 14px;
    align-items: center;
}

.composer-shell {
    display: contents;
    min-width: 0;
    width: 100%;
    margin: 0;
}

.composer-trigger {
    grid-column: 2;
    justify-self: end;
    width: min(320px, 100%);
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
    box-shadow: 0 8px 22px rgba(34, 48, 36, 0.04);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    height: 58px;
    padding: 12px 16px;
}

.composer-summary-main {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.composer-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 24px;
    line-height: 1;
}

.composer-title {
    font-size: 18px;
    font-weight: 700;
}

.composer-shell.is-open .composer-toggle {
    transform: rotate(45deg);
}

.composer-body {
    display: none;
    grid-column: 1 / -1;
    justify-self: stretch;
    align-self: stretch;
    padding-top: 10px;
    width: 100%;
}

.composer-shell.is-open .composer-body {
    display: block;
}

.composer-panel {
    max-width: none;
    margin: 0;
    min-width: 0;
    width: 100%;
    box-shadow: 0 20px 44px rgba(34, 48, 36, 0.14);
}

.composer-grid {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.composer-stats,
.composer-summary-stats {
    justify-content: flex-end;
}

.auth-form {
    display: grid;
    gap: 12px;
}

.auth-status {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
}

.empty {
    color: var(--muted);
    padding: 8px 0 4px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.toolbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

@media (max-width: 900px) {
    .account-shell {
        width: 180px;
    }

    .search-toolbar {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .composer-shell {
        grid-template-columns: 1fr;
    }

    .composer-trigger {
        grid-column: 1;
        justify-self: stretch;
        width: 100%;
    }

    .hero-top {
        flex-wrap: wrap;
        align-items: stretch;
    }

    .account-corner {
        flex: 0 1 180px;
        width: 180px;
        max-width: 180px;
        min-width: 0;
        margin-right: 0;
    }

    .account-popover {
        width: 180px;
        max-width: 180px;
    }

    .account-shell summary {
        min-width: 0;
        width: 180px;
        margin-left: 0;
        justify-content: center;
    }

    .search-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .composer-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) and (orientation: portrait) {
    .page {
        padding: 20px 14px 40px;
    }

    .hero {
        padding: 18px 12px;
    }

    .hero h1 {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 24px;
    }

    .hero-top {
        flex-wrap: nowrap;
        align-items: center;
        gap: 8px;
    }

    .account-corner {
        flex: 0 1 180px;
        width: 180px;
        max-width: 180px;
        min-width: 0;
        margin-right: 0;
    }

    .account-shell summary {
        gap: 8px;
        justify-content: center;
        padding: 8px 10px;
        border-radius: 14px;
    }

    .account-badge {
        gap: 6px;
    }

    .account-label {
        font-size: 13px;
    }

    .account-summary-meta {
        font-size: 12px;
    }

    .account-popover {
        margin-top: 8px;
        margin-left: 0;
        width: 180px;
        max-width: 180px;
        padding: 12px;
        border-radius: 14px;
    }

    .account-section {
        gap: 8px;
    }

    .account-links {
        gap: 8px;
    }

    .field-grid {
        grid-template-columns: 1fr;
    }

    .composer-primary-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .composer-primary-fields .composer-date-fields {
        grid-column: 1 / -1;
        width: 100%;
    }

    .composer-panel .field {
        width: 100%;
        overflow: hidden;
    }

    .composer-date-fields {
        grid-template-columns: minmax(0, calc(60% - 6px)) minmax(0, calc(40% - 6px));
        justify-content: space-between;
    }

    .composer-date-fields input {
        font-size: 14px;
    }

    .composer-panel .composer-time-input {
        width: 100%;
        max-width: 100%;
        letter-spacing: 0.04em;
    }

    .search-form {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        height: auto;
    }

    .search-query-field {
        grid-column: 1 / -1;
    }

    .fold-summary,
    .title-summary {
        align-items: center;
        flex-direction: row;
    }

    .fold-meta {
        white-space: normal;
    }

    .post-content {
        font-size: 17px;
    }

    .composer-trigger {
        padding: 14px 16px;
    }

    .composer-body {
        padding-top: 10px;
    }
}