/* ============================================================
 * spreadsheet-mobile.css
 * myCalc栄養計算シート - スマートフォン向けレスポンシブUI
 *
 * ブレークポイント: 767px以下でモバイルビュー表示
 * 依存: spreadsheet.css（デスクトップ版、ダークモード定義）
 * ============================================================ */

/* ============================================================
   iOS auto-zoom prevention baseline
   iOSではfont-size 16px未満のinput/select/textareaにフォーカスすると
   ブラウザが自動ズームする。全入力要素のデフォルトを16pxに設定。
   個別クラスで16px以上の値に上書きは可能。
   ============================================================ */
input, select, textarea {
    font-size: 16px;
}

/* === CSS Custom Properties === */
:root {
    /* Primary */
    --mobile-primary: #16a34a;
    --mobile-primary-dark: #15803d;
    --mobile-primary-light: #f0fdf4;
    --mobile-primary-ring: rgba(22, 163, 74, 0.2);

    /* Light mode */
    --mobile-bg: #f8f9fa;
    --mobile-bg-card: #ffffff;
    --mobile-bg-secondary: #f3f4f6;
    --mobile-bg-tertiary: #f9fafb;
    --mobile-text: #1f2937;
    --mobile-text-secondary: #6b7280;
    --mobile-text-tertiary: #9ca3af;
    --mobile-border: #e5e7eb;
    --mobile-border-light: #f3f4f6;
    --mobile-divider: #d1d5db;

    /* Meal badge colors */
    --mobile-meal-breakfast: #3b82f6;
    --mobile-meal-lunch: #22c55e;
    --mobile-meal-dinner: #f97316;
    --mobile-meal-snack: #a855f7;

    /* Meal group backgrounds */
    --mobile-group-breakfast: #eff6ff;
    --mobile-group-lunch: #f0fdf4;
    --mobile-group-dinner: #fff7ed;
    --mobile-group-snack: #faf5ff;

    /* Semantic */
    --mobile-danger: #ef4444;
    --mobile-danger-light: #fef2f2;
    --mobile-danger-border: #fca5a5;

    /* Shadows */
    --mobile-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --mobile-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
    --mobile-shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.15);

    /* Sizing */
    --mobile-header-height: 48px;
    --mobile-tab-bar-height: 56px;
    --mobile-touch-target: 44px;
    --mobile-fab-size: 56px;

    /* Transitions */
    --mobile-transition-fast: 0.2s ease;
    --mobile-transition-normal: 0.3s ease;
    --mobile-transition-sheet: 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Dark mode variable overrides */
.dark {
    --mobile-bg: #111827;
    --mobile-bg-card: #1f2937;
    --mobile-bg-secondary: #374151;
    --mobile-bg-tertiary: #111827;
    --mobile-text: #f3f4f6;
    --mobile-text-secondary: #9ca3af;
    --mobile-text-tertiary: #6b7280;
    --mobile-border: #374151;
    --mobile-border-light: #374151;
    --mobile-divider: #4b5563;

    --mobile-primary-light: #052e1633;
    --mobile-primary-ring: rgba(34, 197, 94, 0.25);

    --mobile-group-breakfast: #1e2a3a;
    --mobile-group-lunch: #1a2e1a;
    --mobile-group-dinner: #2a2015;
    --mobile-group-snack: #2a1a30;

    --mobile-danger-light: #451a1a;

    --mobile-shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.4);
}


/* ============================================================
 * 1. Viewport Switching
 * ============================================================ */

@media (max-width: 767px) {
    #nutrition-sheet-app {
        display: none !important;
        width: 0 !important;
        max-width: 0 !important;
        overflow: hidden !important;
    }
    #mobile-app {
        display: flex !important;
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
    }
    body:has(#mobile-app) footer {
        display: none !important;
    }
}

@media (min-width: 768px) {
    #mobile-app {
        display: none !important;
    }
}


/* ============================================================
 * 2. Mobile App Shell
 * ============================================================ */

@media (max-width: 767px) {
    html {
        overflow-x: hidden;
        overscroll-behavior-x: none;
    }
    body {
        overflow-x: hidden;
        overscroll-behavior-x: none;
        width: 100%;
        max-width: 100%;
        position: relative;
    }
    #main-content {
        overflow-x: hidden;
        max-width: 100%;
    }
    .mobile-app *,
    .mobile-app *::before,
    .mobile-app *::after {
        box-sizing: border-box;
    }
}

.mobile-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    background: var(--mobile-bg);
    color: var(--mobile-text);
    overscroll-behavior: none;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    touch-action: pan-y pinch-zoom;
    font-family: 'Inter', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
}

/* --- Header --- */
.mobile-header {
    height: var(--mobile-header-height);
    flex-shrink: 0;
    z-index: 50;
    background: var(--mobile-bg-card);
    border-bottom: 1px solid var(--mobile-border);
    display: flex;
    align-items: center;
    padding: 0 12px;
    padding-top: env(safe-area-inset-top, 0px);
}

.mobile-header-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--mobile-text);
}

.mobile-header-action {
    background: none;
    border: none;
    color: var(--mobile-primary);
    font-size: 18px;
    padding: 8px;
    cursor: pointer;
    min-width: var(--mobile-touch-target);
    min-height: var(--mobile-touch-target);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mobile-header-action.secondary {
    color: var(--mobile-text-secondary);
}

/* --- Content Area --- */
.mobile-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    max-width: 100%;
    touch-action: pan-y pinch-zoom;
    padding-bottom: calc(var(--mobile-tab-bar-height) + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
}

.mobile-tab-content {
    display: none;
    animation: mobileTabFadeIn 0.2s ease;
    overflow-x: hidden;
    max-width: 100%;
}

.mobile-tab-content.active {
    display: block;
}

@keyframes mobileTabFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Day Total Bar --- */
.mobile-day-total {
    flex-shrink: 0;
    z-index: 5;
    background: var(--mobile-primary);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

.mobile-day-total-main {
    display: flex;
    align-items: center;
    gap: 4px 8px;
    flex-wrap: wrap;
    padding: 8px 12px;
    cursor: pointer;
    min-height: 36px;
}

.mobile-day-total-nutrients {
    background: rgba(255, 255, 255, 0.12);
    padding: 6px 12px 6px 18px;
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-day-total-nutrients .mobile-nutrient-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.mobile-day-total-nutrients .mobile-nutrient-row:last-child {
    border-bottom: none;
}

.mobile-day-total-nutrients .mobile-nutrient-value {
    font-weight: 600;
}

.dark .mobile-day-total {
    background: var(--mobile-primary-dark);
}

.dark .mobile-day-total-nutrients {
    background: rgba(255, 255, 255, 0.08);
}

.mobile-day-total-label {
    flex-shrink: 0;
    font-weight: 700;
}

.mobile-day-total-item {
    flex-shrink: 0;
}

/* --- Bottom Tab Bar --- */
.mobile-tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    height: calc(var(--mobile-tab-bar-height) + env(safe-area-inset-bottom, 0px));
    background: var(--mobile-bg-card);
    border-top: 1px solid var(--mobile-border);
    display: flex;
    align-items: flex-start;
    padding-top: 4px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--mobile-text-secondary);
    font-size: 10px;
    position: relative;
    transition: color var(--mobile-transition-fast);
    min-height: var(--mobile-touch-target);
    justify-content: center;
}

.mobile-tab-item i {
    font-size: 20px;
}

.mobile-tab-item.active {
    color: var(--mobile-primary);
}

.dark .mobile-tab-item.active {
    color: #22c55e;
}

.mobile-tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 25%;
    right: 25%;
    height: 2px;
    background: var(--mobile-primary);
    border-radius: 1px;
}

