/* デジタルフォント */
@font-face {
    font-family: 'Digital';
    src: url('/fonts/digital.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* ==============================================
   リセット & ベース
   ============================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    /* ダブルタップによる拡大を防止 */
    touch-action: manipulation;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
    font-size: 14px;
    background: #e8d8c0;
    color: #4a3728;
    -webkit-font-smoothing: antialiased;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.hidden {
    display: none !important;
}

/* ==============================================
   スクリーン管理
   ============================================== */
.screen {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    background: #e8d8c0;
    background-image: url('/images/bg_general-812h@2x.png');
    background-size: cover;
    background-position: center top;
    padding-bottom: env(safe-area-inset-bottom);
}

.screen.active {
    display: flex;
}

/* 各スクリーンの背景 */
#screen-record {
    background-image: url('/images/bg_graph-812h@2x.png');
}

#screen-graph {
    background-image: url('/images/bg_graph-812h@2x.png');
}

/* ボトムナビがある場合は余白を作る */
.main-screen {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==============================================
   ローディング
   ============================================== */
.loading-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
}

.loading-bear-img {
    width: 60px;
    height: 60px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0d0c0;
    border-top-color: #8b6a4f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==============================================
   セットアップ画面 共通
   ============================================== */

/* メッセージバー */
.setup-msg-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 14px 12px 10px;
    padding: 0;
}

