/* =====================================================
   インデックス構成銘柄トラッカー - スタイルシート
   ===================================================== */

/* CSS Variables */
/* CSS Variables */
/* CSS Variables */
:root {
    /* Colors - Sunny Day Theme */
    --bg-primary: #f8fafc;
    /* Slate 50 - Very light grey/white */
    --bg-secondary: #ffffff;
    /* Pure White */
    --bg-card: #ffffff;
    /* White cards */
    --bg-hover: #f1f5f9;
    /* Slate 100 */

    --text-primary: #1e293b;
    /* Slate 800 - Dark text for contrast */
    --text-secondary: #475569;
    /* Slate 600 */
    --text-muted: #94a3b8;
    /* Slate 400 */

    --accent-primary: #0ea5e9;
    /* Sky 500 - Bright Blue */
    --accent-secondary: #ec4899;
    /* Pink 500 - Bright Pink */
    --accent-gradient: linear-gradient(135deg, #0ea5e9 0%, #ec4899 100%);

    --success: #10b981;
    /* Emerald 500 */
    --danger: #f43f5e;
    /* Rose 500 */
    --warning: #f59e0b;
    /* Amber 500 */

    --border-color: #e2e8f0;
    /* Slate 200 - Light border */
    --border-radius: 24px;
    --border-radius-sm: 12px;

    /* Shadows - Soft and Airy */
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -2px rgb(0 0 0 / 0.025);
    /* Lighter shadow */
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.05), 0 10px 10px -5px rgb(0 0 0 / 0.025);
    --shadow-glow: 0 0 15px rgba(14, 165, 233, 0.2);

    /* Transitions */
    --transition-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 18px;
    /* Larger base font size for kids */
    scroll-behavior: smooth;
}

body {
    font-family: 'M PLUS Rounded 1c', 'Noto Sans JP', sans-serif;
    background: var(--bg-primary);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(14, 165, 233, 0.08) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.08) 0%, transparent 20%);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    font-weight: 500;
}

/* App Container */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =====================================================
   Header
   ===================================================== */
.header {
    padding: 24px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-icon {
    font-size: 1.8rem;
    -webkit-text-fill-color: initial;
}

.last-updated {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* =====================================================
   Index Tabs
   ===================================================== */
/* =====================================================
   Tabs & Navigation (Categorized)
   ===================================================== */
.tabs-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 10px;
    margin-bottom: 24px;
    align-items: center;
}

.tab-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.5);
    padding: 6px 14px;
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: var(--shadow-sm);
}

.tab-group-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-right: 8px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-normal);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    white-space: nowrap;
}

.tab-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
}

.tab-icon {
    font-size: 1.2rem;
}

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

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
}

.stat-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2rem;
}

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

.stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.stat-value.positive {
    color: var(--success);
}

.stat-value.negative {
    color: var(--danger);
}

/* =====================================================
   Charts Section
   ===================================================== */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 24px;
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.chart-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

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

.chart-container {
    position: relative;
    height: 300px;
}

.chart-period-btns {
    display: flex;
    gap: 8px;
}

