:root {
    --bg: #07080d;
    --bg-soft: #0c0e15;
    --ink: #eef1f6;
    --ink-soft: #a9b0bd;
    --ink-muted: #6b7280;
    --line: rgba(238, 241, 246, 0.09);
    --accent: #6fd3ff;
    --accent2: #b48bff;
    --gold: #e7c982;
    --hue: 205;
    --font-en: "Inter", sans-serif;
    --font-jp: "Noto Sans JP", sans-serif;
    --font-mincho: "Shippori Mincho B1", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-jp);
    line-height: 1.75;
    /* NOTE: overflow-x must NOT be hidden here — an overflow-hidden
       ancestor disables position:sticky for the pinned sections.
       `clip` clips without creating a scroll container. */
    overflow-x: clip;
}

html { overflow-x: clip; }

a { color: inherit; text-decoration: none; }
button { font: inherit; border: none; background: none; cursor: pointer; }

/* ===== Shader canvas ===== */
#shaderBg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    transition: opacity 0.35s linear;
}

/* ===== Progress rail ===== */
.progress-rail {
    position: fixed;
    top: 50%;
    left: 26px;
    transform: translateY(-50%);
    width: 2px;
    height: 180px;
    background: var(--line);
    border-radius: 2px;
    z-index: 30;
}

.progress-rail span {
    display: block;
    width: 100%;
    height: 0%;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--accent), var(--accent2));
    box-shadow: 0 0 12px rgba(111, 211, 255, 0.6);
}

/* ===== Header ===== */
.site-header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px clamp(18px, 3vw, 42px);
    transition: background 0.3s ease, backdrop-filter 0.3s ease;
}