.bear-icon-img {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

/* 吹き出しテキスト (bg_message は左向きのしっぽつき) */
.setup-msg-text {
    flex: 1;
    background-image: url('/images/bg_message@2x.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    padding: 14px 14px 10px 24px;
    min-height: 48px;
    line-height: 1.5;
    font-size: 13px;
    color: #5a3a18;
    font-weight: 500;
    /* vertically center text */
    display: block;
}

/* 入力行 */
.setup-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 16px 16px;
}

.setup-label {
    font-size: 15px;
    color: #4a3728;
    width: 72px;
    flex-shrink: 0;
}

/* 値表示ボックス */
.value-display {
    flex: 1;
    padding: 10px 30px;
    border-radius: 8px;
    font-size: 30px;
    font-weight: 600;
    text-align: right;
    min-width: 120px;
    background: #fff;
    border: 2px solid #d0c0a8;
}

.value-display.cyan {
    background-image: url('/images/bg_lcd@2x.png');
    background-size: 100% 100%;
    background-color: transparent;
    border: none;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

/* 単位トグル */
.unit-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.unit-btn {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #c8b898;
    background: rgba(255,255,255,0.7);
    font-size: 12px;
    color: #6b5040;
    transition: background 0.1s;
}

.unit-btn.active {
    background: #8b6a4f;
    color: #fff;
    border-color: #8b6a4f;
}

/* OKボタン（クマ画像） */
.setup-ok-row {
    display: flex;
    justify-content: flex-end;
    padding: 16px 20px;
    margin-top: auto;
}

.bear-ok-btn {
    position: relative;
    top: 0;
    width: 90px;
    height: 65px;
    background-image: url('/images/btn_bg_ok@2x.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-color: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 10px;
    font-size: 16px;
    font-weight: bold;
    color: #5a3a18;
    letter-spacing: 0.05em;
    /* 画像の不透明部分の輪郭に沿った drop-shadow で立体化 */
    filter: drop-shadow(0 5px 0 rgba(100, 55, 10, 0.50))
            drop-shadow(0 7px 5px rgba(0, 0, 0, 0.20));
    transition: top 0.08s ease, filter 0.08s ease;
}

.bear-ok-btn:active {
    top: 4px;
    filter: drop-shadow(0 1px 0 rgba(100, 55, 10, 0.40))
            drop-shadow(0 2px 3px rgba(0, 0, 0, 0.14));
}

/* ==============================================
   テンキー（セットアップ用・木目調）
   ============================================== */
.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0 16px;
}

.setup-numpad {
    flex: 1;
    align-content: center;
}

.setup-numpad .num-key {
    aspect-ratio: 160 / 134;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-color: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    transition: opacity 0.08s, transform 0.08s;
}

.setup-numpad .num-key:active {
    opacity: 0.75;
    transform: scale(0.93);
}

/* 通常状態 */
.setup-numpad .num-key[data-key="1"] { background-image: url('/images/btn_bg_num_1@2x.png'); }
.setup-numpad .num-key[data-key="2"] { background-image: url('/images/btn_bg_num_2@2x.png'); }
.setup-numpad .num-key[data-key="3"] { background-image: url('/images/btn_bg_num_3@2x.png'); }
.setup-numpad .num-key[data-key="4"] { background-image: url('/images/btn_bg_num_4@2x.png'); }
.setup-numpad .num-key[data-key="5"] { background-image: url('/images/btn_bg_num_5@2x.png'); }
.setup-numpad .num-key[data-key="6"] { background-image: url('/images/btn_bg_num_6@2x.png'); }
.setup-numpad .num-key[data-key="7"] { background-image: url('/images/btn_bg_num_7@2x.png'); }
.setup-numpad .num-key[data-key="8"] { background-image: url('/images/btn_bg_num_8@2x.png'); }
.setup-numpad .num-key[data-key="9"] { background-image: url('/images/btn_bg_num_9@2x.png'); }
.setup-numpad .num-key[data-key="C"] { background-image: url('/images/btn_bg_num_c@2x.png'); }
.setup-numpad .num-key[data-key="0"] { background-image: url('/images/btn_bg_num_0@2x.png'); }
.setup-numpad .num-key[data-key="."] { background-image: url('/images/btn_bg_num_dot@2x.png'); }

/* ==============================================
   テンキー（記録用・白丸ボタン）
   ============================================== */
.record-numpad {
    padding: 0 16px;
    gap: 8px;
    flex-shrink: 0;
}

.record-numpad .num-key {
    aspect-ratio: 1.4;
    border-radius: 12px;
    background: #fff;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    font-size: 24px;
    font-weight: 500;
    color: #333;
    transition: background 0.08s;
}

.record-numpad .num-key:active {
    background: #f0e8d8;
}

/* ==============================================
   確認画面
   ============================================== */
.confirm-card {
    background: rgba(255,255,255,0.9);
    border-radius: 16px;
    margin: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.confirm-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0e8d8;
}

.confirm-row:last-child {
    border-bottom: none;
}

.confirm-label {
    color: #6b5040;
    font-size: 15px;
}

.confirm-value {
    font-size: 20px;
    font-weight: 600;
    color: #4a3728;
}

.confirm-btns {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
}

/* 保存するボタン（オレンジ立体） */
.btn-save {
    position: relative;
    top: 0;
    padding: 15px 16px;
    border-radius: 50px;
    background: linear-gradient(to bottom, #fac94a 0%, #e08820 60%, #c87010 100%);
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
    box-shadow:
        0 6px 0 #9a5508,
        0 8px 14px rgba(0, 0, 0, 0.28);
    transition: top 0.08s ease, box-shadow 0.08s ease;
}

.btn-save:active {
    top: 4px;
    box-shadow:
        0 2px 0 #9a5508,
        0 3px 6px rgba(0, 0, 0, 0.20);
}

/* 戻るボタン（ブラウン立体） */
.btn-back {
    position: relative;
    top: 0;
    padding: 13px 16px;
    border-radius: 50px;
    background: linear-gradient(to bottom, #cfc0b0 0%, #a09080 60%, #887868 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.20);
    box-shadow:
        0 5px 0 #5a4838,
        0 7px 12px rgba(0, 0, 0, 0.22);
    border: none;
    transition: top 0.08s ease, box-shadow 0.08s ease;
}

.btn-back:active {
    top: 4px;
    box-shadow:
        0 1px 0 #5a4838,
        0 2px 5px rgba(0, 0, 0, 0.16);
}

/* ==============================================
   グラフ画面
   ============================================== */
.ad-banner {
    display: flex;
    justify-content: center;
    padding: 8px 0;
    flex-shrink: 0;
}

.ad-banner-small {
    display: flex;
    justify-content: center;
    padding: 4px 0;
    flex-shrink: 0;
}

/* 広告プレースホルダー */
.ad-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(232, 224, 208, 0.8);
    border: 1px dashed #c0b090;
    border-radius: 6px;
    color: #a09080;
    font-size: 12px;
    font-style: italic;
}

.ad-320x100 { width: 320px; height: 100px; }
.ad-320x50  { width: 320px; height: 50px; }
.ad-300x250 { width: 300px; height: 250px; }

/* グラフ期間ボタン */
.graph-period-btns {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 10px 16px 6px;
    flex-shrink: 0;
}

/* カレンダーアイコンボタン（34x34px @1x = 68x68 @2x） */
.period-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    background-color: transparent;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.55;
    transition: opacity 0.15s, transform 0.1s;
}

.period-btn:active {
    transform: scale(0.9);
}

.period-btn.active {
    opacity: 1;
}

/* 通常状態 */
.period-btn[data-days="1"]  { background-image: url('/images/icon_graph_range_1@2x.png');  }
.period-btn[data-days="7"]  { background-image: url('/images/icon_graph_range_7@2x.png');  }
.period-btn[data-days="31"] { background-image: url('/images/icon_graph_range_31@2x.png'); }
.period-btn[data-days="90"] { background-image: url('/images/icon_graph_range_90@2x.png'); }

/* 選択状態（darker icon） */
.period-btn.active[data-days="1"]  { background-image: url('/images/icon_graph_range_1-s@2x.png');  }
.period-btn.active[data-days="7"]  { background-image: url('/images/icon_graph_range_7-s@2x.png');  }
.period-btn.active[data-days="31"] { background-image: url('/images/icon_graph_range_31-s@2x.png'); }
.period-btn.active[data-days="90"] { background-image: url('/images/icon_graph_range_90-s@2x.png'); }

/* 右Y軸オーバーレイ用ラッパー（screen の flex:column 内で flex:1 を引き継ぐ） */
.graph-area-wrap {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Y軸固定オーバーレイ共通（div+絶対配置テキスト方式・横スクロール非連動・完全透過） */
.y-overlay-left,
.y-overlay-right {
    position: absolute;
    top: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 10;
}

.y-overlay-left  { left: 0; }
.y-overlay-right { right: 0; }

.y-overlay-left span,
.y-overlay-right span {
    position: absolute;
    transform: translateY(-50%);
    font-size: 10px;
    white-space: nowrap;
    line-height: 1;
}

/* 左：右寄せ（目盛り値をグラフ端に合わせる） */
.y-overlay-left span {
    right: 4px;
    color: #6b5040;
}

/* 右：左寄せ */
.y-overlay-right span {
    left: 4px;
    color: #8b7868;
}

/* ========================================
   グラフ吹き出し（マーカータップ）
   ======================================== */
.chart-bubble {
    position: absolute;
    z-index: 20;
    pointer-events: none;
    /* マーカー位置を基準に中央・マーカー上に表示 */
    transform: translateX(-50%) translateY(calc(-100% - 12px));
}

.chart-bubble-inner {
    position: relative;
    background: rgba(40, 22, 8, 0.93);
    border-radius: 10px;
    padding: 7px 16px 9px;
    text-align: center;
    min-width: 90px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.35);
}

/* 下向きの三角（しっぽ） */
.chart-bubble-inner::after {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 50%;
    transform: translateX(-50%);
    border-left:  9px solid transparent;
    border-right: 9px solid transparent;
    border-top:   9px solid rgba(40, 22, 8, 0.93);
}

.chart-bubble-date {
    font-size: 11px;
    color: #c8a88a;
    margin-bottom: 3px;
    letter-spacing: 0.5px;
}

.chart-bubble-value {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 3px;
}

.chart-bubble-weight {
    font-family: 'Digital', "Courier New", monospace;
    font-size: 36px;
    color: #ffffff;
    letter-spacing: 2px;
    line-height: 1;
}

.chart-bubble-unit {
    font-size: 14px;
    color: #c8a88a;
    padding-bottom: 2px;
}

.chart-bubble-bodyfat {
    font-size: 12px;
    color: #7ee0c8;
    margin-top: 3px;
    letter-spacing: 0.5px;
}

/* グラフコンテナ（横スクロール対応） */
.graph-wrap {
    flex: 1;
    position: relative;
    /* margin: 4px 8px; */
    background: rgba(255,255,255,0.85);
    /* border-radius: 12px; */
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 220px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.1);
    -webkit-overflow-scrolling: touch;
    /* スクロールバーを細くして目立たなくする */
    scrollbar-width: thin;
    scrollbar-color: rgba(139,106,79,0.3) transparent;
}

.graph-wrap::-webkit-scrollbar {
    height: 4px;
}

.graph-wrap::-webkit-scrollbar-track {
    background: transparent;
}

.graph-wrap::-webkit-scrollbar-thumb {
    background: rgba(139,106,79,0.3);
    border-radius: 2px;
}

/* スクロールする内部コンテナ（JSでwidthを動的設定） */
#graph-canvas-wrap {
    height: 100%;
    min-height: 220px;
    position: relative;
}