.period-btn {
    padding: 6px 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.period-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

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

/* Region Section */
.region-section {
    margin-bottom: 24px;
}

.region-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.region-chart-container {
    text-align: center;
}

.region-chart-container h3 {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* =====================================================
   Historical Comparison Section
   ===================================================== */
.historical-section {
    margin-bottom: 24px;
}

.chart-container-lg {
    height: 350px;
}

.returns-summary {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

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

.return-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.return-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.return-value.positive {
    color: var(--success);
}

.return-value.negative {
    color: var(--danger);
}

.historical-comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.historical-item {
    text-align: center;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
}

.historical-item:hover {
    border-color: var(--accent-primary);
}

.historical-item h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.historical-item .year-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--accent-gradient);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
}

.historical-chart-container {
    height: 180px;
    margin-bottom: 12px;
}

.sector-list {
    text-align: left;
    font-size: 0.8rem;
}

.sector-list-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.sector-list-item .sector-name {
    color: var(--text-secondary);
}

.sector-list-item .sector-value {
    font-weight: 600;
    color: var(--text-primary);
}

.country-history-section {
    margin-bottom: 24px;
}

.country-history-comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.history-note {
    margin-top: 8px;
    padding: 8px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: var(--border-radius-sm);
    font-size: 0.7rem;
    color: var(--accent-primary);
    text-align: center;
}

/* =====================================================
   Timeline Section
   ===================================================== */
.timeline-section {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 24px;
    margin-bottom: 24px;
}

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

.section-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.filter-controls {
    display: flex;
    gap: 12px;
}

.filter-select {
    padding: 8px 16px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.timeline-container {
    padding-right: 8px;
}

.timeline-container::-webkit-scrollbar {
    width: 6px;
}

.timeline-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.timeline-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.timeline-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.timeline-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    margin-bottom: 12px;
    border-left: 4px solid transparent;
    transition: all var(--transition-fast);
}

.timeline-item:hover {
    background: var(--bg-hover);
}

.timeline-item.add {
    border-left-color: var(--success);
}

.timeline-item.remove {
    border-left-color: var(--danger);
}

.timeline-item.rebalance {
    border-left-color: var(--accent-primary);
}

.timeline-date {
    flex-shrink: 0;
    width: 100px;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.timeline-type {
    flex-shrink: 0;
    width: 60px;
}

.timeline-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.timeline-badge.add {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.timeline-badge.remove {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.timeline-badge.rebalance {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-primary);
}

.timeline-content {
    flex: 1;
}

.timeline-ticker {
    font-weight: 600;
    color: var(--text-primary);
}

.timeline-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.timeline-reason {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Empty state */
.timeline-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* =====================================================
   Table Section
   ===================================================== */
.table-section {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 24px;
    margin-bottom: 24px;
}

.search-box {
    position: relative;
}

.search-input {
    width: 280px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
}

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

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.table-container {
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

.constituents-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.constituents-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
}

.constituents-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.constituents-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.constituents-table th.sortable:hover {
    color: var(--accent-primary);
}

.constituents-table th.sortable::after {
    content: ' ↕';
    opacity: 0.3;
}

.constituents-table th.sortable.asc::after {
    content: ' ↑';
    opacity: 1;
}

.constituents-table th.sortable.desc::after {
    content: ' ↓';
    opacity: 1;
}

.constituents-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.constituents-table tbody tr {
    transition: background var(--transition-fast);
}

.constituents-table tbody tr:hover {
    background: var(--bg-hover);
}

.ticker-cell {
    font-weight: 600;
    color: var(--accent-primary);
}

.weight-cell {
    font-weight: 500;
}

.sector-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-secondary);
    border-radius: 20px;
    font-size: 0.8rem;
}

/* =====================================================
   Footer
   ===================================================== */
.footer {
    padding: 24px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.footer p {
    margin-bottom: 4px;
}

.footer a {
    color: inherit;
    text-decoration: underline;
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .logo {
        font-size: 1.25rem;
    }

    .index-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        padding: 10px 16px;
        font-size: 0.875rem;
    }

    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-section {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-controls {
        width: 100%;
    }

    .filter-select {
        flex: 1;
    }

    .search-input {
        width: 100%;
    }

    .timeline-item {
        flex-wrap: wrap;
    }

    .timeline-date {
        width: auto;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 0 12px;
    }

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

    .stat-card {
        padding: 16px;
    }

    .chart-container {
        height: 250px;
    }
}

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

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

.stat-card,
.chart-card,
.timeline-section,
.table-section {
    animation: fadeIn 0.5s ease forwards;
}

.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.15s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.25s;
}

/* Loading state */
.loading {
    opacity: 0.5;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* =====================================================
   Index Overview Card
   ===================================================== */
.index-overview {
    margin-bottom: 24px;
}

.overview-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.overview-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.overview-description {
    font-size: 1.1rem;
    margin-bottom: 24px;
    line-height: 1.8;
}

.overview-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding-top: 20px;
    border-top: 2px dashed var(--border-color);
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.meta-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 700;
}

.meta-value {
    font-weight: 600;
    color: var(--text-primary);
}

.trust-tag {
    display: inline-block;
    background: var(--bg-hover);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-right: 6px;
    margin-bottom: 4px;
    color: var(--accent-secondary);
    border: 1px solid var(--border-color);
}

/* =====================================================
   Investment Simulation
   ===================================================== */
.simulation-section {
    margin-top: 24px;
    margin-bottom: 24px;
}

.simulation-card {
    background: linear-gradient(to bottom right, #ffffff, #f0f9ff);
    border: 2px solid var(--accent-primary);
}

.simulation-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.5);
    padding: 15px;
    border-radius: var(--border-radius-sm);
    justify-content: center;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-symbol {
    position: absolute;
    left: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

#investmentAmount {
    padding: 10px 10px 10px 30px;
    font-size: 1.2rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    width: 150px;
    font-family: inherit;
    font-weight: 700;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

#investmentAmount:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.simulation-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.simulation-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.simulation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}

.simulation-item:hover {
    transform: translateX(5px);
}

.sim-company-info {
    display: flex;
    flex-direction: column;
}

.sim-company-name {
    font-weight: 700;
    font-size: 1.1rem;
}

.sim-product-name {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.sim-amount {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--accent-primary);
}

.visual-bar-container {
    height: 50px;
    background: var(--bg-hover);
    border-radius: 25px;
    overflow: hidden;
    display: flex;
    width: 100%;
    margin-top: 10px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.visual-segment {
    height: 100%;
    transition: width 0.5s ease;
    position: relative;
    cursor: help;
}

.visual-segment:hover::after {
    content: attr(title);
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    z-index: 10;
    pointer-events: none;
    border: 1px solid var(--border-color);
}

/* =====================================================
   Tooltips
   ===================================================== */
.glossary-term {
    border-bottom: 2px dashed var(--accent-primary);
    cursor: help;
    position: relative;
    display: inline-block;
}

.glossary-term::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    padding: 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 12px;
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    text-align: left;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    white-space: pre-wrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    visibility: hidden;
}

.glossary-term:hover::after,
.glossary-term.active::after {
    opacity: 1;
    visibility: visible;
}


/* =====================================================
   Scrollytelling Layout & UX
   ===================================================== */
.story-section {
    padding: 60px 20px;
    margin-bottom: 40px;
    border-bottom: 1px dashed var(--border-color);
    position: relative;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.story-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.story-section.highlight-section {
    background: linear-gradient(to bottom, var(--bg-secondary), rgba(255, 255, 255, 0));
    border-radius: 20px;
    border: none;
}

.section-badge {
    display: inline-block;
    background: var(--accent-gradient);
    color: white;
    font-weight: 800;
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    letter-spacing: 1px;
}

.story-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--text-primary) 0%, #475569 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.story-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
    max-width: 600px;
    line-height: 1.6;
}

.scroll-indicator {
    text-align: center;
    margin-top: 40px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {

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

    40% {
        transform: translateY(-10px);
    }

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

/* Floating Tutorial Button */
.tutorial-float-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: white;
    border: 2px solid var(--accent-primary);
    color: var(--accent-primary);
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tutorial-float-btn:hover {
    transform: translateY(-3px) scale(1.05);
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.4);
}

/* Responsive Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .story-title {
        font-size: 1.5rem;
    }

    .tutorial-float-btn {
        bottom: 20px;
        right: 20px;
        padding: 10px 18px;
        font-size: 0.9rem;
    }
}

/* =====================================================
   Index Selection (Home Page)
   ===================================================== */
.index-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    margin-top: 32px;
}

.index-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.group-label {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.index-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
    border: 1px solid var(--border-color);
}

.index-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-primary);
}

