/* ==========================================================================
   ベーススタイル - 大凶・ダークホラー調
   ========================================================================== */
* {
    box-sizing: border-box;
}

body {
    font-family: "Yu Mincho", "Sawarabi Mincho", "MS PMincho", serif;
    background: #000000; /* Pitch black */
    background-image: 
        radial-gradient(circle at center, transparent 0%, #000 80%),
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(20, 0, 0, 0.1) 2px, rgba(20, 0, 0, 0.1) 4px); /* Scanline effect */
    color: #d3c0c0;
    margin: 0;
    padding: 20px 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    transition: background 0.6s ease;
}

/* ==========================================================================
   ★ 大吉：サイト全体ゴールドモード（明るく華やかな仕様）
   ========================================================================== */
body.gold-mode {
    background: radial-gradient(circle at top center, #fffbeb 0%, #fef0c2 55%, #fde08b 100%);
    color: #5c3a00;
}

body.gold-mode .container {
    background: linear-gradient(180deg, #ffffff 0%, #fffbf0 100%);
    border: 2px solid #facc15;
    box-shadow: 0 0 50px rgba(250, 204, 21, 0.6), 0 20px 50px rgba(0, 0, 0, 0.15);
}

body.gold-mode h1,
body.gold-mode h2 {
    color: #d97706;
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.8), 0 0 20px rgba(250, 204, 21, 0.4);
}

body.gold-mode .back-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 50%, #d97706 100%);
    color: #ffffff;
    font-weight: 900;
    border: 1px solid #fcd34d;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

/* ==========================================================================
   メインコンテナ
   ========================================================================== */
.container {
    background: #0a0000;
    width: 100%;
    max-width: 420px;
    border-radius: 4px;
    padding: 32px 20px;
    border: 1px solid #4a0000;
    box-shadow: 0 0 20px rgba(138, 3, 3, 0.2), inset 0 0 10px rgba(0, 0, 0, 0.8);
    text-align: center;
    transition: all 0.5s ease;
    position: relative;
}

/* 画面ビュー切り替え */
.view {
    animation: fadeIn 0.4s ease-out;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   ① 入力画面
   ========================================================================== */
h1 {
    color: #8a0303;
    font-size: 32px;
    margin-top: 0;
    margin-bottom: 10px;
    letter-spacing: 4px;
    text-shadow: 0 0 8px rgba(138, 3, 3, 0.6), 2px 2px 0px rgba(0,0,0,0.9);
    animation: glitchText 3s infinite alternate;
}

@keyframes glitchText {
    0% { transform: translate(0) skew(0deg); opacity: 1; }
    5% { transform: translate(-2px, 1px) skew(-10deg); opacity: 0.8; text-shadow: -2px 0 red, 2px 0 black; }
    10% { transform: translate(2px, -1px) skew(10deg); opacity: 1; text-shadow: 2px 0 red, -2px 0 black; }
    15% { transform: translate(0) skew(0deg); opacity: 1; text-shadow: 0 0 8px rgba(138, 3, 3, 0.6); }
    100% { transform: translate(0) skew(0deg); opacity: 1; }
}

p {
    font-size: 14px;
    line-height: 1.6;
    color: #bfaec9;
    margin-bottom: 22px;
}

.input-form {
    background: #050000;
    border: 1px solid #330000;
    border-radius: 2px;
    padding: 16px 14px;
    margin-bottom: 22px;
    text-align: left;
}

.form-group {
    margin-bottom: 12px;
}

.form-group:last-of-type {
    margin-bottom: 4px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: #a07a7a;
    margin-bottom: 6px;
}

.required {
    color: #8a0303;
    font-weight: bold;
}

.input-form input[type="text"],
.input-form select {
    width: 100%;
    padding: 12px 14px;
    background-color: #0a0000;
    border: 1px solid #4a0000;
    border-radius: 2px;
    color: #e6e6e6;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
}

.input-form input[type="text"]:focus,
.input-form select:focus {
    border-color: #8a0303;
    box-shadow: 0 0 8px rgba(138, 3, 3, 0.5);
}

.input-form input[type="text"]::placeholder {
    color: #725c80;
}

.birth-select-group {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.select-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    position: relative;
}

.select-wrapper select {
    width: 100%;
    padding-right: 30px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23725c80' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.select-wrapper span {
    font-size: 14px;
    color: #e0d5e6;
    white-space: nowrap;
}

.error-message {
    color: #ff3333;
    font-size: 13px;
    font-weight: bold;
    margin-top: 10px;
    padding: 8px 10px;
    background: rgba(138, 3, 3, 0.15);
    border-radius: 2px;
    border-left: 3px solid #8a0303;
    text-align: center;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

.main-btn {
    background: #000000;
    color: #8a0303;
    border: 1px solid #8a0303;
    border-radius: 2px;
    padding: 16px 30px;
    font-size: 19px;
    font-weight: bold;
    letter-spacing: 4px;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(138, 3, 3, 0.2);
    transition: all 0.2s ease;
    width: 100%;
    max-width: 280px;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
}

.main-btn:hover {
    background: #1a0000;
    box-shadow: 0 0 15px rgba(138, 3, 3, 0.6);
    color: #ff3333;
}

.main-btn:active {
    transform: scale(0.98);
}

/* ==========================================================================
   ② 運命判定中（ローディング）画面
   ========================================================================== */
#loading-view {
    padding: 40px 10px;
}

.crystal-orb {
    font-size: 64px;
    margin-bottom: 20px;
    animation: orbPulseScary 1.5s infinite ease-in-out;
    display: inline-block;
    filter: drop-shadow(0 0 5px #8a0303);
}

@keyframes orbPulseScary {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.1) skewX(5deg);
        opacity: 1;
        filter: drop-shadow(0 0 15px #ff0000);
    }
    55% {
        transform: scale(0.9) skewX(-10deg);
    }
    100% {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

/* 大吉確定ローディング演出（黄金オーラ） */
.crystal-orb.gold-orb {
    animation: goldOrbPulse 0.7s infinite alternate ease-in-out;
}

@keyframes goldOrbPulse {
    0% {
        transform: scale(1.0) rotate(-5deg);
        filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.7));
    }

    100% {
        transform: scale(1.3) rotate(5deg);
        filter: drop-shadow(0 0 45px rgba(255, 215, 0, 1)) drop-shadow(0 0 70px rgba(255, 152, 0, 0.9));
    }
}

/* 吉系煽りローディング演出（蒼玉・クリスタルオーラ） */
.crystal-orb.kichi-orb {
    animation: kichiOrbPulse 0.8s infinite alternate ease-in-out;
}

@keyframes kichiOrbPulse {
    0% {
        transform: scale(1.0) translateY(0);
        filter: drop-shadow(0 0 15px rgba(0, 229, 255, 0.7));
    }

    100% {
        transform: scale(1.2) translateY(-4px);
        filter: drop-shadow(0 0 40px rgba(0, 229, 255, 1)) drop-shadow(0 0 60px rgba(61, 90, 254, 0.8));
    }
}

.loading-text {
    font-size: 18px;
    font-weight: bold;
    color: #8a0303;
    letter-spacing: 2px;
    margin-bottom: 8px;
    animation: blinkText 2s infinite alternate;
}

.loading-text.gold-text {
    color: #ffe066;
    font-size: 20px;
    text-shadow: 0 0 15px #ffd700, 0 0 30px #ff9800;
    animation: goldBlink 0.5s infinite alternate;
}

.loading-text.kichi-text {
    color: #80deea;
    font-size: 19px;
    text-shadow: 0 0 15px #00e5ff, 0 0 30px #3d5afe;
    animation: kichiBlink 0.6s infinite alternate;
}

@keyframes goldBlink {
    0% {
        opacity: 0.7;
        transform: scale(0.98);
    }

    100% {
        opacity: 1;
        transform: scale(1.02);
    }
}

@keyframes kichiBlink {
    0% {
        opacity: 0.7;
        transform: scale(0.98);
    }

    100% {
        opacity: 1;
        transform: scale(1.02);
    }
}

@keyframes blinkText {
    0% {
        opacity: 0.6;
    }

    100% {
        opacity: 1;
    }
}

.loading-sub {
    font-size: 13px;
    color: #9e8ea6;
    letter-spacing: 1px;
}

.loading-sub.gold-sub {
    color: #fff3bf;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

.loading-sub.kichi-sub {
    color: #e0f7fa;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.8);
}

/* ==========================================================================
   ③ 占い結果画面
   ========================================================================== */
#result-view h2 {
    color: #e072a4;
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 18px;
    letter-spacing: 1px;
    text-shadow: 0 0 8px rgba(224, 114, 164, 0.4);
    word-break: break-word;
}

.result-fortune-card {
    border-radius: 14px;
    padding: 22px 18px;
    margin-bottom: 18px;
    text-align: center;
    transition: all 0.4s ease;
}

.rare-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

/* ① 大凶テーマ（漆黒＆血赤） */
.theme-daikyo {
    background: #000000;
    border: 1px solid #4a0000;
    box-shadow: 0 0 20px rgba(138, 3, 3, 0.3), inset 0 0 10px #1a0000;
    border-radius: 0;
}

.joke-badge {
    display: inline-block;
    color: #555;
    font-size: 11px;
    padding: 6px 16px;
    margin-bottom: 16px;
    letter-spacing: 1px;
    border: 1px solid #333;
}

.theme-daikyo .fortune-rank {
    font-size: 32px;
    font-weight: bold;
    color: #8a0303;
    letter-spacing: 6px;
    text-shadow: 0 0 10px rgba(138, 3, 3, 0.8);
    margin-bottom: 12px;
    animation: glitchText 4s infinite;
}

.theme-daikyo .fortune-desc {
    font-size: 15px;
    line-height: 1.8;
    color: #d3c0c0;
    font-weight: 500;
    word-break: break-word;
    white-space: pre-wrap;
}

/* ② 中吉・小吉・吉・末吉テーマ（明るく美麗なクリスタルサファイア＆アメジスト豪華仕様） */
.theme-kichi {
    background: linear-gradient(135deg, #1b3d82 0%, #321c63 50%, #155e88 100%);
    border: 2px solid #00f0ff;
    box-shadow: 0 0 35px rgba(0, 240, 255, 0.5), 0 10px 40px rgba(65, 105, 225, 0.45), inset 0 0 25px rgba(255, 255, 255, 0.25);
    animation: kichiGlow 2.8s infinite alternate ease-in-out;
}

@keyframes kichiGlow {
    0% {
        box-shadow: 0 0 25px rgba(0, 240, 255, 0.4), 0 10px 30px rgba(65, 105, 225, 0.35), inset 0 0 15px rgba(255, 255, 255, 0.2);
    }

    100% {
        box-shadow: 0 0 50px rgba(0, 240, 255, 0.75), 0 15px 55px rgba(65, 105, 225, 0.65), inset 0 0 30px rgba(255, 255, 255, 0.4);
    }
}

.theme-kichi .rare-badge {
    color: #00e5ff;
    background: rgba(0, 229, 255, 0.25);
    border: 1.5px solid #00e5ff;
    text-shadow: 0 0 10px #00e5ff;
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
}

.theme-kichi .fortune-rank {
    font-size: 34px;
    font-weight: bold;
    color: #ffffff;
    letter-spacing: 6px;
    text-shadow: 0 0 20px #00e5ff, 0 0 40px #3d5afe, 0 0 60px #7c4dff;
    margin-bottom: 12px;
}

.theme-kichi .fortune-desc {
    font-size: 15px;
    line-height: 1.6;
    color: #f0fbff;
    font-weight: bold;
    word-break: break-word;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    white-space: pre-wrap;
}

.theme-kichi .rare-badge {
    color: #e0f7fa;
    background: rgba(0, 229, 255, 0.2);
    border: 1px solid #80deea;
    text-shadow: 0 0 10px rgba(128, 222, 234, 0.8);
    box-shadow: 0 0 10px rgba(128, 222, 234, 0.3);
}

.theme-kichi .fortune-rank {
    font-size: 32px;
    font-weight: bold;
    color: #e0f7fa;
    letter-spacing: 6px;
    text-shadow: 0 0 20px #80deea, 0 0 35px #00bcd4, 0 0 50px rgba(63, 81, 181, 0.7);
    margin-bottom: 12px;
}

.theme-kichi .fortune-desc {
    font-size: 15px;
    line-height: 1.6;
    color: #ffffff;
    font-weight: 500;
    word-break: break-word;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    white-space: pre-wrap;
}

/* ③ 大吉テーマ（超豪華・黄金に輝くプレミアムゴールド仕様 - 明るい版） */
.theme-daikichi {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 50%, #fed7aa 100%);
    border: 2px solid #f59e0b;
    box-shadow: 0 0 35px rgba(245, 158, 11, 0.5), inset 0 0 20px rgba(250, 204, 21, 0.3);
    animation: goldShine 2.5s infinite alternate ease-in-out;
}

@keyframes goldShine {
    0% {
        box-shadow: 0 0 25px rgba(245, 158, 11, 0.4), inset 0 0 15px rgba(250, 204, 21, 0.2);
    }

    100% {
        box-shadow: 0 0 50px rgba(245, 158, 11, 0.7), inset 0 0 30px rgba(250, 204, 21, 0.5);
    }
}

.theme-daikichi .rare-badge {
    color: #b45309;
    background: rgba(253, 230, 138, 0.8);
    border: 1px solid #f59e0b;
    text-shadow: none;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.theme-daikichi .fortune-rank {
    font-size: 36px;
    font-weight: bold;
    color: #ea580c;
    letter-spacing: 7px;
    text-shadow: 0 0 15px rgba(250, 204, 21, 0.8), 0 0 30px rgba(249, 115, 22, 0.4);
    margin-bottom: 12px;
}

.theme-daikichi .fortune-desc {
    font-size: 16px;
    line-height: 1.7;
    color: #78350f;
    font-weight: bold;
    word-break: break-word;
    text-shadow: none;
    white-space: pre-wrap;
}

/* 詳細項目エリア */
#detail-area {
    margin-bottom: 16px;
}

.result-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    padding: 14px 16px;
    background: rgba(30, 19, 40, 0.85);
    border-radius: 10px;
    text-align: left;
    border: 1px solid #3d244c;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.label {
    font-weight: bold;
    color: #b39ddb;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.value {
    color: #ede7f6;
    font-weight: 500;
    font-size: 15px;
    line-height: 1.6;
    word-break: break-word;
}

#lucky-category-result {
    color: #ff79b0;
    font-weight: bold;
    font-size: 16px;
}

/* お清めボタンエリア */
.purify-area {
    margin: 18px 0 22px;
}

.purify-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(200, 180, 220, 0.15) 100%);
    color: #ffffff;
    border: 1px solid #b39ddb;
    border-radius: 25px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
    width: 100%;
    max-width: 280px;
}