.dark .mobile-tab-item.active::after {
    background: #22c55e;
}

/* --- FAB (Floating Action Button) --- */
.mobile-fab {
    position: fixed;
    z-index: 40;
    right: 16px;
    bottom: calc(var(--mobile-tab-bar-height) + env(safe-area-inset-bottom, 0px) + 16px);
    width: var(--mobile-fab-size);
    height: var(--mobile-fab-size);
    border-radius: 50%;
    background: var(--mobile-primary);
    color: #ffffff;
    border: none;
    box-shadow: var(--mobile-shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: transform var(--mobile-transition-fast), box-shadow var(--mobile-transition-fast);
}

.mobile-fab:active {
    transform: scale(0.92);
}

.dark .mobile-fab {
    background: #22c55e;
}


/* ============================================================
 * 3. Sheet Tab - Food List
 * ============================================================ */

/* --- Meal Group Header --- */
.mobile-meal-group-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    overflow: hidden;
    max-width: 100%;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--mobile-border);
    min-height: var(--mobile-touch-target);
    color: var(--mobile-text);
}

.mobile-meal-group-header .chevron,
.mobile-meal-group-header .mobile-chevron {
    transition: transform 0.3s;
    margin-right: 8px;
    font-size: 12px;
}

.mobile-meal-group-header .chevron.collapsed,
.mobile-meal-group-header .mobile-chevron.collapsed {
    transform: rotate(-90deg);
}

/* Meal group background colors */
.mobile-meal-group-header.group-bg-breakfast {
    background: var(--mobile-group-breakfast);
}

.mobile-meal-group-header.group-bg-lunch {
    background: var(--mobile-group-lunch);
}

.mobile-meal-group-header.group-bg-dinner {
    background: var(--mobile-group-dinner);
}

.mobile-meal-group-header.group-bg-snack {
    background: var(--mobile-group-snack);
}

/* --- Recipe Header --- */
.mobile-recipe-header {
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    background: var(--mobile-primary-light);
    color: var(--mobile-primary-dark);
    border-bottom: 1px solid #bbf7d0;
    border-left: 3px solid var(--mobile-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    min-height: 44px;
}

.mobile-recipe-chevron {
    font-size: 10px;
    transition: transform 0.2s;
    opacity: 0.6;
}

.mobile-recipe-chevron.collapsed {
    transform: rotate(-90deg);
}

.dark .mobile-recipe-header {
    background: #052e1633;
    color: #4ade80;
    border-bottom-color: #064e3b;
    border-left-color: #22c55e;
}

.mobile-recipe-header-icon {
    font-size: 11px;
    opacity: 0.7;
}

.mobile-recipe-header-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.mobile-recipe-header-info {
    font-size: 11px;
    font-weight: 400;
    color: var(--mobile-text-secondary);
}

/* --- Food Item --- */
.mobile-food-item-wrapper {
    position: relative;
    overflow: hidden;
    max-width: 100%;
    touch-action: pan-y pan-x;
}

.mobile-food-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    width: 100%;
    min-height: 56px;
    border-bottom: 1px solid var(--mobile-border-light);
    background: var(--mobile-bg-card);
    cursor: pointer;
    transition: transform var(--mobile-transition-fast);
    position: relative;
    z-index: 1;
}

/* --- Meal Badge --- */
.mobile-meal-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    color: #ffffff;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.mobile-meal-badge.badge-breakfast,
.mobile-meal-badge.mobile-badge-breakfast {
    background: var(--mobile-meal-breakfast);
}

.mobile-meal-badge.badge-lunch,
.mobile-meal-badge.mobile-badge-lunch {
    background: var(--mobile-meal-lunch);
}

.mobile-meal-badge.badge-dinner,
.mobile-meal-badge.mobile-badge-dinner {
    background: var(--mobile-meal-dinner);
}

.mobile-meal-badge.badge-snack,
.mobile-meal-badge.mobile-badge-snack {
    background: var(--mobile-meal-snack);
}

/* --- Food Name & Info --- */
.mobile-food-name {
    flex: 1;
    min-width: 0;
    margin: 0 8px;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--mobile-text);
}

.mobile-food-info {
    text-align: right;
    font-size: 12px;
    color: var(--mobile-text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mobile-food-info .tabular-nums {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* --- Food Detail (Accordion) --- */
.mobile-food-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    background: var(--mobile-bg-tertiary);
    border-bottom: 1px solid var(--mobile-border-light);
    position: relative;
    z-index: 2;
}

.mobile-food-detail.expanded {
    max-height: 800px;
    overflow-y: auto;
    overflow-x: hidden;
}

.mobile-food-detail-inner {
    padding: 12px;
    max-width: 100%;
    overflow: hidden;
}

/* --- Food Meta --- */
.mobile-food-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 8px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--mobile-border);
    font-size: 12px;
    color: var(--mobile-text-secondary);
}

.mobile-food-meta > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* --- Editable Meta --- */
.mobile-editable-meta {
    color: var(--mobile-primary);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px dashed transparent;
    transition: border-color var(--mobile-transition-fast);
}

.mobile-editable-meta:active {
    border-color: var(--mobile-primary);
    background: var(--mobile-primary-light);
}

.dark .mobile-editable-meta {
    color: #22c55e;
}

.dark .mobile-editable-meta:active {
    background: #064e3b33;
    border-color: #22c55e;
}

/* --- Nutrient Row --- */
.mobile-nutrient-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--mobile-border-light);
}

.mobile-nutrient-row > span:first-child {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.mobile-nutrient-row > .mobile-nutrient-value {
    flex-shrink: 0;
    margin-left: 8px;
}

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

.mobile-nutrient-value {
    font-weight: 500;
    text-align: right;
    color: var(--mobile-text);
    font-variant-numeric: tabular-nums;
}

/* --- Action Buttons --- */
.mobile-action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
    max-width: 100%;
}

.mobile-action-btn {
    flex: 1;
    padding: 12px 8px;
    border-radius: 8px;
    border: 1px solid var(--mobile-divider);
    background: var(--mobile-bg-card);
    color: var(--mobile-text);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    min-height: var(--mobile-touch-target);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--mobile-transition-fast);
}

