/* --- 基本リセットとフォント指定 (変更なし) --- */
html, body, div, p, ul, li, h1, nav, a, button, textarea {
    margin: 0;
    padding: 0;
    font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", メイリオ, Meiryo, Osaka, "ＭＳ Ｐゴシック", "MS PGothic", sans-serif;
}

body {
    background-color: #f8f8f8;
    color: #333;
    font-size: 16px;
    line-height: 1.7;
}

/* 基本スタイル */
* { box-sizing: border-box; }
.container { display: flex; flex-direction: column; height: 100vh; padding: 10px; }

/* --- v0.8 追加: ヘッダーエリアのスタイル --- */
.page-header {
    display: flex;
    justify-content: space-between; /* 両端揃え */
    align-items: center; /* 上下中央揃え */
    padding: 10px;
    border-bottom: 1px solid #ddd;
    background-color: #fff;
    margin-bottom: 10px; /* ボタンエリアとの余白 */
}

.page-title {
    font-size: 20px;
    font-weight: bold;
}

.header-links {
    display: flex;
    gap: 15px; /* リンク間の余白 */
    font-size: 14px;
}

.header-links a {
    color: #0d6efd;
    text-decoration: none;
}
.header-links a:hover {
    text-decoration: underline;
}
/* --- 追加ここまで --- */


.controls { padding-bottom: 10px; display: flex; flex-wrap: wrap; gap: 5px; }
.controls button { padding: 8px 12px; border: 1px solid #ccc; background-color: #fff; border-radius: 4px; cursor: pointer; font-size: 14px; color: #333; }
.controls button:hover { background-color: #f0f0f0; }

.controls .copy-button { margin-left: auto; background-color: #28a745; color: white; border: none; }
.controls .copy-button:hover { background-color: #218838; }

.tabs { display: none; width: 100%; }
.tab-item { flex: 1; padding: 10px; text-align: center; background-color: #e0e0e0; cursor: pointer; border-bottom: 2px solid transparent; }
.tab-item.active { background-color: #fff; border-bottom: 2px solid #4494d5; }
.editor-container { display: flex; flex-grow: 1; gap: 10px; min-height: 0; }
.editor-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#editor, #preview { width: 100%; height: 100%; padding: 15px; border: 1px solid #ccc; border-radius: 4px; background-color: #fff; font-size: inherit; line-height: inherit; }
#editor { resize: none; }
#preview { overflow-y: auto; }

/* --- Writening プレビュー用スタイル (変更なし) --- */
#preview p { margin-top: 1em; margin-bottom: 1em; }
#preview blockquote { margin-left: 10px; padding: 15px; color: #666; border-left: solid 4px #ddd; background-color: #f9f9f9; line-height: 1.5; }
#preview strong { font-weight: bold; }
#preview .big { font-size: 1.5em; }
#preview .red { color: red; }
#preview .headline { margin-top: 30px; margin-bottom: 15px; font-size: 28px; font-weight: bold; border-bottom: solid 1px #ddd; padding-bottom: 5px; line-height: 1.2; }
#preview .headlink { margin-left: 8px; text-decoration: none; color: #ccc; visibility: hidden; }
#preview .headline:hover .headlink { visibility: visible; }

#preview .headline-index { background-color: #f8f8f8; margin-bottom: 20px; padding: 15px 20px 15px 35px; font-size: 13px; line-height: 20px; display: inline-block; border-radius: 6px; border: solid 1px #eee; }
#preview .headline-index li { padding-bottom: 2px; }
#preview .headline-index a { font-size: 15px; line-height: 24px; color: #444; text-decoration: none; border-bottom: solid 1px #666; display: inline-block; }
#preview .headline-index a:hover { border-bottom-color: transparent; }

/* --- レスポンシブデザインの調整 --- */
@media (max-width: 768px) {
    /* v0.8 追加: ヘッダーもレスポンシブ対応 */
    .page-header {
        flex-direction: column; /* 縦並びに変更 */
        gap: 10px;
    }
    
    .tabs { display: flex; }
    .editor-container { flex-direction: column; }
    .editor-pane { display: none; }
    .editor-pane.active { display: flex; }
}