.purify-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(200, 180, 220, 0.25) 100%);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

.purify-btn:active,
.purify-btn.purified {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.8);
}

/* SNSシェアエリア */
.share-area {
    margin: 20px 0;
    padding: 16px 12px;
    background: rgba(20, 12, 28, 0.7);
    border-radius: 12px;
    border: 1px solid #3d2048;
}

.share-label {
    font-size: 12px;
    font-weight: bold;
    color: #ce93d8;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.share-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.share-btn {
    flex: 1;
    padding: 10px 6px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    color: #ffffff;
    transition: transform 0.15s, opacity 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.share-btn:hover {
    opacity: 0.9;
}

.share-btn:active {
    transform: scale(0.96);
}

.x-btn {
    background-color: #000000;
    border: 1px solid #444;
}

.line-btn {
    background-color: #06c755;
}

.copy-btn {
    background-color: #4a2c5a;
    border: 1px solid #7b1fa2;
}

/* 戻るボタン */
.action-area {
    margin-top: 18px;
}

.back-btn {
    background: transparent;
    color: #a07a7a;
    border: 1px solid #4a0000;
    border-radius: 2px;
    padding: 15px 30px;
    font-size: 17px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(138, 3, 3, 0.2);
    transition: all 0.2s ease;
    width: 100%;
    max-width: 260px;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
}

.back-btn:hover {
    background: rgba(138, 3, 3, 0.1);
    color: #d3c0c0;
    box-shadow: 0 0 10px rgba(138, 3, 3, 0.5);
}

.back-btn:active {
    transform: scale(0.98);
}

/* ==========================================================================
   将来の広告枠（ダミー）
   ========================================================================== */
.ad-placeholder {
    margin-top: 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed #725c80;
    border-radius: 8px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #725c80;
    font-size: 14px;
}

body.gold-mode .ad-placeholder {
    border-color: #fcd34d;
    background: rgba(250, 204, 21, 0.1);
    color: #d97706;
}

/* ==========================================================================
   サイトフッター
   ========================================================================== */
.site-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #3d2048;
    font-size: 12px;
    color: #725c80;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

body.gold-mode .site-footer {
    border-top-color: #fde68a;
    color: #b45309;
}

.site-footer a {
    color: #a894b5;
    text-decoration: none;
    transition: color 0.2s;
}

body.gold-mode .site-footer a {
    color: #d97706;
}

.site-footer a:hover {
    color: #ffffff;
    text-decoration: underline;
}

body.gold-mode .site-footer a:hover {
    color: #78350f;
}

.site-footer p {
    width: 100%;
    margin: 8px 0 0 0;
}

/* ==========================================================================
   モーダル（規約表示用）
   ========================================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content {
    background: #1c1424;
    border: 1px solid #5c296f;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
}

.modal-content h2 {
    margin: 0 0 16px 0;
    font-size: 20px;
    color: #ff5277;
    text-align: center;
}

.modal-body {
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    color: #e0d8e8;
    padding-right: 8px;
    margin-bottom: 20px;
    flex-grow: 1;
}

.modal-body h3 {
    font-size: 16px;
    color: #ff85a1;
    margin: 16px 0 8px;
}

.modal-body p {
    margin-bottom: 12px;
}

.modal-content .main-btn {
    margin-top: auto;
}

/* ==========================================================================
   トースト通知
   ========================================================================== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(18, 10, 24, 0.95);
    color: #ffffff;
    padding: 12px 22px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: bold;
    border: 1px solid #ab47bc;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.8), 0 0 15px rgba(171, 71, 188, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    z-index: 1000;
    max-width: 90%;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   アニメーション
   ========================================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}