.dark .mobile-action-btn {
    background: var(--mobile-bg-secondary);
    border-color: #4b5563;
    color: var(--mobile-text);
}

.mobile-action-btn:active {
    background: var(--mobile-bg-secondary);
}

.dark .mobile-action-btn:active {
    background: #4b5563;
}

.mobile-action-btn.danger {
    color: var(--mobile-danger);
    border-color: var(--mobile-danger-border);
}

.mobile-action-btn.danger:active {
    background: var(--mobile-danger-light);
}

/* --- Weight Input --- */
.mobile-weight-input {
    width: 60px;
    padding: 4px 6px;
    border: 2px solid var(--mobile-primary);
    border-radius: 6px;
    font-size: 16px;
    text-align: center;
    outline: none;
    background: var(--mobile-bg-card);
    color: var(--mobile-text);
}

.dark .mobile-weight-input {
    background: var(--mobile-bg-secondary);
    color: var(--mobile-text);
    border-color: #22c55e;
}


/* ============================================================
 * 4. Subtotals & Totals
 * ============================================================ */

.mobile-recipe-subtotal {
    padding: 6px 12px 6px 15px;
    font-size: 12px;
    font-style: italic;
    background: var(--mobile-bg-tertiary);
    color: var(--mobile-text-secondary);
    border-bottom: 1px solid var(--mobile-border-light);
    border-left: 3px solid var(--mobile-divider);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    min-height: var(--mobile-touch-target);
}

.dark .mobile-recipe-subtotal {
    background: #1a1f2e;
    color: var(--mobile-text-secondary);
    border-bottom-color: var(--mobile-border);
    border-left-color: #4b5563;
}

.mobile-subtotal-nutrients {
    padding: 8px 12px 8px 18px;
    background: var(--mobile-bg-tertiary);
    border-left: 3px solid var(--mobile-divider);
    border-bottom: 1px solid var(--mobile-border-light);
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

.dark .mobile-subtotal-nutrients {
    background: #1a1f2e;
    border-left-color: #4b5563;
    border-bottom-color: var(--mobile-border);
}

.mobile-meal-total {
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 700;
    background: var(--mobile-bg-secondary);
    color: var(--mobile-text);
    border-bottom: 1px solid var(--mobile-border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    cursor: pointer;
    min-height: var(--mobile-touch-target);
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

.dark .mobile-meal-total {
    background: #1e2533;
    color: var(--mobile-text);
    border-bottom-color: var(--mobile-border);
}


/* ============================================================
 * 5. Insert Line (Between Items)
 * ============================================================ */

.mobile-insert-line {
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity var(--mobile-transition-fast);
}

.mobile-insert-line:hover,
.mobile-insert-line:active {
    opacity: 1;
}

.mobile-insert-line-bar {
    position: absolute;
    left: 16px;
    right: 16px;
    height: 0;
    border-top: 1px dashed var(--mobile-divider);
}

.dark .mobile-insert-line-bar {
    border-color: #4b5563;
}

.mobile-insert-line-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--mobile-border);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    font-size: 11px;
    color: var(--mobile-text-secondary);
    border: none;
    cursor: pointer;
}

.mobile-insert-line:hover .mobile-insert-line-btn,
.mobile-insert-line:active .mobile-insert-line-btn {
    background: var(--mobile-primary);
    color: #ffffff;
}

.dark .mobile-insert-line-btn {
    background: var(--mobile-bg-secondary);
    color: var(--mobile-text-tertiary);
}

.dark .mobile-insert-line:hover .mobile-insert-line-btn,
.dark .mobile-insert-line:active .mobile-insert-line-btn {
    background: var(--mobile-primary);
    color: #ffffff;
}


/* ============================================================
 * 6. Insert Menu
 * ============================================================ */

.mobile-insert-menu {
    background: var(--mobile-bg-card);
    border-radius: 12px;
    box-shadow: var(--mobile-shadow-lg);
    overflow: hidden;
    min-width: 200px;
    max-width: calc(100vw - 32px);
}

.dark .mobile-insert-menu {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.mobile-insert-menu-item {
    padding: 14px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    min-height: var(--mobile-touch-target);
    color: var(--mobile-text);
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}

.mobile-insert-menu-item:hover,
.mobile-insert-menu-item:active {
    background: var(--mobile-bg-secondary);
}

.mobile-insert-menu-item + .mobile-insert-menu-item {
    border-top: 1px solid var(--mobile-border);
}


/* ============================================================
 * 7. Empty Food Item
 * ============================================================ */

.mobile-empty-food-item {
    border: 2px dashed var(--mobile-divider) !important;
    background: #fafbfc;
}

.dark .mobile-empty-food-item {
    border-color: #4b5563 !important;
    background: #1a2332;
}

.mobile-empty-row-search-container {
    padding: 8px 0;
}

.mobile-empty-row-search {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--mobile-divider);
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    background: var(--mobile-bg-card);
    color: var(--mobile-text);
}

.dark .mobile-empty-row-search {
    background: var(--mobile-bg-secondary);
    border-color: #4b5563;
    color: var(--mobile-text);
}

.mobile-empty-row-search:focus {
    border-color: var(--mobile-primary);
    box-shadow: 0 0 0 2px var(--mobile-primary-ring);
}

.dark .mobile-empty-row-search:focus {
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.mobile-empty-row-results {
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.mobile-empty-row-result-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--mobile-border);
    cursor: pointer;
    min-height: var(--mobile-touch-target);
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--mobile-text);
    overflow: hidden;
}

.mobile-empty-row-result-item > div {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-empty-row-result-item:active {
    background: var(--mobile-primary-light);
}

/* --- Inline Search (header-level search box) --- */
.mobile-inline-search-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mobile-inline-search {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid var(--mobile-divider);
    border-radius: 6px;
    font-size: 16px;
    outline: none;
    background: var(--mobile-bg);
    color: var(--mobile-text);
}

.mobile-inline-search:focus {
    border-color: var(--mobile-primary);
    box-shadow: 0 0 0 2px var(--mobile-primary-ring);
}

.dark .mobile-inline-search {
    background: var(--mobile-bg-secondary);
    border-color: #4b5563;
}

.dark .mobile-inline-search:focus {
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.dark .mobile-empty-row-result-item:active {
    background: #064e3b33;
}


/* ============================================================
 * 8. Bottom Sheet
 * ============================================================ */

.mobile-bottom-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--mobile-transition-normal);
}

.mobile-bottom-sheet-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

.mobile-bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    background: var(--mobile-bg-card);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform var(--mobile-transition-sheet);
    height: 95vh;
    height: 95dvh;
    display: flex;
    flex-direction: column;
}

.mobile-bottom-sheet.half {
    transform: translateY(50%);
}

.mobile-bottom-sheet.full {
    transform: translateY(5%);
}

.mobile-bs-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 6px;
    cursor: grab;
    flex-shrink: 0;
}

.mobile-bs-handle-bar {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--mobile-divider);
}

