@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700;800&family=Noto+Sans+JP:wght@400;500;700;800&display=swap');

:root {
    /* --- DUOLINGO PALETTE --- */
    --duo-green: #58CC02;
    --duo-green-shadow: #46A302;
    --duo-green-light: #89E219;

    --duo-blue: #1CB0F6;
    --duo-blue-shadow: #1899D6;

    --duo-yellow: #FFC800;
    --duo-yellow-shadow: #E5B200;

    --duo-red: #FF4B4B;
    --duo-red-shadow: #D93737;

    --duo-gray: #E5E5E5;
    --duo-gray-shadow: #C7C7C7;
    --duo-text: #4B4B4B;
    --duo-text-gray: #777777;

    --duo-bg: #FFFFFF;
    --duo-body-bg: #FFFFFF;

    --radius-lg: 16px;
    --radius-md: 12px;
    --border-width: 2px;
    --btn-shadow-depth: 4px;
    --tap-target-min: 44px;
    --focus-ring-color: rgba(28, 176, 246, 0.35);
    --network-indicator-height: 3px;

    --safe-bottom: env(safe-area-inset-bottom, 20px);
}

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    margin: 0;
    padding: 0;
    padding-bottom: calc(120px + var(--safe-bottom));
    /* Fixed footer space */
    background: var(--duo-body-bg);
    color: var(--duo-text);
    -webkit-tap-highlight-color: transparent;
}

/* --- UX DETAIL ENHANCEMENTS --- */
:where(button, a, input, select, textarea, [role="button"]) {
    touch-action: manipulation;
}

:where(button, a, input, select, textarea, [role="button"]):focus-visible {
    outline: 3px solid var(--focus-ring-color);
    outline-offset: 2px;
}

html::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--network-indicator-height);
    background: linear-gradient(90deg, #89e219 0%, #1cb0f6 50%, #89e219 100%);
    z-index: 3000;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-100%);
}

html.is-network-busy::before {
    opacity: 1;
    animation: network-progress 1.1s ease-in-out infinite;
}

@keyframes network-progress {
    0% {
        transform: translateX(-100%);
    }

    50% {
        transform: translateX(0%);
    }

    100% {
        transform: translateX(100%);
    }
}

.duo-btn,
.nav-item,
.fixed-footer .duo-btn,
.bottom-nav .nav-item,
.toggle-button-group button {
    min-height: var(--tap-target-min);
}

.info-btn {
    position: relative;
}

.info-btn::after {
    content: '';
    position: absolute;
    inset: -10px;
    pointer-events: none;
}

.is-disabled-feedback {
    animation: disabled-shake 0.32s ease-in-out;
}

.skeleton-block,
.skeleton-line {
    position: relative;
    overflow: hidden;
    background: #e9edf3;
}

.skeleton-block::after,
.skeleton-line::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.55) 50%, transparent 100%);
    animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
    100% {
        transform: translateX(100%);
    }
}

@keyframes skeleton-bg-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

body.dashboard-skeleton-loading #dash-income-amount,
body.dashboard-skeleton-loading #dash-expense-amount,
body.dashboard-skeleton-loading #dash-receipt-count,
body.dashboard-skeleton-loading #days-left {
    display: inline-block;
    min-width: 88px;
    min-height: 1.2em;
    color: transparent !important;
    border-radius: 8px;
    background: linear-gradient(90deg, #e9edf3 25%, #f6f9fc 50%, #e9edf3 75%);
    background-size: 220% 100%;
    animation: skeleton-bg-shimmer 1.25s ease-in-out infinite;
}

body.dashboard-skeleton-loading #dash-receipt-count,
body.dashboard-skeleton-loading #days-left {
    min-width: 56px;
}

body.dashboard-skeleton-loading #todo-list-section .todo-item {
    pointer-events: none;
}

body.dashboard-skeleton-loading #todo-list-section .todo-item .todo-checkbox,
body.dashboard-skeleton-loading #todo-list-section .todo-item div:not([class]) {
    color: transparent !important;
    border-color: transparent !important;
    border-radius: 8px;
    background: linear-gradient(90deg, #e9edf3 25%, #f6f9fc 50%, #e9edf3 75%) !important;
    background-size: 220% 100% !important;
    animation: skeleton-bg-shimmer 1.25s ease-in-out infinite;
}

