/* 色は将来のダークモード対応を見据えてカスタムプロパティにまとめる(今回はライトテーマのみ実装) */
:root {
    --color-panel-bg: white;
    --color-border: gainsboro;
    --color-text: #6b6b6b;
    --color-text-heading: #4b4b4b;
    --color-text-muted: #9a9a9a;
    --color-accent-important: #d99a00;
    --color-hover: #e6e6e6;
}

.layout {
    max-width: 1300px;
    margin: 24px auto 60px;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ログ入力欄とタイムラインの横並び。サイドバー分の幅を考慮できるよう
   grid ではなく flex-wrap を使う(他ツールでも同じ理由でgridを避けている)。 */
.layout-main {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.panel.log-input {
    flex: 1 1 380px;
    min-width: 320px;
}

.panel.timeline {
    flex: 2 1 420px;
    min-width: 320px;
}

.panel h2 {
    margin: 0 0 12px;
    font-size: 16px;
    font-family: "游ゴシック", 'ヒラギノ角ゴ ProN W3', sans-serif;
    color: var(--color-text-heading);
}

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

.timeline-header h2 {
    margin: 0;
}

.timeline-header button {
    padding: 4px 12px;
    font-size: 13px;
}

/* 共通フィールド行 */
.field-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.field-row label,
.field-label {
    font-size: 13px;
    color: var(--color-text-heading);
}

select,
input[type="text"],
textarea {
    width: 100%;
    font-size: 14px;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background-color: white;
    color: var(--color-text-heading);
    font-family: inherit;
}

textarea {
    resize: vertical;
}

.caption {
    margin: -4px 0 8px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.warning {
    color: #8a5a00;
    background-color: whitesmoke;
    border-left: 4px solid var(--color-accent-important);
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 14px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--color-text-heading);
    padding: 6px 0;
    cursor: pointer;
}

.checkbox-row input {
    width: 16px;
    height: 16px;
    accent-color: #888888;
}

button {
    background-color: whitesmoke;
    color: var(--color-text-heading);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
}

button:hover:not(:disabled) {
    background-color: var(--color-hover);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 破壊的な操作(新しいセッションを始める、等)であることが分かるよう控えめに赤系にする */
.danger-btn {
    color: #b23b3b;
    border-color: #e3b0b0;
}

.danger-btn:hover:not(:disabled) {
    background-color: #fbeaea;
}

/* セッション情報 */
.character-block {
    margin-top: 4px;
}

.character-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.character-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: whitesmoke;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 4px 8px 4px 12px;
    font-size: 13px;
    color: var(--color-text-heading);
}

.character-chip-remove {
    border: none;
    background: none;
    padding: 0 2px;
    font-size: 14px;
    line-height: 1;
    color: var(--color-text-muted);
    cursor: pointer;
}

.character-chip-remove:hover {
    color: var(--color-text-heading);
}

.character-add {
    display: flex;
    gap: 8px;
    max-width: 360px;
}

.character-add input {
    flex: 1;
    min-width: 0;
}

/* モードタブ(見た目はタブ、実体はラジオボタン) */
.mode-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.mode-tab {
    position: relative;
}

.mode-tab input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mode-tab span {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--color-text-heading);
    background-color: white;
    cursor: pointer;
}

.mode-tab input:checked + span {
    background-color: whitesmoke;
    font-weight: bold;
    box-shadow: inset 0 -2px 0 #888888;
}

.mode-tab input:focus-visible + span {
    outline: 2px solid #888888;
    outline-offset: 1px;
}

.mode-fields {
    border: none;
    padding: 0;
    margin: 0;
}

/* 「誰が」の複数選択ピル(見た目はトグルボタン、実体はチェックボックス。mode-tabと同じ方式) */
.who-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.who-option {
    position: relative;
}

.who-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.who-option span {
    display: inline-block;
    padding: 5px 12px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 13px;
    color: var(--color-text-heading);
    background-color: white;
    cursor: pointer;
}

.who-option input:checked + span {
    background-color: whitesmoke;
    font-weight: bold;
    box-shadow: inset 0 0 0 1px #888888;
}

.who-option input:focus-visible + span {
    outline: 2px solid #888888;
    outline-offset: 1px;
}

.radio-pair {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: var(--color-text-heading);
}

.radio-pair label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

/* 詳細(折りたたみ) */
#log-detail {
    margin: 8px 0 16px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

#log-detail summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text-heading);
}

.detail-fields {
    margin-top: 12px;
}

.submit-row {
    display: flex;
    gap: 8px;
}

/* タイムライン。ログ変換ツールのプレビュー欄と同じく、ボックス内でスクロールさせ
   ページ自体が際限なく伸びないようにする。 */
.timeline-list {
    display: flex;
    flex-direction: column;
    max-height: 600px;
    overflow-y: auto;
}

.timeline-entry {
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.timeline-entry.important {
    border-left: 4px solid var(--color-accent-important);
    padding-left: 10px;
}

.timeline-entry.gm-only {
    background-color: whitesmoke;
}

.timeline-entry.editing {
    box-shadow: inset 0 0 0 2px #888888;
}

.timeline-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.timeline-no {
    font-weight: bold;
    color: var(--color-text-heading);
}

.timeline-character {
    font-weight: bold;
    color: var(--color-text-heading);
}

.timeline-detail {
    color: var(--color-text-muted);
}

.gm-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    background-color: gainsboro;
    font-size: 11px;
    color: var(--color-text-heading);
}

.mode-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    background-color: gainsboro;
    font-size: 13px;
    font-weight: bold;
    color: var(--color-text-heading);
}

.timeline-scene {
    color: var(--color-text-muted);
}

/* 本文とボタンを同じ行に並べ、1記録あたりの行数を減らす */
.timeline-content-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.timeline-body {
    flex: 1;
    min-width: 0;
    color: var(--color-text-heading);
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.timeline-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.timeline-action-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 12px;
    color: var(--color-text-muted);
    cursor: pointer;
}

.timeline-action-btn:hover:not(:disabled) {
    color: var(--color-text-heading);
}

.timeline-action-btn:disabled {
    color: var(--color-border);
    cursor: not-allowed;
}

.timeline-star {
    font-size: 14px;
}

/* ファイル入出力 */
.file-io-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.file-input-label {
    display: inline-block;
    background-color: whitesmoke;
    color: var(--color-text-heading);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
}

.file-input-label:hover {
    background-color: var(--color-hover);
}