.dark .mobile-bs-handle-bar {
    background: #4b5563;
}

.mobile-bs-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 16px;
    -webkit-overflow-scrolling: touch;
}


/* ============================================================
 * 9. Search Tab
 * ============================================================ */

.mobile-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--mobile-bg-secondary);
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 12px;
}

.mobile-search-bar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 16px;
    color: var(--mobile-text);
}

.mobile-search-bar input::placeholder {
    color: var(--mobile-text-tertiary);
}

.mobile-search-bar .clear-btn {
    background: none;
    border: none;
    color: var(--mobile-text-tertiary);
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    min-width: 28px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* --- Search Tabs --- */
.mobile-search-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--mobile-border);
}

.mobile-search-tab {
    flex: 1;
    padding: 12px 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--mobile-text-secondary);
    position: relative;
    transition: color var(--mobile-transition-fast);
    min-height: var(--mobile-touch-target);
}

.mobile-search-tab.active {
    color: var(--mobile-primary);
}

.dark .mobile-search-tab.active {
    color: #22c55e;
}

.mobile-search-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--mobile-primary);
}

.dark .mobile-search-tab.active::after {
    background: #22c55e;
}

/* --- Nutrient Settings Panel --- */
.mobile-nutrient-settings-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--mobile-transition-normal);
    background: var(--mobile-bg-tertiary);
    border-radius: 8px;
    margin-bottom: 8px;
}

.mobile-nutrient-settings-panel.open {
    max-height: 300px;
    overflow-y: auto;
}

.mobile-nutrient-settings-panel label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    color: var(--mobile-text);
}

/* --- Recent Chips --- */
.mobile-recent-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}

.mobile-recent-chips::-webkit-scrollbar {
    display: none;
}

.mobile-recent-chip {
    padding: 10px 14px;
    border-radius: 20px;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
    background: var(--mobile-border);
    color: var(--mobile-text);
    border: none;
    flex-shrink: 0;
    min-height: var(--mobile-touch-target);
    display: inline-flex;
    align-items: center;
}

.dark .mobile-recent-chip {
    background: var(--mobile-bg-secondary);
    color: #d1d5db;
}

/* --- Search Result Card --- */
.mobile-search-result-card {
    background: var(--mobile-bg-card);
    border: 1px solid var(--mobile-border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
}

.mobile-search-result-card .food-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--mobile-text);
}

.mobile-search-result-card .food-code {
    font-size: 11px;
    color: var(--mobile-text-tertiary);
}

.mobile-search-result-card .nutrients-preview {
    font-size: 12px;
    color: var(--mobile-text-secondary);
    margin-bottom: 8px;
}

.mobile-search-result-card .add-row {
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--mobile-border-light);
    padding-top: 8px;
}

.mobile-search-result-card select,
.mobile-search-result-card input[type="number"] {
    padding: 6px 8px;
    border: 1px solid var(--mobile-divider);
    border-radius: 6px;
    font-size: 16px;
    background: var(--mobile-bg-card);
    color: var(--mobile-text);
}

.dark .mobile-search-result-card select,
.dark .mobile-search-result-card input[type="number"] {
    background: var(--mobile-bg-secondary);
    border-color: #4b5563;
    color: var(--mobile-text);
}

.mobile-search-result-card .add-btn {
    padding: 10px 14px;
    background: var(--mobile-primary);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    margin-left: auto;
    min-height: var(--mobile-touch-target);
    display: inline-flex;
    align-items: center;
}

.mobile-search-result-card .add-btn:active {
    background: var(--mobile-primary-dark);
}

/* --- Recipe List Item (Search) --- */
.mobile-recipe-list-item {
    padding: 12px;
    border: 1px solid var(--mobile-border);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    color: var(--mobile-text);
    transition: background var(--mobile-transition-fast);
}

.mobile-recipe-list-item:active {
    background: var(--mobile-bg-secondary);
}

.dark .mobile-recipe-list-item {
    border-color: var(--mobile-border);
}


/* ============================================================
 * 10. Analysis Tab
 * ============================================================ */

.mobile-analysis-card {
    background: var(--mobile-bg-card);
    border-radius: 12px;
    padding: 16px;
    margin: 12px;
    box-shadow: var(--mobile-shadow-sm);
}

.mobile-analysis-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--mobile-text);
}

.mobile-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--mobile-border);
    border-radius: 8px;
    overflow: hidden;
}

.mobile-summary-cell {
    background: var(--mobile-bg-card);
    padding: 12px;
    text-align: center;
}

.mobile-summary-cell .label {
    font-size: 11px;
    color: var(--mobile-text-secondary);
    margin-bottom: 4px;
}

.mobile-summary-cell .value {
    font-size: 20px;
    font-weight: 700;
    color: var(--mobile-text);
    font-variant-numeric: tabular-nums;
}

.mobile-summary-cell .unit {
    font-size: 12px;
    color: var(--mobile-text-secondary);
    font-weight: 400;
}

.mobile-chart-container {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

/* PFCドーナツチャートは正方形で適度なサイズ */
.mobile-chart-container-pfc {
    max-width: 280px;
    margin: 0 auto;
}

/* 充足率チャートは栄養素数に応じた高さ（Chart.jsのresponsive:falseで制御） */
.mobile-chart-container-satisfaction {
    width: 100%;
    overflow-x: hidden;
}

.mobile-chart-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--mobile-text);
}

.mobile-dri-card {
    background: var(--mobile-primary-light);
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 12px;
    margin: 12px;
    cursor: pointer;
    transition: background var(--mobile-transition-fast);
}

.dark .mobile-dri-card {
    background: #052e16;
    border-color: #166534;
}

.mobile-dri-card:active {
    opacity: 0.8;
}

.mobile-dri-label {
    font-size: 11px;
    color: var(--mobile-text-secondary);
    margin-bottom: 12px;
}


/* ============================================================
 * 11. Settings Tab
 * ============================================================ */

.mobile-settings-section {
    margin: 12px;
}

.mobile-settings-section-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--mobile-text);
}

.mobile-settings-card {
    background: var(--mobile-bg-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--mobile-shadow-sm);
}

.mobile-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--mobile-border-light);
    cursor: pointer;
    font-size: 14px;
    min-height: var(--mobile-touch-target);
    color: var(--mobile-text);
}

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

.mobile-settings-row i.fa-chevron-right {
    color: var(--mobile-text-tertiary);
    font-size: 12px;
}

.mobile-settings-select {
    padding: 4px 8px;
    border: 1px solid var(--mobile-divider);
    border-radius: 6px;
    font-size: 16px;
    background: var(--mobile-bg-card);
    color: var(--mobile-text);
}

.dark .mobile-settings-select {
    background: var(--mobile-bg-secondary);
    border-color: #4b5563;
    color: var(--mobile-text);
}

/* --- Toggle Switch --- */
.mobile-toggle-switch {
    position: relative;
    width: 48px;
    height: 28px;
    background: var(--mobile-divider);
    border-radius: 14px;
    cursor: pointer;
    transition: background var(--mobile-transition-normal);
    flex-shrink: 0;
    border: none;
}

