* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --accent-color: #3b82f6;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --positive-color: #10b981;
    --negative-color: #ef4444;
    --warning-color: #f59e0b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-align: left;
    vertical-align: top;
    background-color: unset;
    background: unset;
    width: auto;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.date {
    font-size: 0.9rem;
    opacity: 0.8;
}

main {
    padding: 2rem 0;
}

section {
    margin-bottom: 3rem;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

/* 統計カード */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    transition: transform 0.2s, box-shadow 0.2s;
    min-height: 44px;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.stat-change {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

.stat-change.positive {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--positive-color);
}

.stat-change.negative {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--negative-color);
}

/* 年齢構成カード */
.age-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.age-stat-card {
    background: linear-gradient(135deg, #dbeafe 0%, #93c5fd 100%);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    border-top: 4px solid var(--primary-color);
    min-height: 44px;
}

.age-stat-card h3 {
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 1rem;
    font-weight: 600;
}

.age-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.age-percent {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* チャートコンテナ */
.chart-container {
    position: relative;
    height: 400px;
    margin-top: 1rem;
}

/* テーブル */
.table-container {
    overflow-x: auto;
    margin-top: 1rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.table-container::-webkit-scrollbar {
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

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

thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    height: 36px;
}

td:first-child {
    width: auto;
    min-width: 60px;
    height: 36px;
    white-space: nowrap;
}

tbody tr:hover {
    background-color: #f3f4f6;
}

tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

table strong {
    display: inline;
    white-space: nowrap;
}

footer {
    background-color: var(--text-color);
    color: white;
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
}

footer p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.note {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    header {
        padding: 1.5rem 0;
    }

    header h1 {
        font-size: 1.3rem;
        line-height: 1.3;
    }

    .subtitle {
        font-size: 1rem;
    }

    .date {
        font-size: 0.85rem;
    }

    main {
        padding: 1.5rem 0;
    }

    section {
        padding: 1.25rem;
        margin-bottom: 2rem;
        border-radius: 8px;
    }

    section h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
        padding-bottom: 0.4rem;
    }

    .stats-grid,
    .age-stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card,
    .age-stat-card {
        padding: 1.25rem;
    }

    .stat-card h3 {
        font-size: 0.85rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .stat-change {
        font-size: 0.85rem;
        padding: 0.3rem 0.6rem;
    }

    .age-stat-card h3 {
        font-size: 0.9rem;
    }

    .age-value {
        font-size: 1.5rem;
    }

    .age-percent {
        font-size: 1rem;
    }

    .chart-container {
        height: 300px;
        margin-top: 0.75rem;
    }

    table {
        font-size: 0.8rem;
    }

    th,
    td {
        padding: 0.6rem 0.5rem;
    }

    footer {
        padding: 1.5rem 0;
        margin-top: 2rem;
    }

    footer p {
        font-size: 0.85rem;
    }

    .note {
        font-size: 0.8rem;
    }
}

/* 小さなモバイルデバイス（480px以下） */
@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    header {
        padding: 1.25rem 0;
    }

    header h1 {
        font-size: 1.1rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .date {
        font-size: 0.8rem;
    }

    main {
        padding: 1rem 0;
    }

    section {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    section h2 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }

    .stats-grid,
    .age-stats-grid {
        gap: 0.75rem;
    }

    .stat-card,
    .age-stat-card {
        padding: 1rem;
    }

    .stat-card h3 {
        font-size: 0.8rem;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .stat-change {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }

    .age-stat-card h3 {
        font-size: 0.85rem;
    }

    .age-value {
        font-size: 1.3rem;
    }

    .age-percent {
        font-size: 0.9rem;
    }

    .chart-container {
        height: 250px;
    }

    table {
        font-size: 0.75rem;
    }

    th,
    td {
        padding: 0.5rem 0.4rem;
    }

    th {
        font-size: 0.75rem;
    }

    footer {
        padding: 1.25rem 0;
    }

    footer p {
        font-size: 0.8rem;
    }

    .note {
        font-size: 0.75rem;
    }
}

