:root {
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.7);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent: #ef4444;
    --accent-gradient: linear-gradient(135deg, #f97316, #ef4444, #ec4899);
    --glass-border: rgba(255, 255, 255, 0.4);
    --shadow: 0 8px 32px rgba(31, 38, 135, 0.07);
    --font-main: 'Inter', 'Noto Sans JP', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

/* Background Decor */
.background-decor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.circle-1 {
    width: 400px;
    height: 400px;
    background: #fecaca;
    top: -100px;
    right: -100px;
}

.circle-2 {
    width: 300px;
    height: 300px;
    background: #bae6fd;
    bottom: -50px;
    left: -50px;
}

/* Header */
header {
    padding-top: 4rem;
    padding-bottom: 2rem;
    text-align: center;
}

h1 {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.highlight {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header .subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.last-updated {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.8;
    margin-top: 0.5rem;
    font-weight: 400;
}

/* Summary Tiles */
#summary-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.tile {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.3s ease;
}

.tile:hover {
    transform: translateY(-5px);
}

.tile-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.tile-value {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-primary);
}

.tile-value span {
    font-size: 1.5rem;
    margin-left: 0.2rem;
}

.tile-sub {
    font-size: 1rem;
    color: var(--text-secondary);
}

.tile-sub-date {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-weight: 400;
}

.tile-value-sub {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.tile-unit {
    font-size: 0.9rem;
    font-weight: 600;
    margin-left: 0.15rem;
    color: var(--text-secondary);
}

/* Ranking Table/Grid */
.section-header {
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 800;
}

.section-header p {
    color: var(--text-secondary);
}

.tips-note {
    background: rgba(255, 255, 255, 0.4);
    border-left: 4px solid var(--accent);
    padding: 0.8rem 1rem;
    margin: 1rem auto 0;
    border-radius: 0 12px 12px 0;
    font-size: 0.85rem;
    color: var(--text-primary);
    text-align: left;
    display: inline-block;
    max-width: 90%;
}

.sort-controls {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.sort-btn {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(31, 38, 135, 0.05);
}

.sort-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.sort-btn.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.ranking-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ranking-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.25rem 2rem;
    display: grid;
    grid-template-columns: 60px 1fr 1fr 120px;
    align-items: center;
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ranking-card:hover {
    transform: scale(1.02);
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.9);
}

.rank-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-secondary);
}

.rank-top-1 { color: #f59e0b; }
.rank-top-2 { color: #94a3b8; }
.rank-top-3 { color: #92400e; }

.location-info .city {
    font-size: 1.25rem;
    font-weight: 700;
    display: block;
}

.location-info .pref {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.date-info {
    color: var(--text-secondary);
    font-size: 1rem;
}

.temp-value {
    font-size: 1.75rem;
    font-weight: 800;
    text-align: right;
    color: var(--accent);
}

.temp-value::after {
    content: "℃";
    font-size: 1rem;
    margin-left: 0.1rem;
}

.badge-tag {
    background: #fee2e2;
    color: #ef4444;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
    opacity: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

footer {
    margin-top: 4rem;
    padding: 2rem 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Tabs */
.nav-tabs {
    display: flex;
    justify-content: center;
    list-style: none;
    gap: 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.nav-tabs li {
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    padding: 0.5rem 1rem;
    transition: color 0.3s;
}

.nav-tabs li:hover {
    color: var(--text-primary);
}

.nav-tabs li.active {
    color: var(--accent);
}

.nav-tabs li.active::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-gradient);
    border-radius: 3px 3px 0 0;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Stats Bar Chart */
.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.bar-row {
    display: grid;
    grid-template-columns: 200px 1fr 65px;
    align-items: center;
    gap: 1rem;
}

.bar-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.bar-rank {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 22px;
    text-align: right;
}

.bar-city {
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bar-pref {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.bar-track {
    background: #f1f5f9;
    border-radius: 8px;
    height: 32px;
    position: relative;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #f97316, #ef4444);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    min-width: 40px;
    animation: barGrow 0.8s ease-out forwards;
    transform-origin: left;
}

@keyframes barGrow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.bar-count {
    font-size: 0.8rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

@media (max-width: 600px) {
    .bar-row {
        grid-template-columns: 140px 1fr 50px;
    }
    .bar-pref {
        display: none;
    }
}

.bar-duration {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: right;
    white-space: nowrap;
}

.duration-badge {
    background: #e0f2fe;
    color: #0284c7;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.5rem;
}

/* ── Yearly Trends chart ── */
.yearly-chart {
    overflow-x: auto;
    padding-bottom: 1rem;
}

.year-bars {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 220px;
    padding: 0 0.5rem 0;
    min-width: max-content;
}

.year-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 48px;
    height: 100%;
    justify-content: flex-end;
}

.year-count {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.year-bar-wrap {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: flex-end;
}

.year-bar {
    width: 100%;
    background: linear-gradient(to top, #94a3b8, #cbd5e1);
    border-radius: 6px 6px 0 0;
    transition: height 0.6s ease;
    min-height: 4px;
}

.year-bar--hot {
    background: var(--accent-gradient);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.year-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 6px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    height: 36px;
}

/* Map */
.map-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    height: 600px;
}

.map-wrapper {
    background: #fff;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.geolonia-svg-map {
    width: 100%;
    height: 100%;
    max-height: 550px;
}

.prefecture {
    fill: #f1f5f9;
    stroke: #cbd5e1;
    stroke-width: 0.5;
    transition: all 0.3s ease;
    cursor: pointer;
}

.prefecture:hover {
    fill: #e2e8f0;
    stroke: #94a3b8;
}

.prefecture.has-record {
    fill: #fee2e2;
    stroke: #fca5a5;
}

.prefecture.has-record:hover {
    fill: #fecaca;
    stroke: #ef4444;
}

.map-details-card {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 2rem;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.marker {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    transform: translate(-50%, -50%);
    transition: transform 0.2s;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.marker:hover {
    transform: translate(-50%, -50%) scale(1.5);
    z-index: 10;
}

/* Responsive Map */
@media (max-width: 900px) {
    .map-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    .map-placeholder {
        height: 500px;
    }
}
