/* --- 1. グローバル定数・変数定義 --- */
:root {
    --bg-app: #7494c0;
    --status-bg: rgba(15, 23, 42, 0.95);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-white: #ffffff;
    --accent-blue: #3b82f6;
    --accent-gold: #fbbf24;
    --accent-green: #10b981;
    --border-color: #e2e8f0;
    --bubble-ai: #ffffff;
    --bubble-user: #dcf8c6;
    --safe-area-bottom: env(safe-area-inset-bottom);
}

/* レイアウト崩れを物理的に防ぐリセット設定 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    width: 100%;
    background-color: var(--bg-app);
    /* 全デバイス（iOS/Android/PC）で標準的に美しく見えるフォント */
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    color: var(--text-primary);
    overflow: hidden; /* 二重スクロールの完全防止 */
}

/* メインコンテナ：スマホ幅を中央に固定 */
#main-app-container {
    width: 100%;
    max-width: 500px;
    height: 100dvh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-app);
    box-shadow: 0 0 30px rgba(0,0,0,0.2);
}

/* --- 2. オーバーレイ共通スタイル（仕様書準拠：z-index階層） --- */
.overlay-full {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2500; /* モーダル系のz-index */
}

#auth-overlay {
    z-index: 2500; /* 認証画面：最前面 */
}

#news-modal {
    z-index: 2500; /* ニュースモーダル：認証画面と同じ階層 */
    align-items: flex-start !important;
    justify-content: center !important;
    overflow-y: auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

#settings-overlay {
    z-index: 2500; /* 設定画面：同じ階層 */
}

#ranking-hub-overlay {
    z-index: 2000; /* ランキングハブ：モーダルより下 */
}

#overlay-menu {
    z-index: 9999 !important; /* オーバーレイメニュー：最前面（ヘッダーより上） */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    display: none;
    align-items: flex-start !important;
    justify-content: center !important;
    overflow-y: auto !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

/* --- 2-1. 認証・新規登録画面：デザイン刷新 --- */
.auth-box {
    background-color: #ffffff;
    padding: 35px;
    border-radius: 24px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1);
    border: none;
}

.auth-logo {
    font-size: 2.4rem;
    font-weight: 900;
    color: var(--accent-blue);
    letter-spacing: 0.15em;
    margin-bottom: 8px;
}

.auth-catchphrase {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 25px;
    line-height: 1.6;
    text-align: center;
    min-height: 3em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-form-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.auth-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--border-color);
    border-radius: 14px;
    font-size: 1rem;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
}

.auth-input:focus {
    border-color: var(--accent-blue);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), 0 2px 8px rgba(59, 130, 246, 0.15);
}

.auth-button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-btn-primary {
    width: 100%;
    padding: 16px;
    background-color: var(--accent-blue);
    color: #ffffff;
    border: none;
    border-radius: 16px;
    font-weight: 700;
    font-size: 1.0rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3), 0 2px 4px rgba(59, 130, 246, 0.2);
    transition: all 0.2s ease;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    letter-spacing: 0.02em;
}

.auth-btn-primary:active { transform: scale(0.98); }

.auth-btn-secondary {
    width: 100%;
    padding: 16px;
    background-color: transparent;
    color: var(--accent-blue);
    border: 2px solid var(--accent-blue);
    border-radius: 16px;
    font-weight: 700;
    font-size: 1.0rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
}

.auth-btn-secondary:active {
    background-color: #eff6ff;
    transform: scale(0.98);
}