body.payment-skeleton-loading #receipt-breakdown li,
body.payment-skeleton-loading #receipt-total-display {
    color: transparent !important;
    border-color: transparent !important;
    border-radius: 8px;
    background: linear-gradient(90deg, #e9edf3 25%, #f6f9fc 50%, #e9edf3 75%) !important;
    background-size: 220% 100% !important;
    animation: skeleton-bg-shimmer 1.25s ease-in-out infinite;
}

body.payment-skeleton-loading #receipt-breakdown li {
    min-height: 18px;
}

body.settings-loading .settings-skeleton-target {
    color: transparent !important;
    border-color: #e9edf3 !important;
    box-shadow: none !important;
    background: linear-gradient(90deg, #e9edf3 25%, #f6f9fc 50%, #e9edf3 75%) !important;
    background-size: 220% 100% !important;
    animation: skeleton-bg-shimmer 1.25s ease-in-out infinite;
}

body.settings-loading .settings-skeleton-target::placeholder {
    color: transparent !important;
}

body.settings-loading .settings-skeleton-card {
    pointer-events: none;
}

@keyframes disabled-shake {
    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-2px);
    }

    40% {
        transform: translateX(2px);
    }

    60% {
        transform: translateX(-1px);
    }

    80% {
        transform: translateX(1px);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    html::before,
    html.is-network-busy::before {
        animation: none !important;
        transform: none !important;
        opacity: 1;
    }
}

header {
    /* Simplified Progress Header */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #fff;
    /* border-bottom: 2px solid #E5E5E5; */
    /* Optional, maybe cleaner without */
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 1.2rem;
    color: var(--duo-text-gray);
    margin: 0;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

header h1 span {
    font-size: 0.8rem;
    font-weight: 700;
    color: #AFB6C1;
    margin-left: 8px;
}

/* --- DUO COMPONENTS --- */

/* 1. BUTTONS */
.duo-btn {
    display: block;
    width: 100%;
    background-color: var(--duo-green);
    color: white;
    font-family: inherit;
    font-weight: 800;
    font-size: 1rem;
    text-transform: none;
    /* Japanese doesn't really have uppercase */
    letter-spacing: 0.05em;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0px var(--btn-shadow-depth) 0px var(--duo-green-shadow);
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.1s;
    user-select: none;
}

.duo-btn:active {
    transform: translateY(var(--btn-shadow-depth));
    box-shadow: 0px 0px 0px var(--duo-green-shadow);
}

/* Variants */
.duo-btn.secondary {
    background-color: #fff;
    color: var(--duo-blue);
    border: 2px solid var(--duo-gray);
    box-shadow: 0px var(--btn-shadow-depth) 0px var(--duo-gray);
}

.duo-btn.secondary:active {
    box-shadow: 0px 0px 0px var(--duo-gray);
}

.duo-btn.blue {
    background-color: var(--duo-blue);
    box-shadow: 0px var(--btn-shadow-depth) 0px var(--duo-blue-shadow);
}

.info-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--duo-gray);
    background: #fff;
    color: var(--duo-text-gray);
    font-weight: 800;
    font-size: 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.info-btn:active {
    transform: translateY(1px);
}

.duo-btn.blue:active {
    box-shadow: 0px 0px 0px var(--duo-blue-shadow);
}

.duo-btn.red {
    background-color: var(--duo-red);
    box-shadow: 0px var(--btn-shadow-depth) 0px var(--duo-red-shadow);
}

.duo-btn.red:active {
    box-shadow: 0px 0px 0px var(--duo-red-shadow);
}

.duo-btn:disabled,
.duo-btn.disabled {
    background-color: var(--duo-gray);
    color: #AFAFAF;
    box-shadow: 0px var(--btn-shadow-depth) 0px var(--duo-gray-shadow);
    cursor: not-allowed;
    transform: none;
}

/* 2. CARDS */
.duo-card {
    background: #fff;
    border: 2px solid var(--duo-gray);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    /* No shadow in flat style, just border */
    position: relative;
    overflow: hidden;
}

.duo-card.active {
    border-color: var(--duo-blue);
    background-color: #f0f9ff;
}

.duo-card:hover {
    border-color: #ccc;
    /* Subtle hover */
}

.tax-estimate-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tax-estimate-description {
    font-size: 0.85rem;
    color: var(--duo-text-gray);
    line-height: 1.6;
}