.graph-wrap canvas {
    display: block;
    height: 100% !important;
}

.graph-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #a09080;
    pointer-events: none;
}

.graph-empty-sub {
    font-size: 12px;
}

/* ==============================================
   記録画面
   ============================================== */
.record-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 14px 16px;
    background: rgba(245, 237, 224, 0.85);
    flex-shrink: 0;
}

.record-title {
    font-size: 17px;
    font-weight: 700;
    color: #4a3728;
}

.help-btn {
    position: absolute;
    right: 16px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #c8b898;
    background: rgba(250,240,224,0.9);
    color: #6b5040;
    font-size: 14px;
    font-weight: 700;
}

/* フィールド群 */
.record-fields {
    margin: 10px 16px 10px;
    background: rgba(255,255,255,0.92);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 8px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.record-field-row {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    gap: 10px;
    border-bottom: 1px solid #f0e8d8;
}

.record-field-row:last-child {
    border-bottom: none;
}

.record-field-label {
    font-size: 14px;
    color: #6b5040;
    width: 68px;
    flex-shrink: 0;
}

.record-datetime {
    flex: 1;
    font-size: 15px;
    color: #4a3728;
    font-weight: 500;
}

.datetime-edit-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #5ecece;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.datetime-edit-btn:active {
    background: #4ab8b8;
}

