/* Nav */
.glass-nav {
    position: fixed;
    top: 0;
    width: 100%;
    height: 70px;
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 2px solid var(--border);
    z-index: 1600;
    display: flex;
    align-items: center;
}

.nav-content {
    max-width: 1100px;
    margin: 0 auto;
    width: 90%;
    display: flex;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary-dark);
}

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

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    padding: 10px;
    border-radius: 12px;
}

.nav-links a.active {
    color: var(--text-main);
    background: var(--primary-light);
}

/* Layout */
.content {
    max-width: 1100px;
    margin: 0 auto;
    width: 90%;
    padding: 20px 0;
}

.dashboard-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 30px;
    margin-bottom: 40px;
}

.header-right {
    display: flex;
    justify-content: flex-end;
}

.dashboard-header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.status-ok {
    color: var(--accent);
    font-weight: 800;
}

/* Cards */
.glass-card {
    background: white;
    border-radius: 32px;
    padding: 30px;
    box-shadow: var(--shadow);
    border: 1px solid white;
}

/* プロフィール詳細カード（PC） */
#profile-detail-card {
    max-width: 900px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stat-card:hover {
    transform: translateY(-8px);
}

.card-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 15px;
    font-weight: 600;
}

.card-value {
    font-size: 2.2rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
}

.expense-text {
    color: var(--primary-dark);
}

.recurring-text {
    color: var(--info);
}

.card-footer {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 10px;
}

/* Calendar */
.calendar-section {
    margin-bottom: 30px;
}

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

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

.calendar-day {
    aspect-ratio: 1;
    background: #fafdf8;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.calendar-day:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(163, 184, 153, 0.2);
    background: white;
    border-color: var(--primary-light);
}

.calendar-day:active {
    transform: translateY(0);
}

.calendar-day.today {
    border: 2px solid var(--primary);
    background: var(--primary-light);
}

.calendar-day-prev {
    background: #f4f7f2;
    opacity: 0.75;
}
.calendar-day-prev .day-num {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.day-num {
    font-size: 0.85rem;
    font-weight: 600;
}

.day-val {
    font-size: 0.75rem;
    text-align: right;
    font-weight: 700;
    color: var(--primary-dark);
}

/* Mortgage Tool */
.mortgage-tool {
    background: linear-gradient(135deg, #ffffff 0%, #f5faf3 100%);
    border: 2px solid var(--primary-light);
}

.tool-header .badge {
    background: var(--primary-dark);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    display: inline-block;
    margin-bottom: 10px;
}

.simulator-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 40px;
    margin-top: 30px;
}

.input-group {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.input-group input {
    border: none;
    font-size: 1.4rem;
    font-weight: 700;
    width: 80%;
    background: transparent;
    color: var(--text-main);
}

.input-group .unit {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.result-box {
    background: white;
    border-radius: 24px;
    padding: 25px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.02);
    text-align: center;
    margin-bottom: 20px;
}

.result-box .label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.result-box .value {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--primary-dark);
    font-family: 'Outfit';
    margin: 10px 0;
}

.simulation-cta {
    background: var(--primary-light);
    padding: 25px;
    border-radius: 20px;
    text-align: center;
}

.simulation-cta p {
    font-size: 0.9rem;
    margin-bottom: 15px;
    line-height: 1.6;
    font-weight: 600;
}

/* Buttons */
.btn {
    border: none;
    padding: 14px 24px;
    border-radius: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, color 0.3s ease;
    white-space: nowrap !important;
}

.btn:active {
    transform: scale(0.96);
}

.btn-lg {
    padding: 16px 36px;
    font-size: 1.1rem;
    border-radius: 35px;
}

.btn-full {
    width: 100%;
}

.btn-primary {
    background: var(--primary-dark);
    color: white;
    box-shadow: var(--shadow-soft);
}

.btn-primary:hover {
    background: #4A7A59;
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(91, 140, 106, 0.3);
}

.btn-secondary {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.btn-accent {
    background: var(--accent);
    color: white;
    box-shadow: 0 8px 20px rgba(157, 192, 139, 0.3);
}

.btn-accent:hover {
    background: #4A7A59;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary-dark);
    color: var(--primary-dark);
    background: white;
}

/* User Menu Dropdown */
.user-menu-container {
    position: relative;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-light);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: 0.3s;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
}

.user-profile:hover {
    background: var(--primary);
    color: white;
}

.avatar {
    width: 28px;
    height: 28px;
    background: white;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 800;
}

.dropdown-menu {
    position: absolute;
    top: 55px;
    right: 0;
    width: max-content;
    min-width: 220px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 10px;
    z-index: 2000;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.dropdown-menu.hidden {
    display: flex;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    pointer-events: none;
}

.dropdown-menu a {
    text-decoration: none;
    color: var(--text-main);
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: 0.2s;
    white-space: nowrap !important;
}

.dropdown-menu a:hover {
    background: var(--bg-warm);
    color: var(--primary-dark);
}

.dropdown-menu i {
    width: 16px;
}

.menu-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

/* Modal scroll lock */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(93, 74, 74, 0.4);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    overscroll-behavior: contain;
}

.hidden {
    display: none;
}

/* Modal & Form Refinement */
.modal-content {
    background: white;
    border-radius: 40px;
    padding: 40px;
    box-shadow: 0 30px 60px rgba(93, 74, 74, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.8);
    position: relative;
    max-width: 90%;
}

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

.modal-header h2 {
    font-size: 1.5rem;
    color: var(--text-main);
    font-weight: 800;
}

.close-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-warm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
    color: var(--text-muted);
}

