/* =========================================================
   Our Whimsy
   彩色蜡笔 · 手绘风格
   整理版：保留原始布局，合并重复样式
   ========================================================= */


/* ==================== 1. 全局基础 ==================== */

:root {
    --ink: #433b36;
    --muted: #887e75;
    --paper: #fffdf7;
    --pink: #ffd9df;
    --yellow: #ffe69a;
    --blue: #d8edff;
    --green: #dff2cf;
    --line: #eadfce;

    --orange: #e98b60;
    --shadow: 4px 4px #e8dfd1;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background:
        #fffaf0
        radial-gradient(#e8d8bf .7px, transparent .7px);
    background-size: 18px 18px;

    color: var(--ink);
    font-family:
        ui-rounded,
        "Trebuchet MS",
        "Microsoft YaHei",
        sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
    color: var(--ink);
    font-weight: 800;
}

img {
    max-width: 100%;
}

.wrap {
    width: min(1120px, calc(100% - 32px));
    margin: auto;
}

[hidden] {
    display: none !important;
}

::selection {
    background: var(--yellow);
    color: var(--ink);
}

:focus-visible {
    outline: 3px dashed #e79a61;
    outline-offset: 3px;
}


/* ==================== 2. 消息提示 ==================== */

.flash-stack {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    width: min(520px, 95%);
}

.flash {
    background: white;
    border: 1.5px dashed var(--ink);
    padding: 12px;
    border-radius: 13px;
    margin: 6px;
    box-shadow: 3px 3px #eadfce;
}

.flash.error {
    background: #ffe1e1;
}

.flash.success {
    background: #e3f4d6;
}


/* ==================== 3. 导航栏 ==================== */

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
}

.brand {
    font-size: 24px;
    font-weight: 1000;
}

.brand:first-letter {
    color: #ed8e58;
}

.nav a {
    transition: color .16s ease, transform .16s ease;
}

.nav a:hover {
    color: var(--orange);
}

.pill,
.small-btn {
    display: inline-block;
    background: white;
    border: 1.5px solid var(--ink);
    border-radius: 11px;
    padding: 8px 12px;
    font-size: 13px;
}

.inline {
    display: inline;
}

.inline button {
    margin-left: 5px;
}


/* ==================== 4. 登录页面 ==================== */

.login-screen {
    min-height: 85vh;
    display: grid;
    place-items: center;
    padding: 22px;
}

.login-card {
    width: min(430px, 100%);
    text-align: center;
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 28px;
    padding: 32px;
    box-shadow: 8px 8px #f3c6a5;
}

.logo {
    font-size: 58px;
    color: #e98b60;
}

.login-card i {
    color: #e98b60;
}

.login-card h1 {
    font-size: 38px;
    margin: 10px;
}

.login-card p {
    color: var(--muted);
    line-height: 1.7;
}

.login-card form {
    display: grid;
    gap: 12px;
    margin: 22px 0;
}

.login-card small {
    color: var(--muted);
}


/* ==================== 5. 输入框与按钮 ==================== */

.field,
textarea {
    border: 1.5px solid var(--ink);
    border-radius: 12px;
    padding: 12px;
    background: white;
    width: 100%;
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #d98c65;
    box-shadow: 0 0 0 3px rgba(255, 230, 154, .58);
    outline: none;
}

.primary {
    display: inline-block;
    background: var(--yellow);
    border: 1.7px solid var(--ink);
    border-radius: 13px;
    padding: 11px 16px;
    box-shadow: 3px 3px var(--ink);
    font-weight: 800;
    color: var(--ink);
    cursor: pointer;
}

.primary:hover {
    background: #ffdda0;
}

button,
.primary,
.pill,
.small-btn,
.download {
    transition:
        transform .16s ease,
        box-shadow .16s ease,
        background-color .16s ease,
        border-color .16s ease;
}

.primary:hover,
.pill:hover,
.small-btn:hover,
.download:hover {
    transform: translateY(-2px) rotate(-.4deg);
    box-shadow: 3px 4px 0 rgba(67, 59, 54, .22);
}

