/* --- Base & Variables --- */
/* --- ベース・変数定義 --- */
:root {
    --color-bg: #f4f0ea; /* 背景のクリーム色 */
    --color-white: #ffffff;
    --color-text-main: #333333;
    --color-terracotta: #d97a62; /* 赤茶色 */
    --color-sage: #839a84;       /* くすんだ緑 */
    --color-sand: #d1bba7;       /* サンドベージュ */
    --color-light-gray: #e0e0e0;
    --color-navy: #2b3a4a;
    --border-radius: 12px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* 画面全体がスクロールしてしまうのを防ぐ */
    overscroll-behavior: none; /* スワイプ時に画面が引っ張られる（バウンスする）のを防ぐ */
}

body {
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    background-color: #e5e5e5; /* PC閲覧時用の背景 */
    color: var(--color-text-main);
    display: flex;
    justify-content: center;
    -webkit-tap-highlight-color: transparent; /* スマホ特有の青いタップハイライトを無効化 */
}

/* --- Loading Screen --- */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-bg); /* 背景と同じクリーム色 */
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-sand);
    border-top: 4px solid var(--color-terracotta);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.loading-text {
    color: var(--color-navy);
    font-family: 'Montserrat', sans-serif;
    font-weight: bold;
    letter-spacing: 0.1em;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* スマホサイズのコンテナ */
#app-container {
    width: 100%;
    max-width: 414px; /* iPhone Pro Max幅相当 */
    background-color: var(--color-bg);
    height: 100%; /* 固定されたbodyの100%に追従させることで、URLバーの変動による隙間やスクロールを防ぐ */
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden; /* 画面全体のスクロールを無効化 */
}

/* --- ヘッダー --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--spacing-md);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 100;
    pointer-events: none; /* スワイプ操作を背面の瓶に貫通させる */
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    color: var(--color-text-main);
    pointer-events: auto; /* ボタンはタッチ可能に */
    transition: opacity 0.2s ease;
}

.icon-btn:active {
    opacity: 0.4; /* タップ時にフワッと薄くなる優しい反応 */
}

.icon-btn.has-profile-img {
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-profile-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--color-light-gray);
}

/* --- メニュー --- */
.menu-container {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px); /* アイコンから少し離す */
    left: 0;
    background-color: rgba(255, 255, 255, 0.95); /* すりガラス風の白背景 */
    backdrop-filter: blur(8px);
    border: 1px solid var(--color-sand); /* カフェっぽい境界線 */
    border-radius: 16px; /* 丸みを少し大きく */
    box-shadow: 0 10px 25px rgba(43, 58, 74, 0.15); /* 影をリッチに */
    overflow: hidden; /* 角丸からはみ出ないように */
    z-index: 100;
    min-width: 220px; /* 少し幅を広くしてゆったり見せる */
    pointer-events: auto; /* メニューはタッチ可能に */
}

.dropdown-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dropdown-menu li {
    padding: 16px 20px; /* ゆとりのある余白 */
    cursor: pointer;
    color: var(--color-navy); /* 文字色をネイビーに */
    font-family: 'Montserrat', 'Noto Sans JP', sans-serif;
    font-weight: 500;
    font-size: 0.95rem;
    border-bottom: 1px dashed var(--color-sand); /* 点線でカフェのメニュー表のように */
    transition: background-color 0.2s, color 0.2s;
}

.dropdown-menu li:last-child {
    border-bottom: none;
}

.dropdown-menu li:hover,
.dropdown-menu li:active {
    background-color: rgba(244, 240, 234, 0.8); /* クリーム色の半透明 */
    color: var(--color-terracotta); /* タップ時にテーマカラーのテラコッタ色に変化 */
}

.dropdown-menu li.menu-version {
    text-align: center;
    color: #999;
    font-size: 0.8rem;
    padding: 12px 20px 8px;
    cursor: default;
    border-bottom: none;
    pointer-events: none; /* ホバーやクリック反応を無効化 */
}

/* --- メインコンテンツ領域 --- */
main {
    display: flex;
    flex-direction: column;
    flex: 1; /* ヘッダーとティッカー以外の高さを埋める */
    overflow: hidden;
}

