/* Design System */
:root {
    --bg-main: #0a0b0f;
    --bg-side: #12141a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --border-card: rgba(255, 255, 255, 0.08);

    --accent-primary: #3b82f6;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;

    --text-main: #f8fafc;
    --text-secondary: #94a3b8;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;

    --glass-blur: blur(25px);
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --accent-date-icon: #facc15;
    /* 目立つ黄色 */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden; /* App-like feel */
    height: 100%;
    /* モバイルブラウザのアドレスバー考慮 */
    height: -webkit-fill-available;
}

h1,
h2,
h3,
.logo {
    font-family: 'Outfit', sans-serif;
}

#app {
    display: flex;
    height: 100vh;
    height: 100dvh; /* Dynamic Viewport Height for mobile */
    width: 100%;
}

/* Sidebar Navigation */
.side-nav {
    width: 260px;
    background-color: var(--bg-side);
    border-right: 1px solid var(--border-card);
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 100;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 48px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    color: var(--accent-primary);
}

.logo span span {
    color: var(--accent-primary);
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-links li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.nav-links li i {
    font-size: 20px;
}

.nav-links li:hover {
    background-color: var(--bg-card);
    color: var(--text-main);
}

.nav-links li.active {
    background-color: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.user-profile {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
}

.avatar-placeholder {
    width: 40px;
    height: 40px;
    background: #2d313d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-email {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Content Area */
.content-area {
    flex: 1;
    overflow-y: scroll;
    /* スクロールバーにより幅が変わるのを防止 */
    padding: 40px;
    position: relative;
    scrollbar-width: thin;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Tab Management */
.tab-pane {
    display: none;
    animation: slideInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-pane.active {
    display: block;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
        filter: blur(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    backdrop-filter: var(--glass-blur);
    padding: 24px;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-premium);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--accent-primary);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.stat-card.calories::before {
    background: var(--accent-primary);
}

.stat-card.pfc::before {
    background: var(--accent-success);
}

.stat-card.weight::before {
    background: var(--accent-warning);
}

.card-title {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

.card-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
}

.unit {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-secondary);
}

.card-progress {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 4px;
}

.card-target {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-card);
    color: var(--text-main);
}

.btn-recommended {
    background: rgba(16, 185, 129, 0.1) !important;
    border: 1px solid #10b981 !important;
    color: #10b981 !important;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-card);
    border-radius: var(--radius-lg);
    padding: 60px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    transition: border-color 0.3s ease;
}

.upload-area:hover {
    border-color: var(--accent-primary);
}

.upload-area i {
    font-size: 64px;
    color: var(--text-secondary);
}

/* Chart Container */
.chart-box {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
    transition: all 0.3s ease;
}

.chart-box:hover {
    border-color: var(--accent-primary);
    transform: scale(1.005);
}

/* Settings */
.settings-group {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.setting-item input,
.setting-item select {
    padding: 12px;
    background: #1f222d;
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    color: white;
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
}

.setting-item input:focus,
.setting-item select:focus {
    border-color: var(--accent-primary);
}

.setting-item select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80a8,8,0,0,1,11.32-11.32L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

/* Analysis Status */
#preview-container {
    padding: 40px;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    margin-top: 20px;
    transition: all 0.3s ease;
}

.analysis-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.analysis-status span {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: 1px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(0.98);
    }
}

.preview-hidden {
    display: none !important;
}

.help-text {
    font-size: 12px;
    color: var(--text-secondary);
}

.help-text a {
    color: var(--accent-primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-side);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    padding: 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    max-height: 90vh;
    /* はみ出し防止 */
    overflow-y: auto;
}

#edit-date,
.edit-item input {
    height: 54px;
    /* タップしやすく大型化 */
    font-size: 18px;
    /* 文字を大きく */
    padding: 12px 16px;
    border-color: var(--accent-date-icon) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23facc15' viewBox='0 0 256 256'%3E%3Cpath d='M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 48px;
}

.edit-item input:not(#edit-date) {
    background-image: none;
    padding-right: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Guide Tab */
.guide-container {
    max-width: 800px;
}

.guide-intro {
    color: var(--text-secondary);
    margin: 16px 0 32px 0;
}

.guide-step {
    display: flex;
    gap: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

.step-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-primary);
    font-family: 'Outfit', sans-serif;
    opacity: 0.5;
}

.step-content h3 {
    margin-bottom: 12px;
    color: var(--text-main);
}

.step-content p {
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
}

.step-content ol {
    padding-left: 20px;
    color: var(--text-secondary);
}

.step-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.step-content a {
    color: var(--accent-primary);
    text-decoration: none;
}

.step-content a:hover {
    text-decoration: underline;
}

.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: var(--radius-md);
    margin-top: 16px;
    font-size: 14px;
}

.alert.tip {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--accent-success);
}