.tax-estimate-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.tax-estimate-item {
    border: 2px solid var(--duo-gray);
    border-radius: 12px;
    padding: 12px;
    background: #f9fbff;
}

.tax-estimate-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--duo-text-gray);
}

.tax-estimate-amount {
    margin-top: 8px;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--duo-blue);
}

.tax-estimate-meta {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--duo-text-gray);
}

.tax-estimate-rows {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tax-estimate-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px dashed #d7dfef;
}

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

.tax-estimate-row-emphasis {
    margin-top: 2px;
    padding-top: 10px;
    border-top: 1px solid #d8ecff;
    border-bottom: none;
}

.tax-estimate-label {
    font-size: 0.76rem;
    color: var(--duo-text-gray);
    font-weight: 700;
}

.tax-estimate-value {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--duo-text);
}

.tax-estimate-tax {
    color: var(--duo-blue);
    font-size: 1.05rem;
}

.tax-estimate-breakdown {
    margin-top: 6px;
    font-size: 0.73rem;
    color: var(--duo-text-gray);
    line-height: 1.5;
}

.tax-estimate-model {
    display: inline-flex;
    align-self: flex-start;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #f0f9ff;
    border: 1px solid #d8ecff;
    color: var(--duo-blue);
    font-size: 0.75rem;
    font-weight: 700;
}

.tax-estimate-note {
    font-size: 0.75rem;
    color: var(--duo-text-gray);
    line-height: 1.6;
}

/* --- TAX SAVING PAGE --- */
.tax-saving-hero {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: linear-gradient(135deg, #f5f9ff 0%, #fef6ff 100%);
    border: 2px solid #dfe8ff;
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.tax-saving-hero-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--duo-text);
}

.tax-saving-hero-sub {
    font-size: 0.85rem;
    color: var(--duo-text-gray);
    line-height: 1.6;
}

.tax-potential-card {
    border-radius: 14px;
    background: #fff;
    border: 1px solid #e6ecf5;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tax-potential-amount {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--duo-red);
}

.tax-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fff7ed;
    color: #c2410c;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid #fed7aa;
}

.tax-alert-card {
    display: flex;
    gap: 12px;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #fde68a;
    padding: 14px 16px;
    align-items: center;
}

.tax-alert-icon {
    font-size: 1.4rem;
}

.tax-alert-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--duo-text);
}

.tax-alert-sub {
    font-size: 0.8rem;
    color: var(--duo-text-gray);
    margin-top: 4px;
}

.tax-bar-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tax-bar {
    display: flex;
    height: 20px;
    border-radius: 999px;
    overflow: hidden;
    background: #e5e7eb;
}

.tax-bar-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    transition: width 0.3s ease;
    white-space: nowrap;
}

.tax-bar-segment.tax {
    background: #ef4444;
}

.tax-bar-segment.takehome {
    background: #9ca3af;
}

.tax-bar-label.is-hidden {
    opacity: 0;
}

.tax-bar-legend {
    font-size: 0.75rem;
    color: var(--duo-text-gray);
}

.catalog-table {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.catalog-item {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.catalog-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--duo-text);
}

.catalog-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag-pill {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: #f3f4f6;
    color: var(--duo-text);
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.score-card {
    background: #f8fafc;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    color: var(--duo-text);
}

.score-stars {
    letter-spacing: 1px;
    color: #f59e0b;
    font-weight: 800;
}

.recommend-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--duo-text-gray);
}

.recommend-yes {
    color: var(--duo-green);
    font-weight: 700;
}

.recommend-no {
    color: var(--duo-red);
    font-weight: 700;
}

.simulator-card {
    border-radius: 16px;
    border: 1px solid #e7eaf0;
    background: #f8fbff;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--duo-text);
}

.slider-value {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--duo-blue);
}

.slider-note {
    font-size: 0.72rem;
    color: var(--duo-text-gray);
    line-height: 1.5;
}

.range-input {
    width: 100%;
    accent-color: var(--duo-blue);
}

.tax-saving-results {
    border-radius: 16px;
    border: 1px solid #e7eaf0;
    background: #fff;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.result-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.yield-badge {
    align-self: flex-start;
    padding: 6px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #fef3c7 0%, #bbf7d0 100%);
    color: #14532d;
    font-weight: 800;
    font-size: 0.95rem;
}

.result-sub {
    font-size: 0.8rem;
    color: var(--duo-text-gray);
}