.auth-btn-guest {
    width: 100%;
    padding: 16px;
    background-color: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: normal;
    line-height: 1.5;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.auth-btn-guest:active {
    background-color: #e2e8f0;
    transform: scale(0.98);
}

.auth-footer {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 40px;
}

/* --- 3. ステータスバー --- */
#status-bar {
    width: 100%;
    height: 55px;
    background-color: var(--status-bg);
    color: var(--text-white);
    display: flex; 
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    box-sizing: border-box;
    z-index: 1000; /* メニューオーバーレイより下に配置 */
    position: relative;
    backdrop-filter: blur(12px);
    border-bottom: 0.5px solid rgba(255,255,255,0.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.status-left, .status-right { display: flex; align-items: center; }

.status-name-wrapper {
    display: flex;
    align-items: center;
    margin-left: 10px;
    font-weight: 700;
    font-size: 0.95rem;
}

.hamburger-btn {
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--accent-gold);
    line-height: 1;
    padding: 5px;
}

.status-item {
    margin-left: 14px;
    font-size: 0.85rem;
    font-weight: 600;
}

.label { color: var(--accent-gold); margin-right: 3px; font-weight: 800; }
.currency { color: var(--accent-green); margin-right: 2px; }
#rank-display { font-size: 1.1rem; margin-right: 5px; display: flex; align-items: center; }

/* ランクアイコン表示 */
.rank-icon {
    font-size: 1.1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* LLM使用回数表示 */
.status-llm {
    margin-right: 3px;
    font-size: 0.9rem;
}

/* --- 4. チャットエリア：LINE風メッセージデザイン --- */
#chat-container {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 10;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* メッセージの基本レイアウト */
.chat-row { display: flex; width: 100%; margin-bottom: 5px; }
.chat-row-ai { justify-content: flex-start; }
.chat-row-user { justify-content: flex-end; }

/* アイコン：位置ズレと縮小を物理的に防止 */
.avatar-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden; /* 画像を円形に切り取る */
    border: 2px solid #ffffff;
    flex-shrink: 0;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2), 0 2px 4px rgba(0,0,0,0.1);
    object-fit: cover; /* 画像が入る場合のため */
}

/* チャットアイコン内の画像要素：円形に切り取り */
.avatar-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* 吹き出し：LINEライクなエッジデザイン */
.bubble {
    max-width: 75%;
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 1.0rem;
    line-height: 1.6;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
}

.bubble-ai {
    background-color: var(--bubble-ai);
    color: var(--text-primary);
    border-top-left-radius: 2px; /* LINE風の尖り */
    border: none;
}

.bubble-user {
    background-color: var(--bubble-user);
    color: #0b4f16;
    border-top-right-radius: 2px;
    border: none;
}

/* システムアナウンス：LINEトーク内通知風 */
.system-message-container {
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 18px 0;
}
.system-message {
    background-color: rgba(0, 0, 0, 0.15);
    color: #ffffff;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.75rem;
    text-align: center;
    font-weight: 500;
    letter-spacing: 0.02em;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* --- 5. 3x2 メニューグリッド：視認性とタップしやすさの向上 --- */
#menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 物理的な3列固定 */
    grid-template-rows: repeat(2, 1fr);    /* 物理的な2行固定 */
    /* 画面幅に応じて正方形のセルになるように高さを設定 */
    aspect-ratio: 3 / 2; /* 3列2行の比率を維持 */
    width: 100%;
    background-color: #ffffff;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    z-index: 100;
}

