/* 記事エディタ専用スタイル (ae- プレフィックス / 設計: blog-editor.html 準拠) */
.ae-toolbar {
    position:sticky; bottom:12px; z-index:30;
    display:flex; align-items:center; gap:16px; flex-wrap:wrap;
    background:var(--card); border:1px solid var(--border); border-radius:12px;
    padding:12px 18px; margin-top:20px;
    box-shadow:0 4px 16px rgba(17,24,39,.1);
}
.ae-progress { display:flex; align-items:center; gap:10px; flex:1; min-width:220px; }
.ae-progress__label { font-size:12px; color:var(--ink-mute); white-space:nowrap; }
.ae-progress__bar { flex:1; height:6px; background:var(--border); border-radius:999px; overflow:hidden; min-width:80px; }
.ae-progress__fill { height:100%; background:linear-gradient(90deg,var(--brand),#52B788); border-radius:999px; transition:width .4s ease; }
.ae-progress__pct { font-size:12px; font-weight:700; color:var(--brand); min-width:36px; text-align:right; }

.ae-layout { display:grid; grid-template-columns:1fr 1fr; gap:20px; align-items:start; }
@media (max-width:980px) { .ae-layout { grid-template-columns:1fr; } }
.ae-preview { position:sticky; top:12px; }
@media (max-width:980px) { .ae-preview { position:static; } }

.ae-sec { margin-bottom:24px; }
.ae-sec__head { display:flex; align-items:baseline; justify-content:space-between; gap:10px; margin-bottom:8px; }
.ae-sec__title { font-size:14px; font-weight:800; }
.ae-sec__hint { font-size:11px; color:var(--ink-soft); }
.ae-sec__sub { font-size:12px; color:var(--ink-mute); margin:0 0 12px; }

.ae-title-input {
    width:100%; border:none; background:transparent; outline:none; resize:none;
    font-size:26px; font-weight:800; line-height:1.4; color:var(--ink); padding:0;
}
.ae-title-input::placeholder { color:#C7CCD1; }
.ae-body-input {
    width:100%; min-height:240px; padding:14px 16px; border:1px solid var(--border);
    border-top:none; border-radius:0 0 10px 10px;
    background:var(--card); font-size:14px; line-height:1.9;
    resize:vertical; outline:none; font-family:inherit;
}
.ae-body-input:focus { border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-soft); }
.ae-reassure { display:flex; align-items:center; gap:7px; font-size:11px; color:var(--ink-soft); margin-top:7px; }
.ae-reassure__dot { width:6px; height:6px; border-radius:50%; background:var(--ok); }

/* =============================================================================
   エディタ: モードタブ + ツールバー + リッチ本文 (contenteditable)
   ============================================================================= */
.ae-editor-bar {
    border:1px solid var(--border); border-bottom:none;
    border-radius:10px 10px 0 0;
    background:var(--bg);
    display:flex; flex-direction:column;
}
.ae-editor-tabs {
    display:flex; gap:0;
    border-bottom:1px solid var(--border);
    background:var(--card);
    border-radius:10px 10px 0 0;
    overflow:hidden;
}
.ae-editor-tab {
    border:none; background:transparent; cursor:pointer;
    padding:9px 16px; font-size:12.5px; font-weight:700;
    color:var(--ink-mute); font-family:inherit;
    border-bottom:2px solid transparent;
    transition:color .12s, border-color .12s, background .12s;
}
.ae-editor-tab:hover { color:var(--ink); background:var(--bg); }
.ae-editor-tab.is-active {
    color:var(--brand); border-bottom-color:var(--brand);
    background:var(--card);
}
.ae-editor-tools {
    display:flex; flex-wrap:wrap; align-items:center; gap:2px;
    padding:6px 8px;
    background:var(--bg);
}
.ae-tool {
    width:30px; height:30px; padding:0;
    border:1px solid transparent; background:transparent;
    border-radius:6px; cursor:pointer;
    font-family:inherit; font-size:13px; color:var(--ink);
    display:inline-flex; align-items:center; justify-content:center;
    transition:background .1s, border-color .1s;
}
.ae-tool:hover { background:var(--card); border-color:var(--border); }
.ae-tool:active { background:var(--brand-soft); border-color:var(--brand); }
.ae-tool b { font-weight:800; }
.ae-tool i { font-style:italic; }
.ae-tool u { text-decoration:underline; }
.ae-tool s { text-decoration:line-through; }
.ae-tool-sep {
    width:1px; height:18px; background:var(--border); margin:0 4px;
}

/* ---------- ドロップダウン式ツール (色 / マーカー / サイズ / 書体) ---------- */
.ae-tool-group { position:relative; display:inline-flex; }
.ae-tool--has-menu {
    width:auto; min-width:38px;
    padding:0 6px; gap:2px;
}
.ae-tool__icon { font-size:13px; font-weight:700; line-height:1; }
.ae-tool__icon--color {
    border-bottom:3px solid #DC2626;
    padding-bottom:1px;
}
.ae-tool__icon--marker { font-size:14px; }
.ae-tool__caret { font-size:9px; color:var(--ink-soft); line-height:1; }

.ae-tool-menu {
    position:absolute; top:calc(100% + 4px); left:0;
    background:var(--card); border:1px solid var(--border);
    border-radius:8px;
    box-shadow:0 8px 24px rgba(0,0,0,.12);
    padding:6px;
    z-index:30;
    opacity:0; pointer-events:none; transform:translateY(-4px);
    transition:opacity .12s, transform .12s;
}
.ae-tool-menu.is-open {
    opacity:1; pointer-events:auto; transform:translateY(0);
}

/* カラーパレット (色 / マーカー) — 24色 (6×4) または 16色 (4×4) */
.ae-tool-menu--palette {
    display:grid; grid-template-columns:repeat(4, 22px); gap:4px;
}
.ae-swatch {
    width:22px; height:22px; padding:0;
    border:1px solid rgba(0,0,0,.12);
    border-radius:4px;
    cursor:pointer;
    transition:transform .1s, border-color .1s, box-shadow .1s;
    display:inline-flex; align-items:center; justify-content:center;
    font-size:11px; color:var(--ink-mute);
    background-color:#fff;
}
.ae-swatch:hover {
    transform:scale(1.18);
    border-color:var(--ink);
    box-shadow:0 2px 6px rgba(0,0,0,.18);
    z-index:1;
}
.ae-swatch--clear {
    background:repeating-linear-gradient(45deg, #fff 0 4px, #F3F4F6 4px 8px) !important;
    color:var(--ink-mute);
}

/* 「🎨 任意の色を選ぶ…」ボタン (パレット内、グリッド全幅にスパン) */
.ae-custom-trigger {
    grid-column: 1 / -1;
    padding:6px 8px; margin-top:4px;
    border:1px dashed var(--border); background:transparent;
    cursor:pointer; font-family:inherit; font-size:11px;
    color:var(--ink); text-align:center;
    border-radius:5px;
    transition:background .1s, border-color .1s;
}
.ae-custom-trigger:hover {
    background:var(--bg); border-color:var(--brand); border-style:solid;
}
.ae-custom-picker {
    /* ネイティブのカラーピッカーは画面外に置いてプログラム的に開く */
    position:absolute; opacity:0; width:1px; height:1px;
    pointer-events:none; grid-column: 1 / -1;
}

/* リスト型メニュー (サイズ / 書体) */
.ae-tool-menu--list {
    display:flex; flex-direction:column; gap:2px;
    min-width:120px; padding:4px;
}
.ae-menuitem {
    display:block; width:100%;
    padding:7px 12px; border:none; background:transparent;
    border-radius:5px; cursor:pointer;
    font-family:inherit; color:var(--ink);
    text-align:left; line-height:1.3;
    transition:background .1s;
}
.ae-menuitem:hover { background:var(--bg); }

/* contenteditable リッチ本文 (textarea と同じ見た目) */
.ae-body-rich {
    width:100%; min-height:280px;
    padding:14px 16px;
    border:1px solid var(--border); border-top:none;
    border-radius:0 0 10px 10px;
    background:var(--card);
    font-size:14px; line-height:1.9;
    outline:none; font-family:inherit;
    color:var(--ink);
    overflow-y:auto;
}
.ae-body-rich:focus { border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-soft); }
.ae-body-rich.is-empty::before {
    content: attr(data-placeholder);
    color:#C7CCD1;
    white-space:pre-line;
    pointer-events:none;
}
/* contenteditable 内のブロック要素の見た目 (記事プレビューに近づける) */
.ae-body-rich h1 {
    font-size:26px; font-weight:800; line-height:1.4;
    margin:28px 0 14px;
    padding-bottom:8px;
    border-bottom:2px solid var(--ink);
    color:var(--ink);
}
.ae-body-rich h1:first-child { margin-top:0; }
.ae-body-rich h2 {
    font-size:22px; font-weight:800; line-height:1.45;
    margin:28px 0 12px;
    padding:6px 0 6px 14px;
    border-left:5px solid var(--brand);
    color:var(--brand-dark);
}
.ae-body-rich h2:first-child { margin-top:0; }
.ae-body-rich h3 {
    font-size:17px; font-weight:700; line-height:1.5;
    margin:22px 0 10px;
    padding-bottom:6px;
    border-bottom:1px dashed var(--border);
    color:var(--ink);
}
.ae-body-rich p  { margin:0 0 14px; line-height:1.9; }
.ae-body-rich ul, .ae-body-rich ol { margin:0 0 14px; padding-left:1.8em; }
.ae-body-rich li { margin:4px 0; line-height:1.8; }
.ae-body-rich blockquote {
    margin:14px 0; padding:10px 16px;
    border-left:3px solid var(--brand); background:var(--brand-soft);
    color:var(--ink-mute); border-radius:0 8px 8px 0;
    font-style:italic;
}
.ae-body-rich a { color:var(--brand); text-decoration:underline; }
.ae-body-rich strong, .ae-body-rich b { font-weight:800; color:var(--ink); }
.ae-body-rich em, .ae-body-rich i      { font-style:italic; }

/* 空の段落も視覚的に高さを保ち、「ここに本文を書く場所」と分かるようにする */
.ae-body-rich p:empty::before {
    content: attr(data-placeholder);
    color: #C7CCD1;
    pointer-events:none;
}
/* h2 / h3 / p 直後の空 p は「本文を書くエリア」として薄いグレーで枠を出す */
.ae-body-rich h2 + p:empty,
.ae-body-rich h3 + p:empty {
    min-height:2.2em;
    border:1px dashed var(--border);
    border-radius:6px;
    padding:6px 10px;
    background:rgba(0,0,0,.015);
    display:block;
}
.ae-body-rich h2 + p:empty::before,
.ae-body-rich h3 + p:empty::before {
    content: "ここに本文を書く…";
    color: #C7CCD1;
    font-style:italic;
    font-size:13px;
}

/* 目的ピッカー */
.ae-purpose { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
@media (max-width:560px) { .ae-purpose { grid-template-columns:repeat(2,1fr); } }
.ae-purpose button {
    padding:10px 8px; border:1px solid var(--border); background:var(--card); border-radius:8px;
    font-size:12px; font-weight:600; color:var(--ink-mute); cursor:pointer; font-family:inherit;
}
.ae-purpose button:hover { border-color:var(--brand); color:var(--brand); }
.ae-purpose button.is-active { background:var(--brand); border-color:var(--brand); color:#fff; }

/* 構造化タグカード */
.ae-cards { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; }
@media (max-width:560px) { .ae-cards { grid-template-columns:1fr; } }
.ae-card {
    position:relative; display:flex; gap:11px; align-items:flex-start; text-align:left;
    padding:13px; border:1.5px solid var(--border); border-radius:10px; background:var(--card);
    cursor:pointer; font-family:inherit; transition:border-color .15s, box-shadow .15s;
}
.ae-card:hover { border-color:var(--brand); }
.ae-card.is-active { border-color:var(--brand); background:#F0FDF4; box-shadow:0 0 0 3px var(--brand-soft); }
.ae-card.is-rec:not(.is-active) { border-color:#F59E0B; background:#FFFBEB; }
.ae-card__icon {
    flex:0 0 34px; width:34px; height:34px; display:flex; align-items:center; justify-content:center;
    border-radius:9px; background:var(--brand-soft); font-size:17px;
}
.ae-card.is-active .ae-card__icon { background:var(--brand); }
.ae-card__title { font-size:13px; font-weight:700; }
.ae-card__desc { font-size:11px; color:var(--ink-soft); line-height:1.5; margin-top:2px; }
.ae-card__check {
    position:absolute; top:9px; right:9px; width:18px; height:18px; border-radius:50%;
    background:var(--brand); color:#fff; font-size:10px; display:none; align-items:center; justify-content:center;
}
.ae-card.is-active .ae-card__check { display:flex; }
.ae-card__badge {
    position:absolute; top:-7px; right:10px; padding:2px 8px; font-size:10px; font-weight:700;
    color:#fff; background:#F59E0B; border-radius:999px;
}
.ae-card.is-active .ae-card__badge { display:none; }

.ae-feedback {
    display:flex; align-items:center; gap:8px; margin-top:12px; padding:10px 12px;
    background:#EFF6FF; color:#1E40AF; border-radius:8px; font-size:12px; font-weight:600;
}
.ae-hint {
    display:flex; align-items:center; gap:10px; margin-top:12px; padding:11px 13px;
    background:#FFFBEB; border:1px solid #FDE68A; border-radius:8px;
}
.ae-hint__body { flex:1; font-size:12px; color:#78350F; line-height:1.5; }
.ae-hint__body strong { color:#92400E; }
.ae-hint button {
    padding:6px 11px; background:#F59E0B; color:#fff; border:none; border-radius:6px;
    font-size:11px; font-weight:700; cursor:pointer; font-family:inherit; white-space:nowrap;
}

/* 動的フォーム */
.ae-dyn-group { padding:16px 18px; background:var(--card); border:1px solid var(--border); border-radius:10px; margin-bottom:12px; }
.ae-dyn-group__head { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.ae-dyn-group__title { display:flex; align-items:center; gap:7px; font-size:13px; font-weight:800; }
.ae-dyn-group__close { font-size:12px; color:var(--ink-soft); background:none; border:none; cursor:pointer; padding:4px 6px; font-family:inherit; }
.ae-dyn-group__close:hover { color:var(--danger); }
.ae-f { display:flex; flex-direction:column; gap:5px; margin-bottom:11px; }
.ae-f:last-child { margin-bottom:0; }
.ae-f__label { font-size:12px; font-weight:600; color:var(--ink-mute); }
.ae-f__label small { font-weight:400; color:var(--ink-soft); margin-left:5px; }
.ae-f__input, .ae-f__textarea {
    width:100%; padding:9px 11px; border:1px solid var(--border); border-radius:7px;
    background:var(--card); font-size:13px; outline:none; font-family:inherit;
}
.ae-f__input:focus, .ae-f__textarea:focus { border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-soft); }
.ae-f__textarea { min-height:64px; resize:vertical; }
.ae-f--row { display:grid; grid-template-columns:1fr 1fr; gap:9px; }
.ae-item { padding:11px; border:1px dashed var(--border); border-radius:7px; margin-bottom:9px; background:var(--bg); }
.ae-item__head { display:flex; justify-content:space-between; align-items:center; margin-bottom:7px; }
.ae-item__no { font-size:11px; font-weight:800; color:var(--brand); }
.ae-item__del { font-size:11px; color:var(--danger); background:none; border:none; cursor:pointer; font-family:inherit; }
.ae-add {
    width:100%; padding:9px; border:1px dashed var(--border); border-radius:7px;
    font-size:12px; font-weight:600; color:var(--ink-mute); background:transparent; cursor:pointer; font-family:inherit;
}
.ae-add:hover { border-color:var(--brand); color:var(--brand); background:var(--brand-soft); }

/* プレビュー */
.ae-pv-card { background:var(--card); border:1px solid var(--border); border-radius:12px; padding:18px; }
.ae-pv-tabs { display:inline-flex; gap:3px; padding:3px; background:var(--bg); border-radius:8px; margin-bottom:16px; }
.ae-pv-tabs button {
    padding:7px 14px; border:none; background:none; border-radius:6px; cursor:pointer;
    font-size:12px; font-weight:700; color:var(--ink-soft); font-family:inherit;
}
.ae-pv-tabs button.is-active { background:var(--card); color:var(--ink); box-shadow:0 1px 3px rgba(0,0,0,.1); }
.ae-pv-block { margin-bottom:22px; }
.ae-pv-block__label { font-size:11px; font-weight:700; color:var(--ink-soft); letter-spacing:.05em; margin-bottom:8px; }
.ae-pv-empty { padding:36px 16px; text-align:center; color:var(--ink-soft); font-size:12px; border:2px dashed var(--border); border-radius:10px; }
.ae-g { padding:16px 18px; border:1px solid var(--border); border-radius:10px; background:var(--card); }
.ae-g__site { font-size:12px; color:#202124; }
.ae-g__crumb { font-size:12px; color:#5f6368; margin-bottom:3px; }
.ae-g__title { font-size:18px; color:#1a0dab; line-height:1.3; margin-bottom:3px; }
.ae-g__desc { font-size:13px; color:#4d5156; line-height:1.55; }
.ae-g__rich { margin-top:10px; padding-top:10px; border-top:1px dashed var(--border); }
.ae-g__pill { display:inline-block; font-size:11px; padding:3px 9px; background:var(--brand-soft); color:var(--brand-dark); border-radius:999px; margin:2px 4px 2px 0; }
.ae-g__stars { font-size:12px; color:#5f6368; } .ae-g__stars b { color:#FBBC04; }
.ae-ai { padding:18px; background:linear-gradient(135deg,#F3E8FF,#EFF6FF); border-radius:10px; }
.ae-ai__head { display:flex; align-items:center; gap:8px; margin-bottom:12px; }
.ae-ai__avatar { width:26px; height:26px; border-radius:50%; background:linear-gradient(135deg,#8B5CF6,#3B82F6); color:#fff; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:800; }
.ae-ai__name { font-size:12px; font-weight:700; color:#4C1D95; }
.ae-ai__body { font-size:13.5px; line-height:1.8; color:var(--ink); }
.ae-ai__body strong { color:var(--brand-dark); }
.ae-ai__src { display:inline-block; margin-top:10px; padding:4px 10px; background:rgba(255,255,255,.7); border-radius:999px; font-size:11px; color:#6B21A8; }
.ae-pv-note { margin-top:12px; font-size:11px; color:var(--ink-soft); line-height:1.6; }
.ae-adv { margin-top:18px; border-top:1px solid var(--border); padding-top:12px; }
.ae-adv__toggle { font-size:11px; color:var(--ink-soft); background:none; border:none; cursor:pointer; font-family:inherit; padding:4px 0; }
.ae-adv__body {
    margin-top:8px; padding:13px; background:#0F172A; border-radius:8px; color:#94A3B8;
    font-family:'Inter',monospace; font-size:11px; line-height:1.6; max-height:280px; overflow:auto; white-space:pre-wrap; word-break:break-all;
}

/* 公開設定 */
.ae-settings { background:var(--card); border:1px solid var(--border); border-radius:10px; padding:16px 18px; }
.ae-meta { background:var(--bg); border-radius:7px; padding:9px 12px; font-size:11px; color:var(--ink-soft); margin-top:12px; display:flex; gap:14px; flex-wrap:wrap; }

.ae-handoff {
    display:flex; gap:11px; align-items:center; padding:12px 14px; margin-bottom:18px;
    background:#F0FDF4; border:1px solid var(--brand-soft); border-left:3px solid var(--brand); border-radius:10px;
}
.ae-handoff__body { flex:1; font-size:12px; color:var(--ink-mute); line-height:1.65; }
.ae-handoff__body strong { display:block; color:var(--ink); font-size:13px; }
.ae-handoff__close { background:none; border:none; cursor:pointer; color:var(--ink-soft); font-size:16px; }

/* ---------- スマホ (≤640px) ---------- */
@media (max-width: 640px) {
    .ae-title-input { font-size:22px; }
    .ae-body-input { padding:11px 12px; font-size:16px; min-height:200px; }
    .ae-sec { margin-bottom:16px; }
    .ae-sec__head { gap:6px; }
    .ae-sec__title { font-size:13px; }
    /* ボトム sticky のツールバー */
    .ae-toolbar { padding:10px 12px; gap:10px; bottom:8px; }
    .ae-progress { min-width:0; gap:8px; }
    .ae-progress__label { font-size:10.5px; }
    .ae-progress__pct { font-size:11px; min-width:30px; }
    /* ヘルプバナーと設定欄を圧縮 */
    .ae-handoff { padding:10px 12px; gap:8px; }
    .ae-handoff__body { font-size:11.5px; }
    .ae-handoff__body strong { font-size:12.5px; }
    .ae-settings { padding:12px 14px; }
    .ae-meta { padding:8px 10px; gap:8px; font-size:10.5px; }
}
