@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@400;500;600&family=Noto+Sans+JP:wght@400;500&display=swap');

:root {
    /* Warm Paper Palette */
    --bg: #fcfbf9;
    --bg-alt: #f7f5f2;
    --surface: #ffffff;

    /* Text - Ink */
    --ink: #2c2c2c;
    --ink-light: #666666;
    --ink-muted: #999999;

    /* Accent - Soft Blue */
    --accent: #5c7cfa;
    --accent-light: #e8ecff;

    /* Borders */
    --line: #e8e6e3;
    --line-strong: #d4d1cc;

    /* Typography */
    --font-serif: 'Noto Serif JP', 'Yu Mincho', serif;
    --font-sans: 'Noto Sans JP', 'Hiragino Sans', sans-serif;

    /* Spacing */
    --s1: 0.25rem;
    --s2: 0.5rem;
    --s3: 0.75rem;
    --s4: 1rem;
    --s5: 1.5rem;
    --s6: 2rem;
    --s8: 3rem;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    line-height: 1.9;
    font-size: 15px;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: var(--s6) var(--s5);
}

/* ===== HEADER ===== */
header {
    text-align: center;
    margin-bottom: var(--s8);
    padding-top: var(--s5);
}

header h1 {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    margin-bottom: var(--s2);
}

.subtitle {
    font-size: 0.9rem;
    color: var(--ink-light);
    margin-bottom: var(--s5);
}

.header-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--s3);
    flex-wrap: wrap;
}

.nav-link {
    font-size: 0.8rem;
    color: var(--ink-muted);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--s1) var(--s2);
    transition: color 0.2s;
    font-family: inherit;
}

.nav-link:hover {
    color: var(--accent);
}

.nav-divider {
    color: var(--line);
}

/* ===== EDITOR ===== */
.editor {
    display: flex;
    flex-direction: column;
    gap: var(--s5);
    margin-bottom: var(--s6);
}

.editor-pane {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 4px;
    overflow: hidden;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--s3) var(--s4);
    border-bottom: 1px solid var(--line);
    background: var(--bg-alt);
}

.pane-header h2 {
    font-family: var(--font-serif);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ink-light);
}

.pane-actions {
    display: flex;
    align-items: center;
    gap: var(--s4);
}

.counter {
    font-size: 0.75rem;
    color: var(--ink-muted);
}

.copy-btn {
    padding: var(--s2) var(--s4);
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.copy-btn:hover:not(:disabled) {
    opacity: 0.85;
}

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

.regen-btn {
    padding: var(--s2) var(--s3);
    background: var(--bg-alt);
    border: 1px solid var(--line);
    border-radius: 3px;
    font-size: 0.8rem;
    color: var(--ink-light);
    cursor: pointer;
    transition: all 0.2s;
}

.regen-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

textarea {
    width: 100%;
    height: 200px;
    padding: var(--s4);
    border: none;
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    line-height: 2;
    resize: vertical;
}

textarea:focus {
    outline: none;
}

textarea::placeholder {
    color: var(--ink-muted);
}

.output-pane {
    border-color: var(--accent);
}

.output-pane .pane-header {
    background: var(--accent-light);
    border-color: var(--accent);
}

/* ===== OPTIONS ===== */
.options {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 4px;
}

.options-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--s4);
    border-bottom: 1px solid var(--line);
}

.options-header h2 {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 500;
}

.options-controls {
    display: flex;
    gap: var(--s2);
}

.options-controls button {
    padding: var(--s2) var(--s3);
    background: var(--bg-alt);
    border: 1px solid var(--line);
    border-radius: 3px;
    font-size: 0.75rem;
    color: var(--ink-light);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.options-controls button:hover {
    border-color: var(--line-strong);
    color: var(--ink);
}

.options-body {
    padding: var(--s4);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--s5);
}

.option-category h3 {
    font-family: var(--font-serif);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ink-light);
    margin-bottom: var(--s3);
    padding-bottom: var(--s2);
    border-bottom: 1px dotted var(--line);
}

.option-list {
    display: flex;
    flex-direction: column;
    gap: var(--s1);
}

.option-item {
    display: flex;
    align-items: center;
    gap: var(--s2);
    padding: var(--s2) 0;
    cursor: pointer;
    transition: color 0.15s;
}

.option-item:hover {
    color: var(--accent);
}

.option-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid var(--line-strong);
    border-radius: 2px;
    flex-shrink: 0;
    position: relative;
    cursor: pointer;
    transition: all 0.15s;
}

.option-item input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.option-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
}

.option-item span {
    font-size: 0.85rem;
}

.option-item:has(input:checked) span {
    color: var(--accent);
}

/* ===== FOOTER ===== */
footer {
    text-align: center;
    padding: var(--s8) 0 var(--s5);
    color: var(--ink-muted);
    font-size: 0.8rem;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: var(--s6);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--ink);
    color: white;
    padding: var(--s3) var(--s5);
    border-radius: 4px;
    font-size: 0.85rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

/* ===== MOBILE BAR ===== */
.mobile-bar {
    display: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .container {
        padding: var(--s4) var(--s3);
        padding-bottom: 80px;
    }

    header {
        margin-bottom: var(--s5);
        padding-top: var(--s3);
    }

    header h1 {
        font-size: 1.3rem;
    }

    .subtitle {
        font-size: 0.8rem;
        margin-bottom: var(--s3);
    }

    .header-nav {
        gap: var(--s2);
    }

    .nav-link {
        font-size: 0.75rem;
    }

    textarea {
        height: 150px;
        font-size: 16px;
        line-height: 1.8;
    }

    .options-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--s3);
    }

    .options-controls {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .options-controls button {
        padding: var(--s3);
        text-align: center;
    }

    .options-body {
        grid-template-columns: 1fr;
        gap: var(--s4);
    }

    .option-item {
        min-height: 44px;
    }

    .pane-actions .copy-btn {
        display: none;
    }

    .mobile-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--surface);
        border-top: 1px solid var(--line);
        padding: var(--s3) var(--s4);
        align-items: center;
        justify-content: space-between;
        z-index: 100;
    }

    .mobile-stats {
        font-size: 0.75rem;
        color: var(--ink-muted);
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .mobile-copy {
        padding: var(--s3) var(--s5);
        background: var(--accent);
        color: white;
        border: none;
        border-radius: 4px;
        font-size: 0.9rem;
        font-family: inherit;
        min-height: 44px;
        cursor: pointer;
    }

    .mobile-copy:disabled {
        opacity: 0.4;
    }

    .toast {
        bottom: 80px;
        left: var(--s3);
        right: var(--s3);
        transform: translateY(10px);
        text-align: center;
    }

    .toast.show {
        transform: translateY(0);
    }
}