.primary:active,
.pill:active,
.small-btn:active,
.download:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 rgba(67, 59, 54, .2);
}


/* ==================== 6. 首页 Hero ==================== */

.hero {
    margin: 14px 0 32px;
    border: 2px solid var(--ink);
    border-radius: 28px;
    overflow: hidden;

    background: linear-gradient(
        120deg,
        #fff0d1,
        #ffe0e8,
        #dff0ff
    );

    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;

    box-shadow: 6px 6px #e8c9a7;
}

.hero > div:first-child {
    padding: 36px;
}

.hero h1 {
    font-size: clamp(40px, 5vw, 62px);
    line-height: 1;
    margin: 18px 0;
}

.hero h1 i {
    font-family: Georgia, serif;
    color: #e47f4e;
}

.hero p {
    line-height: 1.8;
    color: #685e55;
}

.hero-photo {
    padding: 24px;
}

.hero-photo img {
    width: 100%;
    height: 235px;
    object-fit: cover;
    border: 2px solid var(--ink);
    border-radius: 18px;
    box-shadow: 6px 6px white;
}

.placeholder {
    height: 235px;
    display: grid;
    place-items: center;
    text-align: center;
    background: #fffdf7;
    border: 2px dashed var(--ink);
    border-radius: 18px;
    font-size: 27px;
}

.caption {
    grid-column: 1 / -1;
    background: #fffdf7;
    border-top: 1px dashed #cdbda9;
    padding: 12px 22px;
}


/* ==================== 7. 标题 ==================== */

.wrap > h2 {
    margin: 32px 0 12px;
}

.wrap > h2 i {
    font: italic 16px Georgia;
    color: #df8755;
}

.wrap > h2,
.panel h2,
.editor-panel h1,
.detail-panel h1 {
    text-decoration: underline;
    text-decoration-color: #f0c66f;
    text-decoration-thickness: 3px;
    text-underline-offset: 6px;
    text-decoration-skip-ink: none;
}


/* ==================== 8. Gallery 图片轮播 ==================== */

.gallery,
.panel {
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 22px;
    padding: 18px;
    box-shadow: 4px 4px #e8dfd1;
}

.slide {
    display: none;
    position: relative;
    height: 310px;
    background: #f4e9dd;
    border-radius: 14px;
    overflow: hidden;
}

.slide.active {
    display: block;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.slide b {
    position: absolute;
    left: 12px;
    bottom: 12px;
    background: #fffdf0;
    padding: 9px 13px;
    border: 1px solid var(--ink);
    border-radius: 10px;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
}

.controls button {
    background: white;
    border: 1px solid var(--ink);
    border-radius: 10px;
    padding: 8px;
}

.empty {
    color: var(--muted);
    text-align: center;
    padding: 22px;
    border: 1.5px dashed #e3d4c0;
    border-radius: 14px;
    background: rgba(255, 250, 240, .72);
    line-height: 1.8;
}


/* ==================== 9. 双栏与面板 ==================== */

.columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin: 20px 0;
}

.panel h2 {
    margin: 0 0 6px;
}

.panel > p {
    font-size: 13px;
    color: var(--muted);
}


/* ==================== 10. 文件列表 ==================== */

.file {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1.5px dashed #e2d5c4;
    background: white;
    border-radius: 12px;
    padding: 10px;
    margin-top: 9px;

    transition: transform .16s ease, box-shadow .16s ease;
}

.file:hover {
    transform: translateY(-2px);
    box-shadow: 3px 4px 0 #f0e5d6;
}

.file div {
    flex: 1;
    min-width: 0;
}

.file small {
    display: block;
    color: var(--muted);
    font-size: 11px;
}


/* ==================== 11. 评论区 ==================== */

.comments {
    max-height: 340px;
    overflow: auto;
}

.comment {
    display: flex;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px dashed var(--line);
}

.avatar {
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 50%;
    background: var(--pink);
    display: grid;
    place-items: center;
}

