/**
 * Pepe Beauty Labs - 16タイプ肌質チェック
 * Stylesheet (Mobile First / Dark Lab Theme)
 *
 * 配色の考え方: 白背景だとどうしても「よくある診断ページ」に見えるため、
 * 設計書のトーン(白・黒・シルバー / 科学的でミニマル)を暗い側に振っている。
 * 地色は純黒ではなく青に寄せたネイビーで、アクセントの水色と地続きにする。
 */

:root {
    --bg: #070C16;
    /* 地色。純黒を避け、わずかに青へ寄せたネイビー */
    --bg-elev: #0E1626;
    --surface: #131D30;
    --surface-2: #1A2740;
    --border: rgba(148, 176, 214, 0.14);
    --border-strong: rgba(148, 176, 214, 0.30);
    --text: #E9EFF8;
    --text-muted: #8A9BB5;
    --accent: #38BDF8;
    /* Scientific Blue（従来から継続） */
    --accent-deep: #0EA5E9;
    --accent-warm: #FBBF24;
    /* 色素・シワ側を示す暖色 */
    --success: #34D399;
    --transition-speed: 0.3s;

    --font-latin: 'Inter', system-ui, sans-serif;
    /* 日本語は端末標準を使う。Webフォントを読ませないための指定 */
    --font-ja: 'Inter', -apple-system, BlinkMacSystemFont, 'Hiragino Sans',
        'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Yu Gothic UI', Meiryo, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-ja);
}

html {
    background-color: var(--bg);
}

body {
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* --- Layout --- */
#app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--bg);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

header {
    text-align: center;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border);
    background-color: rgba(7, 12, 22, 0.85);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.logo {
    font-family: var(--font-latin);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.08em;
    color: var(--text);
}

/* --- Screens & Transitions --- */
.screen {
    flex: 1;
    display: none;
    padding: 1.75rem 1.5rem 2.5rem;
    flex-direction: column;
    animation: fadeIn 0.4s ease-out;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Start Screen --- */
/* 極細のグリッド線と2つの光源をCSSだけで重ねて「ラボ感」を作る。
   画像を1枚も増やさずに密度を出すのが狙い。 */
#screen-start {
    padding-top: 1.5rem;
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 15% 0%, rgba(56, 189, 248, 0.16), transparent 45%),
        radial-gradient(circle at 90% 30%, rgba(99, 102, 241, 0.12), transparent 40%),
        linear-gradient(rgba(148, 176, 214, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 176, 214, 0.045) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
}

/* ファーストビューに CTA まで必ず収める。
   離脱の大半はここで起きるため、ボタンを折り返しの下に落とさない。 */
.hero {
    min-height: calc(100dvh - 3.4rem - 4rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.9rem;
    text-align: center;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    align-self: center;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--accent);
    background-color: rgba(56, 189, 248, 0.10);
    border: 1px solid rgba(56, 189, 248, 0.28);
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
}

.eyebrow-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    animation: blink 2.4s ease-in-out infinite;
}

.hero h1 {
    font-size: clamp(1.6rem, 7.5vw, 2rem);
    line-height: 1.35;
    letter-spacing: -0.02em;
    text-wrap: balance;
    color: var(--text);
}

.accent-text {
    color: var(--accent);
}

.hero-lead {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.75;
}

/* 一番言いたい一文だけ独立させて、色と太さで持ち上げる */
.hero-lead-strong {
    color: var(--text);
    font-weight: 600;
    margin-top: -0.35rem;
}

/* 16タイプのチップ。斜めに光の波が走る */
.type-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin: 0.35rem 0;
}

.type-chip {
    font-family: var(--font-latin);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background-color: rgba(19, 29, 48, 0.7);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 0.5rem 0;
    animation: chipWave 5.5s ease-in-out infinite;
}

@keyframes chipWave {

    0%,
    70%,
    100% {
        color: var(--text-muted);
        border-color: var(--border);
        background-color: rgba(19, 29, 48, 0.7);
    }

    12% {
        color: var(--accent);
        border-color: rgba(56, 189, 248, 0.55);
        background-color: rgba(56, 189, 248, 0.12);
    }
}

