@charset "UTF-8";
/* ==============================================================================
// base.css (旧 common_base_20260507.css)
// ------------------------------------------------------------------------------
// 【更新履歴】
// 2026-07-10 2大共通CSSの完全統合版 (デグリ防止・ユニバーサルデザイン強化)
// - 20260517版の「衝突防止セーフティ変数」と202604版の「ダークモード・高コントラスト」をマージ
// - 横並び・縦並びが崩れないレスポンシブセーフティ・レイアウトを共通化
// ============================================================================== */

:root {
    /* カラーパレット (ライトモード基準) */
    --c-primary: #007bff;
    --c-primary-dark: #0056b3;
    --c-primary-deep: #003087;
    --c-bg: #fdfdfd;
    --c-surface: #f0f4ff;
    --c-surface2: #fafafa;
    --c-border: #cccccc;
    --c-text: #333333;
    --c-text-muted: #555555;
    --c-text-dim: #666666;
    --c-heading: #222222;

    /* 入力・結果エリア専用カラー */
    --input-bg-color: #ffffff;
    --input-text-color: #000000;
    --result-bg-color: #f9f9f9;
    --focus-color: #007bff;

    /* ボタン */
    --c-btn-main: #007bff;
    --c-btn-copy: #43a047;
    --c-btn-sub: #757575;
    --c-btn-danger: #c62828;
    --button-bg-color: #f0f0f0;
    --button-text-color: #000000;
    --button-hover-color: #0056b3;

    /* ステータス・ユーティリティ */
    --c-warn-bg: #fff8e1;
    --c-warn-border: #f9a825;
    --c-warn-text: #5d4037;
    --c-error: #d32f2f;
    --error-color: #d32f2f;
    --progress-bg-color: #e0e0e0;
    --progress-active-color: #76c7c0;
    --scrollbar-track-color: #f0f0f0;
    --scrollbar-thumb-color: #007bff;
    --scrollbar-thumb-hover-color: #0056b3;

    --radius: 4px;
}

/* 全体初期化（デグリ・文字溢れ防止ガード） */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', Meiryo, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--c-text);
    background-color: var(--c-bg);
    max-width: 960px;
    margin: 0 auto;
    padding: 0 12px 40px;
    transition: background-color 0.3s, color 0.3s;
}

header {
    margin-top: 16px;
    margin-bottom: 1em;
}

h1 {
    margin-bottom: 20px;
    word-break: break-all;
}

h2 {
    font-size: 1.1em;
    margin: 1.3em 0 0.5em;
    color: var(--c-heading);
    border-left: 3px solid var(--c-primary);
    padding-left: 0.5em;
}

/* 関連リンクナビゲーション */
nav[aria-label="関連リンク"], .nav-menu {
    font-size: 0.88em;
    padding: 0.5em 0.8em;
    background-color: var(--c-surface);
    border-bottom: 2px solid var(--c-primary);
}

nav[aria-label="関連リンク"] a, .nav-menu a {
    color: var(--c-primary-dark);
    text-decoration: none;
    padding: 0 0.3em;
}

nav[aria-label="関連リンク"] a:hover, .nav-menu a:hover {
    color: var(--c-primary-deep);
    text-decoration: underline;
}

/* フォーム構造要素 */
label {
    display: block;
    font-size: 0.88em;
    font-weight: bold;
    color: var(--c-text-muted);
    margin-bottom: 6px;
}

textarea, select, input {
    width: 100%;
    padding: 0.55em;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background-color: var(--input-bg-color);
    color: var(--input-text-color);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    resize: vertical;
    overflow-wrap: break-word;
    word-break: break-all;
}

textarea:focus, select:focus, input:focus {
    outline: 2px solid var(--focus-color);
    border-color: var(--focus-color);
}

textarea[readonly] {
    background-color: var(--input-bg-color);
    opacity: 0.85;
    cursor: default;
}