.comment > div {
    min-width: 0;
    overflow-wrap: anywhere;
}

.comment small {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.comment p {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.comment-img {
    max-width: min(100%, 300px);
    max-height: 240px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--line);
    padding: 4px;
    background: #fffefa;
    box-shadow: 2px 3px 0 #eadfce;
}

.comment-form {
    display: grid;
    gap: 9px;
    margin-top: 12px;
}

.comments::-webkit-scrollbar {
    width: 8px;
}

.comments::-webkit-scrollbar-thumb {
    border: 2px solid #fffdf7;
    border-radius: 99px;
    background: #dfc9aa;
}

.comments::-webkit-scrollbar-track {
    background: transparent;
}


/* ==================== 12. 上传控件 ==================== */

.upload-label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    padding: 10px 12px;
    border: 1.5px dashed #d4bda0;
    border-radius: 13px;
    background: #fffaf0;
}

.upload-label input {
    display: block;
    width: 100%;
    margin-top: 8px;
}

input[type="file"] {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 9px;
    border: 1.5px dashed #c9b59c;
    border-radius: 13px;
    background: #fffaf0;
    color: #76685b;
    font-size: 13px;
}

input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 8px 12px;
    border: 1.5px solid var(--ink);
    border-radius: 10px;
    background: var(--yellow);
    color: var(--ink);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 2px 2px 0 #d8c6a9;
}

input[type="file"][hidden],
.editor-shell input[type="file"][hidden] {
    display: none !important;
}


/* ==================== 13. 文章列表 ==================== */

.post-list {
    display: grid;
    gap: 11px;
    margin-top: 14px;
}

.post-card {
    display: block;
    background: white;
    border: 1.5px dashed var(--line);
    border-radius: 13px;
    padding: 13px 15px;
    font-weight: 800;
    line-height: 1.55;
    overflow-wrap: anywhere;
    box-shadow: 2px 2px #f0e5d6;

    transition: transform .16s ease, box-shadow .16s ease;
}

.post-card:nth-child(3n + 1) {
    background: #fff8dc;
}

.post-card:nth-child(3n + 2) {
    background: #f0f8e9;
}

.post-card:nth-child(3n) {
    background: #fff0f1;
}

.post-card:hover {
    background: #fff3d2;
    transform: translateY(-2px) rotate(-.35deg);
    box-shadow: 4px 5px 0 #eadfce;
}


/* ==================== 14. 文章编辑与详情页面 ==================== */

.editor-page,
.detail-page {
    padding: 25px 0 45px;
}

.back {
    display: inline-block;
    margin: 0 0 15px;
    color: #8d725c;
}

.editor-panel,
.detail-panel {
    padding: clamp(18px, 4vw, 34px);
}

.editor-panel h1,
.detail-panel h1 {
    font-size: clamp(28px, 4vw, 40px);
    margin: 10px 0 22px;
}


/* 仅编辑器标签使用，不影响普通面板标签 */

.editor-panel label {
    display: block;
    font-weight: 800;
    margin: 14px 0 7px;
}


/* ==================== 15. 编辑器外框 ==================== */

.editor-shell {
    margin-top: 10px;
    overflow: hidden;
    border: 2px solid var(--ink);
    border-radius: 18px;
    background: #fffefa;
    box-shadow: 4px 4px #eadfce;
}


/* ==================== 16. 工具栏 ==================== */

/*
   兼容旧版 .toolbar 和新版 .editor-toolbar。
   两者共享基础样式，但不强制改变 HTML 结构。
*/

.toolbar,
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 9px;
    background: #fff8e9;
    border: 1.5px dashed #d5c3aa;
    border-radius: 12px;
    margin: 9px 0;
}

.editor-toolbar {
    gap: 9px;
    padding: 12px;
    background: linear-gradient(
        120deg,
        #fff2d8,
        #ffe9ed,
        #e8f4ff
    );
    border: 0;
    border-bottom: 1.5px dashed #cdbda9;
    border-radius: 0;
    margin: 0;
}

.toolbar-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
}