.mobile-toggle-switch.on,
.mobile-toggle-switch.active {
    background: var(--mobile-primary);
}

.mobile-toggle-switch .toggle-knob,
.mobile-toggle-switch .mobile-toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform var(--mobile-transition-normal);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.mobile-toggle-switch.on .toggle-knob,
.mobile-toggle-switch.active .toggle-knob,
.mobile-toggle-switch.on .mobile-toggle-knob,
.mobile-toggle-switch.active .mobile-toggle-knob {
    transform: translateX(20px);
}

/* --- DRI Select --- */
.mobile-dri-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--mobile-divider);
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 12px;
    background: var(--mobile-bg-card);
    color: var(--mobile-text);
}

.dark .mobile-dri-select {
    background: var(--mobile-bg-secondary);
    border-color: #4b5563;
    color: var(--mobile-text);
}

/* --- Sheet List (Saved Sheets) --- */
.mobile-sheet-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--mobile-border-light);
    cursor: pointer;
    min-height: var(--mobile-touch-target);
    color: var(--mobile-text);
}

.mobile-sheet-list-item:active {
    background: var(--mobile-bg-secondary);
}


/* ============================================================
 * 12. Swipe Delete
 * ============================================================ */

.mobile-swipe-delete-btn {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 80px;
    background: var(--mobile-danger);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    z-index: 0;
    border: none;
}

/* Slide out animation for delete */
@keyframes mobileSlideOut {
    to {
        transform: translateX(-100%);
        opacity: 0;
        max-height: 0;
        padding: 0;
        margin: 0;
    }
}

.mobile-slide-out {
    animation: mobileSlideOut 0.3s ease forwards;
}


/* ============================================================
 * 13. Toast
 * ============================================================ */

.mobile-toast-container {
    position: fixed;
    bottom: calc(var(--mobile-tab-bar-height) + env(safe-area-inset-bottom, 0px) + 16px);
    left: 16px;
    right: 16px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.mobile-toast {
    background: #1f2937;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    text-align: center;
    animation: mobileToastIn 0.3s ease, mobileToastOut 0.3s ease 2.7s forwards;
    pointer-events: auto;
    box-shadow: var(--mobile-shadow-md);
}

.dark .mobile-toast {
    background: var(--mobile-bg-secondary);
}

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

@keyframes mobileToastOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}


/* ============================================================
 * 14. Fullscreen Modal
 * ============================================================ */

.mobile-fullscreen-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: var(--mobile-bg);
    transform: translateY(100%);
    transition: transform var(--mobile-transition-sheet);
}

.mobile-fullscreen-modal.open {
    transform: translateY(0);
}

.mobile-modal-header {
    height: var(--mobile-header-height);
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: var(--mobile-bg-card);
    border-bottom: 1px solid var(--mobile-border);
}

.mobile-modal-header .back-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    color: var(--mobile-primary);
    min-width: var(--mobile-touch-target);
    min-height: var(--mobile-touch-target);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dark .mobile-modal-header .back-btn {
    color: #22c55e;
}

.mobile-modal-header .modal-title {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    margin-left: 8px;
    color: var(--mobile-text);
}

.mobile-modal-body {
    padding: 16px;
    overflow-y: auto;
    height: calc(100vh - var(--mobile-header-height));
    height: calc(100dvh - var(--mobile-header-height));
    -webkit-overflow-scrolling: touch;
}


/* ============================================================
 * 15. Header Extensions (HTML references)
 * ============================================================ */

.mobile-sheet-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--mobile-text);
}

.mobile-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.mobile-header-btn {
    background: none;
    border: none;
    color: var(--mobile-primary);
    font-size: 18px;
    padding: 8px;
    cursor: pointer;
    min-width: var(--mobile-touch-target);
    min-height: var(--mobile-touch-target);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mobile-header-btn.secondary {
    color: var(--mobile-text-secondary);
}

.dark .mobile-header-btn {
    color: #22c55e;
}


/* ============================================================
 * 16. JS-generated Classes
 * ============================================================ */

/* --- Chevron (JS variant) --- */
.mobile-chevron-sm {
    font-size: 10px;
    color: var(--mobile-text-tertiary);
    margin-left: 4px;
    transition: transform 0.2s;
}

/* --- Placeholder for empty food rows --- */
.mobile-placeholder {
    color: var(--mobile-text-tertiary);
    font-style: italic;
}

.mobile-placeholder i {
    margin-right: 4px;
}

/* --- Inline edit fields --- */
.mobile-inline-select {
    padding: 4px 8px;
    border: 2px solid var(--mobile-primary);
    border-radius: 6px;
    font-size: 16px;
    outline: none;
    background: var(--mobile-bg-card);
    color: var(--mobile-text);
}

.dark .mobile-inline-select {
    background: var(--mobile-bg-secondary);
    border-color: #22c55e;
    color: var(--mobile-text);
}

.mobile-inline-input {
    padding: 4px 8px;
    border: 2px solid var(--mobile-primary);
    border-radius: 6px;
    font-size: 16px;
    outline: none;
    background: var(--mobile-bg-card);
    color: var(--mobile-text);
    width: 100%;
}

.dark .mobile-inline-input {
    background: var(--mobile-bg-secondary);
    border-color: #22c55e;
    color: var(--mobile-text);
}

/* --- Nutrients list container --- */
.mobile-nutrients {
    margin-bottom: 4px;
}

/* --- Action button danger variant --- */
.mobile-action-btn.mobile-action-btn-danger {
    color: var(--mobile-danger);
    border-color: var(--mobile-danger-border);
}

.mobile-action-btn.mobile-action-btn-danger:active {
    background: var(--mobile-danger-light);
}


/* ============================================================
 * 17. Search Tab Extensions
 * ============================================================ */

.mobile-search-results {
    padding: 0 12px;
}

.mobile-search-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.mobile-search-result-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--mobile-border-light);
    padding-top: 8px;
    margin-top: 4px;
}

.mobile-search-meal-select {
    padding: 6px 8px;
    border: 1px solid var(--mobile-divider);
    border-radius: 6px;
    font-size: 16px;
    background: var(--mobile-bg-card);
    color: var(--mobile-text);
}

.dark .mobile-search-meal-select {
    background: var(--mobile-bg-secondary);
    border-color: #4b5563;
    color: var(--mobile-text);
}

.mobile-search-weight-input {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid var(--mobile-divider);
    border-radius: 6px;
    font-size: 16px;
    text-align: center;
    background: var(--mobile-bg-card);
    color: var(--mobile-text);
}

.dark .mobile-search-weight-input {
    background: var(--mobile-bg-secondary);
    border-color: #4b5563;
    color: var(--mobile-text);
}

.mobile-search-add-btn {
    padding: 10px 14px;
    background: var(--mobile-primary);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    margin-left: auto;
    min-height: var(--mobile-touch-target);
    display: inline-flex;
    align-items: center;
}