.ph-spin {
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.guide-step.mini {
    padding: 16px;
    margin-top: 16px;
    gap: 12px;
}

.guide-step.mini .step-number {
    display: none;
}

.guide-step.mini h3 {
    font-size: 16px;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    margin: 4px 0;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Calendar */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 24px;
}

#calendar-month {
    font-size: 24px;
    font-weight: 700;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    margin-bottom: 30px;
}

.calendar-day-label {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    padding-bottom: 8px;
}

.day-cell {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    padding: 10px 5px;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.day-cell:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.day-cell.today {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.05);
}

.day-cell.other-month {
    opacity: 0.3;
}

.day-num {
    font-weight: 700;
    font-size: 14px;
}

.day-info-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    font-size: 13px;
    /* 拡大 */
    font-weight: 600;
    color: var(--text-secondary);
}

.meal-count {
    font-weight: 600;
    color: var(--accent-primary);
}

.day-cal-mini {
    opacity: 0.8;
}

.day-dot {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 6px;
    height: 6px;
    background: var(--accent-primary);
    border-radius: 50%;
}

.day-summary-banner.detailed {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--accent-primary);
    min-width: 320px;
    /* ある程度の幅を確保 */
}

.day-summary-banner.detailed .main-total {
    font-size: 18px;
}

.day-summary-banner.detailed .sub-total {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Detailed History Items */
.history-item-detailed {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Charts */
.charts-container {
    width: 100%;
}

.chart-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.chart-box:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
}

.chart-header {
    margin-bottom: 20px;
}

.chart-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.chart-header .help-text {
    font-size: 12px;
    color: var(--text-secondary);
}

.h-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.h-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-main);
}

.h-time,
.h-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.h-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    font-size: 13px;
    border-top: 1px solid var(--border-card);
    padding-top: 10px;
}

.h-stat strong {
    color: var(--text-main);
}

/* Global Analysis Status Bar */
.analysis-status-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: 90%;
    max-width: 400px;
    background: rgba(45, 45, 68, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
}

.analysis-status-bar.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        bottom: -100px;
        opacity: 0;
    }

    to {
        bottom: 20px;
        opacity: 1;
    }
}

.status-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#status-text {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent-primary);
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    padding: 5px 10px;
}

/* Segment Selector (1-Tap Selection) */
.segment-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.segment-selector.meals {
    grid-template-columns: repeat(5, 1fr);
}

.segment-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    /* 統一 */
    padding: 12px 10px;
    min-height: 54px;
    /* タップしやすい高さ */
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.segment-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.segment-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.6);
    /* より強調 */
    transform: scale(1.02);
}

/* Scroll Picker Styles */
.scroll-picker-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 15px;
    padding: 15px 50% 15px 50%;
    /* パディングを増やして操作しやすく */
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    /* 少し境界を明確に */
    border-radius: var(--radius-md);
    margin-top: 15px;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
    cursor: grab;
}

.scroll-picker-container::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.picker-item {
    flex: 0 0 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-secondary);
    scroll-snap-align: center;
    scroll-snap-stop: always; /* スナップポイントを通り過ぎないように */
    transition: all 0.2s;
    user-select: none;
}

.picker-item.selected {
    color: var(--accent-primary);
    font-size: 24px;
    font-weight: 700;
    transform: scale(1.2);
}

.countdown-bar-container {
    width: 200px;
}

.profile-row-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.profile-row-grid .setting-item {
    min-width: 0;
    /* これが重要：子要素のはみ出しを防ぐ */
}

/* プロフィール用セグメント表示 */
.profile-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
    width: 100%;
    /* 親要素に合わせる */
}

