* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* LINE LIFF・通常ブラウザ問わず文字サイズ自動調整を無効化 */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

:root {
    --atlas-ink: #f8fbfb;
    --atlas-muted: rgba(248, 251, 251, 0.72);
    --atlas-deep: #0d1718;
    --atlas-panel: rgba(16, 29, 31, 0.72);
    --atlas-panel-strong: rgba(255, 255, 255, 0.9);
    --atlas-line: rgba(255, 255, 255, 0.18);
    --atlas-gold: #d1ac67;
    --atlas-teal: #4b7b83;
    --atlas-mist: #edf4f3;
    --atlas-shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
}

@font-face {
    font-family: "LINESeedJP";
    src: url('https://atlas-bracelet-gamma.vercel.app/res/fonts/LINESeedJP.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

body,
h1, h2, h3, h4, h5, h6,
div, p, ul, li,
input, button, select, option {
    font-family: "LINESeedJP", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif !important;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-size: 18px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* PC：コンテナが480px幅に収まるため文字が相対的に大きく見える → 小さめに */
@media (min-width: 801px) {
    html, body { font-size: 13px; }
    .msg                                               { font-size: 13px; }
    .result-section p                                  { font-size: 13px; }
    .result-section h3                                 { font-size: 13px; }
    .btn                                               { font-size: 13px; }
    .btn-toggle                                        { font-size: 12px; }
    .input-field label                                 { font-size: 12px; }
    .input-field input,
    .input-field textarea,
    .input-field select                                { font-size: 14px; }
    .progress-bar                                      { font-size: 11px; }
}

/* スマートフォン：標準サイズを少し大きめに */
@media (max-width: 800px) {
    html, body { font-size: 16px; }
    .msg                                               { font-size: 18px; }
    .result-section p                                  { font-size: 18px; }
    .result-section h3                                 { font-size: 16px; }
    .btn                                               { font-size: 16px; }
    .btn-toggle                                        { font-size: 15px; }
    .input-field label                                 { font-size: 15px; }
    .input-field input,
    .input-field textarea,
    .input-field select                                { font-size: 16px; }
    .progress-bar                                      { font-size: 12px; }
}

body {
    background:
        radial-gradient(circle at 16% 12%, rgba(209, 172, 103, 0.18), transparent 30%),
        radial-gradient(circle at 86% 22%, rgba(94, 120, 148, 0.18), transparent 34%),
        linear-gradient(160deg, #071012 0%, #132124 46%, #101719 100%);
    color: var(--atlas-ink);
    min-height: 100vh;
    min-height: 100dvh;
}

/* コンテナ */
.container {
    max-width: 480px;
    margin: auto;
    background:
        linear-gradient(180deg, rgba(5, 10, 11, 0.18), rgba(5, 10, 11, 0.82)),
        url("/res/img/hero-service-diagnosis.jpg") center / cover no-repeat;
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.52);
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: relative;
    isolation: isolate;
}

.container::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        linear-gradient(180deg, rgba(7, 14, 15, 0.24), rgba(7, 14, 15, 0.88) 56%, rgba(7, 14, 15, 0.94)),
        radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.16), transparent 28%);
    pointer-events: none;
}

/* チャット */
.chat-box {
    flex: 1;
    padding: 16px 14px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 4px;
    z-index: 2;
    -webkit-overflow-scrolling: touch;
}

/* メッセージ */
.msg {
    position: relative;
    padding: 16px 17px;
    background: rgba(247, 250, 249, 0.92);
    color: #1f2527;
    backdrop-filter: blur(12px);
    border-radius: 8px;
    max-width: 92%;
    line-height: 1.82;
    font-size: 16px;
    border: 1px solid rgba(255, 255, 255, 0.52);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
    animation: messageIn 360ms ease both;
}

/* 診断メッセージ */
.msg.bot {
    border-left: 3px solid var(--atlas-gold);
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.22),
        0 0 26px rgba(209, 172, 103, 0.16);
    line-height: 1.7;
}