/* 誰が作ったのかを最初の画面で見せる。診断は信頼が価値の源泉になるため */
.credential {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
    background-color: rgba(19, 29, 48, 0.75);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.7rem 0.9rem;
}

.credential picture {
    flex: none;
    display: block;
    line-height: 0;
}

.credential-avatar {
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 10%;
    border: 1px solid var(--border-strong);
    background-color: var(--surface-2);
}

.credential-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.credential-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
}

.credential-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.meta-info {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    list-style: none;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.meta-info li {
    background-color: rgba(19, 29, 48, 0.8);
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border);
}

/* 縦の短い端末(iPhone SE など)でも、CTAを必ずファーストビュー内に収める。
   離脱の大半はここで起きるので、ボタンが折り返しの下に落ちる状態を作らない。 */
@media (max-height: 740px) {
    #screen-start {
        padding-top: 1rem;
    }

    .hero {
        gap: 0.6rem;
    }

    .hero h1 {
        font-size: clamp(1.35rem, 6.5vw, 1.7rem);
    }

    .hero-lead {
        font-size: 0.78rem;
        line-height: 1.65;
    }

    .type-chip {
        font-size: 0.6rem;
        padding: 0.36rem 0;
    }

    .credential {
        padding: 0.55rem 0.75rem;
    }

    .credential-avatar {
        width: 38px;
        height: 38px;
    }

    .btn-primary {
        padding: 0.9rem;
        font-size: 1rem;
    }
}

/* --- Below the fold --- */
.below-fold {
    padding-top: 3rem;
}

.section-title {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 1.1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}

.value-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.value-list li {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.15rem 0.75rem;
}

.value-num {
    font-family: var(--font-latin);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    grid-row: span 2;
    padding-top: 0.15rem;
}

.value-head {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}

.value-body {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.below-fold-note {
    margin-top: 2rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* --- Buttons --- */
button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    outline: none;
    transition: all var(--transition-speed) ease;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.btn-primary {
    width: 100%;
    padding: 1.05rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
    color: #04121C;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.28);
}

.btn-primary:hover,
.btn-primary:active {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(56, 189, 248, 0.38);
}

.btn-secondary {
    width: 100%;
    padding: 1rem;
    background-color: transparent;
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
    background-color: var(--surface);
}

.btn-text {
    background: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem;
}

.btn-text:hover {
    color: var(--text);
}

/* ヒーローのボタンが画面外へ出たら下から現れる常時CTA */
.sticky-cta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    padding: 0.75rem 1.5rem calc(0.75rem + env(safe-area-inset-bottom));
    background-color: rgba(7, 12, 22, 0.92);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    transform: translateY(110%);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.sticky-cta>.btn-primary {
    max-width: 480px;
    margin: 0 auto;
    display: block;
    padding: 0.9rem;
    font-size: 1rem;
}

.sticky-cta.is-visible {
    transform: translateY(0);
}

/* --- Question Screen --- */
/* パートごとに背景の色味を変える。同じ画面が16回続くと進んでいる感覚が薄れるため、
   軸が切り替わったことを色で伝えて、残りの見通しを持たせる。 */
#screen-question {
    --part-hue: 199;
    /* パート1: 水色（水分・皮脂） */
    background-image:
        radial-gradient(circle at 50% -10%,
            hsla(var(--part-hue), 90%, 60%, 0.16), transparent 55%);
    transition: background-image 0.6s ease;
}

#screen-question[data-part="SR"] {
    --part-hue: 340;
    /* パート2: 赤（炎症・敏感） */
}

#screen-question[data-part="NP"] {
    --part-hue: 38;
    /* パート3: 琥珀（メラニン） */
}

#screen-question[data-part="TW"] {
    --part-hue: 265;
    /* パート4: 紫（光老化・ハリ） */
}

.progress-container {
    margin-bottom: 2rem;
}

.progress-text {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

/* 4問ごとに何を測っているのかを見せる。残りの見通しが立つと離脱が減る */
.section-label {
    color: hsl(var(--part-hue), 85%, 68%);
    font-weight: 600;
    transition: color 0.6s ease;
}

.progress-count {
    font-family: var(--font-latin);
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.05em;
    font-variant-numeric: tabular-nums;
}

.progress-bar-bg {
    width: 100%;
    height: 5px;
    background-color: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg,
            hsl(var(--part-hue), 80%, 45%),
            hsl(var(--part-hue), 90%, 62%));
    width: 0%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.6s ease;
}

