
/* ==========================================
   水晶占い
========================================== */

.crystal-fortune {
    max-width: 900px;
    margin: 25px auto;
    padding: 25px 18px;
    color: #eee8f5;

    background:
        radial-gradient(ellipse at 50% 40%,
            #30265c 0%,
            #211b43 45%,
            #111329 100%);

    border: 1px solid #514477;
    border-radius: 14px;
    text-align: center;
    box-sizing: border-box;

    box-shadow:
        0 0 30px rgba(111, 75, 190, 0.2),
        inset 0 0 40px rgba(100, 70, 180, 0.12);
}

.crystal-title {
    color: #f1e7ff;
    font-size: 1.8em;
    margin: 0 0 10px;
}

.crystal-description {
    color: #c8bdd4;
    margin-bottom: 12px;
}

.crystal-stage {
    position: relative;
    width: 100%;
    height: 480px;
    overflow: hidden;
    touch-action: none;
    cursor: grab;

    background:
        radial-gradient(circle at 50% 42%,
            rgba(116, 75, 220, 0.25) 0%,
            rgba(53, 44, 125, 0.15) 35%,
            transparent 70%),
        radial-gradient(ellipse at 50% 100%,
            #25204f 0%,
            #12152e 65%,
            #101225 100%);

    border-radius: 12px;
    border: 1px solid rgba(155, 130, 230, 0.25);

    box-shadow:
        inset 0 0 50px rgba(80, 60, 180, 0.2);
}

.crystal-stage:active {
    cursor: grabbing;
}

.crystal-stage:active {
    cursor: grabbing;
}

.crystal-canvas {
    width: 100%;
    height: 100%;
}

.crystal-canvas canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.crystal-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0;
}

.crystal-fortune button {
    padding: 10px 17px;
    border: 1px solid #746183;
    border-radius: 7px;
    background: #42344f;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
}

.crystal-fortune button:hover {
    background: #655078;
}

.crystal-hint {
    color: #aaa0b6;
    font-size: 12px;
    margin: 12px 0 24px;
}

.crystal-next {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 15px;
    border-top: 1px solid #494050;
}

.crystal-next button {
    background: #70518b;
    padding: 13px 22px;
}

.crystal-dialog-placeholder {
    margin-top: 20px;
    padding: 18px;
    background: #302739;
    border-radius: 8px;
}

.crystal-dialog-placeholder p {
    color: #eee;
}

/* 水晶の解釈ダイアログの表示制御 */
.crystal-dialog-placeholder[hidden] {
    display: none !important;
}

.crystal-dialog-placeholder:not([hidden]) {
    display: block !important;
}


@media (max-width: 600px) {

    .crystal-fortune {
        padding: 18px 10px;
    }

    .crystal-stage {
        height: 360px;
    }

    .crystal-controls {
        gap: 6px;
    }

    .crystal-fortune button {
        padding: 9px 12px;
        font-size: 13px;
    }

}

/* 星のきらめき */
.crystal-stage::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    pointer-events: none;
    z-index: 0;

    background-image:
        radial-gradient(2px 2px at 12% 18%, #fff, transparent),
        radial-gradient(2px 2px at 25% 72%, #b8c8ff, transparent),
        radial-gradient(2px 2px at 78% 20%, #e4baff, transparent),
        radial-gradient(2px 2px at 88% 65%, #fff, transparent),
        radial-gradient(1px 1px at 65% 85%, #d6baff, transparent),
        radial-gradient(1px 1px at 42% 12%, #fff, transparent),
        radial-gradient(2px 2px at 8% 88%, #a9baff, transparent);

    opacity: 0.8;
}

/* Canvasを星空の上に配置 */
.crystal-canvas {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
}



/* ==========================================
   水晶占い STEP 1：縦型テーマ選択装置
========================================== */

.crystal-theme-panel {
    margin: 25px auto 10px;
    padding: 25px 18px 28px;
    max-width: 620px;

    background:
        linear-gradient(145deg,
            #30251f,
            #19151a 55%,
            #30251f);

    border: 1px solid #80643e;
    border-radius: 12px;

    box-shadow:
        0 5px 20px rgba(0, 0, 0, 0.4),
        inset 0 0 25px rgba(177, 130, 65, 0.08);

    color: #ead9b7;
}

.crystal-theme-panel[hidden] {
    display: none !important;
}

.crystal-theme-heading {
    color: #d8c29b;
    font-size: 15px;
    letter-spacing: 0.08em;
    margin: 0 0 25px;
    text-align: center;
}

/* 縦型ダイアル全体 */

.crystal-theme-dial {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    max-width: 340px;
    margin: 0 auto;
}

/* 上下操作ボタン */

.crystal-theme-dial button {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    padding: 0;

    color: #e4c58c;
    font-size: 17px;

    background:
        linear-gradient(145deg,
            #9a7744,
            #49331e);

    border: 1px solid #c09a5c;
    border-radius: 50%;

    box-shadow:
        0 3px 7px rgba(0, 0, 0, 0.5),
        inset 0 1px 2px rgba(255, 230, 180, 0.3);

    cursor: pointer;
}

.crystal-theme-dial button:hover {
    background:
        linear-gradient(145deg,
            #b18b50,
            #604326);
}

/* 選択表示パネル */

.crystal-dial-display {
    width: 100%;
    max-width: 300px;
    padding: 15px 12px;

    background:
        linear-gradient(180deg,
            #17151a,
            #29201c,
            #17151a);

    border: 2px solid #967344;
    border-radius: 8px;

    box-shadow:
        inset 0 0 15px rgba(0, 0, 0, 0.8),
        0 0 8px rgba(194, 151, 83, 0.12);

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.crystal-dial-label {
    color: #a98b5e;
    font-size: 10px;
    letter-spacing: 0.18em;
}

/* 縦方向の表示窓 */

.crystal-dial-window {
    width: 100%;
    height: 132px;
    overflow: hidden;
    position: relative;
}

.crystal-dial-track {
    display: flex;
    flex-direction: column;

    transform: translateY(-44px);

    transition: none;
}

/* 各テーマの表示行 */

.crystal-dial-track > span {
    flex: 0 0 44px;
    height: 44px;

    display: flex;
    justify-content: center;
    align-items: center;

    white-space: nowrap;
}

/* 上下のテーマ */

.crystal-dial-item {
    color: #9c8b72;
    font-size: 16px;
    opacity: 0.48;
}

/* 中央の選択テーマ */

.crystal-dial-value {
    color: #f0d6a1;
    font-size: 27px;
    font-weight: bold;
    letter-spacing: 0.12em;

    text-shadow:
        0 0 10px rgba(219, 176, 104, 0.3);
}

/* 選択番号 */

.crystal-dial-count {
    color: #b59a70;
    font-size: 12px;
    letter-spacing: 0.12em;
    margin: 14px 0 22px;
    text-align: center;
}

/* 決定ボタン */

.crystal-theme-confirm {
    display: block;
    margin: 0 auto;
    padding: 13px 30px;

    color: #f5e5c5;

    background: linear-gradient(
        145deg,
        #8a6939,
        #4c351f
    );

    border: 1px solid #c4a16a;
    border-radius: 6px;

    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.4),
        inset 0 1px 2px rgba(255, 230, 180, 0.2);

    letter-spacing: 0.08em;
}

.crystal-theme-confirm:hover {
    background: linear-gradient(
        145deg,
        #a17c46,
        #654726
    );
}

/* スマートフォン */

@media (max-width: 600px) {

    .crystal-theme-panel {
        padding: 22px 10px;
    }

    .crystal-dial-display {
        max-width: 270px;
    }

    .crystal-dial-value {
        font-size: 24px;
    }

}


/* ==========================================
   水晶占い STEP 2：機械式生年月日ダイアル
========================================== */

.crystal-birth-panel {
    max-width: 620px;
    margin: 25px auto 10px;
    padding: 28px 18px 30px;

    color: #ead9b7;

    background:
        linear-gradient(145deg,
            #30251f,
            #19151a 55%,
            #30251f);

    border: 1px solid #80643e;
    border-radius: 12px;

    box-shadow:
        0 5px 20px rgba(0,0,0,0.4),
        inset 0 0 25px rgba(177,130,65,0.08);
}

.crystal-birth-panel[hidden] {
    display: none !important;
}

.crystal-birth-heading {
    margin: 0 0 8px;
    text-align: center;
    color: #e2c99e;
    font-size: 16px;
    letter-spacing: 0.1em;
}

.crystal-birth-subheading {
    margin: 0 0 28px;
    text-align: center;
    color: #a99576;
    font-size: 12px;
}

/* 3つの数字盤 */

.crystal-birth-dials {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    max-width: 460px;
    margin: 0 auto 24px;
}

.crystal-birth-dial {
    flex: 1;
    min-width: 0;
    max-width: 135px;

    display: flex;
    flex-direction: column;
    align-items: center;

    padding: 13px 9px 14px;

    background:
        linear-gradient(145deg,
            #59432d,
            #211a17 45%,
            #493523);

    border: 1px solid #947044;
    border-radius: 9px;

    box-shadow:
        0 5px 12px rgba(0,0,0,0.5),
        inset 0 1px 3px rgba(255,220,160,0.15);
}

/* YEAR / MONTH / DAY */

.crystal-birth-label {
    margin-bottom: 12px;
    color: #b89a68;
    font-size: 10px;
    letter-spacing: 0.18em;
}

/* 上下の小型操作ボタン */

.crystal-birth-up,
.crystal-birth-down {
    display: flex;
    justify-content: center;
    align-items: center;

    width: 25px;
    height: 20px;
    padding: 0;

    color: #e3c58e;
    font-size: 10px;
    line-height: 1;

    background:
        linear-gradient(145deg,
            #987343,
            #49321d);

    border: 1px solid #b18a51;
    border-radius: 4px;

    box-shadow:
        0 2px 4px rgba(0,0,0,0.5),
        inset 0 1px 1px rgba(255,230,180,0.2);

    cursor: pointer;
}

.crystal-birth-up:hover,
.crystal-birth-down:hover {
    background:
        linear-gradient(145deg,
            #b18b50,
            #654526);
}

/* 数字表示窓 */

.crystal-birth-value {
    width: 100%;
    min-height: 76px;
    margin: 8px 0;

    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;

    color: #f0d6a1;

    background:
        linear-gradient(180deg,
            #090d16,
            #202536 50%,
            #0b1019);

    border: 2px solid #a18451;
    border-radius: 6px;

    box-shadow:
        inset 0 0 12px rgba(0,0,0,0.9),
        inset 0 1px 5px rgba(219,176,104,0.12),
        0 0 6px rgba(194,151,83,0.12);

    text-shadow:
        0 0 10px rgba(219,176,104,0.35);
}

.crystal-birth-value span {
    font-family: Georgia, serif;
    font-size: 31px;
    font-weight: bold;
    letter-spacing: 0.03em;
    font-variant-numeric: tabular-nums;
}

.crystal-birth-value small {
    align-self: flex-end;
    margin-bottom: 19px;
    color: #b99b6b;
    font-size: 11px;
}

/* 数字変更時の演出 */

.crystal-birth-value span.is-changing {
    animation: crystalBirthChange 0.25s ease;
}

@keyframes crystalBirthChange {
    0% {
        opacity: 0.35;
        transform: translateY(-3px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 入力任意の案内 */

.crystal-birth-note {
    margin: 15px 0 22px;
    text-align: center;
    color: #b7a487;
    font-size: 12px;
}

/* ボタン共通 */

.crystal-birth-skip,
.crystal-birth-confirm {
    display: block;
    margin: 10px auto;
    padding: 11px 25px;

    color: #f5e5c5;
    letter-spacing: 0.06em;

    background:
        linear-gradient(145deg,
            #8a6939,
            #4c351f);

    border: 1px solid #c4a16a;
    border-radius: 6px;

    cursor: pointer;
}

.crystal-birth-skip {
    color: #c8b99e;
    background: linear-gradient(145deg, #42372e, #25201c);
    border-color: #796346;
}

.crystal-birth-confirm:hover,
.crystal-birth-skip:hover {
    filter: brightness(1.2);
}

/* スマートフォン */

@media (max-width: 600px) {

    .crystal-birth-panel {
        padding: 24px 10px;
    }

    .crystal-birth-dials {
        gap: 8px;
    }

    .crystal-birth-dial {
        padding: 11px 5px;
    }

    .crystal-birth-value {
        min-height: 66px;
    }

    .crystal-birth-value span {
        font-size: 25px;
    }

    .crystal-birth-value small {
        font-size: 10px;
        margin-bottom: 16px;
    }
}

/* 水晶解釈ボタン */

.crystal-stage {
    position: relative;
}

.crystal-interpret {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;

    padding: 9px 15px;

    color: #e8d3aa;
    font-size: 12px;
    letter-spacing: 0.05em;

    background: linear-gradient(
        145deg,
        rgba(112, 80, 43, 0.95),
        rgba(39, 29, 25, 0.95)
    );

    border: 1px solid #a98a59;
    border-radius: 6px;

    box-shadow:
        0 2px 8px rgba(0,0,0,0.45),
        inset 0 1px 2px rgba(255,220,160,0.15);

    cursor: pointer;
}

.crystal-interpret:hover {
    filter: brightness(1.25);
}

@media (max-width: 600px) {
    .crystal-interpret {
        top: 7px;
        right: 7px;
        padding: 7px 10px;
        font-size: 11px;
    }
}


/* ==========================================
   水晶占い STEP 3：性別切替レバー
========================================== */

.crystal-gender-panel {
    max-width: 620px;
    margin: 25px auto 10px;
    padding: 28px 18px 30px;

    color: #ead9b7;

    background:
        linear-gradient(145deg,
            #30251f,
            #19151a 55%,
            #30251f);

    border: 1px solid #80643e;
    border-radius: 12px;

    box-shadow:
        0 5px 20px rgba(0,0,0,0.4),
        inset 0 0 25px rgba(177,130,65,0.08);
}

.crystal-gender-panel[hidden] {
    display: none !important;
}

.crystal-gender-heading {
    margin: 0 0 8px;
    text-align: center;
    color: #e2c99e;
    font-size: 16px;
    letter-spacing: 0.1em;
}

.crystal-gender-subheading {
    margin: 0 0 28px;
    text-align: center;
    color: #a99576;
    font-size: 12px;
}

/* レバー装置本体 */

.crystal-gender-instrument {
    max-width: 390px;
    margin: 0 auto;
    padding: 20px 18px;

    background:
        linear-gradient(145deg,
            #59432d,
            #211a17 48%,
            #493523);

    border: 1px solid #947044;
    border-radius: 9px;

    box-shadow:
        0 5px 12px rgba(0,0,0,0.5),
        inset 0 1px 3px rgba(255,220,160,0.15);
}

.crystal-gender-label {
    display: block;
    margin-bottom: 20px;
    text-align: center;
    color: #b89a68;
    font-size: 10px;
    letter-spacing: 0.18em;
}

/* 選択ボタン */

.crystal-gender-options {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.crystal-gender-option {
    flex: 1;
    min-width: 0;
    padding: 10px 5px;

    color: #bba582;
    font-size: 13px;

    background:
        linear-gradient(180deg,
            #211b19,
            #100f12);

    border: 1px solid #725b3d;
    border-radius: 5px;

    cursor: pointer;
    transition: all 0.2s ease;
}

.crystal-gender-option.is-selected {
    color: #f3dba9;

    background:
        linear-gradient(180deg,
            #6f5430,
            #34251b);

    border-color: #d0aa6b;

    box-shadow:
        0 0 10px rgba(205,164,96,0.25),
        inset 0 0 8px rgba(255,220,160,0.12);
}

/* レバーの移動レール */

.crystal-gender-track {
    position: relative;
    height: 9px;
    margin: 30px 8px 12px;

    background:
        linear-gradient(180deg,
            #100e0d,
            #493725);

    border: 1px solid #8b6a40;
    border-radius: 10px;

    box-shadow:
        inset 0 2px 4px rgba(0,0,0,0.8);
}

/* レバーのつまみ */

.crystal-gender-lever {
    position: absolute;
    top: 50%;
    left: 16.6667%;

    width: 28px;
    height: 28px;

    transform: translate(-50%, -50%);

    background:
        radial-gradient(circle at 35% 30%,
            #f0d49b,
            #a77b3d 55%,
            #49321d);

    border: 2px solid #d0ae72;
    border-radius: 50%;

    box-shadow:
        0 2px 6px rgba(0,0,0,0.7),
        0 0 8px rgba(208,174,114,0.2);

    transition: left 0.25s ease;
    pointer-events: none;
}

/* 現在の選択表示 */

.crystal-gender-current {
    min-height: 20px;
    margin: 24px 0 0;
    text-align: center;

    color: #e5c58e;
    font-size: 14px;
    letter-spacing: 0.12em;
}

/* 案内・ボタン */

.crystal-gender-note {
    margin: 20px 0;
    text-align: center;
    color: #b7a487;
    font-size: 12px;
}

.crystal-gender-skip,
.crystal-gender-confirm {
    display: block;
    margin: 10px auto;
    padding: 11px 25px;

    color: #f5e5c5;
    letter-spacing: 0.06em;

    background:
        linear-gradient(145deg,
            #8a6939,
            #4c351f);

    border: 1px solid #c4a16a;
    border-radius: 6px;

    cursor: pointer;
}

.crystal-gender-skip {
    color: #c8b99e;
    background: linear-gradient(145deg, #42372e, #25201c);
    border-color: #796346;
}

.crystal-gender-confirm:hover,
.crystal-gender-skip:hover {
    filter: brightness(1.2);
}

/* スマートフォン */

@media (max-width: 600px) {

    .crystal-gender-panel {
        padding: 24px 10px;
    }

    .crystal-gender-instrument {
        padding: 18px 12px;
    }

    .crystal-gender-option {
        font-size: 12px;
        padding: 9px 3px;
    }
}

/* ==========================================
   STEP 4：水晶の準備完了
========================================== */

.crystal-ready-panel {
    max-width: 620px;
    margin: 18px auto 15px;
    padding: 18px 22px;

    text-align: center;
    color: #f5e9d2;

    background:
        linear-gradient(
            145deg,
            rgba(45, 34, 76, 0.96),
            rgba(20, 19, 43, 0.98)
        );

    border: 1px solid rgba(193, 157, 103, 0.65);
    border-radius: 12px;

    box-shadow:
        0 0 25px rgba(135, 104, 204, 0.16),
        inset 0 0 25px rgba(0, 0, 0, 0.35);

    animation: crystalReadyAppear 1.2s ease both;
}

.crystal-ready-heading {
    color: #e8c98f;
    font-size: 23px;
    font-weight: bold;
    letter-spacing: 0.12em;
}

.crystal-ready-subheading {
    margin-top: 6px;
    color: #c9bddf;
    font-size: 13px;
}

.crystal-ready-light {
    margin: 8px auto;
    color: #e8d2a1;
    font-size: 34px;

    text-shadow:
        0 0 12px rgba(225, 194, 255, 0.8),
        0 0 28px rgba(159, 125, 255, 0.5);

    animation: crystalReadyGlow 3s ease-in-out infinite;
}

.crystal-ready-message {
    margin: 10px 0 15px;
    line-height: 2;
    color: #e6dff2;
    font-size: 14px;
}

.crystal-ready-information {
    margin: 0 auto 15px;
    max-width: 430px;
    padding: 12px 18px;

    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(193, 157, 103, 0.3);
    border-radius: 8px;
}

.crystal-ready-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;

    padding: 8px 4px;
    border-bottom: 1px solid rgba(193, 157, 103, 0.2);

    font-size: 14px;
}

.crystal-ready-row:last-child {
    border-bottom: none;
}

.crystal-ready-row span {
    color: #bcb0d2;
}

.crystal-ready-row strong {
    color: #f0d4a0;
}

.crystal-ready-confirm {
    display: inline-block;
    padding: 14px 32px;

    color: #f9edda !important;
    font-size: 15px;
    font-weight: bold;

    background:
        linear-gradient(
            145deg,
            #987344,
            #634625
        ) !important;

    border: 1px solid #d1b078 !important;
    border-radius: 7px;

    cursor: pointer;

    transition: all 0.3s ease;
}

.crystal-ready-confirm:hover {
    filter: brightness(1.2);
    transform: translateY(-2px);
}

.crystal-ready-note {
    margin-top: 8px;
    color: #a99bbf;
    font-size: 11px;
}

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

@keyframes crystalReadyGlow {
    0%, 100% {
        opacity: 0.65;
        transform: scale(0.95);
    }
    50% {
        opacity: 1;
        transform: scale(1.08);
    }
}

@media (max-width: 600px) {

    .crystal-ready-panel {
        padding: 25px 15px;
    }

    .crystal-ready-heading {
        font-size: 19px;
    }

    .crystal-ready-confirm {
        width: 100%;
        padding: 14px 10px;
    }

}

/* 性別選択パネル：確定後は確実に非表示 */
.crystal-fortune .crystal-gender-panel[hidden] {
    display: none !important;
}


/* ==========================================
   水晶占い：解釈ダイアログ
========================================== */

.crystal-dialog-placeholder {
    margin: 18px auto;
    padding: 22px;
    max-width: 620px;
    color: #eee8f5;
    text-align: center;
    white-space: pre-line;

    background: linear-gradient(
        145deg,
        #30265c,
        #17172f
    );

    border: 1px solid #8e7957;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(120, 90, 190, 0.15);
}

.crystal-dialog-placeholder[hidden],
.crystal-conversation-panel[hidden] {
    display: none !important;
}

.crystal-dialog-heading {
    margin-bottom: 15px;
    color: #e8c98f;
    font-size: 19px;
    font-weight: bold;
}

.crystal-dialog-placeholder p {
    color: #e3dced;
    line-height: 2;
    font-size: 14px;
}


/* ==========================================
   水晶占い：対話エリア
========================================== */

.crystal-conversation-panel {
    max-width: 700px;
    margin: 20px auto;
    padding: 24px 20px;

    color: #eee8f5;
    text-align: center;

    background:
        linear-gradient(
            145deg,
            #292044,
            #15172e
        );

    border: 1px solid #8e7957;
    border-radius: 12px;

    box-shadow:
        0 0 25px rgba(120, 90, 190, 0.18);
}

.crystal-conversation-heading {
    color: #e8c98f;
    font-size: 21px;
    font-weight: bold;
    letter-spacing: 0.08em;
}

.crystal-conversation-intro {
    margin: 10px 0;
    color: #d0c3df;
    font-size: 13px;
    line-height: 1.8;
}

.crystal-demo-notice {
    margin: 12px 0 18px;
    padding: 8px;
    color: #b9a98e;
    font-size: 11px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
}

.crystal-chat-log {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 15px 0;
    text-align: left;
}

.crystal-chat-message {
    max-width: 88%;
    padding: 12px 15px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.crystal-chat-message.fortune-teller {
    align-self: flex-start;
    color: #eadfcf;
    background: rgba(105, 81, 137, 0.38);
    border: 1px solid rgba(185, 157, 211, 0.3);
}

.crystal-chat-message.user {
    align-self: flex-end;
    color: #f5e7c9;
    background: rgba(133, 99, 53, 0.35);
    border: 1px solid rgba(193, 157, 103, 0.4);
}

.crystal-chat-count {
    margin: 12px 0;
    color: #c8b58e;
    font-size: 12px;
}

.crystal-chat-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 12px 0;
    padding: 12px;

    color: #eee8f5;
    background: #17172b;

    border: 1px solid #746183;
    border-radius: 7px;

    font-size: 14px;
    line-height: 1.7;
    resize: vertical;
}

.crystal-chat-input::placeholder {
    color: #8f849e;
}

.crystal-chat-send {
    display: block;
    width: 100%;
    max-width: 260px;
    margin: 12px auto;

    color: #f9edda !important;
    background: linear-gradient(
        145deg,
        #987344,
        #634625
    ) !important;

    border: 1px solid #d1b078 !important;
}

.crystal-chat-close {
    margin-top: 8px;
    color: #c8b99e !important;
    background: #393044 !important;
    border-color: #746183 !important;
}

.crystal-chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .crystal-conversation-panel {
        padding: 20px 12px;
    }

    .crystal-chat-message {
        max-width: 94%;
        font-size: 13px;
    }
}

/* 水晶の解釈エリア */
.crystal-interpret-result {
    margin: 35px auto 25px;
    padding: 25px;
    max-width: 760px;

    background:
        linear-gradient(
            145deg,
            #302739,
            #1c1a2d
        );

    border: 1px solid #a88b61;
    border-radius: 10px;

    color: #eee8f5;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);

    scroll-margin-top: 30px;
}

.crystal-interpret-result[hidden] {
    display: none !important;
}

.crystal-interpret-heading {
    font-size: 20px;
    color: #d9bd88;
    margin-bottom: 20px;
    border-bottom: 1px solid #806b50;
    padding-bottom: 12px;
}

.crystal-interpret-text {
    line-height: 1.9;
    color: #eee8f5;
}

.crystal-interpret-text li {
    margin-bottom: 10px;
}

.crystal-interpret-close {
    display: block;
    margin: 20px auto 0;
    padding: 9px 30px;

    color: #f5e5c5;
    background: #55412f;

    border: 1px solid #c4a16a;
    border-radius: 6px;

    cursor: pointer;
}


/* ==========================================
   テーマ選択装置：コンパクト化
========================================== */

.crystal-theme-panel {
    margin: 12px auto 8px;
    padding: 16px 14px 18px;
}

.crystal-theme-heading {
    margin-bottom: 12px;
    font-size: 14px;
}

.crystal-theme-dial {
    gap: 6px;
}

.crystal-theme-dial button {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
    font-size: 15px;
}

.crystal-dial-display {
    padding: 10px;
    gap: 6px;
}

.crystal-dial-window {
    height: 108px;
}

.crystal-dial-track > span {
    flex-basis: 36px;
    height: 36px;
}

.crystal-dial-value {
    font-size: 23px;
}

.crystal-dial-item {
    font-size: 14px;
}

.crystal-dial-count {
    margin: 7px 0 12px;
}

.crystal-theme-confirm {
    padding: 10px 24px;
}

@media (max-width: 600px) {
    .crystal-theme-panel {
        padding: 14px 10px 16px;
    }

    .crystal-dial-display {
        max-width: 250px;
    }

    .crystal-dial-value {
        font-size: 22px;
    }
}


/* ==========================================
   STEP1 テーマ選択装置・横型レイアウト
========================================== */

.crystal-theme-panel {
    max-width: 560px;
    margin: 14px auto 8px;
    padding: 16px 16px 18px;
}

/* 見出しと番号を横並び */
.crystal-theme-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.crystal-theme-heading {
    margin: 0;
    text-align: left;
    font-size: 14px;
    letter-spacing: 0.04em;
}

.crystal-dial-count {
    flex-shrink: 0;
    margin: 0;
    font-size: 12px;
}

/* 矢印を左右に配置 */
.crystal-theme-dial {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    max-width: 460px;
    margin: 0 auto 12px;
}

.crystal-theme-dial button {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 14px;
}

/* 中央表示窓 */
.crystal-dial-display {
    flex: 1;
    min-width: 0;
    max-width: 300px;
    padding: 9px 8px;
    gap: 5px;
}

.crystal-dial-window {
    height: 108px;
}

/* 1テーマ36px */
.crystal-dial-track > span {
    flex: 0 0 36px;
    height: 36px;
}

.crystal-dial-value {
    font-size: 23px;
}

.crystal-dial-item {
    font-size: 14px;
}

/* 決定ボタン */
.crystal-theme-confirm {
    margin: 0 auto;
    padding: 10px 24px;
}

@media (max-width: 600px) {

    .crystal-theme-panel {
        padding: 14px 10px 16px;
    }

    .crystal-theme-heading {
        font-size: 12px;
    }

    .crystal-theme-dial {
        gap: 7px;
    }

    .crystal-theme-dial button {
        flex-basis: 34px;
        width: 34px;
        height: 34px;
    }

    .crystal-dial-value {
        font-size: 20px;
    }

}


/* ==========================================
   STEP2 生年月日入力・コンパクト化
========================================== */

.crystal-fortune .crystal-birth-panel {
    max-width: 560px;
    margin: 10px auto 8px;
    padding: 10px 12px 12px;
}

/* 見出し */
.crystal-fortune .crystal-birth-heading {
    margin: 0 0 3px;
    font-size: 14px;
}

.crystal-fortune .crystal-birth-subheading {
    margin: 0 0 8px;
    font-size: 11px;
}

/* 3つの数字盤 */
.crystal-fortune .crystal-birth-dials {
    gap: 10px;
    max-width: 400px;
    margin: 0 auto 8px;
}

.crystal-fortune .crystal-birth-dial {
    padding: 5px 6px;
}

/* YEAR / MONTH / DAY */
.crystal-fortune .crystal-birth-label {
    margin-bottom: 3px;
    font-size: 10px;
}

/* 上下ボタン */
.crystal-fortune .crystal-birth-up,
.crystal-fortune .crystal-birth-down {
    width: 34px;
    height: 22px;
    min-height: 0;
    padding: 0;
    font-size: 11px;
    line-height: 1;
}

/* 数字表示窓 */
.crystal-fortune .crystal-birth-value {
    min-height: 38px;
    margin: 3px 0;
}

.crystal-fortune .crystal-birth-value span {
    font-size: 24px;
    line-height: 1.2;
}

.crystal-fortune .crystal-birth-value small {
    align-self: center;
    margin-bottom: 0;
    font-size: 10px;
}

/* 任意入力の説明 */
.crystal-fortune .crystal-birth-note {
    margin: 5px 0 7px;
    font-size: 11px;
}

/* スキップ・決定ボタンを横並び */
.crystal-fortune .crystal-birth-skip,
.crystal-fortune .crystal-birth-confirm {
    display: inline-block;
    margin: 3px;
    padding: 7px 14px;
    font-size: 12px;
    vertical-align: middle;
}

/* スマートフォン */
@media (max-width: 600px) {

    .crystal-fortune .crystal-birth-panel {
        padding: 10px 6px;
    }

    .crystal-fortune .crystal-birth-dials {
        gap: 5px;
    }

    .crystal-fortune .crystal-birth-dial {
        padding: 5px 3px;
    }

    .crystal-fortune .crystal-birth-value span {
        font-size: 20px;
    }

    .crystal-fortune .crystal-birth-skip,
    .crystal-fortune .crystal-birth-confirm {
        padding: 7px 9px;
        font-size: 11px;
    }

}


/* ==========================================
   STEP2 生年月日ダイアル・左右操作型
========================================== */

.crystal-fortune .crystal-birth-dials {
    max-width: 510px;
    gap: 8px;
}

.crystal-fortune .crystal-birth-dial {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 24px;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 4px;
    max-width: 165px;
    padding: 6px;
}

/* 上部のYEAR / MONTH / DAY */
.crystal-fortune .crystal-birth-label {
    grid-column: 1 / 4;
    grid-row: 1;
    margin: 0;
    text-align: center;
}

/* 左側：数字を減らす */
.crystal-fortune .crystal-birth-down {
    grid-column: 1;
    grid-row: 2;
}

/* 右側：数字を増やす */
.crystal-fortune .crystal-birth-up {
    grid-column: 3;
    grid-row: 2;
}

/* 左右の操作ボタン */
.crystal-fortune .crystal-birth-up,
.crystal-fortune .crystal-birth-down {
    width: 24px;
    height: 30px;
    margin: 0;
    padding: 0;
}

/* 中央の数字表示窓 */
.crystal-fortune .crystal-birth-value {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    margin: 0;
    box-sizing: border-box;
}

.crystal-fortune .crystal-birth-value span {
    font-size: 22px;
}

/* 年月日の単位は上部のラベルで代用 */
.crystal-fortune .crystal-birth-value small {
    display: none;
}

@media (max-width: 600px) {

    .crystal-fortune .crystal-birth-dials {
        gap: 4px;
    }

    .crystal-fortune .crystal-birth-dial {
        grid-template-columns: 18px minmax(0, 1fr) 18px;
        gap: 2px;
        padding: 3px;
    }

    .crystal-fortune .crystal-birth-up,
    .crystal-fortune .crystal-birth-down {
        width: 18px;
        height: 28px;
        font-size: 9px;
    }

    .crystal-fortune .crystal-birth-value span {
        font-size: 16px;
    }

}


/* ==========================================
   STEP3 性別入力・コンパクト化
========================================== */

.crystal-fortune .crystal-gender-panel {
    max-width: 560px;
    margin: 10px auto 8px;
    padding: 10px 12px 12px;
}

/* 見出し */
.crystal-fortune .crystal-gender-heading {
    margin: 0 0 3px;
    font-size: 14px;
}

.crystal-fortune .crystal-gender-subheading {
    margin: 0 0 8px;
    font-size: 11px;
}

/* レバー装置本体 */
.crystal-fortune .crystal-gender-instrument {
    max-width: 390px;
    padding: 8px 10px;
}

.crystal-fortune .crystal-gender-label {
    margin-bottom: 6px;
    font-size: 10px;
}

/* 選択ボタン */
.crystal-fortune .crystal-gender-options {
    gap: 5px;
}

.crystal-fortune .crystal-gender-option {
    padding: 6px 4px;
    font-size: 12px;
}

/* レール */
.crystal-fortune .crystal-gender-track {
    height: 7px;
    margin: 14px 8px 8px;
}

/* レバーのつまみ */
.crystal-fortune .crystal-gender-lever {
    width: 22px;
    height: 22px;
}

/* 現在の選択表示 */
.crystal-fortune .crystal-gender-current {
    min-height: 16px;
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.4;
}

/* 任意入力の案内 */
.crystal-fortune .crystal-gender-note {
    margin: 5px 0 7px;
    font-size: 11px;
}

/* スキップ・決定ボタンを横並び */
.crystal-fortune .crystal-gender-skip,
.crystal-fortune .crystal-gender-confirm {
    display: inline-block;
    margin: 3px;
    padding: 7px 14px;
    font-size: 12px;
    vertical-align: middle;
}

@media (max-width: 600px) {

    .crystal-fortune .crystal-gender-panel {
        padding: 10px 6px;
    }

    .crystal-fortune .crystal-gender-instrument {
        padding: 8px 6px;
    }

    .crystal-fortune .crystal-gender-option {
        font-size: 11px;
        padding: 6px 3px;
    }

    .crystal-fortune .crystal-gender-skip,
    .crystal-fortune .crystal-gender-confirm {
        padding: 7px 9px;
        font-size: 11px;
    }

}

/* ==========================================
   STEP4 準備完了画面の簡略化
========================================== */

.crystal-fortune .crystal-ready-panel {
    max-width: 560px;
    margin: 10px auto 8px;
    padding: 12px 14px;
}

.crystal-fortune .crystal-ready-heading {
    margin: 0 0 10px;
    font-size: 19px;
    letter-spacing: 0.06em;
}

.crystal-fortune .crystal-ready-information {
    margin: 6px auto 10px;
    padding: 6px 12px;
}

.crystal-fortune .crystal-ready-row {
    padding: 4px 0;
    line-height: 1.4;
}

.crystal-fortune .crystal-ready-confirm {
    margin: 5px auto 0;
    padding: 9px 20px;
}

@media (max-width: 600px) {

    .crystal-fortune .crystal-ready-heading {
        font-size: 16px;
    }

}





/* ==========================================
   性別レバーの操作機能
========================================== */

.crystal-fortune .crystal-gender-track {
    cursor: ew-resize;
    touch-action: none;
    height: 12px;
    margin: 18px 8px 12px;
    user-select: none;
}

/* レバーを直接操作可能にする */
.crystal-fortune .crystal-gender-lever {
    width: 26px;
    height: 26px;
    pointer-events: auto;
    cursor: grab;
    touch-action: none;
}

.crystal-fortune .crystal-gender-track:active,
.crystal-fortune .crystal-gender-track:active
.crystal-gender-lever {
    cursor: grabbing;
}

.crystal-fortune .crystal-gender-lever:hover {
    filter: brightness(1.2);
}

/* レールの操作範囲を上下に広げる */
.crystal-fortune .crystal-gender-track::before {
    content: "";
    position: absolute;
    top: -10px;
    bottom: -10px;
    left: 0;
    right: 0;
}

/* 確定ボタン */
.crystal-fortune .crystal-gender-confirm {
    margin: 3px auto;
    padding: 8px 24px;
}

/* ==========================================
   水晶の見方・文章レイアウト改善
========================================== */

.crystal-fortune .crystal-interpret-result {
    padding: 18px 22px;
    text-align: left;
}

.crystal-fortune .crystal-interpret-heading {
    text-align: center;
}

.crystal-fortune .crystal-interpret-result p {
    text-align: left;
    margin: 12px 0;
    line-height: 1.8;
}

.crystal-fortune .crystal-interpret-result ul {
    list-style: none;
    margin: 12px 0;
    padding: 0;
    text-align: left;
}

.crystal-fortune .crystal-interpret-result li {
    position: relative;
    list-style: none;
    padding-left: 18px;
    margin: 5px 0;
    text-align: left;
    line-height: 1.7;
}

.crystal-fortune .crystal-interpret-result li::before {
    content: "・";
    position: absolute;
    left: 0;
    top: 0;
    color: #d5ba89;
}

.crystal-fortune .crystal-interpret-close {
    display: block;
    margin: 15px auto 0;
}

/* ==========================================
   水晶占いタイトルの視認性改善
========================================== */

.crystal-fortune .crystal-title {
    color: #f5eaff !important;
    font-size: 1.8em;
    font-weight: 700;
    opacity: 1;

    text-shadow:
        0 0 8px rgba(190,160,255,0.45),
        0 2px 4px rgba(0,0,0,0.5);

    letter-spacing: 0.12em;
    margin: 0 0 10px;
}

/* ==========================================
   水晶占い：タイトルデザイン修正
========================================== */

.crystal-fortune .crystal-title {
    background: transparent !important;
    background-color: transparent !important;

    color: #e8d6ae !important;

    font-size: 2em;
    font-weight: 700;
    letter-spacing: 0.18em;

    text-align: center;
    text-shadow:
        0 0 10px rgba(218, 184, 120, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.7);

    border: none !important;
    border-radius: 0;
    box-shadow: none !important;

    margin: 0 0 12px;
    padding: 12px 0;
}

/* Cocoonの見出し装飾を無効化 */

.crystal-fortune .crystal-title::before,
.crystal-fortune .crystal-title::after {
    content: none !important;
    display: none !important;
}