.close-btn:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    transform: rotate(90deg);
}

.tab-container {
    display: flex;
    background: var(--bg-warm);
    padding: 6px;
    border-radius: 20px;
    margin-bottom: 25px;
}

.tab-btn {
    flex: 1;
    border: none;
    padding: 10px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 0.9rem;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.3s;
}

.tab-btn.active {
    background: white;
    color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(163, 184, 153, 0.15);
    white-space: nowrap !important;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    margin-left: 5px;
}

.input-with-icon {
    display: flex;
    align-items: center;
    background: var(--bg-warm);
    border-radius: 18px;
    padding: 5px 15px;
    border: 2px solid transparent;
    transition: 0.3s;
}

.input-with-icon:focus-within {
    border-color: var(--primary-light);
    background: white;
    box-shadow: 0 0 0 4px rgba(163, 184, 153, 0.15);
}

.input-with-icon i {
    color: var(--text-muted);
    width: 18px;
    margin-right: 12px;
}

.input-with-icon input,
.input-with-icon select {
    border: none;
    background: transparent;
    width: 100%;
    padding: 10px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    outline: none;
}
.input-with-icon input:focus-visible,
.input-with-icon select:focus-visible {
    outline: 2px solid var(--primary-dark);
    outline-offset: 2px;
    border-radius: 4px;
}

.input-with-icon input::placeholder {
    color: #c8cec4;
}

.category-add-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.btn-icon {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.btn-icon:hover {
    background: var(--primary-dark);
    color: white;
    transform: scale(1.05);
}

.btn-icon-sm {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-dark);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.btn-icon-sm:hover {
    background: var(--primary-dark);
    color: white;
    transform: scale(1.1);
}

.btn-icon-sm svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 800px) {
    .simulator-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

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

/* Landing Page Specific */
.hero-section {
    padding: 50px 0 30px;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr;
    text-align: center;
    gap: 30px;
}

.hero-text {
    max-width: 700px;
    margin: 0 auto;
}

.hero-text h1 {
    font-size: 3rem;
    line-height: 1.2;
    margin-bottom: 24px;
    font-family: 'Zen Kaku Gothic New', sans-serif;
}

.highlight {
    color: var(--primary-dark);
    position: relative;
    display: inline-block;
}

.highlight::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 0;
    width: 100%;
    height: 12px;
    background: var(--primary-light);
    z-index: -1;
    opacity: 0.6;
}

.hero-text p {
    font-size: 1.05rem;
    color: var(--text-muted);
    margin-bottom: 30px;
    line-height: 1.8;
}

.hero-ctas {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.lp-app-store-info {
    margin-top: 28px;
    text-align: center;
}
.lp-app-store-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.lp-app-store-rows {
    display: inline-flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(163, 184, 153, 0.1);
    border: 1px solid rgba(91, 140, 106, 0.15);
    border-radius: 12px;
    padding: 12px 24px;
}
.lp-app-store-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
}
.lp-app-store-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--primary-dark);
}

.section-title {
    text-align: center;
    margin-bottom: 60px;
}

.section-title h2 {
    font-size: 2.2rem;
    margin-bottom: 12px;
    font-family: 'Zen Kaku Gothic New', sans-serif;
}