.mobile-search-add-btn:active {
    background: var(--mobile-primary-dark);
}

/* --- Nutrient Settings Button & Checkbox --- */
.mobile-nutrient-settings-btn {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--mobile-text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    min-height: var(--mobile-touch-target);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.mobile-nutrient-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    color: var(--mobile-text);
}

.mobile-nutrient-checkbox input[type="checkbox"] {
    accent-color: var(--mobile-primary);
}


/* ============================================================
 * 18. Analysis Tab Extensions
 * ============================================================ */

.mobile-analysis-section {
    padding: 12px;
}

.mobile-section-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--mobile-text);
}

.mobile-summary-label {
    font-size: 11px;
    color: var(--mobile-text-secondary);
    margin-bottom: 4px;
}

.mobile-summary-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--mobile-text);
    font-variant-numeric: tabular-nums;
}

.mobile-dri-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    border: 2px dashed var(--mobile-divider);
    border-radius: 10px;
    background: none;
    color: var(--mobile-text-secondary);
    font-size: 14px;
    cursor: pointer;
    min-height: var(--mobile-touch-target);
}

.dark .mobile-dri-add-btn {
    border-color: #4b5563;
    color: var(--mobile-text-secondary);
}

.mobile-dri-add-btn:active {
    background: var(--mobile-bg-secondary);
}

.mobile-export-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 8px;
    border: 1px solid var(--mobile-border);
    border-radius: 10px;
    background: var(--mobile-bg-card);
    color: var(--mobile-text);
    font-size: 14px;
    cursor: pointer;
    min-height: var(--mobile-touch-target);
}

.dark .mobile-export-btn {
    background: var(--mobile-bg-secondary);
    border-color: var(--mobile-border);
    color: var(--mobile-text);
}

.mobile-export-btn:active {
    background: var(--mobile-bg-secondary);
}


/* ============================================================
 * 19. Settings Tab Extensions
 * ============================================================ */

.mobile-settings-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--mobile-text);
}

.mobile-settings-row.mobile-settings-row-info {
    cursor: default;
}


/* ============================================================
 * 20. Bottom Sheet Search Extensions
 * ============================================================ */

.mobile-bs-search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--mobile-divider);
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    background: var(--mobile-bg-card);
    color: var(--mobile-text);
}

.dark .mobile-bs-search-input {
    background: var(--mobile-bg-secondary);
    border-color: #4b5563;
    color: var(--mobile-text);
}

.mobile-bs-search-input:focus {
    border-color: var(--mobile-primary);
    box-shadow: 0 0 0 2px var(--mobile-primary-ring);
}

.dark .mobile-bs-search-input:focus {
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.mobile-bs-search-results {
    padding: 0 16px;
}

.mobile-bs-result-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--mobile-border);
    cursor: pointer;
    min-height: var(--mobile-touch-target);
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--mobile-text);
}

.mobile-bs-result-item:active {
    background: var(--mobile-primary-light);
}

.dark .mobile-bs-result-item:active {
    background: #064e3b33;
}

.mobile-bs-indicator {
    background: #fef3c7;
    color: #92400e;
    padding: 8px 16px;
    border-radius: 8px;
    margin: 8px 16px 0;
    font-size: 13px;
}

.dark .mobile-bs-indicator {
    background: #451a00;
    color: #fbbf24;
}


/* ============================================================
 * Utility Classes
 * ============================================================ */

/* --- Text helpers --- */
.mobile-text-sub {
    font-size: 12px;
    color: var(--mobile-text-secondary);
}

.mobile-icon-muted {
    color: var(--mobile-text-tertiary);
}

.mobile-no-results {
    color: var(--mobile-text-secondary);
    font-size: 13px;
}

.mobile-tabular-nums {
    font-variant-numeric: tabular-nums;
}

.mobile-safe-top {
    padding-top: env(safe-area-inset-top, 0px);
}

.mobile-safe-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Prevent rubber-banding and ensure touch tap highlight is suppressed */
.mobile-app *,
.mobile-app *::before,
.mobile-app *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}


/* ============================================================
 * 21. Advanced Search & Usage History
 * ============================================================ */

/* --- Icon buttons (history / advanced search) --- */
.mobile-search-icon-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border: 1px solid var(--mobile-border);
    border-radius: 6px;
    background: var(--mobile-bg-secondary);
    color: var(--mobile-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    position: relative;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mobile-search-icon-btn:active {
    background: var(--mobile-border);
}

.dark .mobile-search-icon-btn {
    background: #374151;
    border-color: #4b5563;
    color: #9ca3af;
}

.dark .mobile-search-icon-btn:active {
    background: #4b5563;
}

/* --- Recording indicator dot --- */
.mobile-recording-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    animation: mobile-recording-pulse 1.5s ease-in-out infinite;
}

@keyframes mobile-recording-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* --- Bottom Sheet Header (for advanced search / history) --- */
.mobile-bs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--mobile-text);
    flex-shrink: 0;
}

.mobile-bs-close {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    font-size: 22px;
    color: var(--mobile-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.mobile-bs-close:active {
    background: var(--mobile-bg-secondary);
}

.dark .mobile-bs-close {
    color: #9ca3af;
}

.dark .mobile-bs-close:active {
    background: #374151;
}

/* --- Advanced Search Filters --- */
.mobile-adv-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 16px 12px;
}

.mobile-adv-filter-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-adv-filter-row label {
    font-size: 13px;
    font-weight: 500;
    color: var(--mobile-text-secondary);
}

.mobile-adv-filter-row select {
    width: 100%;
    font-size: 16px;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--mobile-divider);
    border-radius: 8px;
    background: var(--mobile-bg-card);
    color: var(--mobile-text);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.mobile-adv-filter-row select:focus {
    border-color: var(--mobile-primary);
    box-shadow: 0 0 0 2px var(--mobile-primary-ring);
}

.dark .mobile-adv-filter-row select {
    background-color: #374151;
    border-color: #4b5563;
    color: var(--mobile-text);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

.dark .mobile-adv-filter-row select:focus {
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

/* --- Sort Radios --- */
.mobile-adv-sort {
    display: flex;
    gap: 16px;
    padding: 0 16px;
    align-items: center;
}

.mobile-adv-sort label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--mobile-text);
    cursor: pointer;
    min-height: 44px;
}

.mobile-adv-sort input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--mobile-primary);
}

/* --- Action Buttons --- */
.mobile-adv-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
}

