:root {
    /* 方案 A: 暖阳微醺 (Warm & Healing) - 极淡的奶油色向暖粉色过渡 */
    --bg-body: linear-gradient(135deg, #fffbf0 0%, #fff0f3 100%);

    /* 固定文字颜色配置 (默认：焦糖拿铁) */
    --color-header: #795548;
    /* 中咖色(加深) - 用于称呼 */
    --color-body: #3e2723;
    /* 深黑巧 - 用于正文 */
    --color-footer: #bf360c;
    /* 红丝绒 - 用于落款 */

    --font-main: 'Noto Serif SC', serif;
    --font-sign: 'Ma Shan Zheng', cursive;
    --font-content: 'Noto Serif SC', serif;
    /* 默认正文字体，可通过JS动态更改 */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-body);
    min-height: 100vh;
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 100px;
    color: #333;
}

main {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- 控制面板 --- */
.config-panel {
    width: 95%;
    max-width: 1100px;
    background: #fff;
    margin: 10px 0px 5px 0px;
    padding: 25px 25px 15px 25px;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    gap: 20px;
    border: 1px solid #f0f0f0;
}

.panel-title {
    font-size: 1.2rem;
    color: #333;
    font-weight: 700;
    border-bottom: 2px solid #fef0f0;
    padding-bottom: 15px;
    margin-bottom: 5px;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 0.9rem;
    font-weight: bold;
    color: #555;
    display: flex;
    justify-content: space-between;
}

.hint {
    font-weight: normal;
    color: #999;
    font-size: 0.8rem;
}

.bg-mode-selector {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
}

.radio-input {
    margin-right: 8px;
    width: auto;
}

.control-section {
    display: none;
    margin-bottom: 15px;
}

.control-label {
    font-size: 0.9rem;
    font-weight: bold;
    color: #555;
    margin-bottom: 8px;
    display: block;
}

.styled-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fafafa;
    outline: none;
}

.opacity-section {
    display: none;
    margin-top: 15px;
}

.file-input-wrapper {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.file-input-area {
    flex: 1;
}

.file-input {
    width: 100%;
    padding: 10px;
    border: 2px dashed #ff9a9e;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
}

.file-hint {
    font-size: 0.75rem;
    color: #999;
    margin-top: 5px;
}

.image-preview-box {
    width: 80px;
    height: 80px;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    background: #f9f9f9;
    display: none;
}

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

.toggle-btn-container {
    text-align: center;
    margin: 10px 0;
}

.toggle-btn {
    font-size: 0.9rem;
    padding: 8px 20px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
}

.advanced-settings {
    display: none;
    animation: fadeIn 0.3s ease;
}

.opacity-slider {
    width: 100%;
    cursor: pointer;
}



/* 文本域样式 */
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    background: #fafafa;
    outline: none;
    transition: all 0.3s;
}

textarea:focus {
    border-color: #ff9a9e;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 154, 158, 0.1);
}

/* 设置不同高度 */
.area-short {
    height: 90px;
}

.area-long {
    height: 90px;
}

/* 选择框样式 */
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #fafafa;
    outline: none;
    cursor: pointer;
    transition: all 0.3s;
}

select:focus {
    border-color: #ff9a9e;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 154, 158, 0.1);
}

.password-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #fafafa;
    outline: none;
    transition: all 0.3s;
    font-family: monospace;
    /* 方便查看密码 */
}

.password-input:focus {
    border-color: #ff9a9e;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 154, 158, 0.1);
}

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /*margin-top: 10px;*/
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.btn-preview {
    background: #fff;
    border: 1px solid #ddd;
    color: #555;
}

.btn-download {
    background: linear-gradient(45deg, #ff9a9e, #fad0c4);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 进度条 */
.progress-area {
    display: none;
    margin-top: 15px;
}

.progress-bar {
    height: 6px;
    background: linear-gradient(90deg, #ff9a9e, #fbc2eb);
    width: 0%;
    border-radius: 3px;
    transition: width 0.2s;
}

.status-text {
    font-size: 12px;
    color: #888;
    text-align: right;
    margin-top: 5px;
}

/* --- 预览网格 --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    width: 95%;
    max-width: 1100px;
}

/* --- 卡片核心样式 (3:4) --- */
.note-card {
    width: 100%;
    aspect-ratio: 3 / 4;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* 新增内容容器，负责内边距 */
.note-content-wrapper {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    padding: 46px 35px 40px;
    display: flex;
    flex-direction: column;
}

/* 纸张噪点 - 增加高级感 */
.note-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
}

.card-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px dashed rgba(160, 82, 45, 0.2);
    /* 虚线分割 */
    padding-bottom: 15px;
}

.header-to {
    font-family: var(--font-content);
    font-size: 26px;
    font-weight: 700;
    color: var(--color-header);
    /* 暖焦糖色 */
    letter-spacing: 0.5px;
}

.header-no {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.2);
    margin-top: 2px;
}

.card-body {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
    /* 移除 overflow: hidden 以显示顶部引号 */
    /* overflow: hidden; */
    /* 恢复：限制中间内容高度，防止挤走 footer */
    min-height: 0;
    /* 保持，允许 flex 子项收缩 */
}

.content-text {
    font-family: var(--font-content);
    font-size: 26px;
    line-height: 1.5;
    color: var(--color-body);
    text-align: left;
    white-space: pre-wrap;
    width: 100%;
    z-index: 2;
}

/* 装饰引号 */
.quote-mark {
    position: absolute;
    font-family: "Times New Roman", serif;
    font-size: 80px;
    color: rgba(255, 255, 255, 0.6);
    /* 半透明白色，融入背景 */
    top: -30px;
    left: -20px;
    z-index: 1;
}

.card-footer {
    margin-top: 17px;
    text-align: right;
}

.sign-text {
    font-family: var(--font-content);
    font-size: 26px;
    color: var(--color-footer);
    /* 暖红色 */
    transform: rotate(-3deg);
    display: inline-block;
    max-width: 95%;
    word-wrap: break-word;
}

/* 移除时间，只保留一个小的装饰点 */
.footer-dot {
    font-size: 20px;
    color: var(--color-footer);
    line-height: 0;
    opacity: 0.5;
    margin-top: 5px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- 自定义提示框 (Toast) --- */
.toast-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.toast-box {
    background: white;
    padding: 25px 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    position: relative;
    max-width: 80%;
    min-width: 300px;
    text-align: center;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-message {
    font-size: 1rem;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap;
    /* 支持换行 */
}

.toast-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
    transition: color 0.2s;
}

.toast-close:hover {
    color: #333;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 单个卡片下载按钮 */
.single-download-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #eee;
    color: #555;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    opacity: 0;
    /* 默认隐藏 */
    transform: translateY(5px);
}

.note-card:hover .single-download-btn {
    opacity: 1;
    transform: translateY(0);
}

.single-download-btn:hover {
    background: #ff9a9e;
    color: white;
    border-color: #ff9a9e;
    box-shadow: 0 4px 12px rgba(255, 154, 158, 0.3);
}

/* --- 移动端适配优化 --- */
@media (max-width: 768px) {
    .input-grid {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .action-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    /* 待生成文字居中 */
    .action-bar>div:first-child {
        text-align: center;
        margin-bottom: 5px;
    }

    /* 按钮容器 */
    .action-bar>div:last-child {
        display: flex;
        gap: 15px !important;
        /* 覆盖内联样式的 gap:10px */
    }

    .btn {
        flex: 1;
        padding: 10px 10px;
        /* 减小左右内边距以防文字过长 */
        font-size: 0.95rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.empty-line {
    margin-bottom: 10px;
}