.menu-item {
    border: none;
    display: flex;
    flex-direction: column; /* 縦並び */
    align-items: stretch;
    justify-content: flex-start;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* キャラクターボタンの背景色を設定 */
.menu-item.char-NET { background-color: #F38020; }
.menu-item.char-PLTR { background-color: #1e293b; }
.menu-item.char-MCD { background-color: #fbbf24; }
.menu-item.char-TSLA { background-color: #64748b; }
.menu-item.char-NVDA { background-color: #059669; }

.menu-item:active {
    opacity: 0.9; /* タップ時のフィードバック */
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* メニューグリッド内のキャラクター画像：ボタンいっぱいに表示 */
.menu-char-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    flex: 1;
    min-height: 0;
}

/* キャラクター名表示：画像の下に配置 */
.menu-char-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    line-height: 1.2;
    letter-spacing: 0.02em;
    padding: 4px 2px;
    background-color: rgba(0, 0, 0, 0.6);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    box-sizing: border-box;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* MCDボタンは背景がゴールドなので文字色を調整 */
.menu-item.char-MCD .menu-char-name {
    background-color: rgba(0, 0, 0, 0.6); /* FIX: より濃い背景 */
}

/* 銘柄アイコン(サークル) */
.char-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden; /* 画像を円形に切り取る */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    color: #ffffff;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.1);
    object-fit: cover; /* 画像が入る場合のため */
    border: 2px solid rgba(255,255,255,0.2);
}

/* メニューグリッド内のアイコン：円形、少し大きく、中央配置 */
#menu-grid .char-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25), 0 2px 4px rgba(0,0,0,0.15);
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.3);
    /* 背景色は .char-NET, .char-PLTR などのクラスで設定される */
}

/* 銘柄アイコン内の画像要素：円形に切り取り（メニューグリッド以外） */
.char-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* メニューグリッド内の画像要素：円形に切り取り */
#menu-grid .char-icon img {
    border-radius: 50%;
}

.menu-control {
    background-color: #0f172a;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-control-inner {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: 0.05em;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* --- 6. ランキングハブ：崩れ・重なりの物理的解消 --- */
#ranking-hub-overlay {
    background-color: #f8fafc;
    display: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
}

.hub-header {
    background-color: var(--accent-blue);
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 55px;
    padding: 0 15px;
    flex-shrink: 0;
}

.hub-title-box { 
    font-weight: 900; 
    letter-spacing: 0.1em; 
    display: flex;
    align-items: center;
    gap: 10px;
}
.hub-close-btn { font-size: 1.3rem; cursor: pointer; padding: 10px; }

/* ツールチップトリガー */
.tooltip-trigger {
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    transition: background-color 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.tooltip-trigger:active {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

/* ランキング説明ツールチップ */
.ranking-tooltip {
    position: absolute;
    z-index: 3000;
    animation: tooltipFadeIn 0.2s ease-out;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tooltip-content {
    background-color: #ffffff;
    border: 2px solid var(--accent-blue);
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2), 0 2px 8px rgba(59, 130, 246, 0.15);
    max-width: 320px;
    position: relative;
}

.tooltip-text {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
}

.tooltip-note {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
}

.tooltip-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: #f1f5f9;
    color: #64748b;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.tooltip-close:active {
    background-color: #e2e8f0;
}

.hub-tabs {
    display: flex;
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: none;
}
.hub-tabs::-webkit-scrollbar { display: none; }

.hub-tab-item {
    padding: 15px 20px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.hub-tab-item.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
    background-color: #f0f7ff;
    font-weight: 700;
}

.hub-tab-item:hover:not(.active) {
    background-color: #f8fafc;
    color: var(--text-primary);
}

/* 愛指数キャラタブ：縮小(Squashed)を防止 */
.char-tabs {
    display: flex;
    gap: 12px;
    padding: 12px 18px;
    background-color: #ffffff;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-color);
    scrollbar-width: none;
}
.char-tabs::-webkit-scrollbar { display: none; }

.char-tab-item {
    flex-shrink: 0; /* ここを1文字も削らず指定することで潰れを防止 */
    width: 68px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}
.char-tab-item.active { 
    /* インラインスタイルで transform: scale(1.1) が適用される */
}

.char-tab-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 900;
    font-size: 0.75rem;
    margin: 0 auto 6px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden; /* FIX: 画像を切り取るため */
    border: 1px solid rgba(255,255,255,0.2);
}

/* 愛指数タブアイコン内の画像 */
.char-tab-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.hub-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

/* ★ ランキング行：順位・名前・数値を一行に固定 ★ */
.ranking-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between; /* 左右端への配置を強制 */
    padding: 16px 20px;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
}

/* プロフェッショナル・トレーディングUI（株価一覧） */
.stock-price-list-container {
    padding: 12px;
    background: linear-gradient(to bottom, #f8fafc 0%, #ffffff 100%);
    display: grid;
    grid-template-columns: 1fr; /* FIX: 1列レイアウトに変更（ボーナスアイコンがはみ出さないように） */
    gap: 12px; /* FIX: カード間の余白 */
}

.stock-price-card {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px; /* FIX: 角丸を少し大きく */
    padding: 12px; /* FIX: パディングを調整 */
    margin-bottom: 0; /* FIX: グリッドのgapで管理 */
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,0.6),
        0 4px 12px rgba(0,0,0,0.06),
        0 2px 4px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column; /* FIX: 縦並びレイアウト */
    gap: 10px; /* FIX: 要素間の余白 */
    position: relative;
    overflow: hidden;
}

.stock-price-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right, transparent, rgba(0,0,0,0.05), transparent);
}