.toolbar button,
.toolbar select,
.editor-toolbar button,
.editor-toolbar select,
.toolbar-group button,
.toolbar-group select {
    border: 1.3px solid #c9bba9;
    border-radius: 8px;
    background: white;
    padding: 7px 10px;
    color: var(--ink);
    font-size: 13px;
    box-shadow: 1px 2px #eadfce;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.toolbar button:hover,
.editor-toolbar button:hover,
.toolbar-group button:hover {
    background: #fff0c6;
    transform: translateY(-2px) rotate(-.5deg);
    box-shadow: 3px 3px #eadfce;
}

.toolbar button:active,
.editor-toolbar button:active,
.toolbar-group button:active {
    transform: translateY(1px);
    box-shadow: none;
}

.toolbar input,
.editor-toolbar input {
    width: 35px;
    height: 34px;
    border: 0;
    background: transparent;
}

.toolbar-divider {
    width: 1px;
    height: 25px;
    background: #d9cbb7;
}


/* ==================== 17. 颜色选择工具 ==================== */

/*
   注意：这里不能把所有 label 都设成 flex。
   只对编辑器中的颜色工具生效，避免影响其他表单。
*/

.editor-toolbar .color-tool,
.toolbar .color-tool,
.color-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: auto;
    height: 34px;
    margin: 0;
    padding: 4px;
    border: 1.4px solid #b9a995;
    border-radius: 9px;
    background: white;
    cursor: pointer;
}

.color-tool span {
    font-weight: 1000;
    text-decoration: underline;
    text-decoration-color: #ed8e58;
    text-decoration-thickness: 3px;
}

.color-tool input {
    width: 19px !important;
    height: 22px !important;
    padding: 0;
    border: 0 !important;
    background: transparent !important;
    cursor: pointer;
}


/* ==================== 18. 富文本编辑区域 ==================== */

.rich-editor {
    min-height: 390px;
    padding: 22px;
    border: 1.5px solid var(--ink);
    border-radius: 13px;
    outline: none;

    background-color: #fffefa;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 31px,
        rgba(220, 205, 181, .18) 32px
    );

    color: var(--ink);
    font-size: 16px;
    line-height: 2;
    overflow-wrap: anywhere;
}

.editor-shell .rich-editor {
    border: 0;
    border-radius: 0;
    min-height: 390px;
}

.rich-editor:focus {
    box-shadow: inset 0 0 0 2px rgba(255, 230, 154, .4);
}

.rich-editor:empty::before {
    content: attr(data-placeholder);
    color: #b4a99b;
    pointer-events: none;
}

.rich-editor p {
    margin: 0 0 12px;
}

.rich-editor h2 {
    margin: 22px 0 12px;
    font-size: 27px;
}

.rich-editor h3 {
    margin: 18px 0 10px;
    font-size: 21px;
}

.rich-editor blockquote {
    border-left: 5px solid #e99b68;
    padding: 12px 17px;
    margin: 15px 0;
    background: #fff3df;
    color: #756052;
    border-radius: 0 12px 12px 0;
}

.rich-editor ul,
.rich-editor ol {
    padding-left: 28px;
}

.rich-editor a {
    color: #3479bd;
    text-decoration: underline;
}


/* ==================== 19. 编辑器图片 ==================== */

.rich-editor img {
    display: block;
    max-width: 100%;
    height: auto;
    max-height: 720px;
    object-fit: contain;

    margin: 15px auto;
    padding: 5px;

    border: 1.5px solid #d9cbb7;
    border-radius: 12px;
    background: white;
    box-shadow: 3px 3px #eadfce;
}

.rich-editor img.rich-inserted-image {
    max-width: 100%;
    height: auto;
    max-height: 720px;
    object-fit: contain;
    cursor: pointer;
}

.rich-editor img.rich-inserted-image:hover {
    outline: 2px dashed #e9a64b;
    outline-offset: 4px;
}

.rich-editor img.rich-inserted-image.image-selected {
    outline: 2px dashed #e9a64b;
    outline-offset: 4px;
}


