:root {
    --bg-deep: #040711;
    --bg-mid: #0a1630;
    --bg-surface: rgba(10, 18, 37, 0.84);
    --bg-card: rgba(14, 23, 44, 0.82);
    --text: #eef6ff;
    --muted: #bfd0e6;
    --line: rgba(255, 255, 255, 0.1);
    --accent: #7dd3fc;
    --accent-strong: #facc15;
    --accent-soft: rgba(125, 211, 252, 0.16);
    --violet: #c4b5fd;
    --rose: #f9a8d4;
    --danger: #f87171;
    --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: "IBM Plex Sans JP", sans-serif;
    background:
        radial-gradient(circle at 18% 14%, rgba(125, 211, 252, 0.14), transparent 22%),
        radial-gradient(circle at 82% 18%, rgba(250, 204, 21, 0.1), transparent 18%),
        radial-gradient(circle at 50% 110%, rgba(196, 181, 253, 0.12), transparent 28%),
        linear-gradient(180deg, #030612 0%, #07101f 28%, #091325 52%, #03060f 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px),
        radial-gradient(circle at 70% 18%, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px),
        radial-gradient(circle at 40% 70%, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px),
        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: auto, auto, auto, 44px 44px, 44px 44px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.84), rgba(0, 0, 0, 0.2));
}

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

button,
input {
    font: inherit;
}

canvas {
    display: block;
}

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

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

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

.brand {
    font-size: 1.14rem;
    letter-spacing: 0.12em;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 18px;
    color: rgba(238, 246, 255, 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;
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
    padding: 34px 0 22px;
}

.stage-copy,
.simulation-shell,
.tool-card,
.physics-card,
.related-card,
.signal-strip,
.site-footer {
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.stage-copy {
    position: relative;
    overflow: hidden;
    min-width: 0;
    padding: 42px 36px 42px 38px;
    border-radius: 36px;
    background: linear-gradient(180deg, rgba(9, 20, 42, 0.94), rgba(8, 15, 30, 0.88));
}

.stage-copy::after {
    content: "";
    position: absolute;
    right: -64px;
    bottom: -96px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(125, 211, 252, 0.28), rgba(125, 211, 252, 0));
}

.eyebrow,
.card-label,
.signal-kicker {
    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 {
    line-height: 1.15;
}

h1,
h2 {
    margin: 0;
}

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

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

h3 {
    margin: 0;
    font-size: 1.34rem;
}

.stage-lead,
.section-heading p,
.tool-card p,
.physics-card p,
.related-card p,
.site-footer p,
.signal-sub,
.panel-header p,
.panel-status,
.floating-hint,
.stage-stats span,
.control span,
.subheading,
.button-secondary {
    color: var(--muted);
}

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

.stage-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 26px;
}

.stage-tags span {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(238, 246, 255, 0.92);
    font-size: 0.9rem;
}

.simulation-shell {
    order: -1;
    position: relative;
    min-width: 0;
    min-height: 840px;
    border-radius: 38px;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 50%, rgba(250, 204, 21, 0.08), transparent 18%),
        radial-gradient(circle at 72% 20%, rgba(125, 211, 252, 0.1), transparent 22%),
        linear-gradient(180deg, rgba(6, 12, 24, 0.96), rgba(4, 8, 18, 0.98));
}

.simulation-shell::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 180px;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(3, 6, 12, 0), rgba(3, 6, 12, 0.52));
}

#spaceCanvas {
    width: 100%;
    height: 100%;
    min-height: 840px;
    background:
        radial-gradient(circle at 50% 52%, rgba(250, 204, 21, 0.08), transparent 14%),
        radial-gradient(circle at 78% 22%, rgba(125, 211, 252, 0.08), transparent 26%),
        linear-gradient(180deg, #030711 0%, #050b17 48%, #03060d 100%);
    cursor: crosshair;
    touch-action: none;
}

.panel {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 2;
    width: min(370px, calc(100% - 40px));
    padding: 18px;
    border-radius: 24px;
    background: rgba(7, 13, 27, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(16px);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.3);
}

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

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

.button-grid,
.tool-grid {
    display: grid;
    gap: 10px;
}

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

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

button {
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
}

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