.profile-options .segment-btn {
    flex: 1 1 auto;
    /* 設定値を固定せず内容に合わせつつ広がる */
    min-width: 60px;
    padding: 8px 4px;
    font-size: 14px;
}

@media (max-width: 480px) {
    .profile-row-grid {
        grid-template-columns: 1fr;
        /* モバイルでは1列に */
    }

    .segment-selector.meals {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Status Colors for Dashboard */
.status-blue {
    color: #60a5fa !important;
}

/* Blue (Success/Neutral) */
.status-yellow {
    color: #facc15 !important;
}

/* Yellow (Warning) */
.status-red {
    color: #f87171 !important;
}

/* Red (Danger) */

/* Delete Button Styles */
.btn-delete {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete:hover {
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
}

/* Day Info Refinement */
.day-info-mini {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 10px;
    line-height: 1.2;
}

/* History */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    padding: 16px;
    border-radius: var(--radius-md);
}

.h-img {
    width: 60px;
    height: 60px;
    background: #2d313d;
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.h-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.h-info {
    flex: 1;
}

.h-name {
    font-weight: 600;
    font-size: 16px;
}

.h-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.h-stats {
    text-align: right;
    display: flex;
    flex-direction: column;
}

.pfc-mini {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    #app {
        flex-direction: column;
    }

    .side-nav {
        width: 100%;
        height: 70px;
        padding: 0;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border-card);
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 1000;
        background: rgba(18, 20, 26, 0.95);
        backdrop-filter: blur(10px);
    }

    .logo,
    .user-profile,
    .nav-links span {
        display: none;
    }

    .nav-links {
        display: flex;
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        align-items: center;
        margin: 0;
        padding: 0 10px;
    }

    .nav-links li {
        margin-bottom: 0;
        padding: 12px;
        flex: 1;
        justify-content: center;
        border-radius: var(--radius-md);
        background: transparent;
    }

    .nav-links li i {
        font-size: 24px;
        margin: 0;
    }

    .nav-links li.active {
        box-shadow: none;
        background: transparent;
        color: var(--accent-primary);
    }

    .nav-links li.active i {
        background: rgba(59, 130, 246, 0.2);
        padding: 8px;
        border-radius: 50%;
    }

    .content-area {
        padding: 20px;
        padding-top: calc(20px + env(safe-area-inset-top));
        padding-bottom: calc(120px + env(safe-area-inset-bottom));
        /* ボトムナビの高さ分 + 余裕を確保 */
        width: 100%;
        overflow-y: auto;
    }

    .tab-pane {
        padding-bottom: 40px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card.veg {
        grid-column: span 1 !important;
    }
}

.troubleshoot-box {
    background: rgba(245, 158, 11, 0.05);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 10px;
}

.troubleshoot-box h5 {
    color: var(--accent-warning);
    font-size: 13px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.troubleshoot-box ul {
    list-style: none;
    font-size: 11px;
    color: var(--text-secondary);
}

.troubleshoot-box li {
    margin-bottom: 4px;
    position: relative;
    padding-left: 14px;
    line-height: 1.4;
}

.troubleshoot-box li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent-warning);
}

/* QR Modal */
.qr-content {
    max-width: 400px;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.qr-content h3 {
    margin-bottom: 10px;
    color: var(--accent-primary);
}

#qr-container img {
    border: 8px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    /* スマホナビよりも上に */
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay.hidden {
    display: none !important;
}

.hidden {
    display: none !important;
}

/* Profile Summary Card */
.profile-summary-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-item {
    font-size: 14px;
    color: var(--text-main);
}

.summary-item .label {
    color: var(--text-secondary);
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
}

.summary-stats-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: var(--radius-md);
    margin: 15px 0;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.stat-val {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
}

.stat-val .unit {
    font-size: 12px;
    font-weight: 400;
    margin-left: 2px;
}

.stat.highlight .stat-val {
    color: var(--accent-primary);
    font-size: 24px;
}

#profile-edit-area.hidden {
    display: none !important;
}

#profile-summary-area.hidden {
    display: none !important;
}

@media (max-width: 600px) {
    .summary-stats-box {
        grid-template-columns: 1fr;
    }
}