.features-section {
    padding: 50px 0 70px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.f-card {
    padding: 40px 30px;
    text-align: center;
    transition: 0.4s;
    background: white;
    border-radius: 25px;
    box-shadow: var(--shadow);
}

.f-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.f-icon {
    width: 50px;
    height: 50px;
    color: var(--primary-dark);
    margin-bottom: 20px;
}

/* App Showcase Responsive */
@media (max-width: 700px) {
    .hero-text h1 {
        font-size: 1.8rem;
    }

    .hero-text p {
        font-size: 0.92rem;
    }

    .btn-lg {
        font-size: 0.95rem !important;
        padding: 14px 30px !important;
    }

    .lp-mock-dashboard {
        grid-template-columns: 1fr !important;
    }

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

    .f-card p {
        line-height: 1.8;
    }
}

/* Auth Modal Styles */
.auth-content {
    max-width: 450px !important;
}

.auth-divider {
    margin: 25px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    padding: 0 15px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

/* ===== ハンバーガーメニュー（デスクトップ非表示） ===== */

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    min-width: 44px;
    min-height: 44px;
    z-index: 1001;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 3px;
    background: var(--text-main);
    border-radius: 3px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger-btn.is-open .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.hamburger-btn.is-open .hamburger-line:nth-child(2) {
    opacity: 0;
}
.hamburger-btn.is-open .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(93, 74, 74, 0.3);
    z-index: 999;
}
.mobile-nav-overlay.is-visible {
    display: block;
}

/* ===== ホーム画面セクション配置（ベース: モバイル） ===== */
.home-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 100%;
    overflow: hidden;
}
.home-sec-stats { display: none; }

/* ===== デスクトップ: 左サイドバー + カレンダーの Grid レイアウト ===== */
@media (min-width: 769px) {
    .home-sections {
        display: grid !important;
        grid-template-columns: 220px 1fr;
        grid-template-areas:
            "sidebar  calendar"
            "sidebar  stats"
            "sidebar  mode";
        gap: 16px;
    }
    .home-sidebar { grid-area: sidebar; display: flex; flex-direction: column; gap: 12px; align-self: start; }
    .home-sec-stats-compact { display: block; grid-area: stats; align-self: start; }
    .home-sec-calendar { grid-area: calendar; }
    .home-sec-mode-content { grid-area: mode; }

    /* サイドバー共通: 控えめな見た目 */
    .home-sidebar .glass-card {
        background: #FFF8F6 !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
        border: none !important;
        font-size: 0.85rem;
    }

    /* サイドバー内CTA: 縦積み */
    .home-sidebar .fp-cta-card {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        padding: 16px 14px;
    }
    .home-sidebar .fp-cta-photo { width: 52px; height: 52px; }
    .home-sidebar .fp-cta-body h3 { font-size: 0.78rem; margin-bottom: 4px; }
    .home-sidebar .fp-cta-body p { font-size: 0.72rem; }
    .home-sidebar .fp-cta-btn { width: 100%; padding: 10px; font-size: 0.75rem; }
}

/* コンパクト収支バー（Web・モバイル共通） */
.home-sec-stats-compact {
    display: block;
    padding: 10px 12px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 0.75rem;
}
.hsc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
}
.hsc-item {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: space-between;
    padding: 4px 0;
}
.hsc-label { color: var(--text-muted); font-weight: 700; font-size: 0.7rem; }
.hsc-val { font-weight: 900; color: var(--text-main); }
.hsc-inc { color: var(--accent); }
.hsc-exp { color: var(--primary-dark); }
.hsc-check { color: var(--success); }

/* 自炊頻度ボタン */
.hsc-cooking-btn {
    background: none;
    border: 1px dashed var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
    padding: 4px 6px;
    min-height: 44px;
    transition: background 0.2s;
}
.hsc-cooking-btn:active { background: var(--bg-warm); }

/* 自炊頻度セグメントコントロール */
.hsc-cooking-panel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, margin-top 0.3s ease, padding 0.3s ease;
    margin-top: 0;
    padding: 0 0;
}
.hsc-cooking-panel.open {
    max-height: 50px;
    margin-top: 8px;
    padding: 4px 0;
}
.hsc-cooking-opt {
    padding: 6px 2px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: inherit;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    text-align: center;
}
.hsc-cooking-opt:active { transform: scale(0.95); }
.hsc-cooking-opt.active {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary-dark);
    font-weight: 900;
}

/* カレンダーセル金額 */
.cal-amounts {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    width: 100%;
    overflow: hidden;
}
.cal-amt {
    font-size: 0.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ===== ナビロックアイコン ===== */
.nav-locked { opacity: 0.5; }
.lock-icon { font-size: 0.65rem; vertical-align: super; }