.stock-price-card:hover {
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,0.8),
        0 6px 16px rgba(0,0,0,0.1),
        0 2px 6px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

/* 左側: アイコン + 銘柄名 + ボーナスアイコン（一行、必要に応じて折り返し） */
.stock-price-left {
    display: flex;
    align-items: center;
    gap: 10px; /* FIX: 余白を調整 */
    flex-shrink: 0;
    min-width: 0;
    flex-wrap: wrap; /* FIX: ボーナスアイコンがはみ出さないように折り返し可能に */
}

.stock-name-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.stock-name-inline {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.3px;
    white-space: nowrap;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
}

.stock-ticker-inline {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    letter-spacing: 0.3px;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    border: 1px solid rgba(0,0,0,0.05);
}

/* 中央: スパークライン */
.stock-price-center {
    width: 100%; /* FIX: 幅いっぱいに */
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sparkline-container {
    width: 100%;
    height: 50px; /* FIX: 少し高く */
    opacity: 0.7;
}

.sparkline {
    width: 100%;
    height: 100%;
    display: block;
}

/* 右側: 価格 + 変動率 */
.stock-price-right {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* FIX: 左揃えに変更 */
    gap: 6px;
    flex-shrink: 0;
    width: 100%; /* FIX: 幅いっぱいに */
}

.stock-price-main {
    font-size: 1.3rem;
    font-weight: 700;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    letter-spacing: -1px;
    line-height: 1;
}

.stock-price-change {
    display: flex;
    align-items: center;
    gap: 8px;
}

.change-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    letter-spacing: -0.5px;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.change-badge.change-up {
    background-color: #22c55e;
}

.change-badge.change-down {
    background-color: #ef4444;
}

.change-amount {
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    letter-spacing: -1px;
}

.ranking-rank {
    width: 40px;
    font-weight: 900;
    color: var(--accent-blue);
    font-size: 1.2rem;
    font-style: italic;
}

.ranking-info {
    flex: 1; /* 名前エリアを可変最大化 */
    margin: 0 15px;
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* 長すぎる名前のケア */
}

.ranking-val {
    font-weight: 900;
    text-align: right;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-variant-numeric: tabular-nums; /* 数字の幅を一定に固定 */
}

/* 自分のランクハイライト */
.ranking-list-item.is-me {
    background-color: #eff6ff;
    border-color: var(--accent-blue);
}

/* 自分のランク固定表示 */
.my-rank-fixed {
    background-color: #1e293b;
    color: #ffffff;
    padding: 24px 20px;
    border-radius: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2), 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.1);
}
.my-rank-number { font-size: 2.2rem; font-weight: 900; color: var(--accent-gold); }

.ranking-hint {
    background-color: #f0f7ff;
    border: 1px solid var(--accent-blue);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
}
.ranking-hint .hint-note {
    margin-top: 8px;
    font-size: 11px;
    color: #64748b;
}

/* ★ランキング順位の装飾（仕様書「13. 視覚効果」準拠） */
.rank-1 { 
    color: #fbbf24; /* 金色 */
    font-weight: 900; 
}
.rank-2 { 
    color: #94a3b8; /* 銀色 */
    font-weight: 900; 
}
.rank-3 { 
    color: #b45309; /* 銅色 */
    font-weight: 900; 
}

.ranking-list-item.is-me.rank-1 .ranking-rank,
.ranking-list-item.is-me.rank-1 .ranking-name,
.ranking-list-item.is-me.rank-1 .ranking-val {
    color: #fbbf24; /* 金色を優先 */
}

.ranking-list-item.is-me.rank-2 .ranking-rank,
.ranking-list-item.is-me.rank-2 .ranking-name,
.ranking-list-item.is-me.rank-2 .ranking-val {
    color: #94a3b8; /* 銀色を優先 */
}