.index-card-icon {
    font-size: 3rem;
    background: var(--bg-primary);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.index-card-info {
    flex: 1;
}

.index-card-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.index-card-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Page Navigation Bar */
.navigation-bar {
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.nav-link {
    display: inline-block;
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 8px;
    transition: var(--transition-fast);
}

.nav-link:hover {
    color: var(--accent-secondary);
    transform: translateX(-4px);
}

.page-title {
    font-size: 2rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Loading Overlay */
#loadingOverlay {
    backdrop-filter: blur(5px);
}

/* =====================================================
   Timeline (History) Redesign
   ===================================================== */
.timeline-section {
    position: relative;
    padding: 20px 0;
}

.timeline-container {
    position: relative;
    padding-left: 30px;
    /* Space for the line */
}

/* Vertical Line */
.timeline-container::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 7px;
    /* Align with node center */
    width: 2px;
    background: var(--border-color);
}

.timeline-date-group {
    position: relative;
    margin-bottom: 40px;
}

/* Node (Dot) */
.timeline-node {
    position: absolute;
    left: -29px;
    /* Adjust based on container padding */
    top: 0;
    width: 16px;
    height: 16px;
    background: var(--bg-secondary);
    border: 3px solid var(--accent-primary);
    border-radius: 50%;
    z-index: 1;
    box-shadow: 0 0 0 4px var(--bg-primary);
    /* Breathing room */
}

.timeline-content {
    background: transparent;
}

.timeline-date-label {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
}

/* Timeline Cards */
.timeline-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Event Item */
.timeline-event-item {
    background: linear-gradient(to right, #f8fafc, #ffffff);
    border-left: 4px solid var(--accent-secondary);
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
}

.event-badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.event-content .event-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.event-content .event-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Change Item (Add/Remove) */
.timeline-subgroup {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.highlight-change {
    display: flex;
    flex-direction: column;
    /* Stack for detailed info */
    background: var(--bg-card);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    flex: 1 1 200px;
    /* Responsive grid-like */
    min-width: 200px;
    transition: var(--transition-fast);
}

.highlight-change:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-primary);
}

.change-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

.badge.add {
    background: var(--success);
}

.badge.remove {
    background: var(--danger);
}

.badge.other {
    background: var(--text-muted);
}

.ticker {
    font-family: monospace;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.name {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.3;
}

/* Famous Company styling */
.highlight-change.famous-company {
    background: linear-gradient(to bottom right, #fff, #f0fdf4);
    /* Subtle green tint for "Good/Famous" */
    border: 1px solid var(--success);
}

.highlight-change.famous-company .name {
    color: #15803d;
    /* Darker green */
}

.product-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed var(--border-color);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Empty State */
.timeline-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-style: italic;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
}

/* =====================================================
   Rebalance Grid (High Resolution History)
   ===================================================== */
.rebalance-grid-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
    box-shadow: var(--shadow-sm);
}

.rebalance-header {
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 8px;
}

.rebalance-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

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

.rebalance-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.col-title {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.col-title.in {
    color: var(--success);
}

.col-title.out {
    color: var(--danger);
}

.change-card-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.change-card-compact:hover {
    transform: translateX(2px);
    border-color: var(--accent-primary);
}

.compact-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--text-muted);
    color: white;
    font-weight: 700;
    flex-shrink: 0;
}