.mobile-adv-execute-btn {
    flex: 1;
    min-height: 44px;
    border: none;
    border-radius: 8px;
    background: var(--mobile-primary);
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.mobile-adv-execute-btn:active {
    background: var(--mobile-primary-dark);
}

.mobile-adv-clear-btn {
    min-width: 70px;
    min-height: 44px;
    border: 1px solid var(--mobile-border);
    border-radius: 8px;
    background: var(--mobile-bg-secondary);
    color: var(--mobile-text);
    font-size: 16px;
    cursor: pointer;
}

.mobile-adv-clear-btn:active {
    background: var(--mobile-border);
}

.dark .mobile-adv-clear-btn {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

.dark .mobile-adv-clear-btn:active {
    background: #4b5563;
}

/* --- Result count --- */
.mobile-adv-result-count {
    padding: 4px 16px 8px;
    font-size: 13px;
    color: var(--mobile-text-secondary);
}

/* --- Advanced Search Results --- */
.mobile-adv-results {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px;
}

.mobile-adv-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 0;
    border-bottom: 1px solid var(--mobile-border-light);
    cursor: pointer;
    color: var(--mobile-text);
}

.mobile-adv-result-item:active {
    background: var(--mobile-primary-light);
}

.dark .mobile-adv-result-item {
    border-bottom-color: #374151;
}

.dark .mobile-adv-result-item:active {
    background: #064e3b33;
}

/* Color badge */
.mobile-adv-color-badge {
    width: 16px;
    height: 16px;
    min-width: 16px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.mobile-adv-result-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.mobile-adv-nutrient-value {
    flex-shrink: 0;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: var(--mobile-text-secondary);
}

/* --- History Controls --- */
.mobile-history-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 16px 12px;
}

.mobile-history-controls select {
    width: 100%;
    font-size: 16px;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--mobile-divider);
    border-radius: 8px;
    background: var(--mobile-bg-card);
    color: var(--mobile-text);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.dark .mobile-history-controls select {
    background-color: #374151;
    border-color: #4b5563;
    color: var(--mobile-text);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

.mobile-history-actions {
    display: flex;
    gap: 8px;
}

.mobile-history-action-btn {
    flex: 1;
    min-height: 44px;
    border: 1px solid var(--mobile-border);
    border-radius: 8px;
    background: var(--mobile-bg-secondary);
    color: var(--mobile-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.mobile-history-action-btn:active {
    background: var(--mobile-border);
}

.dark .mobile-history-action-btn {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

.dark .mobile-history-action-btn:active {
    background: #4b5563;
}

.mobile-history-reset-btn {
    color: var(--mobile-danger);
}

.dark .mobile-history-reset-btn {
    color: #f87171;
}

/* --- History List --- */
.mobile-history-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px;
}

.mobile-history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 0;
    border-bottom: 1px solid var(--mobile-border-light);
    cursor: pointer;
    color: var(--mobile-text);
}

.mobile-history-item:active {
    background: var(--mobile-primary-light);
}

.dark .mobile-history-item {
    border-bottom-color: #374151;
}

.dark .mobile-history-item:active {
    background: #064e3b33;
}

.mobile-history-food-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.mobile-usage-count {
    flex-shrink: 0;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: var(--mobile-text-secondary);
    padding: 2px 8px;
    background: var(--mobile-bg-secondary);
    border-radius: 12px;
}

.dark .mobile-usage-count {
    background: #374151;
    color: #9ca3af;
}

/* --- Preset Modal (Recording setup) --- */
.mobile-preset-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.mobile-preset-modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.mobile-preset-modal {
    width: 100%;
    max-width: 360px;
    background: var(--mobile-bg-card);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--mobile-shadow-lg);
}

.dark .mobile-preset-modal {
    background: #1f2937;
}

.mobile-preset-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--mobile-text);
    border-bottom: 1px solid var(--mobile-border);
}

.dark .mobile-preset-modal-header {
    border-bottom-color: #374151;
}

.mobile-preset-modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mobile-preset-name-input {
    width: 100%;
    font-size: 16px;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--mobile-divider);
    border-radius: 8px;
    background: var(--mobile-bg);
    color: var(--mobile-text);
    outline: none;
}

.mobile-preset-name-input:focus {
    border-color: var(--mobile-primary);
    box-shadow: 0 0 0 2px var(--mobile-primary-ring);
}

.dark .mobile-preset-name-input {
    background: #374151;
    border-color: #4b5563;
    color: var(--mobile-text);
}

.dark .mobile-preset-name-input:focus {
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.mobile-preset-existing label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--mobile-text-secondary);
    margin-bottom: 8px;
}

.mobile-preset-list {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid var(--mobile-border);
    border-radius: 8px;
}

.dark .mobile-preset-list {
    border-color: #4b5563;
}

.mobile-preset-list-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--mobile-text);
    border-bottom: 1px solid var(--mobile-border-light);
    min-height: 44px;
    display: flex;
    align-items: center;
}

.mobile-preset-list-item:last-child {
    border-bottom: none;
}

.mobile-preset-list-item:active {
    background: var(--mobile-primary-light);
}

.mobile-preset-list-item.selected {
    background: var(--mobile-primary-light);
    color: var(--mobile-primary);
    font-weight: 500;
}

.dark .mobile-preset-list-item {
    border-bottom-color: #374151;
}

.dark .mobile-preset-list-item:active,
.dark .mobile-preset-list-item.selected {
    background: #064e3b33;
    color: #22c55e;
}

.mobile-preset-modal-footer {
    display: flex;
    gap: 8px;
    padding: 12px 16px 16px;
}

.mobile-preset-modal-footer .mobile-adv-execute-btn,
.mobile-preset-modal-footer .mobile-adv-clear-btn {
    flex: 1;
}


/* ============================================================
 * 24. カスタム成分表（モバイル）
 * ============================================================ */

.mobile-food-table-selector {
    padding: 12px 16px;
}

.mobile-food-table-radio-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.mobile-food-table-radio-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    min-height: var(--mobile-touch-target, 44px);
    cursor: pointer;
}

.mobile-food-table-radio-item:active {
    background: var(--mobile-primary-light, #f0fdf4);
}

.mobile-food-table-radio-item input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--mobile-primary, #16a34a);
}

.mobile-food-table-radio-item .radio-label {
    flex: 1;
    font-size: 15px;
    color: var(--mobile-text);
}

