:root {
    --bg-dark: #080610;
    --bg-mid: #25122e;
    --bg-soft: #f7f2eb;
    --surface: rgba(255, 250, 245, 0.92);
    --surface-soft: rgba(255, 239, 228, 0.84);
    --surface-strong: rgba(255, 255, 255, 0.96);
    --ink: #261523;
    --muted: #705d6a;
    --line: rgba(38, 21, 35, 0.12);
    --accent: #c9574f;
    --accent-strong: #7d211e;
    --accent-soft: #efaa7a;
    --accent-alt: #efd86d;
    --cool: #3e5f9f;
    --cool-soft: #d6e2ff;
    --shadow: 0 28px 70px rgba(14, 7, 22, 0.18);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: "IBM Plex Sans JP", sans-serif;
    background:
        radial-gradient(circle at 14% 12%, rgba(239, 216, 109, 0.22), transparent 20%),
        radial-gradient(circle at 86% 10%, rgba(201, 87, 79, 0.25), transparent 24%),
        linear-gradient(180deg, #080610 0%, #25122e 18%, #f4ede7 18.1%, #fbf7f1 100%);
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.08));
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding-bottom: 80px;
}

.site-header {
    position: sticky;
    top: 14px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 18px 0 20px;
    padding: 16px 22px;
    border-radius: 999px;
    background: rgba(8, 6, 16, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(18px);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.26);
}

.brand {
    color: #fff5f3;
    font-family: "Shippori Mincho", serif;
    font-size: 1.14rem;
    letter-spacing: 0.1em;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 18px;
    color: rgba(255, 245, 243, 0.84);
    font-size: 0.95rem;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.footer-link:hover,
.footer-link:focus-visible {
    color: white;
}

.section,
.signal-strip,
.site-footer {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 520ms ease, transform 520ms ease;
}

.reveal.is-visible,
.site-footer.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: 24px;
    padding: 34px 0 22px;
}

.hero-copy,
.hero-panel,
.step-card,
.formula-card,
.demo-panel,
.canvas-panel,
.comparison-card,
.link-card,
.signal-strip,
.hero-note,
.site-footer {
    border: 1px solid rgba(255, 255, 255, 0.64);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.hero-copy {
    min-width: 0;
    padding: 42px 32px 42px 38px;
    border-radius: 38px;
    position: relative;
    overflow: hidden;
}

.hero-copy::after {
    content: "";
    position: absolute;
    inset: auto -52px -108px auto;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(239, 170, 122, 0.34), rgba(239, 170, 122, 0));
}

.hero-panel {
    min-width: 0;
    padding: 26px;
    border-radius: 36px;
    display: grid;
    gap: 18px;
    background: rgba(255, 243, 235, 0.42);
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--accent-strong);
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

h1,
h2,
h3,
.brand,
.signal-main,
.formula-block,
.note-title,
.canvas-caption strong {
    font-family: "Shippori Mincho", serif;
}

h1,
h2,
h3,
.brand {
    line-height: 1.15;
}

h1,
h2 {
    margin: 0;
}

h1 {
    font-size: clamp(2.6rem, 5vw, 4.6rem);
    letter-spacing: -0.04em;
}

.hero-lead,
.section-heading p,
.step-card p,
.formula-card p,
.demo-note,
.comparison-card p,
.link-card p,
.canvas-caption,
.hero-note p,
.signal-sub,
.site-footer p {
    color: var(--muted);
}

.hero-lead {
    margin: 20px 0 0;
    font-size: 1.04rem;
    line-height: 1.85;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 28px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 0 22px;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.button:hover,
.button:focus-visible,
.preset-chip:hover,
.preset-chip:focus-visible {
    transform: translateY(-1px);
}

.button-primary {
    color: #fff8f4;
    background: linear-gradient(135deg, var(--accent), #9d352d);
    box-shadow: 0 14px 28px rgba(157, 53, 45, 0.22);
}

.button-secondary {
    border-color: rgba(125, 33, 30, 0.18);
    background: rgba(255, 252, 250, 0.78);
    color: var(--accent-strong);
}

.hero-points {
    display: grid;
    gap: 10px;
    padding: 0;
    margin: 24px 0 0;
    list-style: none;
}

.hero-points li {
    position: relative;
    padding-left: 20px;
    line-height: 1.7;
}

.hero-points li::before {
    content: "";
    position: absolute;
    top: 0.68em;
    left: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-alt), var(--accent));
    box-shadow: 0 0 16px rgba(201, 87, 79, 0.35);
}