/* デジタルディスプレイ */
.record-input-row {
    cursor: pointer;
    transition: background 0.1s;
}

.record-input-row.active {
    background: #fef8f0;
}

/* デジタルディスプレイ（記録画面） */
.digital-display {
    flex: 1;
    background: #f0f0f0;
    border-radius: 8px;
    padding: 7px 12px;
    min-width: 100px;
    text-align: right;
    border: 1.5px solid #ddd;
}

.record-input-row.active .digital-display {
    background: #fff;
    border-color: #5ecece;
    box-shadow: 0 0 0 2px rgba(94, 206, 206, 0.25);
}

.digital-value {
    font-family: 'Digital', "Courier New", monospace;
    font-size: 24px;
    font-weight: normal;
    color: #888;
    letter-spacing: 1px;
}

/* 入力中（アクティブ）は大きく・濃く */
.record-input-row.active .digital-value {
    font-size: 36px;
    color: #222;
}

.record-unit {
    font-size: 14px;
    color: #6b5040;
    width: 24px;
    flex-shrink: 0;
}

.clear-input-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a09080;
    flex-shrink: 0;
    /* アクティブでないフィールドでは非表示 */
    visibility: hidden;
}

.record-input-row.active .clear-input-btn {
    visibility: visible;
}

.clear-input-btn:active {
    color: #8b6a4f;
}