button.is-active,
button.accent,
.button-primary {
    background: linear-gradient(135deg, var(--accent), #dbeafe);
    color: #07111f;
    border-color: rgba(125, 211, 252, 0.34);
}

button.warning {
    background: linear-gradient(135deg, #fde68a, #facc15);
    color: #251605;
}

button.danger {
    background: linear-gradient(135deg, #f97373, #fb7185);
    color: #240c12;
}

button.is-paused {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.12);
}

.subheading {
    margin: 16px 0 10px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.control-grid {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

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

.control span,
.control strong {
    font-size: 0.9rem;
}

.control strong {
    justify-self: end;
    color: #fff4c2;
}

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

.panel-status {
    margin: 14px 0 0;
    font-size: 0.92rem;
    line-height: 1.7;
}

.floating-hint {
    position: absolute;
    right: 20px;
    bottom: 20px;
    z-index: 2;
    max-width: 380px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(7, 13, 27, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.92rem;
    line-height: 1.65;
}

.stage-stats {
    position: absolute;
    left: 20px;
    bottom: 20px;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.stage-stats article {
    min-width: 126px;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(7, 13, 27, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.stage-stats span {
    display: block;
    margin-bottom: 6px;
    font-size: 0.8rem;
}

.stage-stats strong {
    font-size: 1.02rem;
}

.signal-strip {
    margin-top: 6px;
    padding: 24px 28px;
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(8, 17, 34, 0.94), rgba(13, 18, 36, 0.9));
}

.signal-kicker,
.signal-main,
.signal-sub {
    margin: 0;
}

.signal-main {
    margin-top: 6px;
    font-size: clamp(1.45rem, 2.6vw, 2.4rem);
}

.signal-sub {
    margin-top: 10px;
    line-height: 1.8;
}

.section {
    padding-top: 28px;
}

.section-heading {
    max-width: 780px;
    margin-bottom: 20px;
}

.section-heading p {
    margin: 12px 0 0;
    line-height: 1.8;
}

.tool-card-grid,
.physics-grid,
.related-grid {
    display: grid;
    gap: 18px;
}

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

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

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

.tool-card,
.physics-card,
.related-card {
    min-width: 0;
    padding: 24px;
    border-radius: 30px;
    background: var(--bg-card);
}

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

.strong-card {
    background: linear-gradient(180deg, rgba(10, 28, 54, 0.92), rgba(11, 18, 34, 0.86));
}

.warm-card {
    background: linear-gradient(180deg, rgba(36, 28, 12, 0.9), rgba(15, 18, 33, 0.86));
}

.moon-card {
    background: linear-gradient(180deg, rgba(28, 21, 55, 0.9), rgba(12, 17, 33, 0.86));
}

.void-card {
    background: linear-gradient(180deg, rgba(17, 13, 35, 0.92), rgba(10, 12, 24, 0.88));
}

.erase-card {
    background: linear-gradient(180deg, rgba(25, 18, 30, 0.9), rgba(12, 14, 22, 0.86));
}

.burst-card {
    background: linear-gradient(180deg, rgba(17, 31, 47, 0.9), rgba(9, 15, 26, 0.86));
}

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

.button-secondary {
    background: rgba(255, 255, 255, 0.06);
}

.feature-card {
    background: linear-gradient(180deg, rgba(10, 24, 46, 0.94), rgba(11, 18, 33, 0.9));
}

.site-footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-top: 28px;
    padding: 24px 26px;
    border-radius: 28px;
    background: rgba(6, 12, 24, 0.78);
}

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

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

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 16px;
}

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

    .simulation-shell,
    #spaceCanvas {
        min-height: 900px;
    }
}

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

    .site-header,
    .site-footer {
        border-radius: 28px;
        flex-direction: column;
        align-items: flex-start;
    }

    .site-nav,
    .footer-links {
        justify-content: flex-start;
    }

    .tool-card-grid,
    .physics-grid,
    .related-grid {
        grid-template-columns: 1fr;
    }

    .simulation-shell {
        min-height: auto;
        padding-bottom: 16px;
    }

    #spaceCanvas {
        min-height: 480px;
        height: 58vh;
    }

    .panel,
    .floating-hint,
    .stage-stats {
        position: relative;
        top: auto;
        right: auto;
        bottom: auto;
        left: auto;
        width: auto;
        max-width: none;
        margin: 16px 16px 0;
    }

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

@media (max-width: 560px) {
    .stage-copy,
    .tool-card,
    .physics-card,
    .related-card,
    .signal-strip,
    .site-footer {
        border-radius: 24px;
    }

    .stage-copy {
        padding: 32px 22px;
    }

    .panel {
        padding: 16px;
    }

    #spaceCanvas {
        min-height: 420px;
        height: 52vh;
    }

    .button-grid,
    .tool-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stage-stats article {
        min-width: calc(50% - 6px);
    }
}