.question-container {
    flex: 1;
}

#question-text {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 1.75rem;
    line-height: 1.55;
    text-wrap: balance;
    color: var(--text);
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.option-btn {
    width: 100%;
    text-align: left;
    padding: 1.1rem 1rem;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.55;
    position: relative;
}

.option-btn:hover,
.option-btn:focus {
    border-color: var(--border-strong);
    background-color: var(--surface-2);
}

.option-btn.selected {
    border-color: hsl(var(--part-hue), 85%, 62%);
    background-color: hsla(var(--part-hue), 85%, 62%, 0.16);
    color: var(--text);
}

.actions {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-start;
}

.hidden {
    visibility: hidden;
    opacity: 0;
}

/* --- Analyzing Screen --- */
/* 計算自体は一瞬で終わるが、結果の前に「タメ」を作るための演出画面。 */
#screen-analyzing {
    justify-content: center;
    background-image:
        radial-gradient(circle at 50% 35%, rgba(56, 189, 248, 0.14), transparent 55%);
}

.analyzing-wrap {
    text-align: center;
    width: 100%;
}

.analyzing-ring-wrap {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 1.75rem;
}

.analyzing-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.analyzing-ring circle {
    fill: none;
    stroke-width: 6;
    stroke-linecap: round;
}

.ring-bg {
    stroke: var(--surface-2);
}

.ring-fg {
    stroke: var(--accent);
    /* 2 * π * r(52) ≒ 326.7 */
    stroke-dasharray: 327;
    stroke-dashoffset: 327;
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.6));
    animation: ringFill 2.65s cubic-bezier(0.45, 0, 0.15, 1) forwards;
}

@keyframes ringFill {
    to {
        stroke-dashoffset: 0;
    }
}

.analyzing-percent {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 数字とパーセント記号は、内側のグループでベースラインを揃えてから
   まとめて円の中央に置く。外側で揃えると記号だけが円周まで落ちる。 */
.percent-group {
    display: flex;
    align-items: baseline;
    gap: 0.06em;
    font-family: var(--font-latin);
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.percent-group small {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0;
}

.analyzing-title {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 1.75rem;
}

.analyzing-log {
    list-style: none;
    text-align: left;
    max-width: 300px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.log-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.88rem;
    color: var(--text-muted);
    opacity: 0.35;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.log-item.is-active,
.log-item.is-done {
    opacity: 1;
}

.log-item.is-done {
    color: var(--text);
}

.log-icon {
    width: 18px;
    height: 18px;
    flex: none;
    border-radius: 50%;
    border: 2px solid var(--surface-2);
    position: relative;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

/* 実行中はリングがくるくる回る */
.log-item.is-active .log-icon {
    border-color: var(--surface-2);
    border-top-color: var(--accent);
    animation: spin 0.7s linear infinite;
}

.log-item.is-done .log-icon {
    border-color: var(--success);
    background-color: var(--success);
    animation: none;
}

.log-item.is-done .log-icon::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #04121C;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.analyzing-skip {
    margin-top: 2.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    animation: blink 1.8s ease-in-out infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }
}

/* --- Result Screen --- */
/* 上から順に浮かび上がらせる。タイプ名が確定してから
   スコアバー、解説、商品カードの順に出すことで視線を誘導する。 */
#screen-result.is-revealed>* {
    opacity: 0;
    animation: revealUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

#screen-result.is-revealed>*:nth-child(1) {
    animation-delay: 0.05s;
}

#screen-result.is-revealed>*:nth-child(2) {
    animation-delay: 0.70s;
}

#screen-result.is-revealed>*:nth-child(3) {
    animation-delay: 0.85s;
}

#screen-result.is-revealed>*:nth-child(4) {
    animation-delay: 1.00s;
}

#screen-result.is-revealed>*:nth-child(5) {
    animation-delay: 1.15s;
}

#screen-result.is-revealed>*:nth-child(6) {
    animation-delay: 1.30s;
}