.comparison-chart {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chart-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chart-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--duo-text);
}

.stacked-bar {
    display: flex;
    height: 22px;
    border-radius: 12px;
    overflow: hidden;
    background: #e5e7eb;
}

.stacked-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
    transition: width 0.3s ease;
    white-space: nowrap;
}

.stacked-segment.tax {
    background: #ef4444;
}

.stacked-segment.tax.compressed {
    background: #f87171;
}

.stacked-segment.asset {
    background: #22c55e;
}

.stacked-segment.takehome {
    background: #6b7280;
}

.stacked-label.is-hidden {
    opacity: 0;
}

.chart-meta {
    font-size: 0.75rem;
    color: var(--duo-text-gray);
}

.takehome-diff {
    align-self: flex-start;
    padding: 8px 12px;
    border-radius: 12px;
    background: #ecfdf3;
    color: #15803d;
    font-weight: 800;
    font-size: 0.9rem;
}

.simulator-result {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--duo-blue);
}

.vip-mosaic {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #fff;
}

.vip-content {
    filter: blur(6px);
    opacity: 0.6;
    padding: 16px;
}

.vip-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.55);
    color: #fff;
    text-align: center;
    padding: 20px;
}

.vip-overlay-title {
    font-size: 1rem;
    font-weight: 800;
}

.vip-overlay-text {
    font-size: 0.8rem;
    line-height: 1.6;
}

/* --- SWIPE UI --- */
.swipe-intro {
    text-align: center;
    padding: 18px 20px;
}

.swipe-intro-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--duo-text);
}

.swipe-intro-sub {
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--duo-text-gray);
}

.swipe-intro-hint {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--duo-text-gray);
}

.swipe-count {
    margin-top: 10px;
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: #f3f4f6;
    font-weight: 700;
    font-size: 0.85rem;
}

.swipe-stage {
    position: relative;
    min-height: 260px;
}

.swipe-card {
    position: relative;
    background: #fff;
    border: 2px solid var(--duo-gray);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.swipe-card::before,
.swipe-card::after {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    top: 8px;
    bottom: -8px;
    background: #fff;
    border: 2px solid var(--duo-gray);
    border-radius: var(--radius-lg);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.swipe-card::after {
    top: 16px;
    bottom: -16px;
}

.swipe-card.stack-2::before {
    opacity: 1;
    transform: translateY(6px);
}

.swipe-card.stack-3::before {
    opacity: 1;
    transform: translateY(6px);
}

.swipe-card.stack-3::after {
    opacity: 1;
    transform: translateY(12px);
}

.swipe-card.swipe-left {
    transform: translateX(-120px) rotate(-6deg);
    opacity: 0;
}

.swipe-card.swipe-right {
    transform: translateX(120px) rotate(6deg);
    opacity: 0;
}

.swipe-card-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fef9c3;
    color: #92400e;
    font-size: 0.7rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.swipe-card-date {
    font-size: 0.85rem;
    color: var(--duo-text-gray);
}

.swipe-card-vendor {
    margin-top: 8px;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--duo-text);
}

.swipe-card-amount {
    margin-top: 10px;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--duo-green);
}

.swipe-card-amount.expense {
    color: #EF5350;
}

.swipe-card-amount.income {
    color: var(--duo-green);
}

.swipe-card-meta {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--duo-text-gray);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f3f4f6;
}

.swipe-card-ai {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
}

.swipe-card-ai-title {
    font-size: 0.75rem;
    font-weight: 800;
    color: #475569;
    margin-bottom: 4px;
}

.swipe-card-ai-text {
    font-size: 0.82rem;
    line-height: 1.4;
    color: #334155;
}

.swipe-card-ai.high {
    border-color: #fecaca;
    background: #fff1f2;
}

.swipe-card-ai.high .swipe-card-ai-title {
    color: #b91c1c;
}

.swipe-card-ai.medium {
    border-color: #fde68a;
    background: #fffbeb;
}

.swipe-card-ai.medium .swipe-card-ai-title {
    color: #b45309;
}

.swipe-card-ai.low {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.swipe-card-ai.low .swipe-card-ai-title {
    color: #1d4ed8;
}

.swipe-empty {
    text-align: center;
    padding: 40px 20px;
}

.fixed-footer.swipe-footer {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 12px 20px calc(16px + var(--safe-bottom));
}

.fixed-footer.swipe-footer .duo-btn {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 12px 8px;
    font-size: 0.9rem;
}

#swipe-private-btn,
#swipe-expense-btn {
    flex: 2;
}