.ranking-list-item.is-me.rank-3 .ranking-rank,
.ranking-list-item.is-me.rank-3 .ranking-name,
.ranking-list-item.is-me.rank-3 .ranking-val {
    color: #b45309; /* 銅色を優先 */
}

/* --- 7. 配当金受領カード：image_dfba25.png の視認性不足を解消 --- */
.dividend-card {
    background-color: #1e293b;
    color: #ffffff;
    padding: 35px;
    border-radius: 24px;
    width: 90%;
    max-width: 400px; /* ★FIX: 設定モーダルと同じ横幅に統一 */
    min-height: calc(100vh - 40px);
    margin: 20px auto;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 25px 50px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05); /* ダークテーマのため、より強い影を維持 */
    display: flex;
    flex-direction: column;
    position: relative;
    box-sizing: border-box;
}

.dividend-header { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 25px; }
.dividend-title { font-size: 0.9rem; font-weight: 900; letter-spacing: 0.2em; opacity: 0.7; }
.dividend-label { 
    font-size: 0.85rem; 
    color: rgba(255, 255, 255, 0.8); 
    margin-bottom: 10px; 
    font-weight: 600; 
}
.dividend-amount { font-size: 3.2rem; font-weight: 900; color: #ffffff; margin: 15px 0; }
.news-content {
    text-align: left;
    flex: 1;
    overflow-y: auto;
    margin: 0;
    padding-right: 8px;
    /* ★スクロールバーのスタイル（WebKit系ブラウザ） */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.news-content::-webkit-scrollbar {
    width: 8px;
}

.news-content::-webkit-scrollbar-track {
    background: transparent;
}

.news-content::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.news-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

/* ★FIX: フルスクリーン表示時の調整 */
#news-modal .dividend-status {
    margin-top: auto;
    padding-top: 24px;
    flex-shrink: 0;
}

#news-modal .dividend-confirm-btn {
    margin-top: 16px;
    flex-shrink: 0;
}
.news-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.news-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
/* ニュースヘッダー */
.news-header {
    text-align: center;
    padding: 8px 0 12px 0;
    margin-bottom: 16px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.news-header-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.news-header-date {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.news-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
/* ★FIX: ニュースアイテム - 行間と区切りを改善（読み物としての視認性向上） */
.news-item {
    font-size: 0.9rem; /* ★FIX: 0.85rem → 0.9rem（読みやすく） */
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 12px;
    padding-bottom: 12px; /* ★FIX: 下パディングを追加 */
    line-height: 1.6; /* ★FIX: 1.5 → 1.6（読みやすく） */
    padding-left: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* ★FIX: 区切り線を追加 */
    position: relative;
}

.news-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none; /* ★FIX: 最後のアイテムは区切り線なし */
}

/* ★FIX: ニュースアイテムのアイコン（リストマーカー風） */
.news-item::before {
    content: '•';
    position: absolute;
    left: 8px; /* ★FIX: 左端に配置 */
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
    line-height: 1.6;
}

.news-item-price {
    font-weight: 700; /* ★FIX: 600 → 700（強調） */
    color: #ffffff;
}

.news-item-positive {
    color: #10b981;
    font-weight: 600; /* ★FIX: 太字で強調 */
}

.news-item-negative {
    color: #ef4444;
    font-weight: 600; /* ★FIX: 太字で強調 */
}

/* 噂的中通知のデザイン */
.rumor-hit-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.rumor-hit-card {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    animation: rumorCardSlideIn 0.3s ease-out;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
}

.rumor-hit-card:last-child {
    margin-bottom: 0;
}

.rumor-hit-badge {
    display: inline-block;
    background: var(--accent-gold);
    color: #000000;
    font-weight: 700;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    letter-spacing: 0.05em;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    box-shadow: 0 2px 6px rgba(251, 191, 36, 0.4);
}

.rumor-hit-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 6px;
    line-height: 1.4;
}

.rumor-hit-content {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 10px;
    line-height: 1.5;
}