/* ==================== 20. 编辑器底部 ==================== */

.editor-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 15px;
    border-top: 1px dashed #e5d9c7;
    background: #fff9ed;
    color: #9b8d7e;
    font-size: 12px;
}

.editor-status {
    min-height: 20px;
    margin-top: 9px;
    color: #8d725c;
    font-size: 12px;
}

.editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    margin-top: 18px;
}


/* ==================== 21. 图片宽度选择器 ==================== */

#imageWidth {
    width: auto;
    max-width: 140px;
    border: 2px solid #e8d6ad;
    border-radius: 10px;
    padding: 6px 9px;
    background: #fffdf7;
    color: #51463b;
    font-family: inherit;
}


/* ==================== 22. 文章详情正文 ==================== */

.detail-meta {
    color: var(--muted);
    font-size: 13px;
    border-bottom: 1px dashed var(--line);
    padding-bottom: 16px;
}

.rich-content {
    font-size: 16px;
    line-height: 1.85;
    overflow-wrap: anywhere;
    padding: 20px 0 30px;
}

.rich-content h2 {
    margin: 24px 0 12px;
    font-size: 27px;
}

.rich-content h3 {
    margin: 20px 0 10px;
    font-size: 21px;
}

.rich-content h4 {
    font-size: 18px;
}

.rich-content p {
    margin: 0 0 14px;
}

.rich-content a {
    color: #3479bd;
    text-decoration: underline;
}

.rich-content blockquote {
    border-left: 4px solid #e99b68;
    padding: 8px 15px;
    margin: 12px 0;
    background: #fff5e7;
    color: #69594d;
}

.rich-content img {
    display: block;
    max-width: 100%;
    height: auto;
    max-height: 720px;
    object-fit: contain;

    margin: 16px auto;
    padding: 5px;

    border: 1.5px solid #e1d2bd;
    border-radius: 13px;
    background: white;
    box-shadow: 3px 3px #eadfce;
}

.rich-content ul,
.rich-content ol {
    padding-left: 28px;
}

.rich-content hr {
    border: 0;
    border-top: 2px dashed #d9cbb7;
    margin: 20px 0;
}


/* ==================== 23. 后台管理 ==================== */

.admin-panel {
    margin: 18px 0;
}

.admin-panel form {
    display: grid;
    gap: 10px;
}

.admin-panel label {
    font-weight: 700;
}

.admin-panel .primary {
    justify-self: start;
}


/* ==================== 24. 页脚 ==================== */

footer {
    text-align: center;
    color: #9b8d7e;
    font-size: 12px;
    padding: 20px;
}


/* ==================== 25. 小屏幕适配 ==================== */

@media (max-width: 720px) {

    .hero {
        grid-template-columns: 1fr;
    }

    .hero > div:first-child {
        padding: 25px;
    }

    .hero-photo {
        padding: 0 22px 20px;
    }

    .hero-photo img,
    .placeholder {
        height: 190px;
    }

    .columns {
        grid-template-columns: 1fr;
    }

    .nav {
        align-items: flex-start;
        gap: 8px;
    }

    .slide {
        height: 230px;
    }

    .panel {
        min-width: 0;
    }

    input[type="file"] {
        font-size: 12px;
    }

    input[type="file"]::file-selector-button {
        padding: 7px 9px;
    }

    .comment-form {
        flex-wrap: wrap;
    }

    .comment-form button {
        min-height: 42px;
    }

    .editor-actions {
        flex-wrap: wrap;
    }

    .editor-toolbar {
        gap: 7px;
        padding: 9px;
    }

    .toolbar-divider {
        display: none;
    }

    .toolbar-group {
        gap: 4px;
    }

    .toolbar-group button,
    .toolbar-group select {
        padding: 6px 8px;
        font-size: 12px;
    }

    .rich-editor,
    .editor-shell .rich-editor {
        min-height: 330px;
        padding: 15px;
    }

    .editor-footer {
        flex-wrap: wrap;
    }
}