/* ボタン構造システム */
.action-btn, button, .negative-copy-btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font-size: 0.88em;
    font-weight: bold;
    cursor: pointer;
    background-color: var(--button-bg-color);
    color: var(--button-text-color);
    min-width: 100px;
    transition: opacity 0.2s, filter 0.18s ease, transform 0.1s ease, background-color 0.2s;
    margin: 4px 2px;
    box-sizing: border-box;
}

.action-btn:hover:not(:disabled), button:hover:not(:disabled) {
    filter: brightness(0.88);
    background-color: var(--button-hover-color);
    color: #ffffff;
    transform: translateY(-1px);
}

button:disabled, .action-btn:disabled {
    opacity: 0.5;
    background-color: #bdbdbd !important;
    color: #777777 !important;
    cursor: not-allowed;
    transform: none !important;
}

/* 役割セパレータ */
.btn-copy   { background-color: var(--c-btn-copy); color: #fff; border: none; }
.btn-sub    { background-color: var(--c-btn-sub); color: #fff; border: none; }
.btn-danger { background-color: var(--c-btn-danger); color: #fff; border: none; }

/* 出力・結果コンテントリージョン */
.result {
    margin-top: 10px;
    background-color: var(--result-bg-color);
    border: 1px solid var(--c-border);
    padding: 12px;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: break-word;
    min-height: 50px;
}

/* ログマネージャー */
.log-list {
    margin-top: 1em;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 0.75em;
    background-color: var(--c-surface2);
    scrollbar-width: thin;
}

.log-list::-webkit-scrollbar { width: 6px; }
.log-list::-webkit-scrollbar-track { background: var(--scrollbar-track-color); border-radius: 3px; }
.log-list::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb-color); border-radius: 3px; }
.log-list::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover-color); }

/* ユーティリティ */
.hidden { display: none !important; }

.warning, .similar-warning {
    background: var(--c-warn-bg);
    border: 1px solid var(--c-warn-border);
    border-radius: var(--radius);
    padding: 0.6em 0.9em;
    font-size: 0.88em;
    color: var(--c-warn-text);
}

.error {
    color: var(--error-color);
    font-size: 0.85em;
    font-weight: bold;
}

/* プログレスバー */
.progress-bar {
    width: 100%;
    background: var(--progress-bg-color);
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    display: none;
    margin: 10px 0;
}
.progress {
    width: 0;
    height: 100%;
    background: var(--progress-active-color);
    transition: width 0.3s ease-in-out;
}

/* 汎用レイアウトコンテナ */
.input-output-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 25px 0;
    align-items: flex-start;
}

.input-output-wrapper section {
    flex: 1;
    min-width: 280px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
}

/* ==============================================================================
// プレファレンス・レスポンシブ制御クエリ
// ============================================================================== */

@media (max-width: 640px) {
    body { padding: 0 8px 30px; margin: 12px; }
    h2 { font-size: 1em; }
    .input-output-wrapper { flex-direction: column; gap: 16px; }
    .input-output-wrapper section { min-width: 100%; width: 100%; }
}

/* ダークモード自動追従 */
@media (prefers-color-scheme: dark) {
    :root {
        --c-bg: #1a1a1a;
        --c-text: #e0e0e0;
        --c-heading: #ffffff;
        --c-surface: #252936;
        --c-surface2: #222222;
        --c-border: #444444;
        --input-bg-color: #2a2a2a;
        --input-text-color: #e0e0e0;
        --result-bg-color: #2a2a2a;
        --c-text-muted: #aaaaaa;
        --button-bg-color: #333333;
        --button-text-color: #ffffff;
        --scrollbar-track-color: #222222;
        --scrollbar-thumb-color: #4fc9a4;
    }
}

/* 高コントラストアシスト */
@media (prefers-contrast: high) {
    body, textarea, .result {
        background-color: #ffffff !important;
        color: #000000 !important;
        border-color: #000000 !important;
    }
    .action-btn, button {
        background-color: #003087 !important;
        color: #ffffff !important;
    }
}