#swipe-hold-btn {
    flex: 1;
    min-width: 66px;
}

.swipe-divider {
    flex: 0 0 auto;
    color: #c4ccd9;
    font-weight: 800;
    font-size: 1.05rem;
    line-height: 1;
    user-select: none;
}

/* 3. INPUTS */
.input-text,
.input-select,
.input-textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--duo-text);
    background: #F7F7F7;
    border: 2px solid var(--duo-gray);
    border-radius: var(--radius-md);
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    /* Fix for mobile width */
}

.input-text:focus,
.input-select:focus,
.input-textarea:focus {
    border-color: var(--duo-blue);
    background: #fff;
}

/* Date Input Fix for Mobile */
input[type="date"].input-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    max-width: 100%;
    min-height: 52px;
}

/* 4. LABELS & BADGES */
label {
    display: block;
    font-weight: 800;
    color: var(--duo-text);
    margin-bottom: 10px;
    font-size: 1rem;
}

.badge {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 8px;
    margin-left: 8px;
    vertical-align: middle;
}

.badge.required {
    background: #FFE5E5;
    color: var(--duo-red);
}

.badge.optional {
    background: #F0F0F0;
    color: #999;
}

/* 5. SELECTION GROUPS (Big Cards) */
.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-card input,
.checkbox-card input {
    /* Hide default radio, use custom UI */
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border: 2px solid var(--duo-gray);
    border-radius: 50%;
    margin-right: 16px;
    position: relative;
    background: #fff;
    flex-shrink: 0;
}

.radio-card input:checked,
.checkbox-card input:checked {
    background: var(--duo-blue);
    border-color: var(--duo-blue);
    box-shadow: 0 0 0 4px rgba(28, 176, 246, 0.2);
}

.radio-card input:checked::after {
    /* Checkmark or center dot */
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
}

.radio-card,
.checkbox-card {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid var(--duo-gray);
    border-radius: var(--radius-lg);
    padding: 16px;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.1s;
}

.radio-card:active,
.checkbox-card:active {
    transform: scale(0.98);
}

.radio-card:has(input:checked),
.checkbox-card:has(input:checked) {
    border-color: var(--duo-blue);
    background: #F2FAFF;
}

