:root {
    --life-bg: #07111f;
    --life-panel: rgba(18, 28, 48, 0.86);
    --life-panel-soft: rgba(255, 255, 255, 0.075);
    --life-gold: #ffd36e;
    --life-blue: #8fdfff;
    --life-pink: #ff9fc9;
    --life-green: #92f6c3;
    --life-text: #f6fbff;
    --life-muted: #aebed0;
}

body {
    background:
        radial-gradient(circle at 20% 10%, rgba(255, 211, 110, 0.16), transparent 26rem),
        radial-gradient(circle at 82% 18%, rgba(143, 223, 255, 0.14), transparent 24rem),
        linear-gradient(180deg, #07111f 0%, #0d1728 52%, #050b14 100%);
    color: var(--life-text);
}

.life-page {
    overflow-x: clip;
}

.hero-section,
.map-stage,
.birth-trend-section,
.more-insights-section,
.global-section,
.source-section {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.hero-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
    gap: 28px;
    align-items: center;
    padding: clamp(36px, 6vw, 72px) 0 24px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--life-gold);
    font-size: 0.82rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.hero-copy h1 {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.12em 0.28em;
    margin: 0;
    font-size: clamp(2rem, 5.2vw, 4.4rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
    text-shadow: 0 0 28px rgba(143, 223, 255, 0.28);
}

.title-main,
.title-sub {
    white-space: nowrap;
}

.hero-lead {
    max-width: 680px;
    color: var(--life-muted);
    font-size: clamp(1rem, 2vw, 1.25rem);
    line-height: 1.85;
}

.odometer-card {
    position: relative;
    padding: clamp(18px, 4vw, 34px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 26px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.035)),
        rgba(8, 15, 30, 0.82);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(16px);
}

.odometer-label,
.odometer-note,
.metric-label {
    display: block;
    color: var(--life-muted);
    font-size: 0.92rem;
}

.odometer-wrap {
    min-width: 0;
    overflow: hidden;
}

.odometer {
    margin: 10px 0;
    padding: 0.12em 0.18em;
    border-radius: 16px;
    background: #060a12;
    color: #ffeeb8;
    font-family: "Courier New", monospace;
    font-size: clamp(1.55rem, 4.2vw, 3.4rem);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    line-height: 1.15;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: inset 0 -3px 0 rgba(255, 255, 255, 0.08), inset 0 3px 0 rgba(0, 0, 0, 0.65);
}

/* 往後 50 年：線性外推小工具 */
.future-pop-tool {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.future-pop-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 10px;
}

.future-pop-label {
    margin: 0;
    color: var(--life-muted);
    font-size: 0.88rem;
    cursor: pointer;
}

.future-pop-year {
    color: var(--life-gold);
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.future-pop-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 10px;
    margin: 0 0 12px;
    border-radius: 99px;
    background: linear-gradient(90deg, rgba(255, 211, 110, 0.35), rgba(143, 223, 255, 0.28));
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
    cursor: pointer;
}

.future-pop-range:focus {
    outline: 2px solid var(--life-gold);
    outline-offset: 3px;
}

.future-pop-range:focus:not(:focus-visible) {
    outline: none;
}

.future-pop-range:focus-visible {
    outline: 2px solid var(--life-gold);
    outline-offset: 3px;
}

.future-pop-range::-webkit-slider-runnable-track {
    height: 10px;
    border-radius: 99px;
    background: transparent;
}

.future-pop-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    margin-top: -6px;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    background: linear-gradient(145deg, #ffe9a8, #d4a84a);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.future-pop-range::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    background: linear-gradient(145deg, #ffe9a8, #d4a84a);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.future-pop-range::-moz-range-track {
    height: 10px;
    border-radius: 99px;
    background: transparent;
}

.future-pop-readout {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.future-pop-value {
    font-family: "Courier New", monospace;
    font-size: clamp(1.05rem, 2.6vw, 1.45rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--life-blue);
    letter-spacing: 0.02em;
}

.future-pop-note {
    font-size: 0.82rem;
    color: var(--life-muted);
    line-height: 1.45;
}

.future-pop-disclaimer {
    margin: 10px 0 0;
    font-size: 0.72rem;
    line-height: 1.5;
    color: rgba(174, 190, 208, 0.75);
}

.map-stage {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(280px, 380px);
    gap: 28px;
    align-items: stretch;
    margin-top: 14px;
}

.map-shell {
    position: relative;
    min-height: clamp(520px, 70vw, 720px);
    border-radius: 34px;
    background:
        radial-gradient(circle at 50% 40%, rgba(143, 223, 255, 0.16), transparent 22rem),
        linear-gradient(180deg, rgba(19, 35, 58, 0.82), rgba(7, 12, 25, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.map-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 38px 38px;
    mask-image: radial-gradient(circle at 50% 50%, black, transparent 75%);
}

.map-focus {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(62%, 400px);
    aspect-ratio: 2 / 3;
    display: grid;
    place-items: center;
}

.taiwan-map {
    position: relative;
    z-index: 2;
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 28px 50px rgba(0, 0, 0, 0.44));
    pointer-events: none;
}

.life-stream {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
}

.life-particle {
    position: absolute;
    left: var(--sx);
    top: var(--sy);
    transform: translate(-50%, -50%);
    animation-duration: var(--duration);
    animation-timing-function: cubic-bezier(0.22, 0.72, 0.2, 1);
    animation-fill-mode: forwards;
    will-change: left, top, transform, opacity;
}

.life-particle img {
    display: block;
    width: clamp(52px, 8vw, 88px);
    height: auto;
    filter: drop-shadow(0 0 16px rgba(255, 255, 255, 0.35));
}

.life-particle.birth {
    animation-name: birthArrive;
}

.life-particle.death {
    animation-name: angelDepart;
}

.pulse-ring {
    position: absolute;
    width: 88%;
    aspect-ratio: 1;
    left: 50%;
    top: 54%;
    border: 1px solid rgba(143, 223, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulseRing 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

.pulse-two {
    width: 118%;
    animation-delay: 1.4s;
}

.speed-panel,
.birth-trend-section,
.mini-insight,
.source-section {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 26px;
    background: var(--life-panel);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(14px);
}

.speed-panel {
    padding: 24px;
}

.speed-panel h2,
.birth-trend-section h2,
.global-copy h2,
.source-section h2 {
    margin: 0 0 12px;
    color: #fff2c5;
}

.speed-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 18px 0;
}

.speed-grid div {
    padding: 16px;
    border-radius: 18px;
    background: var(--life-panel-soft);
}

.speed-grid strong {
    display: block;
    margin-top: 4px;
    font-size: 2rem;
}

.poetic-line {
    color: var(--life-muted);
    line-height: 1.8;
}

.birth-trend-section {
    margin-top: 28px;
    padding: clamp(22px, 4vw, 34px);
}

.birth-trend-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.birth-trend-lead {
    max-width: 640px;
    margin: 0;
    color: var(--life-muted);
    line-height: 1.8;
}

.trend-badge,
.decline-badge {
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
}

.trend-badge.trend-down,
.decline-badge {
    background: rgba(255, 159, 201, 0.14);
    border: 1px solid rgba(255, 159, 201, 0.35);
    color: #ffc9de;
}

.trend-badge.trend-up {
    background: rgba(255, 211, 110, 0.14);
    border: 1px solid rgba(255, 211, 110, 0.4);
    color: #ffe9b0;
}

.trend-badge.trend-flat {
    background: rgba(143, 223, 255, 0.12);
    border: 1px solid rgba(143, 223, 255, 0.28);
    color: #c8e8ff;
}

.birth-compare-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 14px;
    align-items: center;
}

.birth-year-card {
    min-width: 0;
    padding: 20px;
    border-radius: 22px;
    background: var(--life-panel-soft);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.birth-year-card.last-year {
    border-color: rgba(143, 223, 255, 0.22);
}

.birth-year-card.this-year {
    border-color: rgba(255, 211, 110, 0.28);
}

.year-label {
    display: block;
    color: var(--life-muted);
    font-size: 0.9rem;
}

.birth-year-value {
    display: block;
    margin: 8px 0 4px;
    font-size: clamp(1.5rem, 4vw, 2.6rem);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.year-meta {
    color: var(--life-muted);
    font-size: 0.85rem;
}

.birth-arrow {
    display: grid;
    place-items: center;
    gap: 6px;
    min-width: 72px;
    font-size: 0.88rem;
    text-align: center;
}

.birth-arrow.trend-down {
    color: var(--life-pink);
}

.birth-arrow.trend-up {
    color: var(--life-gold);
}

.birth-arrow.trend-flat {
    color: var(--life-blue);
}

.arrow-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.birth-arrow.trend-down .arrow-icon {
    animation: arrowBounceDown 1.8s ease-in-out infinite;
}

.birth-arrow.trend-up .arrow-icon {
    animation: arrowBounceUp 1.8s ease-in-out infinite;
}

.birth-chart-wrap {
    margin-top: 24px;
}

.chart-caption {
    margin: 0 0 8px;
    color: var(--life-muted);
    font-size: 0.9rem;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
}

.chart-legend li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--life-muted);
    font-size: 0.88rem;
}

.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

.legend-swatch.last {
    background: linear-gradient(180deg, #8fdfff, #3d8fb8);
}

.legend-swatch.this {
    background: linear-gradient(180deg, #ffd36e, #c98b2f);
}

.birth-chart {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
    gap: 10px;
    align-items: end;
    min-height: 180px;
    padding: 14px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.22);
}

.birth-bar-group {
    display: grid;
    gap: 6px;
    align-items: end;
    min-width: 0;
}

.birth-bar-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    align-items: end;
    height: 120px;
}

.birth-bar {
    border-radius: 8px 8px 4px 4px;
    min-height: 4px;
    transition: height 0.8s ease;
}

.birth-bar.last {
    background: linear-gradient(180deg, #8fdfff, #3d8fb8);
}

.birth-bar.this {
    background: linear-gradient(180deg, #ffd36e, #c98b2f);
}

.birth-bar-label {
    text-align: center;
    color: var(--life-muted);
    font-size: 0.75rem;
}

.birth-insight-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.mini-insight {
    padding: 18px;
    border-radius: 18px;
    background: var(--life-panel-soft);
}

.mini-insight h3 {
    margin: 0 0 8px;
    font-size: 1rem;
    color: #fff2c5;
}

.mini-insight p {
    margin: 0;
    color: var(--life-muted);
    line-height: 1.75;
}

.age-meter-caption {
    margin: 10px 0 0;
    color: var(--life-muted);
    font-size: 0.82rem;
    line-height: 1.6;
}

.age-meter {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.age-meter-side {
    color: var(--life-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.age-meter-side.senior {
    color: #ffd36e;
}

.age-meter-track {
    height: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.age-meter-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7ee8fa, #eec0c6, #ffd36e);
    transition: width 1s ease;
}

.life-particle.birth.flip-x img {
    transform: scaleX(-1);
}

.more-insights-section {
    margin-top: 28px;
    padding: clamp(22px, 4vw, 34px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 26px;
    background: var(--life-panel);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(14px);
}

.more-insights-header h2 {
    margin: 0 0 8px;
    color: #fff2c5;
}

.more-insights-lead {
    margin: 0;
    color: var(--life-muted);
    line-height: 1.75;
}

.more-insights-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.insight-stat-card {
    padding: 18px;
    border-radius: 18px;
    background: var(--life-panel-soft);
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 132px;
}

.insight-stat-card h3 {
    margin: 0 0 10px;
    font-size: 0.95rem;
    color: #fff2c5;
}

.insight-value {
    margin: 0;
    font-size: clamp(1.15rem, 2.5vw, 1.55rem);
    font-weight: 700;
    line-height: 1.35;
    color: var(--life-text);
}

.insight-value.insight-rank {
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    font-weight: 600;
    white-space: pre-line;
}

.insight-desc {
    margin: 8px 0 0;
    color: var(--life-muted);
    font-size: 0.82rem;
    line-height: 1.6;
}

.global-section {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 36px;
    align-items: center;
    margin-top: 44px;
    padding: clamp(28px, 5vw, 54px);
    border-radius: 34px;
    background:
        radial-gradient(circle at 18% 45%, rgba(97, 180, 255, 0.24), transparent 20rem),
        linear-gradient(145deg, rgba(13, 26, 49, 0.94), rgba(2, 7, 18, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.earth-orbit {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 300px;
}

.earth-wrap {
    position: relative;
    width: 250px;
    height: 250px;
    display: grid;
    place-items: center;
    transform: translateX(-8%);
}

.earth {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: contain;
    object-position: 44% 50%;
    box-shadow: 0 0 55px rgba(81, 182, 255, 0.42);
    animation: earthSpin 12s linear infinite;
}

.satellite {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border-radius: 50%;
    background: #fff8d6;
    box-shadow: 0 0 18px #fff8d6;
    animation: orbit 6s linear infinite;
}

.global-numbers {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.stat-box {
    min-width: 0;
    padding: 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.075);
    overflow: hidden;
}

.stat-box span {
    display: block;
    color: var(--life-muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

.stat-value {
    display: block;
    margin-top: 8px;
    font-size: clamp(1rem, 2.4vw, 1.65rem);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.source-line,
.source-section li {
    color: var(--life-muted);
    line-height: 1.8;
}

.source-section {
    margin-top: 30px;
    margin-bottom: 48px;
    padding: 24px;
}

.source-section ul {
    margin: 0;
    padding-left: 1.4em;
}

@keyframes birthArrive {
    0% {
        left: var(--sx);
        top: var(--sy);
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.35);
    }
    18% {
        opacity: 1;
    }
    100% {
        left: var(--ex);
        top: var(--ey);
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes angelDepart {
    0% {
        left: var(--sx);
        top: var(--sy);
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.75);
    }
    22% {
        opacity: 1;
    }
    100% {
        left: var(--ex);
        top: var(--ey);
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.08);
    }
}

@keyframes pulseRing {
    0%, 100% {
        opacity: 0.2;
        transform: translate(-50%, -50%) scale(0.88);
    }
    50% {
        opacity: 0.65;
        transform: translate(-50%, -50%) scale(1.05);
    }
}

@keyframes arrowBounceDown {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(4px);
    }
}

@keyframes arrowBounceUp {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

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

@keyframes orbit {
    from {
        transform: rotate(0deg) translateX(145px) rotate(0deg);
    }
    to {
        transform: rotate(360deg) translateX(145px) rotate(-360deg);
    }
}

@media (max-width: 920px) {
    .hero-section,
    .map-stage,
    .global-section {
        grid-template-columns: 1fr;
    }

    .birth-compare-grid,
    .birth-insight-row,
    .more-insights-grid,
    .global-numbers {
        grid-template-columns: 1fr;
    }

    .birth-arrow {
        flex-direction: row;
        display: flex;
        justify-content: center;
        gap: 10px;
    }

    .map-focus {
        width: min(78%, 340px);
    }
}

@media (max-width: 560px) {
    .hero-section,
    .map-stage,
    .birth-trend-section,
    .more-insights-section,
    .global-section,
    .source-section {
        width: min(100% - 18px, 1180px);
    }

    .birth-compare-grid {
        grid-template-columns: 1fr;
    }

    .map-shell {
        min-height: 500px;
    }

    .odometer {
        font-size: clamp(1.8rem, 10vw, 3rem);
    }
}
