:root {
    --bg-dark: #071724;
    --bg-deep: #0f4c67;
    --surface: rgba(248, 251, 247, 0.9);
    --surface-soft: rgba(230, 245, 247, 0.84);
    --surface-warm: rgba(255, 240, 218, 0.9);
    --ink: #17313d;
    --muted: #5f7480;
    --line: rgba(23, 49, 61, 0.12);
    --accent: #118ab2;
    --accent-strong: #0f4c67;
    --accent-soft: #d97706;
    --success: #1d9c67;
    --danger: #cb4f66;
    --shadow: 0 28px 64px rgba(8, 20, 32, 0.22);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: "IBM Plex Sans JP", sans-serif;
    background:
        radial-gradient(circle at 16% 10%, rgba(17, 138, 178, 0.16), transparent 22%),
        radial-gradient(circle at 82% 12%, rgba(217, 119, 6, 0.18), transparent 22%),
        linear-gradient(180deg, #06111b 0%, #0f4c67 18%, #e9efe8 18.1%, #f6f2e9 100%);
}

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

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

button,
input {
    font: inherit;
}

canvas {
    display: block;
    touch-action: none;
    cursor: crosshair;
    image-rendering: pixelated;
}

.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(4, 11, 18, 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.24);
}

.brand,
h1,
h2,
h3,
.signal-main,
.footer-title {
    font-family: "Shippori Mincho", serif;
}

.brand {
    color: #f3f1ea;
    font-size: 1.14rem;
    letter-spacing: 0.08em;
}

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

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

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

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

.stage {
    display: grid;
    gap: 20px;
    padding: 34px 0 22px;
}

.stage-copy,
.signal-strip,
.mechanism-card,
.experiment-card,
.related-card,
.site-footer {
    border: 1px solid rgba(255, 255, 255, 0.58);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.stage-copy {
    position: relative;
    overflow: hidden;
    padding: 28px 28px 24px;
    border-radius: 32px;
}

.stage-copy::after {
    content: "";
    position: absolute;
    inset: auto -40px -120px auto;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(17, 138, 178, 0.28), rgba(17, 138, 178, 0));
}

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

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

h1,
h2 {
    margin: 0;
}

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

.stage-lead,
.section-heading p,
.mechanism-card p,
.experiment-card p,
.related-card p,
.signal-sub,
.site-footer p,
.panel-header p,
.panel-status,
.floating-hint,
.stage-stats span,
.stat-box,
.tool-header span {
    color: var(--muted);
}

.stage-lead {
    margin: 18px 0 0;
    max-width: 780px;
    font-size: 1.04rem;
    line-height: 1.8;
}

.stage-tags,
.footer-links,
.buttons,
.tool-buttons,
.stats,
.stage-stats {
    display: grid;
    gap: 12px;
}

.stage-tags {
    margin-top: 22px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
}

.stage-tags span {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(15, 76, 103, 0.12);
    color: var(--accent-strong);
    font-weight: 600;
}

.simulation-shell {
    order: -1;
    position: relative;
    min-height: clamp(760px, 84vh, 940px);
    border-radius: 38px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 32px 64px rgba(4, 9, 18, 0.34);
    background:
        radial-gradient(circle at 50% 40%, rgba(14, 44, 58, 0.88), rgba(1, 8, 16, 0.98)),
        linear-gradient(180deg, rgba(2, 10, 18, 0.96), rgba(6, 21, 34, 0.98));
}

.simulation-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 20%, rgba(103, 232, 249, 0.08), transparent 20%),
        radial-gradient(circle at 82% 18%, rgba(250, 204, 21, 0.08), transparent 18%),
        radial-gradient(circle at 54% 72%, rgba(59, 130, 246, 0.07), transparent 24%);
}

#waveCanvas {
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at center, #123a5b 0%, #071522 78%);
}