#screen-result.is-revealed>*:nth-child(7) {
    animation-delay: 1.45s;
}

#screen-result.is-revealed>*:nth-child(8) {
    animation-delay: 1.60s;
}

/* 成分は1項目ずつ送り出す。読ませたい順に視線を運ぶため */
#screen-result.is-revealed .ingredient-item {
    opacity: 0;
    animation: revealUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

#screen-result.is-revealed .ingredient-item:nth-child(1) {
    animation-delay: 1.15s;
}

#screen-result.is-revealed .ingredient-item:nth-child(2) {
    animation-delay: 1.24s;
}

#screen-result.is-revealed .ingredient-item:nth-child(3) {
    animation-delay: 1.33s;
}

#screen-result.is-revealed .ingredient-item:nth-child(4) {
    animation-delay: 1.42s;
}

@keyframes revealUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem 0.5rem 1.75rem;
    position: relative;
}

/* タイプ名の背後に光を置いて、結果画面の頂点をはっきりさせる */
.result-header::before {
    content: "";
    position: absolute;
    inset: -1rem -1.5rem auto;
    height: 220px;
    background: radial-gradient(ellipse at 50% 40%, rgba(56, 189, 248, 0.22), transparent 65%);
    pointer-events: none;
    z-index: -1;
}

.result-header label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.1em;
}

/* 日本語のタイプ名を主役にする。4文字コードは型番として下に小さく添える */
.result-title {
    font-size: clamp(1.5rem, 7vw, 1.9rem);
    line-height: 1.35;
    letter-spacing: -0.02em;
    text-wrap: balance;
    color: var(--text);
    margin: 0.5rem 0 0.85rem;
}

.result-code {
    display: inline-flex;
    gap: 0.12em;
    font-family: var(--font-latin);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: var(--accent);
    background-color: rgba(56, 189, 248, 0.10);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 999px;
    padding: 0.3rem 0.9rem 0.3rem 1.05rem;
}

/* 4文字を1文字ずつカチッと確定させる */
.result-code .code-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(10px) scale(0.6);
    animation: letterPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes letterPop {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 解説を読みたい人と、商品だけ見たい人を分岐させる。
   読ませたい気持ちで距離を伸ばすと、買う気のある人まで落としてしまう。 */
.jump-products {
    display: inline-block;
    margin-top: 1rem;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    background-color: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 0.5rem 1.1rem;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.jump-products:hover {
    border-color: var(--accent);
    background-color: var(--surface-2);
}

/* 飛んだ先が見出しの真下に来るように、ヘッダーのぶん余白をとる */
.routine-card {
    scroll-margin-top: 4.5rem;
}

.result-card {
    background-color: var(--surface);
    border-radius: 14px;
    padding: 1.4rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
}

.result-card h3 {
    font-size: 1rem;
    margin-bottom: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.7rem;
    color: var(--text);
}

.result-desc {
    font-size: 0.9rem;
    line-height: 1.85;
    color: var(--text);
}

.result-desc strong {
    color: var(--accent);
}

/* --- 4軸スコアバー --- */
/* 判定文字だけだと「なぜ自分がDなのか」が伝わらないので、
   軸ごとの位置を見せて納得感を作る。中央付近なら注記も出す。 */
.axis-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.axis-labels {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.axis-side {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    transition: color 0.3s ease;
}

.axis-side.is-active {
    color: var(--text);
    font-weight: 800;
}

.axis-name {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: center;
    flex: 1;
}

.axis-track {
    position: relative;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg,
            rgba(56, 189, 248, 0.35) 0%,
            var(--surface-2) 50%,
            rgba(251, 191, 36, 0.35) 100%);
}

.axis-tick {
    position: absolute;
    left: 50%;
    top: -3px;
    bottom: -3px;
    width: 2px;
    background-color: var(--border-strong);
    transform: translateX(-50%);
}

.axis-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: var(--text);
    border: 3px solid var(--surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transform: translate(-50%, -50%);
    transition: left 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 中央付近＝どちらの性質も持つ軸は色を変えて区別する */
.axis-dot.is-borderline {
    background-color: var(--accent);
}

.axis-note {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-top: 1.25rem;
}

.axis-note:empty {
    margin-top: 0;
}

/* --- 成分 --- */
.ingredients-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

/* 成分カード。読み物として成立させたいので、見出しと本文の階層をはっきりさせる。
   すべてを開いたままにすると長くなりすぎるので、選び方と注意点は折りたたむ。 */
.ingredient-item {
    background-color: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem 0.9rem;
}

.ing-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.45rem;
}

.ingredient-item h4 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
}

.ingredient-item h4::before {
    content: "💡";
    margin-right: 0.45rem;
}

.ing-badges {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.ing-badge {
    font-size: 0.63rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    white-space: nowrap;
}

.ing-role {
    color: var(--accent);
    background-color: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.ing-quasi {
    color: var(--success);
    background-color: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.32);
}

/* そのタイプでの位置づけ。ここだけは必ず読ませたいので目立たせる */
.ing-why {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.75;
    border-left: 3px solid var(--accent);
    padding: 0 0 0 0.65rem;
}

.ing-block {
    margin-bottom: 0.8rem;
}

.ing-block:last-child {
    margin-bottom: 0;
}

.ing-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}

.ingredient-item p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.9;
}