.cavity-illustration {
    position: relative;
    min-height: 300px;
    border-radius: 28px;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 45%, rgba(239, 216, 109, 0.16), transparent 28%),
        linear-gradient(180deg, #120b1c 0%, #1b1026 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.cavity-mirror {
    position: absolute;
    top: 56px;
    bottom: 56px;
    width: 14px;
    border-radius: 999px;
    background: linear-gradient(180deg, #e9eef6, #94a6bf);
    box-shadow: 0 0 24px rgba(255, 255, 255, 0.24);
}

.cavity-mirror.left {
    left: 52px;
}

.cavity-mirror.right {
    right: 52px;
}

.cavity-wave {
    position: absolute;
    left: 92px;
    right: 92px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(239, 216, 109, 0), rgba(239, 216, 109, 0.95), rgba(239, 216, 109, 0));
    box-shadow: 0 0 18px rgba(239, 216, 109, 0.42);
    animation: pulse-line 2.6s ease-in-out infinite;
}

.wave-a {
    top: 108px;
}

.wave-b {
    top: 150px;
    animation-delay: -0.7s;
}

.wave-c {
    top: 192px;
    animation-delay: -1.35s;
}

.cavity-atom {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #f06e63;
    box-shadow: 0 0 20px rgba(240, 110, 99, 0.5);
}

.atom-a { top: 86px; left: 148px; }
.atom-b { top: 202px; left: 232px; }
.atom-c { top: 136px; left: 326px; }
.atom-d { top: 88px; right: 212px; }
.atom-e { top: 206px; right: 134px; }

.cavity-pump {
    position: absolute;
    left: 50%;
    top: 22px;
    width: 150px;
    height: 90px;
    transform: translateX(-50%);
    background: linear-gradient(180deg, rgba(201, 87, 79, 0.78), rgba(201, 87, 79, 0));
    clip-path: polygon(50% 0%, 100% 0%, 72% 100%, 28% 100%, 0% 0%);
    filter: blur(2px);
}

.cavity-label {
    position: absolute;
    color: rgba(255, 248, 244, 0.84);
    font-size: 0.82rem;
}

.label-left { left: 28px; bottom: 28px; }
.label-right { right: 30px; bottom: 28px; }
.label-center {
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%);
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
}

.hero-note {
    padding: 18px 20px;
    border-radius: 24px;
    background: rgba(255, 252, 250, 0.82);
}