.msg.bot:has(.result-section) {
    width: 100%;
    max-width: 100%;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

/* ユーザー */
.msg.user {
    border-radius: 8px;
    align-self: flex-end;
    background: linear-gradient(135deg, #e8f0ef, #ffffff);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.16),
        0 0 18px rgba(75, 123, 131, 0.16);
}

.result-section p strong,
.msg.bot strong,
.msg.user strong {
    font-weight: 800;
    color: #285760;
}

/* 入力エリア - スクロール可能に */
.input-area {
    padding: 14px 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    background:
        linear-gradient(180deg, rgba(13, 23, 24, 0.68), rgba(13, 23, 24, 0.92)),
        rgba(13, 23, 24, 0.86);
    color: var(--atlas-ink);
    backdrop-filter: blur(18px);
    z-index: 3;
    max-height: 55vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
}

/* 入力 */
.input-field {
    margin-bottom: 10px;
}

.input-field label {
    font-size: 14px;
    color: rgba(248, 251, 251, 0.88);
    margin-bottom: 6px;
    display: block;
    font-weight: 700;
}

.field-note {
    margin-top: 6px;
    color: rgba(248, 251, 251, 0.58);
    font-size: 12px;
    line-height: 1.6;
}

.input-field input,
.input-field textarea,
.input-field select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.62);
    color: #1f2527;
    font-size: 17px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

textarea {
    resize: vertical;
}

/* メインボタン */
.btn {
    width: 100%;
    padding: 14px 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff, #edf4f3);
    color: #172123;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.20);
    margin-bottom: 8px;
    transition: all .15s ease;
    border: 1px solid rgba(255, 255, 255, 0.7);
}

/* hover */
.btn:hover {
    background: linear-gradient(135deg, #ffffff, #e5efee);
    color: #172123;
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.26);
}

/* サブボタン */
.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(248, 251, 251, 0.92);
    border-color: rgba(255, 255, 255, 0.24);
    font-weight: 700;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.42);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.btn-mode {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 76px;
    text-align: left;
}

.btn-primary-choice {
    position: relative;
    border-color: rgba(209, 172, 103, 0.72);
    box-shadow:
        0 14px 34px rgba(0, 0, 0, 0.24),
        0 0 0 1px rgba(209, 172, 103, 0.18);
}

.btn-mode__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 50%;
    color: var(--atlas-gold);
    background: rgba(13, 23, 24, 0.08);
    border: 1px solid rgba(209, 172, 103, 0.36);
}

.btn-mode strong,
.btn-mode small {
    display: block;
}

.btn-mode__badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-bottom: 5px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(209, 172, 103, 0.18);
    color: #8c6727;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
    line-height: 1;
}

.btn-mode small {
    margin-top: 4px;
    color: rgba(23, 33, 35, 0.68);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
}

.btn-mode.btn-secondary small {
    color: rgba(248, 251, 251, 0.68);
}

/* 選択チップ */
.btn-toggle {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #1f2527;
    font-size: 14px;
    cursor: pointer;
    transition: all .15s ease;
    margin: 4px;
    border: 1px solid rgba(255, 255, 255, 0.68);
}

/* hover */
.btn-toggle:hover {
    background: #fff;
}

/* 選択状態 */
.btn-toggle.active {
    background: linear-gradient(135deg, #285760, #4b7b83);
    border-color: rgba(209, 172, 103, 0.48);
    color: #fff;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

/* 結果カード */
.result-section {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(237, 244, 243, 0.92)),
        radial-gradient(circle at 18% 12%, rgba(209, 172, 103, 0.14), transparent 28%);
    border-radius: 8px;
    box-shadow: var(--atlas-shadow);
    border: 1px solid rgba(255, 255, 255, 0.72);
    padding: 16px 17px;
}

.result-section h3 {
    letter-spacing: 0;
    color: #172123;
    margin-bottom: 10px;
    font-size: 15px;
    border-bottom: 1px solid rgba(36, 45, 54, 0.12);
    padding-bottom: 8px;
}

.result-section p {
    font-size: 16px;
    line-height: 1.9;
    color: #222;
}

.result-section img {
    width: 100%;
    border-radius: 8px;
    margin: 10px 0;
}

/* 石の発表: 一致率バッジ */
.match-score {
    margin: 4px 0 14px;
}

.match-score__label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
    font-size: 13px;
    color: #555;
}

.match-score__pct {
    font-size: 20px;
    font-weight: 700;
    color: #a97a2e;
}

