/* =========================================
   1. カラー設定（色の住所録：孫と完全同期）
   ========================================= */
:root {
    --bg-white: #f0f2f5;
    --card-white: #ffffff;
    --text-main: #333333;
    --brand-pink: #f10ae6;
    --border-light: #e2e8f0;
}

/* =========================================
   2. 全体設定
   ========================================= */
html { overflow-y: scroll; }
body {
    margin: 0; padding: 0;
    background-color: var(--bg-white);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

/* =========================================
   3. ヘッダー
   ========================================= */
.insta-profile-header {
    background: linear-gradient(135deg, #f09433 0%, #dc2743 50%, #bc1888 100%);
    padding: 15px 20px;
    box-shadow: 0 4px 10px rgba(220, 39, 67, 0.25);
}
.header-inner { display: flex; flex-direction: column; }
.title-row { display: flex !important; align-items: baseline !important; gap: 2vw; width: 100%; }
.site-title {
    color: #ffffff !important;
    font-size: clamp(1.5rem, 7vw, 2.2rem) !important;
    font-weight: 900;
    letter-spacing: -0.03em;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.site-tagline { color: #ffffff !important; font-size: clamp(0.8rem, 3.6vw, 1.1rem) !important; font-weight: 700; margin: 0; opacity: 0.9; }
.motto-box { margin-top: 10px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,0.2); }
.motto-box p { color: #ffffff !important; font-size: 0.8rem; font-weight: 500; margin: 0; }

/* =========================================
   4. アイコンカードグリッド（ここが元のデザインです）
   ========================================= */
.category-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 20px;
}
.card {
    position: relative;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 18px;
    padding: 30px 10px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform 0.2s ease;
}
.card:active { transform: scale(0.96); }
.card-icon {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 85%; height: 85%;
    opacity: 0.7;
    pointer-events: none;
}
.card-icon img { width: 100%; height: 100%; object-fit: contain; }
.card-content {
    position: relative;
    z-index: 10;
    color: var(--brand-pink);
    font-weight: 800;
    font-size: 0.95rem;
    text-align: center;
    white-space: nowrap;
    text-shadow: 2px 2px 0 #fff, -2px -2px 0 #fff;
}

/* --- 年度別ボタン --- */
.yearly-entry-section { 
    display: flex !important;
    justify-content: center;    /* 子要素を中央へ */
    align-items: center; 
    padding: 20px;
    width: 100%;                
    box-sizing: border-box;    /* 🚀 パディングが外に漏れないように追加 */
}

/* ボタン本体のデザイン */
.yearly-entry-card {
    display: flex;
    justify-content: center; 
    align-items: center;     
    
    /* 🚀 幅の設定を「基本90%・最大500px」に変更 */
    width: 90%;             
    max-width: 500px;        
    height: 60px;            
    
    background-color: #fff;  
    text-decoration: none;   
    border: 2px solid #f10ae6; 
    border-radius: 30px;     
    
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); 
    transition: all 0.3s ease;
    
    /* 🚀 左右の自動余白を削除（flexのjustify-contentに任せる） */
    margin: 0; 
}

/* 中の文字のスタイル */
.yearly-entry-title {
    color: #f10ae6;
    /* 🚀 文字サイズをスマホに合わせて可変に（clamp） */
    font-size: clamp(1.0rem, 4vw, 1.2rem); 
    font-weight: bold;
    white-space: nowrap; /* 🚀 文字を絶対に改行させない */
}

/* タップ演出 */
.yearly-entry-card:active {
    transform: translateY(2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    background-color: #fdeefb; 
}

/* =========================================
   5. 検索・結果エリア
   ========================================= */
.search-container { padding: 20px 0; display: flex; justify-content: center; }
#search-input {
    width: 92%; max-width: 500px; height: 48px; padding: 0 20px;
    font-size: 16px; font-weight: 600; border: 2px solid var(--brand-pink); border-radius: 24px; outline: none;
}
#search-results {
    width: 100%; max-width: 600px; margin: 0 auto; padding: 10px 8px;
    display: flex; flex-direction: column; align-items: center;
}
#result-count { text-align: center; margin: 10px 0; font-size: 0.9rem; color: #64748b; font-weight: 600; }

/* 🚀 検索時に使うための非表示設定（これだけ足しました） */
.hidden { display: none !important; }

/* その他 */
.mago-footer-nav { padding: 40px 20px; text-align: center; }
.copyright { color: #94a3b8; font-size: 0.7rem; margin-top: 20px; display: block; }

/* =========================================
   6. 上付き・下付き文字の調整
   ========================================= */
/* 行間を崩さないための魔法の設定 */
sup, sub {
    font-size: 0.7em;      /* 少し小さくする */
    line-height: 0;        /* 行の高さに影響を与えない */
    position: relative;
    vertical-align: baseline;
}

/* 上付き（核種や指数）の位置調整 */
sup {
    top: -0.4em;           /* 上に持ち上げる */
    margin-left: 0.1em;    /* 文字との間隔を少し空ける */
}

/* 下付き（化学式など）の位置調整 */
sub {
    bottom: -0.2em;        /* 下に下げる */
    margin-left: 0.1em;    /* 文字との間隔を少し空ける */
}

/* 検索結果などの強調テキスト内でタグが目立ちすぎないように調整 */
.q-text sup, .q-options sup {
    font-weight: bold;     /* 指数もしっかり見えるように */
    color: inherit;        /* 親要素の色を引き継ぐ */
}

/* =========================================
   全ページ共通：フッター統一デザイン
   ========================================= */
.mago-footer-nav {
    margin-top: 50px;
    padding: 60px 15px 40px; /* 上部余白を多めにとり、コンテンツと分離 */
    background-color: #fff;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

/* 📢 広告エリア：ad-gen.js が中身を流し込む場所 */
.footer-ad-space {
    width: 100%;
    max-width: 728px;
    margin: 0 auto 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 内部の広告ユニットデザイン */
.ad-container {
    width: 100%;
    text-align: center;
}

.ad-label {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-bottom: 5px;
    display: block;
    letter-spacing: 0.1em;
}

.ad-unit {
    width: 100%;
    min-height: 100px;
    background: #f8fafc; /* 背景を少しだけグレーにして「枠」を意識 */
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

/* 🔗 法的リンク集（免責事項など） */
.footer-links {
    margin: 25px 0 15px;
    font-size: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.footer-links a {
    color: #64748b; /* 視認性の良いグレー */
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #f10ae6; /* ホバー時はブランドカラーのピンク */
}

.footer-separator {
    color: #e2e8f0;
    margin: 0; /* flexのgapを使うためセパレーター自体は非表示または幅0を推奨 */
}

/* © コピーライト */
.copyright {
    color: #cbd5e1;
    font-size: 0.7rem;
    margin-top: 15px;
    display: block;
    letter-spacing: 0.05em;
}