.site-header.scrolled {
    background: rgba(7, 8, 13, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.brand {
    font-family: var(--font-en);
    font-weight: 900;
    letter-spacing: 0.34em;
    font-size: 1rem;
}

.site-nav { display: flex; align-items: center; gap: 28px; }

.site-nav a {
    font-family: var(--font-en);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    color: var(--ink-soft);
    transition: color 0.25s ease;
}

.site-nav a:hover { color: var(--ink); }

.nav-cta {
    border: 1px solid rgba(111, 211, 255, 0.5);
    color: var(--accent) !important;
    padding: 8px 18px;
    border-radius: 999px;
    transition: all 0.25s ease !important;
}

.nav-cta:hover {
    background: rgba(111, 211, 255, 0.12);
    box-shadow: 0 0 22px rgba(111, 211, 255, 0.25);
}

/* ===== Hero ===== */
.hero {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
}

.hero-inner {
    width: min(1180px, 92vw);
    margin: 0 auto;
}

.hero-kicker {
    font-family: var(--font-en);
    font-size: clamp(0.62rem, 1.2vw, 0.78rem);
    letter-spacing: 0.4em;
    color: var(--ink-muted);
    margin-bottom: 26px;
}

.hero-title {
    font-family: var(--font-en);
    font-weight: 900;
    line-height: 0.95;
    margin-bottom: 30px;
}

.hero-title .line {
    display: block;
    font-size: clamp(4.4rem, 15vw, 11.5rem);
    letter-spacing: -0.02em;
}

.hero-title i {
    font-style: normal;
    color: transparent;
    -webkit-text-stroke: 2px var(--ink);
}

.hero-title .sub {
    font-size: clamp(0.85rem, 2vw, 1.25rem);
    letter-spacing: 0.52em;
    color: var(--accent);
    margin-top: 14px;
    font-weight: 600;
}

.hero-copy {
    font-family: var(--font-mincho);
    font-size: clamp(1rem, 1.6vw, 1.2rem);
    color: var(--ink-soft);
    margin-bottom: 44px;
}

.scroll-cue {
    display: inline-flex;
    flex-direction: column;
    gap: 10px;
    font-family: var(--font-en);
    font-size: 0.66rem;
    letter-spacing: 0.4em;
    color: var(--ink-muted);
}

.scroll-cue span {
    width: 1px;
    height: 46px;
    background: linear-gradient(180deg, var(--accent), transparent);
    animation: cue-drop 1.9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    transform-origin: top;
}

@keyframes cue-drop {
    0%   { transform: scaleY(0); opacity: 0; }
    45%  { transform: scaleY(1); opacity: 1; }
    100% { transform: scaleY(1); opacity: 0; }
}

/* ===== Pin sections (scrollytelling) ===== */
.pin-section { position: relative; z-index: 1; }

.pin-stage {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
    display: grid;
    place-items: center;
}

.stage-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(90% 70% at 50% 115%, hsl(var(--hue) 60% 16% / 0.55), transparent 60%),
        radial-gradient(60% 46% at 78% 8%, rgba(180, 139, 255, 0.07), transparent 60%),
        var(--bg-soft);
}

.car-theater {
    width: min(1000px, 94vw);
    position: relative;
}

.car-svg { width: 100%; height: auto; display: block; }

.car-shadow { fill: rgba(0, 0, 0, 0.55); }

/* Fill layer */
.car-fill .body   { fill: url(#bodyGrad); opacity: var(--fill-a, 0); transition: opacity 0.15s linear; }
.car-fill .glass  { fill: url(#glassGrad); opacity: calc(var(--fill-a, 0) * 0.9); }
.car-fill .tail-bar { fill: #ff5470; opacity: var(--fill-a, 0); }
.car-fill .head-light { fill: #dff4ff; opacity: var(--fill-a, 0); }
.car-fill .door-line { fill: none; stroke: rgba(0, 0, 0, 0.28); stroke-width: 2; opacity: var(--fill-a, 0); }

/* Line-art layer draws on */
.car-lines path,
.car-lines circle {
    fill: none;
    stroke-width: 2;
    stroke-dasharray: var(--len, 1000);
    stroke-dashoffset: calc(var(--len, 1000) * (1 - var(--draw, 0)));
}

.car-lines .outline { stroke: url(#lineGrad); stroke-width: 2.4; filter: drop-shadow(0 0 6px rgba(140, 190, 255, 0.35)); }
.car-lines .glass-line, .car-lines .wheel-line { stroke: rgba(238, 241, 246, 0.65); }

/* Wheels */
.wheel .tire  { fill: #0b0d11; stroke: rgba(238, 241, 246, 0.14); stroke-width: 3; }
.wheel .rim   { fill: url(#rimGrad); }
.wheel .spokes rect { fill: #23262c; }
.wheel .hub   { fill: #e7c982; }

.spokes {
    transform-box: fill-box;
    transform-origin: center;
}

.car-svg.is-driving .spokes {
    animation: spin-wheels 0.9s linear infinite;
}

@keyframes spin-wheels {
    to { transform: rotate(360deg); }
}

/* Captions */
.captions { position: relative; margin-top: 8px; min-height: 150px; }

.caption {
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
    pointer-events: none;
}

.caption.is-active { opacity: 1; transform: translateY(0); }

.caption em {
    font-family: var(--font-en);
    font-style: normal;
    font-size: 0.68rem;
    letter-spacing: 0.36em;
    color: var(--accent);
}

.caption h2 {
    font-weight: 800;
    font-size: clamp(1.25rem, 2.6vw, 1.9rem);
    margin: 8px 0 6px;
}

.caption p { color: var(--ink-soft); max-width: 560px; font-size: 0.93rem; }

/* ===== Performance ===== */
.perf-section {
    position: relative;
    z-index: 1;
    padding: clamp(80px, 12vw, 150px) 0;
    background: linear-gradient(180deg, var(--bg-soft), var(--bg));
    scroll-margin-top: 60px;
}

.container { width: min(1080px, 92vw); margin: 0 auto; }

.kicker {
    font-family: var(--font-en);
    font-size: 0.68rem;
    letter-spacing: 0.36em;
    color: var(--accent);
    margin-bottom: 14px;
}

.perf-section h2 {
    font-weight: 900;
    font-size: clamp(1.9rem, 4vw, 2.8rem);
    margin-bottom: 46px;
}

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

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 24px 20px;
    transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1),
        border-color 0.35s ease, box-shadow 0.35s ease;
}

.stat-card:hover {
    transform: translateY(-6px);
    border-color: rgba(111, 211, 255, 0.35);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.4);
}

.mini-gauge { width: 110px; height: 64px; margin-bottom: 10px; }

.gauge-track {
    fill: none;
    stroke: rgba(238, 241, 246, 0.1);
    stroke-width: 7;
    stroke-linecap: round;
}

.gauge-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 7;
    stroke-linecap: round;
    filter: drop-shadow(0 0 6px rgba(111, 211, 255, 0.5));
    transition: stroke-dashoffset 1.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.stat-card strong {
    font-family: var(--font-en);
    font-weight: 900;
    font-size: 2.3rem;
    line-height: 1;
    display: block;
    font-variant-numeric: tabular-nums;
}

.stat-card strong small {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink-muted);
    margin-left: 5px;
}

.stat-label {
    display: block;
    margin-top: 6px;
    font-size: 0.74rem;
    letter-spacing: 0.1em;
    color: var(--ink-muted);
}

.charging-note {
    margin-top: 40px;
    display: flex;
    align-items: center;
    gap: 26px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 26px 32px;
}

.charge-ring { position: relative; width: 120px; height: 120px; flex-shrink: 0; }

.charge-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.ring-track {
    fill: none;
    stroke: rgba(238, 241, 246, 0.1);
    stroke-width: 9;
}

.ring-fill {
    fill: none;
    stroke: var(--accent2);
    stroke-width: 9;
    stroke-linecap: round;
    stroke-dasharray: 377;
    stroke-dashoffset: 377;
    filter: drop-shadow(0 0 8px rgba(180, 139, 255, 0.55));
    transition: stroke-dashoffset 2s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.charge-ring b {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    font-family: var(--font-en);
    font-weight: 900;
    font-size: 1.9rem;
}

.charge-ring b small { font-size: 0.8rem; color: var(--ink-muted); margin-left: 4px; }

.charging-note p { color: var(--ink-soft); }

/* ===== Colors section ===== */
.color-section { position: relative; z-index: 1; }

.color-stage {
    background:
        radial-gradient(80% 80% at 50% 120%, hsl(var(--hue) 65% 30% / 0.35), transparent 65%),
        var(--bg);
    text-align: center;
    grid-auto-rows: min-content;
    align-content: center;
    gap: 8px;
    transition: background 0.2s linear;
}

.color-name-wrap { display: grid; justify-items: center; gap: 4px; }

.color-index {
    font-family: var(--font-en);
    font-weight: 900;
    font-size: clamp(4rem, 10vw, 8rem);
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1.5px rgba(238, 241, 246, 0.22);
}

.color-name {
    font-family: var(--font-en);
    font-weight: 900;
    font-size: clamp(2rem, 5vw, 3.6rem);
    letter-spacing: 0.01em;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.color-name.swap { opacity: 0; transform: translateY(10px); }

.color-desc { color: var(--ink-soft); font-family: var(--font-mincho); }

.color-hint {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-en);
    font-size: 0.62rem;
    letter-spacing: 0.4em;
    color: var(--ink-muted);
}

/* ===== Reserve ===== */
.reserve-section {
    position: relative;
    z-index: 1;
    padding: clamp(90px, 13vw, 170px) 0;
    background:
        radial-gradient(60% 80% at 50% 130%, rgba(111, 211, 255, 0.14), transparent 60%),
        var(--bg);
    text-align: center;
    scroll-margin-top: 60px;
}

.reserve-inner { display: grid; justify-items: center; }

.reserve-section h2 {
    font-weight: 900;
    font-size: clamp(2rem, 4.4vw, 3rem);
    margin-bottom: 18px;
}

.reserve-copy { color: var(--ink-soft); margin-bottom: 36px; }

.reserve-btn {
    font-family: var(--font-en);
    font-weight: 700;
    letter-spacing: 0.12em;
    font-size: 0.95rem;
    color: #06131a;
    background: linear-gradient(94deg, var(--accent), #9be2ff);
    padding: 17px 44px;
    border-radius: 999px;
    box-shadow: 0 16px 44px rgba(111, 211, 255, 0.35);
    transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.25s ease;
}

.reserve-btn::after { content: " →"; transition: transform 0.3s ease; display: inline-block; }
.reserve-btn:hover::after { transform: translateX(5px); }

.reserve-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 22px 54px rgba(111, 211, 255, 0.45);
}

.reserve-note { margin-top: 18px; font-size: 0.76rem; color: var(--ink-muted); }

/* ===== Footer / reveal ===== */
.site-footer {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 26px clamp(18px, 3vw, 42px) 34px;
    border-top: 1px solid var(--line);
    font-size: 0.78rem;
    color: var(--ink-muted);
}

.site-footer a:hover { color: var(--accent); }

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

.stat-grid > .reveal:nth-child(2) { transition-delay: 0.1s; }
.stat-grid > .reveal:nth-child(3) { transition-delay: 0.2s; }
.stat-grid > .reveal:nth-child(4) { transition-delay: 0.3s; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .progress-rail { display: none; }
    .site-nav a:not(.nav-cta) { display: none; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .captions { min-height: 175px; }
}

@media (max-width: 760px) {
    /* Small screens: no sticky pinning — plain vertical flow so the car
       can never end up outside the viewport */
    #design,
    #colors {
        height: auto !important;
    }

    #design .pin-stage,
    .color-stage {
        position: relative;
        top: auto;
        height: auto;
        min-height: 0;
        padding: 44px 0 26px;
    }

    .car-theater {
        width: 96vw;
    }

    .captions {
        /* stacked, always visible — no scroll-gated swapping on mobile */
        position: static;
        display: grid;
        gap: 14px;
        margin-top: 20px;
        min-height: 0;
        padding: 0 4px;
    }

    .caption {
        position: static;
        opacity: 1 !important;
        transform: none !important;
    }

    .color-hint { display: none; }
}

@media (max-width: 560px) {
    html, body { max-width: 100vw; }

    img, svg { max-width: 100%; }

    .hero-inner,
    .container,
    .car-theater { max-width: 100%; }

    .hero { padding-top: 90px; }

    .hero-title .line:not(.sub) {
        font-size: clamp(3rem, 17vw, 5rem);
        letter-spacing: -0.01em;
    }

    .hero-title .sub {
        font-size: 0.92rem;
        letter-spacing: 0.3em;
        margin-top: 10px;
    }

    .hero-kicker { letter-spacing: 0.26em; font-size: 0.58rem; }

    .car-theater { width: 96vw; }

    .captions {
        padding: 0 4px;
        min-height: 215px;
    }

    .caption h2 { font-size: 1.1rem; }
    .caption p { font-size: 0.84rem; }

    .color-index { font-size: 3.2rem; }
    .color-name { font-size: 2rem; }
    .color-desc { font-size: 0.85rem; padding: 0 16px; }

    .perf-section h2 { font-size: 1.7rem; }

    .stat-card strong { font-size: 1.9rem; }

    .stat-grid { grid-template-columns: 1fr; }
    .charging-note { flex-direction: column; text-align: center; }

    .reserve-btn { font-size: 0.85rem; padding: 15px 32px; }

    .site-header { padding: 14px 18px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .scroll-cue span, .spokes { animation: none !important; }
    .gauge-fill, .ring-fill { transition: none; }
}

/* ===== v2: compare / share / sound ===== */
.perf-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 46px;
}

.perf-head h2 { margin-bottom: 0; }

.compare-btn {
    font-family: var(--font-en);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--accent);
    border: 1px solid rgba(111, 211, 255, 0.45);
    padding: 10px 20px;
    border-radius: 999px;
    transition: all 0.25s ease;
}

.compare-btn:hover {
    background: rgba(111, 211, 255, 0.12);
    box-shadow: 0 0 24px rgba(111, 211, 255, 0.25);
    transform: translateY(-2px);
}

.compare-dialog {
    border: 1px solid rgba(111, 211, 255, 0.3);
    border-radius: 22px;
    background: #0d1018;
    color: var(--ink);
    padding: 28px;
    width: min(560px, 92vw);
    box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6);
}

.compare-dialog::backdrop {
    background: rgba(4, 6, 10, 0.7);
    backdrop-filter: blur(6px);
}

.cd-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.cd-head h3 {
    font-family: var(--font-en);
    letter-spacing: 0.22em;
    font-size: 0.85rem;
    color: var(--accent);
}

.cd-close {
    font-size: 1.6rem;
    color: var(--ink-muted);
    line-height: 1;
}

.cd-close:hover { color: var(--ink); }

.cd-table { width: 100%; border-collapse: collapse; }

.cd-table th,
.cd-table td {
    padding: 11px 10px;
    text-align: left;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--line);
}

.cd-table thead th {
    font-family: var(--font-en);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    color: var(--ink-muted);
}

.cd-table tbody th { color: var(--ink-soft); font-weight: 500; }

.cd-table td {
    font-family: var(--font-en);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.cd-table td.win {
    color: var(--accent);
}

.cd-note {
    margin-top: 14px;
    font-size: 0.72rem;
    color: var(--ink-muted);
}

.share-btn {
    margin-top: 16px;
    font-size: 0.8rem;
    color: var(--ink-soft);
    border-bottom: 1px solid rgba(238, 241, 246, 0.3);
    padding-bottom: 2px;
    transition: color 0.25s ease, border-color 0.25s ease;
}

.share-btn:hover { color: var(--ink); border-color: var(--accent); }

.sound-toggle {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 60;
    font-family: var(--font-en);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--ink-muted);
    background: rgba(13, 16, 24, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid var(--line);
    padding: 11px 17px;
    border-radius: 999px;
    transition: all 0.3s ease;
}

.sound-toggle:hover { color: var(--ink); }

.sound-toggle.active {
    color: var(--green);
    border-color: rgba(62, 230, 160, 0.5);
    box-shadow: 0 0 26px rgba(62, 230, 160, 0.25);
}

.sound-toggle b { margin-left: 4px; }

.cc-toast {
    position: fixed;
    left: 50%;
    bottom: 70px;
    transform: translate(-50%, 14px);
    z-index: 100;
    background: rgba(13, 16, 24, 0.95);
    border: 1px solid rgba(111, 211, 255, 0.4);
    color: var(--ink);
    font-size: 0.82rem;
    padding: 11px 20px;
    border-radius: 999px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.cc-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===== v3: premium car detailing ===== */
.car-fill .d { opacity: var(--fill-a, 0); }

.car-reflect {
    opacity: calc(var(--fill-a, 0) * 0.16);
    filter: blur(1.5px);
}

.wheel .tire {
    fill: url(#tireRadial);
    stroke: rgba(238, 241, 246, 0.12);
    stroke-width: 2;
}

.wheel .tread {
    fill: none;
    stroke: rgba(238, 241, 246, 0.09);
    stroke-width: 7;
    stroke-dasharray: 4 9;
}

.wheel .rim-lip {
    fill: none;
    stroke: url(#chromeGrad);
    stroke-width: 3;
}

.wheel .disc {
    fill: #20242b;
    stroke: #3a3f47;
    stroke-width: 2;
}

.wheel .spokes path { fill: #d9dee5; }

.wheel .hub-v {
    font-family: "Inter", sans-serif;
    font-size: 7px;
    font-weight: 800;
    fill: #171a1f;
}

.wheel .caliper {
    fill: none;
    stroke: #e0483e;
    stroke-width: 6;
    stroke-linecap: round;
}

/* ===== 3D stage ===== */
#carGL {
    position: relative;
    width: 100%;
    height: clamp(300px, 52vw, 520px);
}

#carCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#carCanvas:active { cursor: grabbing; }

.gl-hint {
    position: absolute;
    left: 14px;
    bottom: 10px;
    font-family: var(--font-en);
    font-size: 0.62rem;
    letter-spacing: 0.3em;
    color: var(--ink-muted);
    pointer-events: none;
}

@media (max-width: 760px) {
    #carGL { height: 240px; }
}
