:root {
    --primary-bg: #e3e5e8;
    --card-bg: #eef0f2;
    --input-bg: #ffffff;
    --text-dark: #202124;
    --text-light: #6b7280;
    --text-muted: #9aa0a6;
    --border-light: #d6d9dd;
    --border-subtle: #d2d6db;
    --input-border: #dcdcdc;
    --default-bg: #222;
    --hover-bg: #000;
    --input-width: 640px;
}

/* dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-bg: #0f1113;
        --card-bg: #1a1d21;
        --input-bg: #111;
        --text-dark: #e6e6e6;
        --text-light: #b0b6bd;
        --text-muted: #8a8f95;
        --border-light: #2c3137;
        --border-subtle: #33383f;
        --input-border: #3b4148;
        --default-bg: #2c3137;
        --hover-bg: #3b4148;
    }
}

/* base */
* {
    box-sizing: border-box;
}

body {
    background: var(--primary-bg);
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100dvh;
    padding: 24px 16px;
    margin: 0;
}

/* inputs */

input,
textarea {
    width: min(var(--input-width), 100%);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text-dark);
}

textarea {
    height: min(180px, 28vh);
    margin-bottom: 15px;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
}

#filename {
    margin-bottom: 8px;
}

#title {
    margin-bottom: 12px;
}

/* buttons */
.button-group {
    margin: 12px 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

button {
    padding: 10px 22px;
    border: none;
    border-radius: 8px;
    background: var(--default-bg);
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: background .2s;
    font-weight: 500;

}

button:hover {
    background: var(--hover-bg);
}

button:active {
    opacity: .8;
}

/* preview */
.capture {
    width: min(var(--input-width), 100%);
    margin-top: 16px;
    padding: 40px;
    overflow: visible;
}

.card {
    background: var(--card-bg);
    border-radius: 18px;
    border: 1px solid var(--border-light);
    padding: 42px 40px 60px;
}

/* title */
.title {
    font-family: "Noto Sans SC";
    font-size: clamp(22px, 5vw, 30px);
    font-weight: 600;
    text-align: center;
    color: var(--text-dark);
    margin-bottom: 46px;
    letter-spacing: .02em;
}

/* sections */
.section {
    margin-bottom: 46px;
}

/* jp text */
.jp {
    font-family: "Noto Sans JP", "Hiragino Sans", system-ui, sans-serif;
    font-size: clamp(16px, 3.8vw, 19px);
    line-height: 1.8;
    color: var(--text-light);
    word-break: break-all;
    margin-bottom: 10px;
    white-space: pre-line;
    padding-left: 2px;
    letter-spacing: .01em;
}

/* cn text */
.cn {
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    font-size: clamp(18px, 4.2vw, 23px);
    line-height: 1.9;
    word-break: break-word;
    color: var(--text-dark);
    border-left: 2px solid var(--border-subtle);
    padding-left: 16px;
    letter-spacing: .01em;
}

/* watermark */
.watermark {
    margin-top: 40px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: right;
    font-family: "Noto Sans SC";
    letter-spacing: .01em;
}

/* loading overlay */
.loading {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, .7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    z-index: 1000;
}

.hidden {
    display: none;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #ddd;
    border-top-color: #333;
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #222;
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    opacity: .95;
}

/* mobile */
@media (max-width:480px) {
    body {
        padding: 18px 12px;
    }

    .card {
        padding: 28px 22px 40px;
    }

    textarea {
        height: 140px;
    }
}