.compact-badge.add {
    background: var(--success);
}

.compact-badge.remove {
    background: var(--danger);
}

.compact-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    overflow: hidden;
}

.compact-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compact-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Enhancements for Famous Companies in Compact View */
.change-card-compact.famous-company {
    background: #f0fdf4;
    border-color: var(--success);
}

/* =====================================================
   Navigation Buttons
   ===================================================== */
.header-nav {
    margin-left: auto;
}

.nav-btn-home {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.nav-btn-home:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

/* Adjust header layout to accommodate button */
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-info {
    display: none;
    /* Hide update date on mobile if space tight */
}

@media (min-width: 768px) {
    .header-info {
        display: block;
        margin-left: 20px;
    }
}

/* Sticky Header */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0;
    /* Override default */
    padding: 16px 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.main-content {
    padding-top: 32px;
    /* Add space since margin-bottom of header was removed */
}

/* ACWI Summary Card */
.acwi-summary-card {
    background: linear-gradient(to right, #f0f9ff, #e0f2fe);
    border: 1px solid #bae6fd;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.acwi-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px dashed #7dd3fc;
    padding-bottom: 8px;
}

.acwi-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0369a1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.acwi-counts {
    display: flex;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 600;
}

.count-pill {
    padding: 4px 10px;
    border-radius: 20px;
    background: white;
    border: 1px solid #7dd3fc;
}

.count-pill.plus {
    color: var(--success);
}

.count-pill.minus {
    color: var(--danger);
}

.acwi-note {
    font-size: 1rem;
    line-height: 1.6;
    color: #334155;
    background: white;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid var(--accent-primary);
}

/* Highlight Japanese text in ACWI history */
.highlight-jp-text {
    color: #b91c1c;
    /* Red-700 */
    font-weight: 700;
    background-color: rgba(185, 28, 28, 0.05);
    padding: 0 4px;
    border-radius: 4px;
}


/* =====================================================
   Home Page Hero Section (LIGHT THEME)
   ===================================================== */
body.home-page {
    background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 50%, #f8fafc 100%);
    color: #1e293b;
}

body.home-page .app-container {
    max-width: 1200px;
}

.hero-section {
    position: relative;
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 20px;
    overflow: hidden;
}

.hero-bg-orbs {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.6;
    animation: orbFloat 15s infinite ease-in-out;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.3), rgba(59, 130, 246, 0.3));
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.25), rgba(244, 63, 94, 0.25));
    bottom: -50px;
    right: -50px;
    animation-delay: 5s;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(20, 184, 166, 0.25));
    top: 50%;
    left: 60%;
    animation-delay: 10s;
}

@keyframes orbFloat {

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

    50% {
        transform: translateY(-30px) scale(1.05);
    }
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-block;
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.3);
    padding: 8px 20px;
    border-radius: 9999px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: #0369a1;
    backdrop-filter: blur(8px);
}