.rumor-hit-price {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rumor-hit-price-change {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rumor-hit-timestamp {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 12px;
    text-align: center;
    font-style: italic;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes rumorCardSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(251, 191, 36, 0.6);
    }
}

.dividend-status {
    display: flex;
    gap: 10px; /* ★FIX: gapを少し増やす（8px → 10px） */
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}
.status-chip {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 0.8rem; /* ★FIX: フォントサイズを少し大きく（0.75rem → 0.8rem） */
    font-weight: 600;
}
.dividend-confirm-btn {
    width: 100%;
    padding: 16px;
    background-color: var(--accent-gold);
    color: #422006;
    border: none;
    border-radius: 16px;
    font-weight: 900;
    font-size: 1.1rem; /* ★FIX: フォントサイズを少し小さく（1.15rem → 1.1rem） */
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(251, 191, 36, 0.4), 0 2px 6px rgba(251, 191, 36, 0.3);
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    letter-spacing: 0.02em;
}

/* 炎アイコン（ストリーク表示） */
.fire-streak {
    display: inline-block;
    margin-left: 8px;
    font-weight: 900;
    color: #fbbf24;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

/* メニューバッジ */
.menu-badge {
    z-index: 10;
    pointer-events: none;
}

.rumor-bonus-icon {
    display: inline-block;
    margin-left: 4px;
    font-weight: 700;
}

/* --- 8. 各種キャライメージカラー定義（仕様書準拠） --- */
/* ★仕様書「18. キャラクター情報の定義事実」に基づく厳密なカラー定義 */
.char-NET { 
    background-color: #F38020;
    color: #ffffff; 
}
.char-PLTR { 
    background-color: #1e293b; /* そのまま：ダークスレート */
    color: #ffffff; 
}
.char-MCD { 
    background-color: #fbbf24;
    color: #000000; /* ゴールド背景のため黒文字に変更 */
}
.char-TSLA { 
    background-color: #64748b;
    color: #ffffff; 
}
.char-NVDA { 
    background-color: #059669; /* そのまま：エメラルドグリーン */
    color: #ffffff; 
    /* 仕様書：box-shadowやその他の装飾プロパティは定義されず、フラットなデザイン */
}

/* 資産レポート：画像 image_dfbac5.png に基づく視認性調整 */
.report-header { 
    text-align: center; /* ★FIX: 総資産カードは中央揃え（トップカードのみ） */
    padding: 20px 20px;
    background: #ffffff; 
    border-radius: 24px; 
    border: 1px solid var(--border-color); 
    margin-bottom: 20px; 
    box-shadow: 0 6px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
}

/* レポートヘッダーのフェードインアニメーション */
.report-header-animated {
    animation: reportFadeInUp 0.5s ease-out;
}

@keyframes reportFadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 数字部分のフォント設定 */
.report-header div[style*="font-size:2.8rem"],
.stock-card span[style*="font-weight:700"],
.report-card-compact span[style*="font-weight:700"] {
    font-weight: 700;
    letter-spacing: -1px;
}

.stock-card { 
    background: #ffffff; 
    border-radius: 18px; 
    padding: 18px; 
    border-left: 4px solid var(--border-color); 
    border: 1px solid var(--border-color); 
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s ease;
}

.stock-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
}

/* 凝縮レイアウト用のカードスタイル */
.report-card-compact {
    background: #ffffff;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    animation: reportCardFadeIn 0.5s ease-out;
    animation-fill-mode: both;
    border: 1px solid var(--border-color);
}

.report-card-compact:nth-child(1) { animation-delay: 0.1s; }
.report-card-compact:nth-child(2) { animation-delay: 0.2s; }
.report-card-compact:nth-child(3) { animation-delay: 0.3s; }
.report-card-compact:nth-child(4) { animation-delay: 0.4s; }
.report-card-compact:nth-child(5) { animation-delay: 0.5s; }

@keyframes reportCardFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ランクアップヒント */
.rankup-hint {
    background: rgba(239, 68, 68, 0.1) !important;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* コメントバブル（吹き出し風） */
.comment-bubble {
    position: relative;
}

.comment-bubble::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #f0f7ff;
}

/* ★資産レポートのアバターアイコン：角丸四角形（仕様書準拠） */
.report-header .char-icon,
.stock-card .char-icon {
    border-radius: 12px; /* 仕様書：資産レポートでは角丸四角形 */
    overflow: hidden; /* FIX: 画像を角丸四角形に切り取るため */
}

/* 資産レポート内の画像要素：角丸四角形に切り取り */
.report-header .char-icon img,
.stock-card .char-icon img {
    border-radius: 12px; /* 角丸四角形 */
}

/* FXエフェクトレイヤー（仕様書準拠） */
/* ★仕様書「13. 視覚効果（CSS Effects）の事実」に基づく定義 */
#fx-container-inner { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    pointer-events: none; 
    z-index: 9999; /* ★仕様書準拠：モーダル（z-index: 2000）よりも前面 */
    overflow: hidden; 
}

