:root {
    --bg-top: #200c07;
    --bg-mid: #361208;
    --bg-bottom: #0f0503;
    --surface: rgba(44, 18, 10, 0.82);
    --surface-strong: rgba(52, 20, 11, 0.92);
    --card: rgba(73, 31, 18, 0.74);
    --card-soft: rgba(58, 26, 16, 0.68);
    --text: #fff7ed;
    --muted: #fed7aa;
    --line: rgba(255, 237, 213, 0.12);
    --magma: #f97316;
    --magma-strong: #fb923c;
    --amber: #fbbf24;
    --ash: #cbd5e1;
    --crystal: #dbeafe;
    --stone: #fdba74;
    --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 16% 12%, rgba(249, 115, 22, 0.16), transparent 18%),
        radial-gradient(circle at 84% 16%, rgba(251, 191, 36, 0.12), transparent 20%),
        radial-gradient(circle at 50% 104%, rgba(71, 85, 105, 0.2), transparent 28%),
        linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 44%, var(--bg-bottom) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 14% 24%, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px),
        radial-gradient(circle at 70% 16%, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px),
        radial-gradient(circle at 42% 74%, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px),
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
    background-size: auto, auto, auto, 44px 44px, 44px 44px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0.12));
}

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(28, 10, 6, 0.82);
    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(255, 247, 237, 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,
.model-card,
.observation-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(48, 17, 10, 0.96), rgba(22, 8, 5, 0.92));
}

.stage-copy::before {
    content: "";
    position: absolute;
    inset: auto auto -88px -62px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(249, 115, 22, 0.2), rgba(249, 115, 22, 0));
}

.stage-copy::after {
    content: "";
    position: absolute;
    right: -48px;
    top: -42px;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.12), rgba(251, 191, 36, 0));
}

.eyebrow,
.card-label,
.signal-kicker,
.band-title {
    margin: 0 0 12px;
    color: var(--amber);
    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.2vw, 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,
.model-card p,
.observation-card p,
.related-card p,
.site-footer p,
.signal-sub,
.panel-header p,
.panel-status,
.floating-hint,
.control span,
.subheading,
.button-secondary,
.note,
.stat-card span {
    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(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.16);
    color: #fff1d6;
    font-size: 0.9rem;
}

.simulation-shell {
    order: -1;
    position: relative;
    min-width: 0;
    min-height: 920px;
    overflow: hidden;
    border-radius: 36px;
    background: linear-gradient(180deg, rgba(43, 16, 10, 0.96), rgba(17, 7, 5, 0.94));
}

#lavaCanvas {
    width: 100%;
    min-height: 620px;
}

.panel,
.floating-hint {
    position: absolute;
    z-index: 2;
    border: 1px solid var(--line);
    backdrop-filter: blur(16px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.panel {
    top: 18px;
    left: 18px;
    width: min(356px, calc(100% - 36px));
    padding: 22px;
    border-radius: 30px;
    background: var(--surface-strong);
}

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

.panel-header p {
    margin: 12px 0 0;
    line-height: 1.8;
    font-size: 0.95rem;
}

.subheading {
    margin: 20px 0 14px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    margin-bottom: 14px;
}

.control strong {
    color: var(--text);
    font-size: 0.95rem;
}

.control input {
    grid-column: 1 / -1;
    width: 100%;
    accent-color: var(--magma);
}

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

.button-grid button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 14px;
    padding: 12px 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

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

.toggle-action {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
}

.quick-action {
    background: linear-gradient(135deg, #fb923c, #f97316);
    color: white;
}

.slow-action {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #3b1706;
}

.heat-action {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.reset-action {
    background: linear-gradient(135deg, #78716c, #57534e);
    color: white;
}

.wide-button {
    grid-column: 1 / -1;
}

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

.stat-card {
    padding: 14px 15px;
    border-radius: 18px;
    background: var(--card);
    border: 1px solid rgba(255, 237, 213, 0.08);
}

.stat-card strong {
    display: block;
    margin-top: 6px;
    color: var(--text);
    font-size: 1.12rem;
}

.note,
.panel-status {
    margin: 16px 0 0;
    font-size: 0.92rem;
    line-height: 1.75;
}

.panel-status {
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.floating-hint {
    top: 18px;
    right: 18px;
    width: min(338px, calc(100% - 40px));
    padding: 18px 20px;
    border-radius: 24px;
    background: rgba(45, 19, 12, 0.86);
    font-size: 0.92rem;
    line-height: 1.78;
}

.signal-strip {
    margin: 20px 0 30px;
    padding: 24px 28px;
    border-radius: 30px;
    background: linear-gradient(135deg, rgba(68, 28, 16, 0.9), rgba(31, 11, 7, 0.94));
}

.signal-main {
    margin: 0;
    font-size: clamp(1.8rem, 3.4vw, 2.8rem);
    letter-spacing: -0.03em;
}

.signal-sub {
    margin: 14px 0 0;
    line-height: 1.82;
}

.section {
    margin-top: 28px;
}

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

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

.model-grid,
.observation-grid,
.related-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.model-card,
.observation-card,
.related-card {
    padding: 24px 22px;
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(56, 24, 15, 0.88), rgba(23, 9, 6, 0.9));
}

.model-card p,
.observation-card p,
.related-card p {
    margin: 12px 0 0;
    line-height: 1.8;
}

.cooling-card {
    background: linear-gradient(180deg, rgba(97, 33, 18, 0.9), rgba(33, 12, 8, 0.94));
}

.nucleation-card {
    background: linear-gradient(180deg, rgba(120, 53, 15, 0.88), rgba(36, 14, 8, 0.94));
}

.growth-card {
    background: linear-gradient(180deg, rgba(68, 40, 26, 0.88), rgba(25, 14, 10, 0.94));
}

.rock-card {
    background: linear-gradient(180deg, rgba(55, 65, 81, 0.82), rgba(24, 28, 36, 0.92));
}

.feature-card {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.24), rgba(48, 17, 10, 0.96));
}

.button-primary,
.button-secondary {
    margin-top: 18px;
    border-radius: 999px;
}

.button-primary {
    background: linear-gradient(135deg, #fb923c, #f97316);
    color: white;
}

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

.site-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    margin-top: 34px;
    padding: 28px 30px;
    border-radius: 30px;
    background: rgba(25, 10, 6, 0.9);
}

.footer-title {
    margin: 0 0 12px;
    font-size: 1.12rem;
}

.site-footer p {
    margin: 0;
    line-height: 1.82;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: flex-end;
    gap: 14px 18px;
}

@media (max-width: 1100px) {
    .floating-hint {
        width: min(300px, calc(100% - 40px));
    }
}

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

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

    .stage-copy,
    .simulation-shell,
    .signal-strip,
    .model-card,
    .observation-card,
    .related-card,
    .site-footer {
        border-radius: 28px;
    }

    .simulation-shell {
        min-height: 0;
        padding-bottom: 18px;
    }

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

    .model-grid,
    .observation-grid,
    .related-grid,
    .site-footer {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 560px) {
    body::before {
        background-size: auto, auto, auto, 34px 34px, 34px 34px;
    }

    .site-header {
        gap: 14px;
    }

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

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

    .stage-lead {
        font-size: 0.98rem;
    }

    .panel {
        padding: 18px;
    }

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

    .wide-button {
        grid-column: auto;
    }

    .floating-hint,
    .signal-strip,
    .site-footer,
    .model-card,
    .observation-card,
    .related-card {
        padding-left: 18px;
        padding-right: 18px;
    }
}