@charset "UTF-8";
:root {
    --primary: #10b981;
    --primary-hover: #059669;
    --accent: #d97706;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --red: #e23c3c;
}

body.page-3chara-break, body.page-2chara-break, body.break-tool {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

main {
    max-width: 1040px;
    margin: 20px auto;
    padding: 24px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
}

h1 {
    font-size: 1.6rem;
    border-left: 4px solid var(--primary);
    padding-left: 12px;
    margin-top: 0;
    margin-bottom: 12px;
}

/* ステップ */
.section {
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.step-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 14px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
}

.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--text);
    color: #fff;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: bold;
}

.hint {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 10px 0;
    padding: 8px 12px;
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-radius: 6px;
}

/* テキストエリア */
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.9rem;
    resize: vertical;
    box-sizing: border-box;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

textarea[readonly] {
    background: #f1f5f9;
}

/* ボタン */
.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.btn-primary, .btn-sub, .btn-green, .btn-llm {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-sub { background: #f1f5f9; color: var(--muted); border: 1px solid #cbd5e1; }
.btn-sub:hover { background: #e2e8f0; color: var(--text); }

.btn-green { background: #10b981; color: #fff; }
.btn-green:hover { background: #059669; }

.btn-llm { background: linear-gradient(90deg, var(--primary), var(--accent)); color: #fff; }

/* キャラ名入力 */
.chara-names {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.name-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.name-box label {
    font-weight: bold;
    font-size: 0.85rem;
    white-space: nowrap;
}

.name-box input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
}

/* チップゾーン */
.zone-container {
    margin-bottom: 14px;
}

.zone-title {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--muted);
    margin-bottom: 6px;
}

.chip-zone {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 54px;
    padding: 10px 12px;
    background: #f1f5f9;
    border: 1px dashed var(--border);
    border-radius: 6px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid;
    font-size: 0.85rem;
    font-family: Consolas, monospace;
    cursor: pointer;
    max-width: 36ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chip-a { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.chip-b { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.chip-c { background: #fff3e0; color: #e65100; border-color: #ffcc80; }
.chip-cm { background: #f5f3ff; color: #7c3aed; border-color: #ddd6fe; }
.chip-neg { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; text-decoration: line-through; }

.chip-del {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: rgba(0,0,0,0.1);
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}

.chip-del:hover { background: var(--red); color: #fff; }

/* 結果エリア */
.result-block { margin-top: 12px; }

.result-label {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--muted);
    margin-bottom: 4px;
}

.result-area {
    background: #f8fafc;
}

/* LLMパネル */
.llm-panel {
    background: #f1f5f9;
    border-radius: 10px;
    padding: 16px;
    margin-top: 16px;
}

.llm-title {
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 10px;
}

.llm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.llm-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.llm-card:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.llm-icon { font-size: 1.2em; }
.llm-note { font-size: 0.75rem; color: var(--muted); margin-top: 10px; }

/* フォーマット選択 */
.fmt-select {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #f1f5f9;
    border-radius: 6px;
}

.fmt-select label {
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

@media (max-width: 768px) {
    main { padding: 16px; margin: 10px; }
    .chara-names { grid-template-columns: 1fr; }
}