.panel,
.floating-hint,
.stage-stats article {
    position: absolute;
    z-index: 2;
    background: rgba(2, 8, 18, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(18px);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
}

.panel {
    top: 22px;
    left: 22px;
    width: min(390px, calc(100% - 44px));
    padding: 18px;
    border-radius: 28px;
}

.panel-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.panel-header h2 {
    font-size: 1.16rem;
}

.panel-header p {
    margin: 10px 0 0;
    font-size: 0.92rem;
    line-height: 1.65;
}

.buttons {
    margin-top: 18px;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

.tool-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
}

.tool-header p {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: rgba(247, 250, 252, 0.88);
}

.tool-header span {
    font-size: 0.82rem;
}

.tool-buttons {
    margin-top: 10px;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
}

button {
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    cursor: pointer;
    font-weight: 700;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

button:hover,
button:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}

button.active {
    background: linear-gradient(135deg, #1d9fe4, #0f67aa);
    border-color: transparent;
}

button.green {
    background: linear-gradient(135deg, #1d9c67, #12714a);
    border-color: transparent;
}

button.red {
    background: linear-gradient(135deg, #cb4f66, #a93a50);
    border-color: transparent;
}

button.yellow {
    background: linear-gradient(135deg, #d97706, #b35d07);
    border-color: transparent;
}

.panel button.panel-toggle,
.panel-reveal {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.panel button.panel-toggle {
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.08);
}

.panel-reveal {
    position: absolute;
    top: 22px;
    left: 22px;
    z-index: 3;
    display: none;
    color: white;
    background: rgba(2, 8, 18, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(18px);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
}

.simulation-shell.is-panel-hidden .panel {
    display: none;
}

.simulation-shell.is-panel-hidden .panel-reveal {
    display: inline-flex;
}

.control {
    margin-top: 16px;
}

.control label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    color: rgba(247, 250, 252, 0.9);
    font-size: 0.9rem;
}

.control input[type="range"] {
    width: 100%;
}

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

.stat-box {
    padding: 11px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.86rem;
}

.panel-status {
    margin: 16px 0 0;
    font-size: 0.88rem;
    line-height: 1.6;
}

.floating-hint {
    right: 22px;
    bottom: 22px;
    width: min(420px, calc(100% - 44px));
    padding: 14px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    line-height: 1.65;
}

.stage-stats {
    position: absolute;
    top: 22px;
    right: 22px;
    width: min(360px, 42%);
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stage-stats article {
    padding: 12px 14px;
    border-radius: 20px;
}

.stage-stats span {
    display: block;
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stage-stats strong {
    display: block;
    margin-top: 6px;
    color: white;
    font-size: 0.94rem;
}

.signal-strip {
    margin-top: 18px;
    padding: 28px 30px;
    border-radius: 28px;
}

.signal-main {
    margin: 0;
    font-size: clamp(1.7rem, 3.3vw, 2.6rem);
    letter-spacing: -0.03em;
}

.signal-sub {
    margin: 14px 0 0;
    max-width: 820px;
    line-height: 1.75;
}

.section {
    margin-top: 22px;
}

.section-heading {
    padding: 0 4px 18px;
}

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

.section-heading p:last-child {
    margin: 12px 0 0;
    max-width: 820px;
    line-height: 1.8;
}

.mechanism-grid,
.experiment-grid,
.related-grid {
    display: grid;
    gap: 18px;
}

.mechanism-grid,
.experiment-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.mechanism-card,
.experiment-card,
.related-card {
    padding: 22px;
    border-radius: 26px;
}

.mechanism-card h3,
.experiment-card h3,
.related-card h3 {
    font-size: 1.24rem;
}

.mechanism-card p,
.experiment-card p,
.related-card p {
    margin: 12px 0 0;
    line-height: 1.75;
}

.strong-card {
    background: linear-gradient(180deg, rgba(244, 251, 255, 0.96), rgba(229, 246, 249, 0.92));
}

.warm-card {
    background: linear-gradient(180deg, rgba(255, 246, 235, 0.96), rgba(252, 237, 214, 0.92));
}

.accent-card {
    background: linear-gradient(180deg, rgba(236, 252, 249, 0.96), rgba(216, 245, 239, 0.92));
}

.feature-card {
    background: linear-gradient(180deg, rgba(234, 242, 252, 0.96), rgba(221, 233, 246, 0.92));
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    font-weight: 700;
}

.button-primary {
    color: white;
    background: linear-gradient(135deg, #1289bf, #0f5c84);
    box-shadow: 0 16px 30px rgba(15, 92, 132, 0.2);
}

.button-secondary {
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--line);
}

.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 18px;
    margin-top: 28px;
    padding: 24px 26px;
    border-radius: 28px;
}

.footer-title {
    margin: 0;
    font-size: 1.08rem;
}

.site-footer p {
    margin: 8px 0 0;
    line-height: 1.7;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
}

@media (max-width: 1100px) {
    .mechanism-grid,
    .experiment-grid,
    .related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .simulation-shell {
        display: grid;
        grid-template-areas:
            "canvas"
            "stats"
            "panel"
            "hint";
        gap: 16px;
        min-height: 0;
        padding: 18px;
        overflow: visible;
    }

    #waveCanvas,
    .panel,
    .floating-hint,
    .stage-stats article {
        position: relative;
        inset: auto;
        width: auto;
    }

    #waveCanvas {
        grid-area: canvas;
        height: clamp(340px, 54vh, 520px);
        border-radius: 26px;
    }

    .stage-stats {
        position: static;
        grid-area: stats;
        width: auto;
    }

    .stage-stats article {
        min-height: 0;
    }

    .panel {
        grid-area: panel;
    }

    .floating-hint {
        grid-area: hint;
    }

    .panel-reveal {
        top: 18px;
        left: 18px;
    }
}

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

    .site-header {
        position: static;
        flex-direction: column;
        align-items: flex-start;
        border-radius: 28px;
        padding: 16px 18px;
    }

    .site-nav {
        justify-content: flex-start;
        gap: 14px;
    }

    .stage-copy,
    .signal-strip,
    .mechanism-card,
    .experiment-card,
    .related-card,
    .site-footer,
    .panel {
        border-radius: 24px;
    }

    h1 {
        font-size: clamp(2.2rem, 11vw, 3.3rem);
    }

    .simulation-shell {
        gap: 12px;
        padding: 14px;
        border-radius: 28px;
    }

    #waveCanvas {
        height: clamp(280px, 50vh, 400px);
        border-radius: 20px;
    }

    .panel-heading-row {
        flex-direction: column;
        align-items: stretch;
    }

    .panel-reveal {
        top: 14px;
        left: 14px;
    }

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

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

    .buttons,
    .tool-buttons,
    .stats,
    .mechanism-grid,
    .experiment-grid,
    .related-grid {
        grid-template-columns: 1fr;
    }
}