@charset "UTF-8";

/* カスタムスタイル */
body {
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    background-color: #f3f4f6;
    color: #374151;
    /* dvh対応: アドレスバーによるレイアウト崩れ防止 */
    min-height: 100vh;
    min-height: 100dvh;
}

/* リンクスタイル */
a {
    transition: opacity 0.3s;
}
a:hover {
    opacity: 0.8;
}

/* 広告スペースのスタイル */
.ad-placeholder {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    min-height: 250px;
    width: 100%;
    margin: 2rem 0;
}

canvas {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* 記事部分の見出しデザイン強化 */
article h1 {
    font-size: 2rem;
    font-weight: 800;
    color: #312e81; /* indigo-900 */
    margin-bottom: 2rem;
    line-height: 1.3;
}

article h2 {
    font-size: 1.75rem; 
    font-weight: 700;
    color: #4f46e5;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

article h3 {
    font-size: 1.4rem; 
    font-weight: 700;
    color: #1f2937;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-left: 5px solid #6366f1;
    padding-left: 0.75rem;
}

article p {
    margin-bottom: 1.25rem;
    line-height: 1.8;
    color: #4b5563;
}

article ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
    background-color: #f9fafb;
    padding: 1.5rem 1.5rem 1.5rem 2.5rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

article li {
    margin-bottom: 0.75rem;
}

/* パンくずリストなど */
.breadcrumb {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 1rem;
}

/* フェードインアニメーションの定義 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* スクロールバー装飾 */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: #1f2937; 
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #4b5563; 
    border-radius: 3px;
}

/* --- 没入モード用スタイル --- */
/* ヘッダーのトランジション */
#mainHeader {
    transition: transform 0.3s ease-in-out;
}
/* ヘッダーを隠すクラス */
.header-hidden {
    transform: translateY(-100%);
}

/* --- スマホ用没入モード（下部固定） --- */
@media (max-width: 768px) {
    body.mobile-immersive #controlPanel {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        background-color: rgba(255, 255, 255, 0.95);
        -webkit-backdrop-filter: blur(5px);
        backdrop-filter: blur(5px);
        border-top: 1px solid #e5e7eb;
        padding: 12px 16px;
        padding-bottom: max(20px, env(safe-area-inset-bottom)); /* iPhone X等対応 */
        z-index: 9999 !important; /* 最前面に表示 */
        box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.1);
        
        /* 横一列レイアウト */
        flex-direction: row !important;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        animation: slideUp 0.3s ease-out;
    }
    /* 固定モード時はラベルや目盛りを隠してコンパクトに */
    body.mobile-immersive .option-label,
    body.mobile-immersive .speed-scale { display: none; }
    
    /* スライダー周りの調整 */
    body.mobile-immersive #controlPanel > div:first-child {
        flex-direction: row;
        gap: 5px;
    }
    body.mobile-immersive #speedControl { width: 100px !important; }
    body.mobile-immersive #btnSkip { width: auto !important; padding: 6px 12px; font-size: 0.85rem; }
    
    /* 結果保存パネル用のスマホ没入モードスタイル */
    body.mobile-immersive #resultPanel {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        background-color: rgba(255, 255, 255, 0.95);
        -webkit-backdrop-filter: blur(5px);
        backdrop-filter: blur(5px);
        border-top: 1px solid #e5e7eb;
        padding: 12px 16px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        z-index: 9999 !important; /* 最前面に表示 */
        box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.1);
        grid-template-columns: 1fr 1fr;
        animation: slideUp 0.3s ease-out;

        /* 没入モード時は2x2グリッドのgapを詰める */
        gap: 8px !important;
    }
    body.mobile-immersive #resultPanel:not(.hidden) {
        display: grid; /* スマホ没入時はグリッド（表示時のみ適用） */
    }
    /* 没入モード時のボタンをコンパクトにする */
    body.mobile-immersive #resultPanel button {
        padding-top: 10px !important;
        padding-bottom: 10px !important;
        font-size: 0.8rem !important;
    }
    /* 没入モード時のボタン内アイコンのサイズ調整 */
    body.mobile-immersive #resultPanel button svg,
    body.mobile-immersive #resultPanel button img,
    body.mobile-immersive #resultPanel button > span.text-lg {
        font-size: 1.1rem; /* emoji icon */
        width: 1.1rem; height: 1.1rem; /* svg icon */
    }
}
/* PC表示で sm:flex が hidden を上書きしてしまう問題を修正 */
#resultPanel.hidden {
    display: none !important;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* --- 結果強調演出 (Pop Up) --- */
@keyframes popUp {
    0% { transform: translateX(-50%) scale(0.5); opacity: 0; }
    60% { transform: translateX(-50%) scale(1.2); opacity: 1; }
    80% { transform: translateX(-50%) scale(0.9); }
    100% { transform: translateX(-50%) scale(1.0); }
}

.result-popup {
    animation: popUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* 結果表示オーバーレイ */
#resultOverlay {
    pointer-events: none; /* 下のCanvasをクリック可能に */
}

.result-tag {
    position: absolute;
    background-color: white;
    border: 2px solid;
    border-radius: 8px;
    padding: 4px 8px;
    font-weight: bold;
    font-size: 0.85rem;
    white-space: nowrap;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 10;
    transform-origin: center bottom;
}

/* 履歴削除ボタン */
.btn-delete-history-item {
    color: #9ca3af;
    padding: 4px;
    margin-left: 8px;
    border-radius: 4px;
    line-height: 1;
}
.btn-delete-history-item:hover {
    color: #ef4444;
    background-color: #fee2e2;
}