/* OK / スキップ ボタン（立体） */
.btn-ok-orange {
    position: relative;
    top: 0;
    margin: 8px 16px 12px;
    padding: 15px 16px;
    border-radius: 50px;
    width: calc(100% - 32px);
    /* OK状態: オレンジ */
    background: linear-gradient(to bottom, #fac94a 0%, #e08820 60%, #c87010 100%);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.05em;
    /* 立体感: 下面の厚み + ドロップシャドウ */
    box-shadow:
        0 6px 0 #9a5508,
        0 8px 14px rgba(0, 0, 0, 0.28);
    transition: top 0.08s ease, box-shadow 0.08s ease;
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

/* 押下: ボタンが沈み込む */
.btn-ok-orange:active {
    top: 4px;
    box-shadow:
        0 2px 0 #9a5508,
        0 3px 6px rgba(0, 0, 0, 0.2);
}

/* スキップ状態: ブラウン系 */
.btn-ok-orange.is-skip {
    background: linear-gradient(to bottom, #b8a898 0%, #8a7868 60%, #72645a 100%);
    box-shadow:
        0 6px 0 #4a3828,
        0 8px 14px rgba(0, 0, 0, 0.25);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.btn-ok-orange.is-skip:active {
    top: 4px;
    box-shadow:
        0 2px 0 #4a3828,
        0 3px 6px rgba(0, 0, 0, 0.18);
}

/* ==============================================
   設定画面
   ============================================== */
.settings-msg-bar {
    margin-top: 12px;
    flex-shrink: 0;
}

.settings-wrap {
    padding: 12px 0;
}

.settings-section {
    margin: 0 12px 16px;
    background: rgba(255,255,255,0.92);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 8px rgba(0,0,0,0.08);
}

.settings-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #8b6a4f;
    padding: 12px 16px 8px;
    border-bottom: 1px solid #f0e8d8;
}

.settings-item {
    display: flex;
    align-items: center;
    padding: 16px 16px;
    cursor: pointer;
    transition: background 0.1s;
}

.settings-item:active {
    background: rgba(250,240,224,0.9);
}

.settings-item-label {
    flex: 1;
    font-size: 15px;
    color: #4a3728;
}

.settings-item-value {
    font-size: 15px;
    color: #8b6a4f;
    margin-right: 6px;
}

.settings-arrow {
    color: #c0b090;
    font-size: 20px;
    font-weight: 300;
}

.settings-divider {
    height: 1px;
    background: #f0e8d8;
    margin: 0 16px;
}

.settings-ad {
    display: flex;
    justify-content: center;
    padding: 8px 0 16px;
}

/* トグルスイッチ */
.toggle-switch {
    position: relative;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-track {
    display: block;
    width: 48px;
    height: 28px;
    background: #ccc;
    border-radius: 14px;
    position: relative;
    transition: background 0.2s;
}

.toggle-switch input:checked + .toggle-track {
    background: #5ecece;
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    transition: left 0.2s;
}

.toggle-switch input:checked + .toggle-track .toggle-thumb {
    left: 23px;
}

/* ==============================================
   ボトムナビゲーション
   ============================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(72px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: #d0bfae;
    display: flex;
    align-items: flex-start;
    padding-top: 4px;
    z-index: 100;
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 0;
}

/* ナビアイコン画像（非アクティブ:白 / アクティブ:黒） */
.nav-icon-img {
    width: 26px;
    height: 26px;
    display: block;
    filter: brightness(0) invert(1); /* 黒→白 */
    transition: filter 0.15s;
}

.nav-btn.active .nav-icon-img {
    filter: brightness(0); /* 白→黒 */
}

.nav-label {
    font-size: 10px;
    color: rgba(90,58,24,0.5);
    transition: color 0.15s;
}

.nav-btn.active .nav-label {
    color: #5a3a18;
    font-weight: 600;
}

/* ==============================================
   モーダル 共通
   ============================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-sheet {
    width: 100%;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 0 0 calc(20px + env(safe-area-inset-bottom));
}

/* ==============================================
   日時ピッカー
   ============================================== */
.picker-sheet {
    background: #f5f5f5;
}

.picker-title {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #4a3728;
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.picker-body {
    position: relative;
    overflow: hidden;
    height: 220px;
}

.picker-highlight {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 44px;
    transform: translateY(-50%);
    background: rgba(94, 206, 206, 0.12);
    border-top: 1px solid rgba(94, 206, 206, 0.5);
    border-bottom: 1px solid rgba(94, 206, 206, 0.5);
    pointer-events: none;
    z-index: 2;
}

.picker-col-wrap {
    display: flex;
    height: 100%;
}

.picker-col {
    flex: 1;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.picker-col::-webkit-scrollbar {
    display: none;
}

.picker-item {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #4a3728;
    scroll-snap-align: center;
    white-space: nowrap;
}

.picker-pad {
    height: 88px;
    scroll-snap-align: none;
}

.picker-actions {
    display: flex;
    border-top: 1px solid #e0e0e0;
}

.picker-cancel-btn,
.picker-ok-btn {
    flex: 1;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.picker-cancel-btn {
    color: #5ecece;
    border-right: 1px solid #e0e0e0;
}

.picker-ok-btn {
    color: #5ecece;
}

/* ==============================================
   インステ広告
   ============================================== */
.ad-interstitial-overlay {
    align-items: center;
    justify-content: center;
}

.ad-interstitial-card {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.ad-close-btn {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #666;
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    z-index: 1;
}

.ad-close-btn:active {
    background: #444;
}

.ad-interstitial-inner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-bear-msg {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 10px 12px;
    background: #fdf6ec;
    border-radius: 10px;
}

.ad-bear-msg .bear-icon-img {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.ad-bear-msg-text {
    font-size: 13px;
    color: #5a3a18;
    line-height: 1.5;
    margin: 0;
}

/* ==============================================
   エラー表示
   ============================================== */
.error-msg {
    color: #c05040;
    font-size: 14px;
    text-align: center;
    padding: 16px;
}
