
        :root[data-theme="dark"] {
            --bg: #1e1e1e;
            --card: #2d2d2d;
            --text: #e0e0e0;
            --muted: #aaa;
            --border: #444;
            --accent: #3a3a3a;
            --active-bg: #e0e0e0;
            --active-text: #1e1e1e;
            --header-bg: #252525;
            --tab-inactive: #252525;
            --badge: #e05a5a;
        }
        :root[data-theme="light"] {
            --bg: #f5f5f5;
            --card: #ffffff;
            --text: #1a1a1a;
            --muted: #666;
            --border: #ddd;
            --accent: #f0f0f0;
            --active-bg: #1a1a1a;
            --active-text: #ffffff;
            --header-bg: #ffffff;
            --tab-inactive: #ebebeb;
            --badge: #e05a5a;
        }

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

        body {
            font-family: 'Helvetica Neue', Arial, sans-serif;
            background: var(--bg);
            color: var(--text);
            min-height: 100vh;
            transition: background 0.2s, color 0.2s;
        }

        /* ヘッダー */
        .header {
            background: var(--header-bg);
            border-bottom: 1px solid var(--border);
            padding: 12px 24px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            position: sticky;
            top: 0;
            z-index: 100;
        }
        .header-left { display: flex; align-items: center; gap: 10px; }
        .header-icon {
            width: 26px; height: 26px;
            filter: invert(1);
        }
        [data-theme="light"] .header-icon { filter: invert(0); }
        .header-title { font-size: 16px; font-weight: bold; color: var(--text); letter-spacing: 0.02em; }

        .btn-theme {
            background: var(--accent);
            border: 1px solid var(--border);
            color: var(--muted);
            padding: 5px 12px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 12px;
            font-weight: bold;
            transition: all 0.15s;
        }
        .btn-theme:hover { border-color: #888; color: var(--text); }

        /* タブ */
        .tab-bar {
            display: flex;
            border-bottom: 1px solid var(--border);
            background: var(--header-bg);
            padding: 0 24px;
            position: sticky;
            top: 94px;
            z-index: 97;
        }
        .tab-btn {
            padding: 10px 20px;
            font-size: 13px;
            font-weight: bold;
            color: var(--muted);
            border: none;
            background: transparent;
            cursor: pointer;
            border-bottom: 2px solid transparent;
            transition: all 0.15s;
            display: flex;
            align-items: center;
            gap: 6px;
            position: relative;
        }
        .tab-btn:hover { color: var(--text); }
        .tab-btn.active { color: var(--text); border-bottom-color: var(--text); }
        .badge {
            background: var(--badge);
            color: white;
            font-size: 9px;
            font-weight: bold;
            padding: 1px 5px;
            border-radius: 10px;
            line-height: 1.4;
        }

        /* タブコンテンツ */
        .tab-content { display: none; }
        .tab-content.active { display: block; }

        .container {
            width: 100%;
            max-width: 800px;
            margin: 0 auto;
            padding: 24px 20px;
        }

        .section { margin-bottom: 24px; }

        .section-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 8px;
        }

        .section-title {
            font-size: 13px;
            font-weight: bold;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: 0.06em;
        }

        .btn-clear {
            background: transparent;
            border: 1px solid var(--border);
            color: var(--muted);
            padding: 5px 12px;
            border-radius: 6px;
            font-size: 12px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.15s;
        }
        .btn-clear:hover { border-color: #888; color: var(--text); }

        textarea {
            width: 100%;
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 8px;
            color: var(--text);
            padding: 12px;
            font-size: 15px;
            resize: vertical;
            transition: background 0.2s;
            font-family: inherit;
            line-height: 1.6;
        }
        textarea::placeholder { color: var(--muted); }
        textarea:focus { outline: none; border-color: #888; }
        #srcText { height: 180px; }
        #personaText { height: 100px; }
        #customRules { height: 80px; }

        .btn-group { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

        .btn-sel {
            background: var(--accent);
            border: 1px solid var(--border);
            color: var(--text);
            padding: 7px 15px;
            border-radius: 20px;
            cursor: pointer;
            font-size: 13px;
            font-weight: bold;
            transition: all 0.2s;
        }
        .btn-sel:hover { border-color: #888; }
        .btn-sel.active { background: var(--active-bg); color: var(--active-text); border-color: var(--active-bg); }

        .hint { font-size: 11px; color: var(--muted); margin-top: 6px; }

        /* 実行ボタン */
        .btn-submit {
            background: var(--card);
            border: 1px solid var(--border);
            color: var(--text);
            padding: 10px 28px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 15px;
            font-weight: bold;
            transition: all 0.15s;
        }
        .btn-submit:hover { border-color: #888; }
        .btn-submit:active { transform: scale(0.98); }

        .loading { display: none; color: var(--muted); font-size: 13px; margin-top: 16px; }

        /* 結果 */
        .result-section {
            margin-top: 28px;
            padding-top: 20px;
            border-top: 1px solid var(--border);
            display: none;
        }
        .result-box {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 18px;
            white-space: pre-wrap;
            line-height: 1.7;
            font-size: 14px;
            margin-top: 8px;
            transition: background 0.2s;
        }
        .model-badge { font-size: 11px; color: var(--muted); margin-top: 10px; }
        .btn-copy {
            background: #4a90e2;
            border: none;
            color: white;
            padding: 7px 16px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 13px;
            font-weight: bold;
            margin-top: 10px;
            display: none;
            width: fit-content;
        }
        .btn-copy:hover { background: #357abd; }

        /* 設定タブ */
        .setting-card {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 18px 20px;
            margin-bottom: 16px;
            transition: background 0.2s;
        }
        .setting-card-title {
            font-size: 13px;
            font-weight: bold;
            color: var(--text);
            margin-bottom: 4px;
        }
        .setting-card-desc {
            font-size: 12px;
            color: var(--muted);
            margin-bottom: 12px;
            line-height: 1.5;
        }

        /* モデル切り替え（設定タブ内） */
        .model-row {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 12px;
        }
        .model-switcher {
            display: flex;
            border: 1px solid var(--border);
            border-radius: 8px;
            overflow: hidden;
            width: fit-content;
        }
        .btn-model {
            background: var(--accent);
            border: none;
            color: var(--muted);
            padding: 7px 18px;
            cursor: pointer;
            font-size: 13px;
            font-weight: bold;
            transition: all 0.2s;
            border-right: 1px solid var(--border);
        }
        .btn-model:last-child { border-right: none; }
        .btn-model:hover { color: var(--text); }
        .btn-model.active { background: var(--active-bg); color: var(--active-text); }

        .api-key-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
        .api-key-label { font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 75px; }
        .api-key-input {
            flex: 1;
            background: var(--bg);
            border: 1px solid var(--border);
            color: var(--text);
            padding: 7px 10px;
            border-radius: 4px;
            font-size: 12px;
        }
        .api-key-link { font-size: 11px; color: #4a90e2; text-decoration: none; }
        .api-key-link:hover { text-decoration: underline; }
        .api-note { font-size: 11px; color: var(--muted); margin-top: 6px; }

        /* 設定プレビュー */
        .persona-preview {
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 10px 12px;
            font-size: 12px;
            color: var(--muted);
            margin-top: 8px;
            line-height: 1.5;
            display: none;
        }
        .persona-preview.visible { display: block; }
        .save-indicator {
            font-size: 11px;
            color: #4caf50;
            margin-top: 6px;
            display: none;
        }

        #snsSection { display: none; }
    
/* 説明エリア */
.desc-area {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    position: sticky;
    top: 51px;
    z-index: 98;
}
.desc-area-inner {
    width: 100%;
}
.desc-text {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.desc-text strong {
    color: var(--text);
}

/* テーマボタン */
.btn-theme {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
}
.theme-icon {
    width: 16px;
    height: 16px;
    filter: invert(1);
}
[data-theme="light"] .theme-icon {
    filter: invert(0);
}

/* 設定タブ内のセクションタイトル間隔 */
.section-title-mb { margin-bottom: 6px; }
.section-title-mt { margin-top: 16px; margin-bottom: 6px; }

/* ヒント（margin付き） */
.hint-mt { margin-top: 8px; font-size: 11px; color: var(--muted); }

/* 保存済みテキスト */
.api-save-note {
    font-size: 11px;
    color: #4caf50;
    margin-top: 6px;
    display: none;
}

/* ===== フッター ===== */
.site-footer {
    margin-top: 60px;
    border-top: 1px solid var(--border);
    background: var(--header-bg);
}
.footer-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 20px 40px;
}
.footer-details { margin-bottom: 0; }
.footer-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.05em;
    user-select: none;
}
.footer-summary::-webkit-details-marker { display: none; }
.footer-toggle-icon { font-size: 14px; color: var(--muted); }
.footer-body {
    margin-top: 20px;
    font-size: 12.5px;
    line-height: 1.9;
    color: var(--muted);
}
.footer-heading {
    font-size: 13px;
    font-weight: bold;
    color: var(--text);
    margin: 0 0 8px;
    letter-spacing: 0.03em;
}
.footer-p { margin: 0 0 16px; }
.footer-p-sm { margin: 0 0 6px; }
.footer-list {
    margin: 0 0 16px;
    padding-left: 1.4em;
}
.footer-list-last { margin: 0 0 20px; }
.footer-copyright {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.footer-copy-text { font-size: 11px; color: var(--muted); }
.footer-link {
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
}
.footer-tools-link { font-size: 11px; }

/* 説明テキストの調整 */
.desc-text { text-align: left; }

/* 結果欄の小見出し */
.result-subtitle {
    font-size: 12px;
    font-weight: bold;
    color: var(--muted);
    margin-top: 14px;
    margin-bottom: 6px;
}
.result-box-changes {
    font-size: 13px;
    line-height: 1.7;
}

/* ===== スマホ対応 ===== */
@media (max-width: 600px) {
    /* 説明文は折り返して全文表示 */
    .desc-text {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        line-height: 1.6;
    }

    /* stickyを解除して余計なスクロール余白を防ぐ */
    .header,
    .desc-area,
    .tab-bar {
        position: static;
        top: auto;
    }

    /* ヘッダー・説明・タブの左右パディングを縮小 */
    .header { padding: 12px 16px; }
    .desc-area { padding: 10px 16px; }
    .tab-bar { padding: 0 16px; }
    .container { padding: 20px 16px; }

    /* フッターの余白を縮小 */
    .site-footer { margin-top: 32px; }
    .footer-inner { padding: 24px 16px 24px; }
}
