:root {
    /* Colors */
    --primary: #2563EB;
    --primary-dark: #1E40AF;
    --secondary: #F59E0B;
    /* JPYC Gold-ish */
    --accent: #10B981;
    --bg-body: #F3F4F6;
    --bg-card: #FFFFFF;
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.3);

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Radius */
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    padding-bottom: 80px;
    /* Space for bottom nav */
}

/* Role Switcher */
.role-switcher {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 200;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.role-switcher:hover {
    transform: scale(1.05);
    background: black;
}

/* Utilities */
.container {
    max-width: 480px;
    /* Mobile width simulation */
    margin: 0 auto;
    padding: var(--spacing-md);
    min-height: 100vh;
    background-color: var(--bg-body);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    /* Subtle border for desktop view */
}

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

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.font-bold {
    font-weight: 700;
}

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

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

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

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

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

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 8px;
}

.gap-4 {
    gap: 16px;
}

/* Components */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-md);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    width: 100%;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid #E5E7EB;
}

/* Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-decoration: none;
    gap: 4px;
    position: relative;
}

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

.nav-icon {
    font-size: 1.5rem;
}

/* Sections */
.section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* Specific UI Elements */
.balance-card {
    background: linear-gradient(135deg, #1E3A8A, #3B82F6);
    color: white;
}

/* Money Animation */
@keyframes flyTopRight {
    to {
        transform: translate(100px, -200px) rotate(360deg);
        opacity: 0;
    }
}

@keyframes flyTopLeft {
    to {
        transform: translate(-100px, -200px) rotate(-360deg);
        opacity: 0;
    }
}

@keyframes flyBottom {
    to {
        transform: translate(0, 100px) rotate(180deg);
        opacity: 0;
    }
}

.coin {
    position: absolute;
    width: 24px;
    height: 24px;
    background: #F59E0B;
    border-radius: 50%;
    border: 2px solid #FCD34D;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    z-index: 10;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    background-color: #E5E7EB;
    border-radius: var(--radius-md);
    object-fit: cover;
    margin-bottom: var(--spacing-sm);
}

.cost-breakdown {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    font-size: 0.9rem;
}

.cost-row {
    padding: 8px 0;
    border-bottom: 1px dashed #E5E7EB;
}

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

/* Log Text Animation */
.log-line {
    opacity: 0;
    animation: fadeInLog 0.2s forwards;
    margin-bottom: 2px;
}

@keyframes fadeInLog {
    to {
        opacity: 1;
    }
}

/* Interactive Annotations */
.annotation-wrapper {
    position: relative;
}

.annotation-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #EF4444;
    /* Red for visibility */
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: pulse-red 2s infinite;
    margin-left: 8px;
    vertical-align: middle;
    z-index: 50;
}

.annotation-marker:hover {
    transform: scale(1.1);
}

.annotation-tooltip {
    display: none;
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #1F2937;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    width: 200px;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: left;
    line-height: 1.4;
}

.annotation-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1F2937 transparent transparent transparent;
}

.annotation-wrapper.active .annotation-tooltip {
    display: block;
    animation: fadeInTooltip 0.2s ease-out;
}

@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

@keyframes fadeInTooltip {
    from {
        opacity: 0;
        transform: translate(-50%, 10px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}