.ing-aka {
    font-size: 0.75rem !important;
    color: var(--text-muted);
    background-color: var(--surface);
    border-radius: 6px;
    padding: 0.5rem 0.65rem;
}

.ing-more {
    margin-top: 0.6rem;
}

/* 畳んでいる間は区切り線を出さない。開いたときだけ本文と分ける */
.ing-more[open] {
    border-top: 1px solid var(--border);
    padding-top: 0.8rem;
}

.ing-more summary {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent);
    cursor: pointer;
    list-style: none;
    padding: 0.2rem 0;
}

.ing-more summary::-webkit-details-marker {
    display: none;
}

.ing-more summary::before {
    content: "＋ ";
    font-weight: 700;
}

.ing-more[open] summary::before {
    content: "− ";
}

.ing-more[open] summary {
    margin-bottom: 0.8rem;
}

.ing-caution .ing-label {
    color: var(--accent-warm);
}

.ing-caution p {
    background-color: rgba(251, 191, 36, 0.07);
    border-left: 3px solid rgba(251, 191, 36, 0.5);
    border-radius: 6px;
    padding: 0.6rem 0.7rem;
}

/* 成分の話と、下のおすすめ商品をつなぐ一行。ここが無いと読み物で終わる */
.ing-link {
    margin-top: 0.6rem;
    font-size: 0.75rem !important;
    color: var(--text) !important;
    background-color: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.28);
    border-radius: 8px;
    padding: 0.45rem 0.6rem;
    line-height: 1.65 !important;
}

.ing-link b {
    color: var(--success);
}

/* --- 商品カード --- */
.routine-meta-text {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
    line-height: 1.75;
}

/* ステマ規制と各アフィリエイトプログラムの規約にあわせた広告表記 */
.ad-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.6;
    background-color: var(--bg-elev);
    border: 1px dashed var(--border-strong);
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    margin-bottom: 1.2rem;
}

.recommendation-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* --- カテゴリのまとまり --- */
/* 洗顔と化粧水が同じ見た目で縦に並ぶと、どこまでが同じカテゴリか読み取れない。
   枠と見出しでひとまとまりにして、選ぶ単位をはっきりさせる。 */
.product-group {
    border: 1px solid var(--border);
    border-radius: 14px;
    background-color: rgba(7, 12, 22, 0.5);
    overflow: hidden;
}

.product-group-head {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.7rem 0.9rem;
    background-color: rgba(56, 189, 248, 0.09);
    border-bottom: 1px solid var(--border);
}

.product-group-name {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 0.02em;
}

.product-group-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
}

.product-group-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.7rem;
}

.product-price {
    display: block;
    font-family: var(--font-latin);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-variant-numeric: tabular-nums;
}

.product-card {
    background-color: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    border-color: var(--border-strong);
}

/* カード自体も1枚ずつ順に出す */
#screen-result.is-revealed .product-card {
    opacity: 0;
    animation: revealUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: calc(1.35s + var(--i) * 0.09s);
}

.product-head {
    display: flex;
    align-items: center;
}