/* フローティング絵文字パーティクル演出 */
.floating-emoji {
    position: absolute;
    font-size: 2rem;
    pointer-events: none;
    z-index: 10000;
    user-select: none;
    -webkit-user-select: none;
    will-change: transform, opacity;
}

/* 上昇アニメーション（👍） */
.floating-emoji[data-direction="up"] {
    animation: floatUp var(--duration, 2s) ease-out forwards;
}

@keyframes floatUp {
    0% {
        transform: translate(0, 0) scale(0.8);
        opacity: 0.8;
    }
    20% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--sway, 0), var(--distance, -150px)) scale(1.2);
        opacity: 0;
    }
}

/* 下落アニメーション（👎） */
.floating-emoji[data-direction="down"] {
    animation: floatDown var(--duration, 2s) ease-in forwards;
}

@keyframes floatDown {
    0% {
        transform: translate(0, 0) scale(0.8);
        opacity: 0.8;
    }
    20% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--sway, 0), var(--distance, 150px)) scale(1.0);
        opacity: 0;
    }
}


/* クイックリプライ：横スクロールを確実に維持 */
#quick-reply-container {
    display: none; 
    flex-direction: row; /* 横並び表示 */
    padding: 15px; 
    background-color: rgba(255,255,255,0.96);
    overflow-x: auto; 
    gap: 12px; 
    border-top: 1px solid var(--border-color);
    scrollbar-width: none;
    flex-shrink: 0;
}
#quick-reply-container::-webkit-scrollbar { display: none; }
/* ★FIX: クイックリプライ - フォントウェイトと角丸を資産レポートに統一 */
.quick-btn {
    padding: 12px 22px;
    border-radius: 16px; /* ★FIX: 25px → 16px（資産レポートに統一） */
    background: #ffffff;
    border: 2px solid var(--accent-blue);
    color: var(--accent-blue);
    font-weight: 700; /* ★FIX: 800 → 700（野暮ったさを解消） */
    font-size: 0.9rem; /* ★FIX: サイズを明確化 */
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15), 0 1px 3px rgba(59, 130, 246, 0.1); /* ★FIX: 影を資産レポート風に */
    flex-shrink: 0;
    transition: all 0.2s ease;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    letter-spacing: 0.01em;
}

.quick-btn:hover {
    background-color: #f0f7ff; /* ★FIX: ホバー時の背景色を追加 */
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25), 0 2px 6px rgba(59, 130, 246, 0.15);
}

.quick-btn:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.1);
}
.quick-btn.locked {
    opacity: 0.5;
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    pointer-events: none;
}

/* ★LLM実装: LLM続ける系の選択肢スタイル（💬マーク付き、枠の色を変更） */
.quick-btn.llm-continue {
    border-color: #8b5cf6; /* 紫色の枠 */
    color: #8b5cf6; /* 紫色の文字 */
    background: #faf5ff; /* 薄い紫色の背景 */
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.2); /* 紫色の影 */
}

.quick-btn.llm-continue:hover {
    background-color: #f3e8ff; /* ホバー時の背景色 */
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.quick-btn.llm-continue:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(139, 92, 246, 0.15);
}