.checkbox-group.weekday-compact {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.checkbox-card.weekday-compact-card {
    padding: 6px 8px;
    justify-content: center;
    gap: 6px;
    font-size: 0.85rem;
    text-align: center;
}

.checkbox-card.weekday-compact-card input {
    width: 18px;
    height: 18px;
    margin-right: 6px;
}

.checkbox-card.weekday-compact-card input:checked {
    box-shadow: 0 0 0 3px rgba(28, 176, 246, 0.2);
}

@media (max-width: 360px) {
    .checkbox-group.weekday-compact {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}


/* --- LAYOUT UTILS --- */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

/* Fixed Footer for Main Action */
.fixed-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    border-top: 2px solid var(--duo-gray);
    padding: 16px 20px;
    padding-bottom: calc(16px + var(--safe-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.fixed-footer .duo-btn {
    max-width: 500px;
    /* Limit width on tablet */
    width: 100%;
}

.container.payment-container {
    padding-bottom: calc(220px + var(--safe-bottom));
}

.fixed-footer.payment-footer {
    gap: 8px;
    height: auto;
    min-height: 0;
    justify-content: flex-start;
    padding: 12px 16px calc(12px + var(--safe-bottom));
}

@supports (padding-bottom: max(0px)) {
    .fixed-footer.payment-footer {
        padding-bottom: max(12px, calc(12px + env(safe-area-inset-bottom)));
    }
}

/* --- DASHBOARD SPECIFIC --- */
.dashboard-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--duo-text);
    margin-bottom: 24px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.dashboard-card {
    background: #fff;
    border: 2px solid var(--duo-gray);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    /* Box shadow bottom for depth */
    box-shadow: 0px 4px 0px var(--duo-gray);
    transition: all 0.1s;
}

.dashboard-card:active {
    transform: translateY(4px);
    box-shadow: 0px 0px 0px var(--duo-gray);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.dashboard-card h3 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--duo-text);
    margin: 0;
}

.dashboard-option-inline {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.dashboard-option-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 800;
    color: #92400E;
    background: #FEF3C7;
    border: 1px solid #FCD34D;
}

.dashboard-option-chip {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    border: 1px solid transparent;
}

.dashboard-option-chip.option-paid,
.dashboard-option-chip.paid {
    background: #DCFCE7;
    color: #166534;
    border-color: #86EFAC;
}

.dashboard-option-chip.option-pending,
.dashboard-option-chip.pending {
    background: #FFF7ED;
    color: #9A3412;
    border-color: #FDBA74;
}

.dashboard-option-chip.option-none,
.dashboard-option-chip.none {
    background: #FEE2E2;
    color: #991B1B;
    border-color: #FCA5A5;
}

.dashboard-option-note {
    margin: 8px 0 0;
    font-size: 0.72rem;
    line-height: 1.45;
    color: var(--duo-text-gray);
}

/* Tower Banner in Dashboard */
.tower-banner {
    background: #fff;
    border: 2px solid var(--duo-blue);
    /* Blue Theme */
    border-radius: var(--radius-lg);
    padding: 4px;
    /* Inner border padding effect? */
    cursor: pointer;
    box-shadow: 0px 4px 0px var(--duo-blue-shadow);
    margin-bottom: 24px;
}

.tower-banner:active {
    transform: translateY(4px);
    box-shadow: none;
}

.tower-inner {
    background: var(--duo-blue);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

/* Quick Action (Camera) */
.action-card {
    background: #fff;
    border: 2px solid var(--duo-gray);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    cursor: pointer;
    box-shadow: 0px 4px 0px var(--duo-gray);
}

.action-card:active {
    transform: translateY(4px);
    box-shadow: none;
}

.action-card.highlight {
    border-color: var(--duo-green);
    box-shadow: 0px 4px 0px var(--duo-green-shadow);
    color: var(--duo-green);
    /* Text color */
}


/* --- TOWER / BADGES --- */
.badge-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
}

.badge-item {
    width: 60px;
    height: 60px;
    background: var(--duo-gray);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    filter: grayscale(1);
    opacity: 0.5;
    border: 4px solid #fff;
    box-shadow: 0 4px 0 var(--duo-gray-shadow);
}

.badge-item.unlocked {
    background: var(--duo-yellow);
    filter: grayscale(0);
    opacity: 1;
    box-shadow: 0 4px 0 var(--duo-yellow-shadow);
}


/* --- GENERAL --- */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

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

.spinner {
    width: 30px;
    height: 30px;
    border: 4px solid var(--duo-gray);
    border-top-color: var(--duo-blue);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

/* --- BOTTOM NAV (Duolingo Style) --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    border-top: 2px solid var(--duo-gray);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    padding-bottom: calc(10px + var(--safe-bottom));
    height: calc(70px + var(--safe-bottom));
    z-index: 1000;
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #AFB6C1;
    cursor: pointer;
    flex: 1;
}

.nav-item .icon {
    font-size: 1.8rem;
    margin-bottom: 4px;
    /* Optional: 3D feel for icons too? */
    transition: transform 0.1s;
}

.nav-item .label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
}

.nav-item.active {
    color: var(--duo-blue);
}

.nav-item.active .icon {
    transform: translateY(-2px);
    /* Add a stroke or filter if possible, or just color */
}

/* Image-based icons if using emojis */
.nav-item .icon img {
    width: 32px;
    height: 32px;
}

/* --- FIXES for Mobile Layout --- */
.container {
    padding-bottom: calc(140px + var(--safe-bottom));
    /* Increase bottom padding to clear fixed footer */
}

.fixed-footer {
    height: calc(56px + 32px + var(--safe-bottom));
    /* Approximate height: btn + padding */
    box-sizing: border-box;
    background: linear-gradient(to top, rgba(255, 255, 255, 1) 80%, rgba(255, 255, 255, 0));
    /* Fade effect? or just solid */
    background: #fff;
    /* Ensure footer is on top */
    z-index: 9999;
}

/* Breakdown List */
#breakdown-list li {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--duo-gray);
    font-weight: 700;
}

#breakdown-list li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* --- DUOLINGO UI/UX ENHANCEMENTS --- */

/* Micro-animations for better feedback */
@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Card entrance animation */
.duo-card,
.action-card,
.dashboard-card {
    animation: slideUp 0.3s ease-out;
}