/* --- 瓶と進捗バー --- */
.bottle-section {
    padding: 0 var(--spacing-md) var(--spacing-md); /* 上部の余白をなくす */
    text-align: center;
    flex: 1; /* 残りの高さを占める（ヘッダーと合わせて約65%になる） */
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* HTML構造変更後のスマホ向けレイアウト調整 */
.goal-info-area {
    order: 2; /* スマホでは進捗情報を下に配置 */
    width: 100%;
    flex-shrink: 0;
}

.bottle-visual-area {
    order: 1; /* スマホでは瓶を上に配置 */
    width: 100%;
    flex: 1; /* 瓶のエリアがしっかり高さを確保するように */
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.bottle-carousel-container {
    width: 100%;
    flex: 1; /* 高さを自動調整 */
    position: relative;
    overflow: hidden;
    touch-action: pan-y; /* 縦スクロールは許可、横スワイプをJSで処理 */
    margin: 0 auto;
}

.bottle-name-overlay {
    position: absolute;
    bottom: 35px; /* プログレスバーが上に被さるため、被らないように上に配置 */
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85rem; /* 文字サイズを少し小さく */
    color: var(--color-navy);
    font-weight: bold;
    pointer-events: none;
    z-index: 30; /* progress-containerより手前 */
    background: rgba(255, 255, 255, 0.7);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Montserrat', 'Noto Sans JP', sans-serif;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.share-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    opacity: 0.7;
}

.progress-container {
    margin-top: -4vh; /* キャンバス領域にめり込ませて上に寄せる */
    padding: 0 var(--spacing-lg);
    flex-shrink: 0; /* プログレスバーが潰れないようにする */
    position: relative;
    z-index: 20; /* キャンバスより手前に表示 */
}

.progress-bar {
    width: 100%;
    height: 24px;
    background-color: var(--color-light-gray);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background-color: var(--color-terracotta);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.5s ease;
    min-width: 15%; /* パーセンテージ文字が見える最小幅 */
}

#progress-text {
    color: var(--color-white);
    font-size: 0.8rem;
    font-weight: bold;
    white-space: nowrap;
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 0.05em;
}

.amount-display {
    margin-top: var(--spacing-sm);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text-main);
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 0.02em;
}

/* --- つもりボタンセクション --- */
.buttons-section {
    padding: var(--spacing-md);
    background-color: var(--color-white);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    height: 35vh; /* 高さ35%に拡大 (5%広げる) */
    flex-shrink: 0;
    overflow-y: auto; /* ボタンが多い場合はこのエリア内でスクロール */
}

.buttons-section h2 {
    font-size: 1.2rem;
    margin-top: 0;
    margin-bottom: var(--spacing-md);
    text-align: center;
    font-family: 'Montserrat', 'Noto Sans JP', sans-serif;
    letter-spacing: 0.05em;
}

/* 3列のグリッドレイアウト */
.button-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.tsumori-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1.15; /* 少し縦長にして余裕を持たせる */
    border-radius: 16px; /* 丸みを少し大きくして優しい印象に */
    border: 1px solid rgba(255, 255, 255, 0.4); /* うっすらとしたハイライト枠線 */
    cursor: pointer;
    color: var(--color-white);
    font-weight: bold;
    padding: var(--spacing-sm);
    
    /* カフェモダンなリッチな立体感（グラデーションと複数シャドウの組み合わせ） */
    background-image: linear-gradient(135deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0) 50%, rgba(0,0,0,0.05) 100%);
    box-shadow: 
        0 6px 12px rgba(0,0,0,0.08), 
        inset 0 2px 4px rgba(255,255,255,0.5), 
        inset 0 -4px 6px rgba(0,0,0,0.05);
    text-shadow: 0 1px 2px rgba(0,0,0,0.15); /* 文字の視認性を高める影 */
    
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    
    position: relative;

    /* ドラッグ時のテキスト選択やメニュー表示を防止 */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.tsumori-btn:active {
    transform: translateY(4px); /* 押し込みを深くする */
    box-shadow: 
        0 2px 4px rgba(0,0,0,0.1), 
        inset 0 2px 4px rgba(255,255,255,0.3), 
        inset 0 -2px 4px rgba(0,0,0,0.05);
}