.match-score__bar {
    height: 8px;
    border-radius: 6px;
    background: rgba(36, 45, 54, 0.1);
    overflow: hidden;
}

.match-score__fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #b8860b, #d1ac67);
    transition: width 1s ease;
}

/* 石の発表: 「なぜこの石か」の一文 */
.result-section p.why-this-stone {
    margin-top: 4px;
    padding: 12px 14px;
    border-left: 3px solid var(--atlas-gold);
    background: rgba(209, 172, 103, 0.12);
    border-radius: 0 8px 8px 0;
    font-weight: 700;
    font-size: 15px;
    line-height: 1.8;
    color: #1c2427;
}

/* ローディング */
.loading {
    text-align: center;
    padding: 24px 10px;
    color: var(--atlas-ink);
}

.loading-card {
    display: grid;
    gap: 5px;
    padding: 15px 16px;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(237, 244, 243, 0.9)),
        rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.7);
    color: #172123;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.loading-card__eyebrow {
    color: var(--atlas-gold);
    font-size: 12px;
    font-weight: 800;
}

.loading-card strong {
    font-size: 17px;
    line-height: 1.45;
}

.loading-card small {
    color: rgba(23, 33, 35, 0.64);
    font-size: 12px;
    font-weight: 700;
}

.spinner {
    width: 46px;
    height: 46px;
    border: 3px solid rgba(255, 255, 255, 0.22);
    border-top-color: var(--atlas-gold);
    border-right-color: rgba(255, 255, 255, 0.52);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: auto;
}

.reading-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 14px;
}

.reading-steps span {
    padding: 7px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(248, 251, 251, 0.78);
    font-size: 11px;
}

.flatpickr-calendar {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #ddd;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    color: #222;
}

.flatpickr-day.selected {
    background: #3b6892;
    color: white;
}

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

#starfield {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

/* ロゴオーバーレイ */
.logo-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(237, 244, 243, 0.92)),
        #fff;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.2s ease;
}

.logo-overlay__card {
    width: min(78%, 340px);
    padding: 24px 18px;
    border-radius: 8px;
    text-align: center;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.88);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
}

.logo-image {
    max-width: 86%;
    height: auto;
}

.logo-overlay__lead {
    margin-top: 14px;
    color: #172123;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.5;
}

.logo-overlay__note {
    margin-top: 5px;
    color: rgba(23, 33, 35, 0.66);
    font-size: 12px;
    font-weight: 700;
}

/* フェードイン用 */
.fade-in {
    opacity: 1 !important;
}

.fortune-girl {
    opacity: 0;
    transition: opacity 1.2s ease;
    position: absolute;
    inset: 0;
    background-image: linear-gradient(180deg, rgba(7, 14, 15, 0), rgba(7, 14, 15, 0.82)), url("/res/img/hero-service-diagnosis.jpg");
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: cover;
    pointer-events: none;
    z-index: 1;
    filter: saturate(0.96) contrast(1.04);
}

.progress-bar {
    padding: 9px 14px;
    font-size: 12px;
    text-align: center;
    background: rgba(7, 14, 15, 0.76);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(248, 251, 251, 0.78);
    letter-spacing: 0;
    z-index: 4;
    backdrop-filter: blur(16px);
}

.welcome-panel {
    padding: 16px;
    margin-bottom: 10px;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(237, 244, 243, 0.9)),
        rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
    color: #172123;
}

.welcome-panel__eyebrow {
    margin-bottom: 6px;
    color: var(--atlas-gold);
    font-size: 12px;
    font-weight: 800;
}

.welcome-panel h1 {
    font-size: 20px;
    line-height: 1.45;
    font-weight: 800;
}

.welcome-panel__lead {
    margin-top: 8px;
    color: rgba(23, 33, 35, 0.72);
    font-size: 13px;
    line-height: 1.65;
}

.trust-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.trust-strip span {
    padding: 6px 9px;
    border-radius: 999px;
    background: rgba(40, 87, 96, 0.08);
    color: #285760;
    font-size: 12px;
    font-weight: 800;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* セクション画像のフェードイン */
.section-image {
    width: 100%;
    border-radius: 12px;
    margin: 8px 0;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.section-image.loaded {
    opacity: 1;
}