.hero-title {
    font-size: clamp(2.2rem, 6vw, 3.5rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 24px;
    color: #0f172a;
}

.highlight-gradient {
    background: linear-gradient(90deg, #0ea5e9, #ec4899, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: #475569;
    max-width: 600px;
    margin: 0 auto 32px;
    line-height: 1.8;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
    color: #fff;
    padding: 16px 36px;
    border-radius: 9999px;
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(14, 165, 233, 0.3);
    transition: transform 0.3s, box-shadow 0.3s;
}

.hero-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(14, 165, 233, 0.4);
}

.cta-arrow {
    font-size: 1.3rem;
    transition: transform 0.3s;
}

.hero-cta:hover .cta-arrow {
    transform: translateX(5px);
}

/* =====================================================
   Index Cards V2
   ===================================================== */
.index-selection-grid-v2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 32px;
    margin-top: 32px;
}

.index-group-v2 {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.group-label-v2 {
    font-size: 1rem;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 8px;
}

.index-card-v2 {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(14, 165, 233, 0.15);
    border-radius: 20px;
    padding: 20px 24px;
    text-decoration: none;
    color: #1e293b;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.index-card-v2:hover {
    background: #fff;
    border-color: rgba(14, 165, 233, 0.4);
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 20px 40px rgba(14, 165, 233, 0.15);
}

.card-icon-wrap {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
}

.card-global .card-icon-wrap {
    background: linear-gradient(135deg, #10b981, #14b8a6);
}

.card-us .card-icon-wrap {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
}

.card-jp .card-icon-wrap {
    background: linear-gradient(135deg, #ef4444, #f97316);
}

.card-body {
    flex: 1;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.card-desc {
    font-size: 0.9rem;
    color: #64748b;
}

.card-arrow {
    font-size: 1.5rem;
    color: #94a3b8;
    transition: transform 0.3s, color 0.3s;
}

.index-card-v2:hover .card-arrow {
    transform: translateX(5px);
    color: #0ea5e9;
}

/* =====================================================
   Educational Section
   ===================================================== */
.education-section {
    padding-top: 60px;
}

.education-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.edu-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(14, 165, 233, 0.15);
    border-radius: 20px;
    padding: 32px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.edu-card:hover {
    background: #fff;
    border-color: rgba(14, 165, 233, 0.3);
    transform: translateY(-4px);
    box-shadow: 0 15px 35px rgba(14, 165, 233, 0.1);
}

.edu-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.edu-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: #1e293b;
}

.edu-text {
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.7;
}

.edu-text strong {
    color: #0ea5e9;
}

.edu-cta-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 40px;
    justify-content: center;
}

.edu-cta {
    display: inline-block;
    padding: 14px 28px;
    border-radius: 9999px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s;
}

.edu-cta:not(.secondary) {
    background: linear-gradient(135deg, #0ea5e9, #3b82f6);
    color: #fff;
    box-shadow: 0 8px 20px rgba(14, 165, 233, 0.25);
}

.edu-cta:not(.secondary):hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(14, 165, 233, 0.35);
}

.edu-cta.secondary {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #f1f5f9;
}

.edu-cta.secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Overrides for dark home page */
body.home-page .story-section {
    background: transparent;
    border: none;
}

body.home-page .story-title {
    color: #f1f5f9;
}

body.home-page .story-desc {
    color: #94a3b8;
}

body.home-page .section-badge {
    background: rgba(14, 165, 233, 0.2);
    color: #0ea5e9;
    border: 1px solid rgba(14, 165, 233, 0.3);
}

body.home-page .overview-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
}

body.home-page .footer {
    color: #64748b;
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* =====================================================
   Bento Grid Layout for Index Cards
   ===================================================== */
.index-bento-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 32px;
}

.index-bento-grid .index-group-v2 {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.index-bento-grid .index-group-v2:first-child .index-card-v2 {
    /* Featured ACWI card - larger */
    padding: 28px 32px;
}

.index-bento-grid .index-group-v2:first-child .card-icon-wrap {
    width: 64px;
    height: 64px;
    font-size: 2rem;
}

.index-bento-grid .index-group-v2:first-child .card-title {
    font-size: 1.4rem;
}

@media (max-width: 900px) {
    .index-bento-grid {
        grid-template-columns: 1fr;
    }
}

/* Override light theme overrides */
body.home-page .story-section {
    background: transparent;
    border: none;
}

body.home-page .story-title {
    color: #0f172a;
}

body.home-page .story-desc {
    color: #475569;
}

body.home-page .section-badge {
    background: rgba(14, 165, 233, 0.1);
    color: #0369a1;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

body.home-page .overview-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(14, 165, 233, 0.15);
    color: #334155;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

body.home-page .footer {
    color: #64748b;
    border-top-color: rgba(14, 165, 233, 0.1);
}