:root {
    color-scheme: dark;
    --bg: #040912;
    --bg-soft: #091526;
    --panel: rgba(8, 18, 34, 0.78);
    --panel-strong: rgba(10, 22, 40, 0.92);
    --line: rgba(164, 196, 255, 0.16);
    --line-strong: rgba(255, 213, 120, 0.28);
    --text: #f4f7ff;
    --muted: #bdd0ee;
    --accent: #76dbff;
    --accent-strong: #ffd469;
    --accent-soft: #8fb8ff;
    --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(100, 146, 255, 0.16), transparent 32%),
        radial-gradient(circle at right 18%, rgba(255, 173, 88, 0.12), transparent 24%),
        linear-gradient(180deg, #02060f 0%, #040912 36%, #07101e 100%);
    color: var(--text);
    font-family: "IBM Plex Sans JP", sans-serif;
}

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

button,
input,
select {
    font: inherit;
}

.page-shell {
    width: min(1220px, calc(100% - 28px));
    margin: 0 auto;
    padding: 18px 0 56px;
}

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

.brand {
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.site-nav a {
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.94rem;
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    transform: translateY(-1px);
}

main {
    display: grid;
    gap: 24px;
    margin-top: 22px;
}

.section,
.hero,
.signal-strip,
.site-footer {
    border: 1px solid var(--line);
    border-radius: 30px;
    background: var(--panel);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}

.section,
.hero {
    padding: clamp(24px, 3vw, 36px);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: clamp(24px, 3.4vw, 40px);
    align-items: center;
}

.hero-copy h1,
.section-heading h2,
.canvas-top h3,
.observer-top h3,
.hero-note h2,
.link-card h3,
.info-card h3,
.bridge-panel h3 {
    margin: 0;
    font-family: "Shippori Mincho", serif;
    line-height: 1.18;
}

.hero-copy h1 {
    font-size: clamp(2rem, 4.5vw, 3.6rem);
    margin-top: 10px;
}

.hero-lead,
.section-heading p,
.control-copy,
.summary-text,
.hero-note p,
.info-card p,
.bridge-panel p,
.formula-card p,
.link-card p,
.site-footer p {
    color: var(--muted);
    line-height: 1.8;
}

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

.hero-actions,
.footer-links,
.button-row,
.legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.button {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 11px 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

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

.button-primary {
    background: linear-gradient(135deg, #78ddff, #82a6ff);
    color: #04111f;
    box-shadow: 0 16px 34px rgba(118, 219, 255, 0.25);
}

.button-secondary {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

.hero-points,
.hint-list {
    margin: 18px 0 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.8;
}

.hero-panel {
    display: grid;
    gap: 18px;
}

.gravity-stage {
    position: relative;
    min-height: 320px;
    overflow: hidden;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        radial-gradient(circle at 58% 52%, rgba(255, 199, 102, 0.12), transparent 15%),
        radial-gradient(circle at 60% 50%, rgba(137, 180, 255, 0.2), transparent 30%),
        linear-gradient(180deg, rgba(7, 14, 26, 0.98) 0%, rgba(6, 12, 24, 0.96) 100%);
}

.gravity-stage::before {
    content: "";
    position: absolute;
    inset: 18px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.gravity-ring,
.gravity-core,
.gravity-ray,
.stage-pill {
    position: absolute;
}

.gravity-ring {
    border-radius: 999px;
    border: 1px dashed rgba(185, 214, 255, 0.28);
}

.ring-outer {
    width: 240px;
    height: 240px;
    top: 38px;
    right: 58px;
}

.ring-mid {
    width: 176px;
    height: 176px;
    top: 70px;
    right: 90px;
    border-style: solid;
    border-color: rgba(255, 212, 105, 0.26);
}

.ring-inner {
    width: 110px;
    height: 110px;
    top: 103px;
    right: 123px;
    border-style: solid;
    border-color: rgba(146, 179, 255, 0.38);
}

.gravity-core {
    width: 72px;
    height: 72px;
    top: 122px;
    right: 142px;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 34%, #050505 0%, #000 54%, #1a1c20 100%);
    box-shadow: 0 0 0 10px rgba(123, 164, 255, 0.12), 0 0 46px rgba(0, 0, 0, 0.6);
}

.gravity-ray {
    left: -22px;
    height: 2px;
    border-radius: 999px;
    transform-origin: left center;
    background: linear-gradient(90deg, rgba(128, 232, 255, 0), rgba(128, 232, 255, 0.82));
    animation: drift 6.2s linear infinite;
}

.ray-a {
    top: 90px;
    width: 300px;
}

.ray-b {
    top: 124px;
    width: 344px;
    transform: rotate(4deg);
    animation-duration: 7.3s;
}

.ray-c {
    top: 156px;
    width: 324px;
    transform: rotate(-9deg);
    animation-duration: 6.8s;
}

.ray-d {
    top: 188px;
    width: 278px;
    transform: rotate(12deg);
    animation-duration: 7.8s;
}

.ray-e {
    top: 222px;
    width: 312px;
    transform: rotate(-16deg);
    animation-duration: 6.5s;
}

.stage-pill {
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(10, 22, 40, 0.84);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 600;
}

.pill-a {
    top: 34px;
    right: 56px;
}

.pill-b {
    top: 84px;
    right: 18px;
}

.pill-c {
    bottom: 26px;
    left: 24px;
}

.hero-note-grid,
.cards-grid,
.link-grid,
.stats-grid {
    display: grid;
    gap: 16px;
}

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

.hero-note,
.info-card,
.formula-card,
.link-card,
.summary-box,
.hint-card,
.panel,
.stat-card,
.bridge-panel {
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 24px;
    background: var(--panel-strong);
}

.hero-note,
.info-card,
.formula-card,
.link-card,
.summary-box,
.hint-card,
.stat-card,
.bridge-panel {
    padding: 18px;
}

.strong-card,
.strong-card .card-label,
.strong-card .control-label {
    --accent: #7cdfff;
}

.warm-card,
.warm-card .card-label,
.warm-card .control-label {
    --accent: #ffd56d;
}

.strong-card,
.strong-card .hero-note,
.strong-card.info-card,
.strong-card.link-card {
    background: linear-gradient(180deg, rgba(10, 24, 44, 0.96) 0%, rgba(7, 18, 34, 0.94) 100%);
}

.warm-card,
.warm-card.info-card,
.warm-card.link-card {
    background: linear-gradient(180deg, rgba(30, 22, 10, 0.9) 0%, rgba(23, 17, 10, 0.92) 100%);
}

.signal-strip {
    padding: 18px 24px;
}

.signal-main {
    margin: 6px 0 4px;
    font-size: clamp(1.12rem, 2vw, 1.52rem);
    font-weight: 700;
    color: var(--text);
}

.signal-sub {
    margin: 0;
    color: var(--muted);
    line-height: 1.8;
}

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

.section-heading h2 {
    font-size: clamp(1.7rem, 3vw, 2.45rem);
    margin-top: 10px;
}

.viewer-grid {
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.controls-panel,
.canvas-panel {
    height: 100%;
}

.canvas-panel {
    display: grid;
    align-content: start;
    gap: 14px;
}

.control-stack {
    display: grid;
    gap: 18px;
}

.control-group {
    display: grid;
    gap: 8px;
}

.control-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.control-title {
    font-weight: 600;
}

.control-value {
    color: var(--accent-strong);
    font-weight: 700;
}

.control-copy {
    margin: 0;
    font-size: 0.92rem;
}

.range-input {
    width: 100%;
    accent-color: #7cdfff;
}

.summary-box,
.hint-card {
    margin-top: 18px;
}

.summary-text,
.hint-list {
    margin-bottom: 0;
}

.canvas-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.canvas-chip,
.legend-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 11px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 0.8rem;
}

.canvas-shell {
    overflow: hidden;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, #060d19 0%, #040910 100%);
}

.observer-block {
    display: grid;
    gap: 12px;
    padding-top: 6px;
}

.observer-top {
    margin-bottom: 0;
}

.observer-shell {
    overflow: hidden;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, #070e1b 0%, #050914 100%);
}

.observer-copy {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
    font-size: 0.92rem;
}

canvas {
    display: block;
    width: 100%;
}

.legend-row {
    margin-top: 14px;
}

.legend-chip.warm {
    border-color: rgba(255, 213, 109, 0.25);
}

.legend-chip.neutral {
    border-color: rgba(143, 184, 255, 0.2);
}

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

.stat-value {
    margin: 8px 0 0;
    font-size: 1.06rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.45;
}

.formula-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.formula-block {
    margin: 12px 0 10px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-family: "Shippori Mincho", serif;
    font-size: 1.12rem;
    line-height: 1.7;
}

.formula-block.multiline {
    display: grid;
    gap: 4px;
}

.bridge-panel {
    margin-top: 16px;
}

.link-card {
    transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.link-card:hover,
.link-card:focus-visible {
    transform: translateY(-3px);
    border-color: rgba(124, 223, 255, 0.3);
}

.site-footer {
    margin-top: 24px;
    padding: 22px 24px;
}

.footer-links {
    margin-top: 12px;
}

.footer-links a {
    color: var(--muted);
}

.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 500ms ease, transform 500ms ease;
}

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

@keyframes drift {
    0% {
        transform: translateX(-26px);
        opacity: 0.15;
    }

    20% {
        opacity: 1;
    }

    100% {
        transform: translateX(48px);
        opacity: 0.35;
    }
}

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

@media (max-width: 780px) {
    .page-shell {
        width: min(100% - 18px, 1000px);
        padding-top: 12px;
    }

    .site-header {
        top: 8px;
        border-radius: 18px;
        padding: 12px 14px;
    }

    .site-nav {
        gap: 6px;
    }

    .site-nav a {
        padding: 6px 10px;
        font-size: 0.88rem;
    }

    .hero-note-grid,
    .cards-grid,
    .link-grid,
    .formula-strip {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .section,
    .hero,
    .site-footer {
        padding: 20px 16px;
        border-radius: 24px;
    }

    .signal-strip {
        padding: 16px;
        border-radius: 24px;
    }

    .gravity-stage {
        min-height: 260px;
    }

    .ring-outer {
        width: 182px;
        height: 182px;
        top: 42px;
        right: 24px;
    }

    .ring-mid {
        width: 130px;
        height: 130px;
        top: 68px;
        right: 50px;
    }

    .ring-inner {
        width: 82px;
        height: 82px;
        top: 92px;
        right: 74px;
    }

    .gravity-core {
        width: 54px;
        height: 54px;
        top: 106px;
        right: 88px;
    }

    .stage-pill {
        font-size: 0.7rem;
    }
}