.mobile-food-table-radio-item .radio-count {
    color: var(--mobile-text-secondary, #6b7280);
    font-size: 13px;
}

.mobile-food-table-actions {
    display: flex;
    gap: 8px;
    padding: 0;
}

.mobile-food-table-action-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--mobile-divider, #d1d5db);
    background: var(--mobile-bg-card, #fff);
    font-size: 14px;
    min-height: var(--mobile-touch-target, 44px);
    cursor: pointer;
    color: var(--mobile-text);
}

.mobile-food-table-action-btn:active {
    background: var(--mobile-bg-secondary, #f3f4f6);
}

/* Full-screen food table manager */
.mobile-food-table-manager {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--mobile-bg, #fff);
    z-index: 10002;
    display: flex;
    flex-direction: column;
}

.mobile-food-table-manager-header {
    display: flex;
    align-items: center;
    padding: 0 12px;
    height: 48px;
    border-bottom: 1px solid var(--mobile-border, #e5e7eb);
    padding-top: env(safe-area-inset-top, 0);
    background: var(--mobile-bg-card, #fff);
}

.mobile-food-table-manager-header .back-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 18px;
    color: var(--mobile-text, #374151);
    cursor: pointer;
}

.mobile-food-table-manager-header h3 {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: var(--mobile-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-food-table-manager-header .done-btn {
    padding: 6px 16px;
    background: none;
    border: none;
    color: var(--mobile-primary, #16a34a);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    min-height: var(--mobile-touch-target, 44px);
    display: flex;
    align-items: center;
}

.mobile-food-table-manager-tabs {
    display: flex;
    border-bottom: 1px solid var(--mobile-border, #e5e7eb);
    background: var(--mobile-bg-card, #fff);
}

.mobile-food-table-manager-tabs .tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 14px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--mobile-text-secondary, #6b7280);
    cursor: pointer;
    min-height: var(--mobile-touch-target, 44px);
}

.mobile-food-table-manager-tabs .tab.active {
    color: var(--mobile-primary, #16a34a);
    border-bottom-color: var(--mobile-primary, #16a34a);
    font-weight: 600;
}

.mobile-food-table-manager-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-food-table-search-input {
    position: sticky;
    top: 0;
    background: var(--mobile-bg-card, #fff);
    padding: 8px 12px;
    border-bottom: 1px solid var(--mobile-border, #e5e7eb);
    z-index: 1;
}

.mobile-food-table-search-input input {
    width: 100%;
    font-size: 16px;  /* iOS auto-zoom prevention */
    padding: 10px 12px;
    border: 1px solid var(--mobile-divider, #d1d5db);
    border-radius: 8px;
    box-sizing: border-box;
    background: var(--mobile-bg-card, #fff);
    color: var(--mobile-text);
}

.mobile-food-table-food-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--mobile-border-light, #f3f4f6);
    gap: 10px;
    min-height: var(--mobile-touch-target, 44px);
}

.mobile-food-table-food-item .food-info {
    flex: 1;
    min-width: 0;
}

.mobile-food-table-food-item .food-num {
    font-size: 11px;
    color: var(--mobile-text-tertiary, #9ca3af);
}

.mobile-food-table-food-item .food-name {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--mobile-text);
}

.mobile-food-table-food-item .action-btn {
    padding: 6px 18px;
    border-radius: 6px;
    border: 1px solid;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    min-height: 36px;
}

.mobile-food-table-food-item .action-btn.add {
    color: #16a34a;
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.mobile-food-table-food-item .action-btn.add:active {
    background: #dcfce7;
}

.mobile-food-table-food-item .action-btn.added {
    color: var(--mobile-text-tertiary, #9ca3af);
    border-color: var(--mobile-border, #e5e7eb);
    background: var(--mobile-bg-tertiary, #f9fafb);
}

.mobile-food-table-food-item .action-btn.remove {
    color: #dc2626;
    border-color: #fecaca;
    background: #fef2f2;
}

.mobile-food-table-food-item .action-btn.remove:active {
    background: #fee2e2;
}

.mobile-food-table-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--mobile-text-tertiary, #9ca3af);
    font-size: 14px;
    text-align: center;
}

/* Create table dialog */
.mobile-food-table-create-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10003;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.mobile-food-table-create-dialog .dialog-content {
    background: var(--mobile-bg-card, #fff);
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    max-width: 360px;
}

.mobile-food-table-create-dialog h3 {
    margin: 0 0 16px 0;
    font-size: 17px;
    color: var(--mobile-text);
}

.mobile-food-table-create-dialog input,
.mobile-food-table-create-dialog textarea {
    width: 100%;
    font-size: 16px;  /* iOS auto-zoom prevention */
    padding: 10px 12px;
    border: 1px solid var(--mobile-divider, #d1d5db);
    border-radius: 8px;
    margin-bottom: 12px;
    box-sizing: border-box;
    background: var(--mobile-bg-card, #fff);
    color: var(--mobile-text);
}

.mobile-food-table-create-dialog textarea {
    min-height: 80px;
    resize: vertical;
}

.mobile-food-table-create-dialog .dialog-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.mobile-food-table-create-dialog .dialog-buttons button {
    padding: 8px 20px;
    border-radius: 8px;
    border: 1px solid var(--mobile-divider, #d1d5db);
    background: var(--mobile-bg-card, #fff);
    font-size: 14px;
    cursor: pointer;
    min-height: var(--mobile-touch-target, 44px);
    color: var(--mobile-text);
}

.mobile-food-table-create-dialog .dialog-buttons button.primary {
    background: var(--mobile-primary, #16a34a);
    color: #fff;
    border-color: var(--mobile-primary, #16a34a);
}

.mobile-food-table-create-dialog .dialog-buttons button.primary:active {
    background: var(--mobile-primary-dark, #15803d);
}

/* Dark mode overrides for food table */
.dark .mobile-food-table-radio-item:active {
    background: #064e3b33;
}

.dark .mobile-food-table-action-btn {
    background: var(--mobile-bg-card);
    border-color: var(--mobile-border);
    color: var(--mobile-text);
}

.dark .mobile-food-table-action-btn:active {
    background: var(--mobile-bg-secondary);
}

.dark .mobile-food-table-food-item .action-btn.add {
    color: #22c55e;
    border-color: #064e3b;
    background: #064e3b33;
}

.dark .mobile-food-table-food-item .action-btn.added {
    color: var(--mobile-text-tertiary);
    border-color: var(--mobile-border);
    background: var(--mobile-bg-secondary);
}

.dark .mobile-food-table-food-item .action-btn.remove {
    color: #f87171;
    border-color: #7f1d1d;
    background: #7f1d1d33;
}

.dark .mobile-food-table-create-dialog {
    background: rgba(0, 0, 0, 0.6);
}

/* ============================================================
   Recipe Detail View - Mobile Responsive
   ============================================================ */

@media (max-width: 767px) {
    .recipe-detail-header {
        padding: 10px 16px;
    }

    .recipe-detail-header h2 {
        font-size: 16px;
    }

    .recipe-detail-content {
        padding: 12px 12px 32px;
    }

    .recipe-detail-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .recipe-detail-meta-row {
        flex-direction: column;
        gap: 2px;
    }

    .recipe-detail-meta-label {
        min-width: auto;
    }

    .recipe-detail-foods-table {
        font-size: 12px;
    }

    .recipe-detail-foods-table th,
    .recipe-detail-foods-table td {
        padding: 4px 6px;
    }

    .recipe-detail-foods-table .sticky-col {
        min-width: 80px;
    }

    .recipe-detail-foods-table .sticky-col-2 {
        left: 80px;
    }

    /* 作り方テーブル */
    .recipe-detail-cooking-table {
        font-size: 12px;
    }

    .recipe-detail-cooking-table th,
    .recipe-detail-cooking-table td {
        padding: 4px 6px;
    }

    .recipe-detail-cooking-desktop {
        display: none;
    }

    .recipe-detail-cooking-mobile {
        display: block;
    }
}