.note-title {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.hero-note p {
    margin: 0;
    line-height: 1.74;
}

.signal-strip {
    margin-top: 12px;
    padding: 26px 30px;
    border-radius: 30px;
}

.signal-kicker,
.card-label {
    margin: 0;
    color: var(--accent-strong);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.signal-main {
    margin: 12px 0 8px;
    font-size: clamp(1.35rem, 3vw, 2.3rem);
    line-height: 1.3;
}

.signal-sub {
    margin: 0;
    line-height: 1.8;
}

.section {
    margin-top: 84px;
}

.section-heading {
    max-width: 760px;
    margin-bottom: 24px;
}

.section-heading h2 {
    font-size: clamp(2rem, 3.2vw, 3rem);
    letter-spacing: -0.03em;
}

.section-heading p {
    margin: 14px 0 0;
    line-height: 1.82;
}

.principle-grid,
.comparison-grid,
.link-grid {
    display: grid;
    gap: 18px;
}

.principle-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.comparison-grid,
.link-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.step-card,
.comparison-card,
.link-card {
    min-width: 0;
    padding: 24px;
    border-radius: 28px;
}

.step-card h3,
.comparison-card h3,
.link-card h3 {
    margin: 10px 0 12px;
    font-size: 1.36rem;
}

.step-card p,
.comparison-card p,
.link-card p {
    margin: 0;
    line-height: 1.8;
}

.strong-card {
    background: linear-gradient(180deg, rgba(255, 247, 240, 0.98), rgba(255, 232, 215, 0.88));
}

.warm-card {
    background: linear-gradient(180deg, rgba(255, 250, 238, 0.98), rgba(255, 241, 199, 0.88));
}

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

.formula-card {
    min-width: 0;
    padding: 24px 26px;
    border-radius: 28px;
}

.formula-block {
    margin: 12px 0 10px;
    font-size: clamp(1.2rem, 2.4vw, 1.74rem);
    line-height: 1.45;
    color: var(--accent-strong);
}

.formula-card p:last-child {
    margin-bottom: 0;
}

.demo-grid {
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 20px;
}

.demo-panel,
.canvas-panel {
    min-width: 0;
    padding: 24px;
    border-radius: 30px;
}

.preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.preset-chip {
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(125, 33, 30, 0.16);
    background: rgba(255, 253, 251, 0.86);
    color: var(--accent-strong);
    cursor: pointer;
    transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.preset-chip.is-active {
    color: #fff8f4;
    background: linear-gradient(135deg, var(--accent), #9d352d);
    box-shadow: 0 14px 28px rgba(157, 53, 45, 0.18);
}

.control-grid {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

.control {
    display: grid;
    gap: 10px;
}

.control span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.control strong {
    color: var(--accent-strong);
}

.control input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.demo-note {
    margin: 18px 0 0;
    line-height: 1.78;
}

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

.stat-grid article {
    padding: 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(125, 33, 30, 0.08);
}

.stat-grid span {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
}

.stat-grid strong {
    display: block;
    margin-top: 8px;
    font-size: 1.3rem;
    color: var(--ink);
}

#statThreshold[data-state="good"] {
    color: #0c8f5d;
}

#statThreshold[data-state="near"] {
    color: #b77a08;
}

#statThreshold[data-state="warn"] {
    color: #b14c48;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 18px;
    color: var(--muted);
    font-size: 0.93rem;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-swatch.excited {
    background: #f06e63;
    box-shadow: 0 0 12px rgba(240, 110, 99, 0.5);
}

.legend-swatch.ground {
    background: #6189d1;
}

.legend-swatch.photon {
    background: #f0d86f;
    box-shadow: 0 0 12px rgba(240, 216, 111, 0.44);
}

.legend-swatch.output {
    background: #f6f1bc;
    box-shadow: 0 0 12px rgba(246, 241, 188, 0.44);
}

.canvas-panel {
    background: linear-gradient(180deg, rgba(255, 250, 245, 0.82), rgba(255, 247, 241, 0.92));
}

.demo-canvas {
    width: 100%;
    border-radius: 24px;
    background: linear-gradient(180deg, #120b1c 0%, #201227 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.canvas-caption {
    margin: 16px 0 0;
    line-height: 1.8;
}

.macro-panel {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(125, 33, 30, 0.12);
}

.macro-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.macro-heading h3 {
    margin: 8px 0 0;
    font-size: 1.34rem;
}

.macro-heading-note,
.macro-note {
    color: var(--muted);
}

.macro-heading-note {
    margin: 0;
    font-size: 0.93rem;
    text-align: right;
}

.macro-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 260px);
    gap: 16px;
    margin-top: 16px;
}

.macro-visual {
    min-width: 0;
}

.macro-canvas {
    width: 100%;
    border-radius: 22px;
    background: linear-gradient(180deg, #120b1c 0%, #201227 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.macro-readout {
    display: grid;
    gap: 12px;
}

.macro-card {
    padding: 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(125, 33, 30, 0.08);
}

.macro-card span {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
}

.macro-card strong {
    display: block;
    margin-top: 8px;
    font-size: 1.18rem;
    color: var(--ink);
    line-height: 1.45;
}

.macro-note {
    margin: 14px 0 0;
    line-height: 1.78;
}

.site-footer {
    margin-top: 84px;
    padding: 26px 30px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.site-footer p {
    margin: 0;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

@keyframes pulse-line {
    0%,
    100% {
        opacity: 0.38;
        transform: translateX(0);
    }
    50% {
        opacity: 0.95;
        transform: translateX(10px);
    }
}

@media (max-width: 1080px) {
    .hero,
    .demo-grid {
        grid-template-columns: 1fr;
    }

    .comparison-grid,
    .link-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .page-shell {
        width: min(100%, calc(100% - 20px));
    }

    .site-header {
        position: static;
        margin-top: 12px;
        padding: 14px 16px;
        border-radius: 28px;
    }

    .site-nav {
        gap: 12px;
        font-size: 0.9rem;
    }

    .hero-copy,
    .hero-panel,
    .demo-panel,
    .canvas-panel,
    .signal-strip,
    .site-footer,
    .step-card,
    .comparison-card,
    .link-card,
    .formula-card {
        padding: 22px;
        border-radius: 26px;
    }

    .principle-grid,
    .formula-strip,
    .comparison-grid,
    .link-grid,
    .stat-grid,
    .macro-grid {
        grid-template-columns: 1fr;
    }

    .signal-main {
        font-size: 1.65rem;
    }

    .cavity-illustration {
        min-height: 260px;
    }

    .label-center {
        width: calc(100% - 32px);
        text-align: center;
    }

    .site-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .macro-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .macro-heading-note {
        text-align: left;
    }
}

@media (max-width: 540px) {
    h1 {
        font-size: 2.4rem;
    }

    .hero-actions,
    .preset-row,
    .footer-links {
        width: 100%;
    }

    .button,
    .preset-chip {
        width: 100%;
    }

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

    .cavity-wave {
        left: 76px;
        right: 76px;
    }

    .cavity-mirror.left {
        left: 38px;
    }

    .cavity-mirror.right {
        right: 38px;
    }

    .label-left,
    .label-right {
        font-size: 0.76rem;
    }
}