.tsumori-btn img.btn-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 6px;
    object-fit: contain;
    filter: drop-shadow(0 4px 4px rgba(0,0,0,0.15)); /* アイコンにも影をつけて浮かせる */
    
    /* 長押しメニューや画像のドラッグを防ぐ */
    pointer-events: none;
    -webkit-user-drag: none;
}

.tsumori-btn span {
    font-size: 0.85rem;
    text-align: center;
    line-height: 1.2;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.tsumori-btn span.long-text {
    font-size: 0.7rem;
    letter-spacing: 0; /* 文字間隔を詰めて収まりやすくする */
}

.tsumori-btn .btn-amount {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    margin-top: 2px;
    background-color: rgba(255, 255, 255, 0.95); /* 値札のような白いバッジ */
    color: var(--color-navy); /* 金額の文字色はネイビーで引き締める */
    padding: 3px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    text-shadow: none; /* バッジ内の文字には影をつけない */
}

/* --- つもりボタン 編集/削除バッジ --- */
.delete-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 24px;
    height: 24px;
    background-color: #e74c3c;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 10;
}

.edit-badge {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 24px;
    height: 24px;
    background-color: var(--color-sage);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 10;
}

/* --- 編集モード時のスタイル --- */
.tsumori-btn.edit-mode-active {
    background-color: #e0e0e0 !important;
    color: #888888 !important;
    border-color: #cccccc !important;
    box-shadow: none;
}

.tsumori-btn.edit-mode-active img.btn-icon {
    opacity: 0.4;
    filter: grayscale(100%);
}

/* 各ボタンの背景色（動的に付与） */
.bg-terracotta { background-color: var(--color-terracotta); }
.bg-sage { background-color: var(--color-sage); }
.bg-sand { background-color: var(--color-sand); }

/* 新規作成ボタン専用のスタイル */
.new-create-btn {
    background-color: #fdfaf6; /* よりカフェっぽいクリーム色 */
    background-image: none; /* グラデーションなし */
    border: 2px dashed var(--color-sand);
    color: var(--color-sand);
    box-shadow: none;
    text-shadow: none;
}

.new-create-btn .plus-icon {
    font-size: 28px;
    font-weight: normal;
    margin-bottom: 5px;
}

/* --- Sortable Drag Styles --- */
.sortable-ghost {
    opacity: 0.4;
}

.sortable-drag {
    cursor: grabbing !important;
    box-shadow: 0 8px 12px rgba(0,0,0,0.2) !important;
}

/* --- リアルタイム通知ティッカー --- */
.ticker-container {
    position: relative;
    width: 100%;
    height: 5vh; /* 残り5%の高さ */
    min-height: 30px;
    background-color: rgba(43, 58, 74, 1);
    overflow: hidden;
    flex-shrink: 0;
    pointer-events: auto; /* タップ可能にする */
    cursor: pointer;
}

.ticker-message {
    position: absolute;
    top: 50%;
    left: 100%;
    transform: translateY(-50%) translateX(0);
    white-space: nowrap;
    color: var(--color-white);
    font-size: 0.85rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: ticker-slide-rtl 12s linear forwards;
}

.ticker-profile-img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background-color: var(--color-white);
}

@keyframes ticker-slide-rtl {
    0% { left: 100%; transform: translateY(-50%) translateX(0); }
    100% { left: 0; transform: translateY(-50%) translateX(-100%); }
}

/* --- トースト通知 --- */
.toast-container {
    position: absolute;
    bottom: 8vh; /* ティッカーより少し上に配置 */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
    pointer-events: none;
    width: 90%;
    max-width: 400px;
}

.toast-message {
    background-color: rgba(43, 58, 74, 0.95); /* --color-navy の透過 */
    color: var(--color-white);
    padding: 12px 20px;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    animation: toast-fade-in 0.3s forwards, toast-fade-out 0.3s 3s forwards;
}