/* 商品画像は白背景のものが多いため、暗い地に沈まないよう白いタイルに載せる */
.product-img {
    width: 58px;
    height: 58px;
    border-radius: 8px;
    object-fit: contain;
    background-color: #FFFFFF;
    padding: 4px;
    margin-right: 0.9rem;
    flex: none;
}

.product-img-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-2);
    font-size: 1.5rem;
    padding: 0;
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-step {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.06em;
    display: block;
    margin-bottom: 0.25rem;
}

.product-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    display: block;
    line-height: 1.45;
}

.product-note {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    line-height: 1.6;
}

/* AmazonとRakutenを並べる。人によって使うモールが違うので取りこぼさない */
.product-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.product-links:has(> :only-child) {
    grid-template-columns: 1fr;
}

.shop-btn {
    display: block;
    text-align: center;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.6rem 0.4rem;
    border-radius: 8px;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.shop-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

.shop-amazon {
    background-color: #FF9900;
    color: #1A1A1A;
}

.shop-rakuten {
    background-color: #BF0000;
    color: #FFFFFF;
}

.product-pending {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 0.5rem;
}

/* --- シェア --- */
.share-card {
    background: linear-gradient(150deg, rgba(56, 189, 248, 0.14), rgba(19, 29, 48, 0.9) 65%);
    border-color: rgba(56, 189, 248, 0.3);
    text-align: center;
}

.share-card h3 {
    justify-content: center;
}

.share-lead {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 1.2rem;
}

.btn-share {
    width: 100%;
    padding: 0.95rem;
    background-color: var(--text);
    color: #04121C;
    font-size: 0.98rem;
    font-weight: 700;
    border-radius: 10px;
}

.btn-share:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(233, 239, 248, 0.18);
}

.share-done {
    font-size: 0.78rem;
    color: var(--accent);
    margin-top: 0.75rem;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.share-done.is-visible {
    opacity: 1;
}

.btn-image {
    margin-top: 0.6rem;
}

/* --- 生成した結果画像 --- */
.image-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(4, 8, 15, 0.9);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    overflow-y: auto;
}

.image-modal[hidden] {
    display: none;
}

.image-modal-inner {
    width: 100%;
    max-width: 340px;
    text-align: center;
}

.image-modal-lead {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 0.9rem;
}

.result-image {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border-strong);
    display: block;
    margin-bottom: 1rem;
}

/* --- 途中復帰の案内 --- */
.resume-banner {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.4rem;
}

.resume-banner[hidden] {
    display: none;
}

.resume-text {
    font-size: 0.82rem;
    color: var(--text);
    margin-bottom: 0.6rem;
}

.resume-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-resume {
    flex: 1;
    background-color: var(--accent);
    color: #04121C;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.55rem;
    border-radius: 8px;
}

.footer-links {
    margin-top: 0.75rem;
    font-size: 0.7rem;
}

.footer-links a {
    color: var(--text-muted);
}

.result-actions {
    margin-top: 1rem;
    margin-bottom: 2rem;
}

footer {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.disclaimer {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* --- 規約・ポリシーページ --- */
.doc-page {
    line-height: 1.9;
}

.doc-title {
    font-size: 1.35rem;
    letter-spacing: -0.02em;
    margin-bottom: 0.4rem;
}

.doc-updated {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.doc-page h2 {
    font-size: 0.98rem;
    color: var(--accent);
    margin: 2rem 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.doc-page p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.9rem;
}

.doc-page strong {
    color: var(--text);
}

.doc-note {
    font-size: 0.75rem !important;
    background-color: var(--surface);
    border-left: 3px solid var(--border-strong);
    border-radius: 6px;
    padding: 0.7rem 0.85rem;
}

.doc-back {
    margin-top: 2.5rem;
}

.doc-back-btn {
    display: block;
    text-align: center;
    text-decoration: none;
    padding: 0.9rem;
}

/* --- アクセシビリティ --- */
/* 端末側で「視差効果を減らす」を有効にしている人には演出を出さない。
   乗り物酔いや前庭障害への配慮で、iOS/Androidの標準設定から拾える。 */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    #screen-result.is-revealed>* {
        opacity: 1;
    }

    .result-code .code-letter {
        opacity: 1;
        transform: none;
    }
}