/* Success toast */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--duo-green);
    color: white;
    padding: 14px 28px;
    border-radius: 30px;
    font-weight: 800;
    font-size: 1rem;
    box-shadow: 0 6px 20px rgba(88, 204, 2, 0.4);
    z-index: 9999;
    animation: slideUp 0.3s ease-out, fadeOut 0.3s 2.5s forwards;
}

.toast.error {
    background: var(--duo-red);
    box-shadow: 0 6px 20px rgba(255, 75, 75, 0.4);
}

.toast.with-action {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    min-width: min(540px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    animation: slideUp 0.3s ease-out;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
    white-space: pre-line;
}

.toast-action-btn {
    border: 0;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.toast-action-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--duo-text-gray);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--duo-text);
    margin-bottom: 8px;
}

.empty-state-desc {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Progress indicator */
.progress-bar {
    height: 12px;
    background: var(--duo-gray);
    border-radius: 6px;
    overflow: hidden;
    margin: 16px 0;
}

.progress-bar-fill {
    height: 100%;
    background: var(--duo-green);
    border-radius: 6px;
    transition: width 0.5s ease-out;
}

/* Streak / Stats display */
.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--duo-gray);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-icon {
    font-size: 1.8rem;
    width: 50px;
    height: 50px;
    background: #F7F7F7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--duo-text);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--duo-text-gray);
    font-weight: 700;
}

/* Better tap feedback */
.dashboard-card:hover,
.action-card:hover,
.duo-card:hover {
    transform: translateY(-2px);
}

.dashboard-card:active,
.action-card:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* Highlighted section title */
.section-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--duo-text-gray);
    margin: 24px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--duo-green);
    border-radius: 2px;
}

/* Checkbox with animation */
.checkbox-animated {
    position: relative;
    width: 28px;
    height: 28px;
    border: 3px solid var(--duo-gray);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.checkbox-animated.checked {
    background: var(--duo-green);
    border-color: var(--duo-green);
    animation: pop 0.3s;
}

.checkbox-animated.checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: 800;
    font-size: 1rem;
}

/* Floating action button */
.fab {
    position: fixed;
    bottom: calc(100px + var(--safe-bottom));
    right: 20px;
    width: 64px;
    height: 64px;
    background: var(--duo-green);
    border: none;
    border-radius: 50%;
    box-shadow: 0 6px 0 var(--duo-green-shadow), 0 8px 20px rgba(0, 0, 0, 0.15);
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 900;
    transition: all 0.1s;
}

.fab:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 var(--duo-green-shadow);
}

/* Tip card */
.tip-card {
    background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
    border: 2px solid #FBBF24;
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.tip-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.tip-content {
    font-size: 0.85rem;
    font-weight: 700;
    color: #92400E;
    line-height: 1.5;
}

/* Achievement unlock animation */
.achievement-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: white;
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    z-index: 10000;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: achievementShow 0.5s ease-out forwards;
}

@keyframes achievementShow {
    0% {
        transform: translate(-50%, -50%) scale(0);
    }

    70% {
        transform: translate(-50%, -50%) scale(1.1);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

.achievement-icon {
    font-size: 5rem;
    animation: bounce 0.5s ease-out 0.3s;
}

/* Improved form validation feedback */
.input-text.error,
.input-select.error {
    border-color: var(--duo-red);
    background: #FFF5F5;
}

.input-text.success,
.input-select.success {
    border-color: var(--duo-green);
    background: #F0FFF4;
}

.field-hint {
    font-size: 0.75rem;
    color: var(--duo-text-gray);
    margin-top: 6px;
}

.field-hint.error {
    color: var(--duo-red);
}

/* Toggle Button Group (はい/いいえ選択用) */
.toggle-button-group {
    display: flex;
    gap: 12px;
}

.toggle-btn {
    flex: 1;
    padding: 14px 20px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 800;
    color: var(--duo-text-gray);
    background: #F7F7F7;
    border: 2px solid var(--duo-gray);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    border-color: #ccc;
    background: #f0f0f0;
}

.toggle-btn.selected {
    background: var(--duo-green);
    color: white;
    border-color: var(--duo-green);
    box-shadow: 0 3px 0 var(--duo-green-shadow);
}

.toggle-btn.selected:active {
    transform: translateY(3px);
    box-shadow: none;
}