/* 入力エリア（仕様書準拠：セーフエリア対応） */
#input-area {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    padding-bottom: calc(12px + var(--safe-area-bottom)); /* ★仕様書準拠：セーフエリア対応 */
    background-color: #ffffff;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    position: relative; /* キーボード被り対策のため */
    z-index: 100; /* キーボードの上に表示 */
}

#input-area #message-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.95rem;
    outline: none;
}

#input-area #message-input:focus {
    border-color: var(--accent-blue);
}

/* 入力エリアボタン */
.send-btn { 
    background-color: var(--accent-blue); 
    color: #ffffff; 
    border: none; 
    padding: 10px 25px; 
    border-radius: 25px; 
    font-weight: 800; 
    cursor: pointer; 
    font-size: 0.95rem;
}

/* 設定画面ボックス */
.settings-box { 
    background-color: #ffffff; 
    padding: 35px; 
    border-radius: 24px; 
    width: 90%; 
    max-width: 400px; 
    text-align: center; 
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1); /* ★FIX: 認証モーダルと同じ影を追加 */
    border: none;
}
.settings-header {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 10px;
    letter-spacing: 0.1em;
}
.settings-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left;
}
.settings-body label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
}
.settings-save-btn { 
    width: 100%; 
    padding: 16px; 
    background-color: var(--accent-blue); 
    color: #ffffff; 
    border: none; 
    border-radius: 12px; 
    font-weight: 900; 
    cursor: pointer; 
    font-size: 1rem;
}
.settings-reset-btn {
    width: 100%;
    padding: 16px;
    background-color: #ef4444;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-weight: 900;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}
.settings-reset-btn:active {
    background-color: #dc2626;
}
.settings-back-btn {
    width: 100%;
    padding: 12px;
    background-color: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}
.settings-back-btn:active {
    background-color: #f8fafc;
}

/* --- メニューオーバーレイ：モバイル最適化 --- */
.overlay-content {
    background-color: #ffffff;
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    padding: 20px;
    box-sizing: border-box;
    margin-top: 10%; /* ヘッダー分の余白 */
    margin-bottom: 100px; /* 戻るボタン分の余白 */
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: calc(100vh - 200px); /* 最小高さを確保 */
}

.overlay-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 20px 0;
    opacity: 0.5;
}

.overlay-section-label {
    font-size: 0.85rem;
    font-weight: 900;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.overlay-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 10px;
}

/* モバイル最適化：画面幅が小さい場合は1列に */
@media (max-width: 360px) {
    .overlay-grid {
        grid-template-columns: 1fr;
    }
}

/* ★FIX: オーバーレイボタンカード - タイポグラフィ統一とホバー効果追加 */
.overlay-btn-card {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 16px; /* 既に統一済み */
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 100px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04); /* ★FIX: 影を追加（資産レポート風） */
}

.overlay-btn-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08); /* ★FIX: ホバー時の影を強化 */
    transform: translateY(-2px); /* ★FIX: ホバー時の浮き上がり効果 */
}

.overlay-btn-card:active {
    background-color: #e2e8f0;
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.overlay-btn-card span {
    font-size: 0.95rem; /* ★FIX: 0.9rem → 0.95rem（読みやすく） */
    font-weight: 700; /* 既に統一済み */
    color: var(--text-primary);
    line-height: 1.4; /* ★FIX: 行間を追加 */
}

.overlay-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

.overlay-list-item {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.overlay-list-item:active {
    background-color: #f8fafc;
    transform: scale(0.98);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.overlay-list-item > span:first-child {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.overlay-list-item > span:last-child {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.overlay-cancel-btn {
    width: 100%;
    padding: 18px;
    background-color: var(--accent-blue);
    color: #ffffff;
    border: none;
    border-radius: 16px;
    font-weight: 900;
    font-size: 1.05rem;
    cursor: pointer;
    text-align: center;
    margin-top: auto;
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3), 0 2px 6px rgba(59, 130, 246, 0.2);
    transition: transform 0.1s;
    position: sticky;
    bottom: 0;
    z-index: 10000;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    letter-spacing: 0.02em;
}

.overlay-cancel-btn:active {
    transform: scale(0.98);
}