@keyframes toast-fade-in {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-fade-out {
    to { opacity: 0; transform: translateY(-10px); }
}

/* --- Congratulations Modern --- */
.congratulations-modern {
    position: fixed;
    top: 35%; /* 瓶の上部あたり */
    left: 50%;
    white-space: nowrap;
    font-size: clamp(1.1rem, 5.5vw, 1.8rem); /* 画面幅に合わせて文字サイズを自動調整 */
    font-weight: 500; /* 太すぎない上品な太さ */
    color: var(--color-navy);
    background-color: rgba(244, 240, 234, 0.85); /* アプリ背景色(クリーム色)の半透明 */
    padding: clamp(10px, 2.5vw, 15px) clamp(20px, 5vw, 40px); /* 余白も自動調整 */
    border-radius: 50px;
    border: 1px solid var(--color-sand);
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    backdrop-filter: blur(4px); /* すりガラス効果 */
    z-index: 999999;
    pointer-events: none;
    animation: congrats-fade 6s cubic-bezier(0.25, 1, 0.5, 1) forwards; /* 4秒から1.5倍の6秒に変更 */
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 0.1em; /* はみ出し防止のため文字間隔を少しだけ詰める */
    text-transform: uppercase;
}

@keyframes congrats-fade {
    0% { opacity: 0; transform: translate(-50%, -30%) scale(0.95); }
    10% { opacity: 1; transform: translate(-50%, -50%) scale(1); } /* 現れる速度はキープ */
    90% { opacity: 1; transform: translate(-50%, -50%) scale(1); } /* 長く表示してから消える */
    100% { opacity: 0; transform: translate(-50%, -70%) scale(0.95); }
}

/* --- 貯金時の光の粒子エフェクト --- */
.deposit-light-particle {
    position: fixed;
    top: 0;
    left: 0;
    width: 10px;
    height: 10px;
    /* JSから渡されたボタンの色を使用して発色させる */
    background: radial-gradient(circle, var(--particle-color, rgba(217, 122, 98, 1)) 0%, var(--particle-color-alpha, rgba(217, 122, 98, 0.6)) 50%, var(--particle-color-transparent, rgba(217, 122, 98, 0)) 100%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 0 10px var(--particle-color-alpha, rgba(217, 122, 98, 0.6));
}

/* --- 画像エラー時のレイアウト維持用白背景 --- */
.img-fallback-bg {
    background-color: var(--color-white) !important;
}

/* =========================================
   PC Layout (Dashboard Style)
   ========================================= */
@media (min-width: 1024px) {
    body {
        align-items: stretch; /* コンテナを画面の高さ全体に広げる */
        overflow: hidden; /* 画面全体に意図せず発生するスクロールを防止 */
    }

    #app-container {
        max-width: 100%; /* 横幅の制限を解除し画面いっぱいに */
        height: 100vh; /* 高さの制限を解除し画面いっぱいに */
        max-height: none;
        margin: 0;
        border-radius: 0; /* 外枠の角丸を解除 */
        flex-direction: row; /* 要素を横並びにする */
        box-shadow: none; /* 外側の影を解除 */
    }

    /* --- 左側：サイドバー（ヘッダーを変形） --- */
    .app-header {
        position: relative;
        width: 20%; /* 左列のメニュー幅を20%に設定 */
        flex-shrink: 0;
        height: 100%;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        background-color: var(--color-navy); /* 画像に合わせて深いネイビーに変更 */
        border-right: none;
        border-radius: 0; /* 左端の角丸を解除 */
        padding: var(--spacing-lg);
        pointer-events: auto; /* PCでは常に操作可能 */
    }

    /* サイドバー上部にアプリのロゴタイトルを追加 */
    .app-header::before {
        content: "つもり貯金";
        display: block;
        font-family: 'Montserrat', 'Noto Sans JP', sans-serif;
        font-size: 1.5rem;
        font-weight: bold;
        color: var(--color-white); /* 背景がネイビーなので白抜き文字に */
        text-align: center;
        margin-bottom: var(--spacing-lg);
        padding-bottom: var(--spacing-md);
        border-bottom: 2px dashed rgba(255, 255, 255, 0.2); /* 境界線もうっすらとした白に変更 */
        letter-spacing: 0.1em;
    }

    .menu-container {
        width: 100%;
    }

    #menu-btn {
        display: none; /* ハンバーガーボタンを隠す */
    }

    /* ドロップダウンメニューを常時表示のリストに変換 */
    #dropdown-menu {
        position: static;
        display: block !important; /* JSの非表示クラスを上書き */
        background: transparent;
        border: none;
        box-shadow: none;
        min-width: auto;
        padding: 0;
    }

    .dropdown-menu ul {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .dropdown-menu li {
        border-bottom: none;
        border-radius: 12px;
        padding: 14px 16px;
        font-weight: bold;
        transition: background-color 0.2s, color 0.2s, transform 0.2s;
        color: var(--color-white); /* メニューの文字を白に */
    }

    /* PC版のホバー時はテラコッタ文字ではなく、うっすら白背景にする */
    .dropdown-menu li:hover,
    .dropdown-menu li:active {
        transform: translateX(4px); /* ホバーで少し右に動く遊び心 */
        background-color: rgba(255, 255, 255, 0.1);
        color: var(--color-white);
    }

    .dropdown-menu li.menu-version {
        color: rgba(255, 255, 255, 0.4);
        padding: 8px 16px;
        text-align: left;
        font-weight: normal;
        font-size: 0.85rem;
    }

    /* PC版では画面右側に履歴が常時表示されるため、メニュー内の「つもり履歴」は非表示にする */
    #menu-history {
        display: none;
    }

    /* 右上のアクションボタンをサイドバー下部に移動 */
    .header-actions {
        margin-top: auto; /* 一番下に押しやる */
        flex-direction: row;
        justify-content: space-evenly;
        padding-top: var(--spacing-lg);
        border-top: 2px dashed rgba(255, 255, 255, 0.2);
    }

    .icon-btn {
        font-size: 1.5rem; /* PCではアイコンを少し大きく */
        color: var(--color-navy); /* 白背景に合わせてアイコン色をネイビーに */
        background-color: var(--color-white); /* 塗りつぶされた白丸背景 */
        width: 48px;
        height: 48px;
        border-radius: 50%;
        padding: 0;
    }

    /* プロフィール画像も白丸に合わせてサイズ調整・枠線非表示 */
    .header-profile-img {
        width: 48px;
        height: 48px;
        border: none;
        background-color: var(--color-white);
    }

    /* --- 右側：メインコンテンツ --- */
    main {
        width: 80%; /* 全体の残り80% */
        display: grid;
        grid-template-columns: 30% 35% 35%; /* 左からボタン26%、分析39%、右側(履歴)35% (合計100%) */
        grid-template-rows: 55% 45%; /* 上段(瓶)と下段(達成率・ボタン)の高さ割合 */
        height: calc(100% - 40px); /* 下部のティッカーの分を引く */
        background-color: var(--color-bg);
    }

    /* --- 左側上段：瓶と達成率エリア --- */
    .bottle-section {
        grid-column: 1 / 3; /* 下段のボタンと分析エリアの上部まで広げる */
        grid-row: 1 / 2;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        box-sizing: border-box;
        padding: 0;
    }

    .bottle-visual-area {
        grid-column: auto;
        grid-row: auto;
        width: 100%;
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0;
    }

    .goal-info-area {
        grid-column: auto;
        grid-row: auto;
        width: 60%; /* 広がりすぎないように制限 */
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 0 0 var(--spacing-lg) 0;
        box-sizing: border-box;
    }

    #bottle-carousel-container {
        width: 100%;
        height: 100%; /* 親要素の高さいっぱいに固定して、読み込み遅延による潰れを防ぐ */
        max-width: 100%;
        max-height: 100%;
        transform: translateY(20px); /* 下部にプログレスバーがあるため、Y軸移動を少し減らす */
    }

    /* PC専用のタイトルと画像を表示（削除要望により非表示） */
    .pc-only-goal-header {
        display: none !important;
    }

    /* スマホで表示していた瓶の上のラベル（名前）をPCでも表示する */
    #bottle-name-overlay {
        display: flex !important;
        font-size: 1.1rem;
        bottom: 20px;
    }

    .progress-container {
        margin-top: 0; /* スマホ用のマイナスマージンを打ち消し */
        padding: 0; /* PCでは余裕を持たせるのをやめる (goal-info-areaの幅で制御) */
        width: 100%;
    }

    /* --- PC用の達成率表示 --- */
    .progress-bar {
        height: 32px; /* 16pxの2倍 */
    }

    #progress-text {
        font-size: 1.1rem; /* 0.55remの2倍 */
    }

    .amount-display {
        font-size: 1.5rem; /* 0.75remの2倍 */
        margin-top: 12px; /* 6pxの2倍 */
    }

    /* --- 左側下段：つもりボタンエリア --- */
    .buttons-section {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
        width: 100%;
        height: 100%;
        border-radius: 0; /* 右上の角丸を解除 */
        border-left: none; /* 左端なので不要 */
        border-right: 1px solid var(--color-light-gray); /* 分析エリアとの境界線 */
        border-top: 1px solid var(--color-light-gray); /* 上にも境界線を追加 */
        background-color: var(--color-white);
        padding: var(--spacing-lg);
        box-sizing: border-box;
    }

    .button-grid {
        grid-template-columns: repeat(auto-fill, 120px);
        gap: 16px;
        justify-content: center;
    }

    .tsumori-btn {
        width: 120px;
        height: 120px;
        aspect-ratio: auto; /* スマホ用のアスペクト比指定を解除 */
        padding: var(--spacing-sm) 4px; /* 横の余白を少し詰める */
    }

    .tsumori-btn img.btn-icon {
        width: 56px;
        height: 56px;
        margin-bottom: 4px;
    }

    /* --- 分析エリア (PC専用) --- */
    .dashboard-analysis-section {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
        display: flex !important;
        flex-direction: column;
        width: 100%;
        height: 100%;
        background-color: var(--color-white);
        border-top: 1px solid var(--color-light-gray);
        padding: var(--spacing-lg);
        box-sizing: border-box;
        overflow-y: auto;
    }

    .dashboard-analysis-section h2 {
        font-family: 'Montserrat', 'Noto Sans JP', sans-serif;
        color: var(--color-navy);
        font-size: 1.1rem;
        margin-top: 0;
        margin-bottom: var(--spacing-md);
        text-align: center;
    }

    .pc-analysis-container {
        max-height: none;
        overflow-y: visible;
        padding-right: 0;
    }

    .pc-analysis-row {
        flex-direction: row !important;
        align-items: center;
        justify-content: center;
        gap: var(--spacing-lg) !important;
    }

    .pc-analysis-row .analysis-pie-chart {
        width: 130px;
        height: 130px;
        flex-shrink: 0;
    }

    .pc-analysis-row .analysis-legend {
        width: auto;
        flex: 1;
    }

    /* --- 右側：履歴・タイムラインエリア（PC専用） --- */
    .dashboard-logs-section {
        grid-column: 3 / 4;
        grid-row: 1 / 3;
        display: flex !important; /* スマホ用の非表示設定を確実に上書きする */
        flex-direction: column;
        width: 100%;
        flex-shrink: 0; /* 画面幅が狭くても潰れずに表示領域を確保する */
        height: 100%;
        background-color: #fdfaf6; /* カフェっぽいクリーム色 */
        border-left: 1px solid var(--color-sand);
        padding: var(--spacing-lg);
        box-sizing: border-box;
    }

    .log-panel {
        flex: 1;
        display: flex;
        flex-direction: column;
        margin-bottom: var(--spacing-lg);
        min-height: 0; /* コンテナ内でのスクロールを有効にするため */
    }

    .log-panel:last-child {
        margin-bottom: 0;
    }

    .log-panel h3 {
        font-family: 'Montserrat', 'Noto Sans JP', sans-serif;
        color: var(--color-navy);
        font-size: 1.1rem;
        margin-top: 0;
        margin-bottom: var(--spacing-sm);
        padding-bottom: 8px;
        border-bottom: 2px dashed var(--color-sand);
    }

    .log-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden; /* 親レベルでの意図しないスクロールを防止 */
    }

    /* モーダル用の中身コンテナを親の高さにフィットさせ、スクロールはこの内部で行う */
    .log-content .history-container,
    .log-content .timeline-container {
        flex: 1;
        max-height: none !important;
        min-height: 0; /* フレックスアイテムが中身に合わせて伸びるのを防ぐ */
    }

    .log-content .timeline-container {
        overflow-y: auto !important;
    }

    /* --- 下部：リアルタイム通知ティッカー --- */
    .ticker-container {
        position: absolute;
        bottom: 0;
        right: 0;
        width: 80%; /* サイドバー20%を除いた残り80%に広げる */
        height: 40px; /* PC用の固定高さ */
        border-radius: 0; /* 右下の角丸を解除 */
        display: flex;
        align-items: center;
    }

    .ticker-message {
        font-size: 1rem;
    }
}
