/* MBTI診断 - アンシェント・スクロール テーマ */
@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700&family=Zen+Old+Mincho&display=swap');

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

body {
    font-family: 'Zen Old Mincho', serif;
    background: #1a1510;
    min-height: 100vh;
    color: #3a3020;
    overflow-x: hidden;
}

/* 羊皮紙背景 */
.parchment-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, #f4e4c8 0%, #e8d4a8 50%, #d8c498 100%);
    z-index: 0;
}

.parchment-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.08;
    pointer-events: none;
}

/* 装飾要素 */
.corner-decor {
    position: fixed;
    width: 150px;
    height: 150px;
    opacity: 0.4;
    pointer-events: none;
    z-index: 1;
}

.corner-decor::before {
    content: '❧';
    font-size: 4rem;
    color: #8b6914;
}

.corner-tl { top: 20px; left: 20px; }
.corner-tr { top: 20px; right: 20px; transform: scaleX(-1); }
.corner-bl { bottom: 20px; left: 20px; transform: scaleY(-1); }
.corner-br { bottom: 20px; right: 20px; transform: scale(-1); }

/* コンテナ */
.container {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 20px;
}

/* ヘッダー */
.header {
    text-align: center;
    margin-bottom: 50px;
}

.header-emblem {
    width: 100px;
    height: 100px;
    margin: 0 auto 25px;
    border: 3px double #8b6914;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: linear-gradient(135deg, #f4e4c8, #e8d4a8);
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.header h1 {
    font-family: 'Cinzel Decorative', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #5a4a1a;
    margin-bottom: 10px;
    letter-spacing: 0.1em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.header p {
    color: #7a6a4a;
    font-size: 1rem;
    font-style: italic;
}

.header-line {
    width: 200px;
    height: 2px;
    margin: 20px auto 0;
    background: linear-gradient(90deg, transparent, #8b6914, transparent);
}

/* バージョン選択 */
.version-select {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 40px;
}

.version-btn {
    padding: 20px 40px;
    background: rgba(255,255,255,0.5);
    border: 2px solid #c9a227;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    text-decoration: none;
    color: inherit;
}

.version-btn:hover {
    background: rgba(201, 162, 39, 0.2);
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(139,105,20,0.2);
}

.version-btn h3 {
    font-family: 'Cinzel Decorative', serif;
    font-size: 1.2rem;
    color: #5a4a1a;
    margin-bottom: 8px;
}

.version-btn p {
    font-size: 0.9rem;
    color: #7a6a4a;
}

/* プログレスセクション */
.progress-section {
    margin-bottom: 40px;
    text-align: center;
}

.progress-text {
    font-size: 1rem;
    color: #6a5a3a;
    margin-bottom: 15px;
    letter-spacing: 0.1em;
}

.progress-bar-wrap {
    height: 8px;
    background: rgba(139,105,20,0.2);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #c9a227, #8b6914);
    border-radius: 4px;
    transition: width 0.5s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: #c9a227;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(201, 162, 39, 0.6);
    margin-right: -8px;
}

/* 質問カード */
.question-card {
    background: linear-gradient(135deg, #faf4e8, #f0e4d0);
    border: 2px solid #c9a227;
    border-radius: 5px;
    padding: 50px 40px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15), inset 0 0 80px rgba(139,105,20,0.05);
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.3s, transform 0.3s;
}

.question-card.fade-out {
    opacity: 0;
    transform: translateX(-30px);
}

.question-card.fade-in {
    opacity: 0;
    transform: translateX(30px);
}

.question-card::before,
.question-card::after {
    content: '✦';
    position: absolute;
    font-size: 1.5rem;
    color: #c9a227;
}

.question-card::before { top: 15px; left: 20px; }
.question-card::after { bottom: 15px; right: 20px; }

.question-chapter {
    font-family: 'Cinzel Decorative', serif;
    font-size: 1rem;
    color: #8b6914;
    margin-bottom: 25px;
    text-align: center;
    letter-spacing: 0.2em;
}

.question-text {
    font-size: 1.3rem;
    line-height: 2;
    margin-bottom: 40px;
    color: #3a3020;
    text-align: center;
}

/* 選択肢 */
.options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.option {
    padding: 25px 30px;
    background: rgba(255,255,255,0.5);
    border: 1px solid #c9a227;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.option::before {
    content: '☙';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: #c9a227;
    opacity: 0;
    transition: opacity 0.3s;
}

.option:hover::before {
    opacity: 1;
}

.option:hover {
    background: rgba(201, 162, 39, 0.15);
    border-color: #8b6914;
    padding-left: 45px;
}

.option.selected {
    background: rgba(201, 162, 39, 0.25);
    border-color: #8b6914;
    border-width: 2px;
}

.option-text {
    font-size: 1.05rem;
    color: #4a3a20;
    line-height: 1.7;
}

/* ナビゲーションボタン */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    gap: 20px;
}

.nav-btn {
    padding: 15px 30px;
    background: transparent;
    border: 1px solid #c9a227;
    border-radius: 3px;
    font-family: 'Zen Old Mincho', serif;
    font-size: 1rem;
    color: #5a4a1a;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-btn:hover:not(:disabled) {
    background: rgba(201, 162, 39, 0.15);
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-btn.primary {
    background: linear-gradient(135deg, #c9a227, #8b6914);
    color: #faf4e8;
    border: none;
}

.nav-btn.primary:hover:not(:disabled) {
    box-shadow: 0 5px 20px rgba(139,105,20,0.3);
    transform: translateY(-2px);
}

/* 結果画面 */
.result-card {
    background: linear-gradient(135deg, #faf4e8, #f0e4d0);
    border: 3px double #c9a227;
    border-radius: 5px;
    padding: 60px 40px;
    text-align: center;
    position: relative;
    box-shadow: 0 15px 50px rgba(0,0,0,0.2);
}

.result-seal {
    width: 140px;
    height: 140px;
    margin: 0 auto 30px;
    background: radial-gradient(circle, #c9a227 0%, #8b6914 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 20px rgba(139,105,20,0.4), inset 0 -5px 15px rgba(0,0,0,0.2);
    position: relative;
    animation: sealAppear 0.8s ease-out;
}

@keyframes sealAppear {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.result-seal::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
}

.result-seal-text {
    font-family: 'Cinzel Decorative', serif;
    font-size: 2rem;
    color: #faf4e8;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.result-seal-icon {
    font-size: 3rem;
}

.result-type {
    font-family: 'Cinzel Decorative', serif;
    font-size: 3rem;
    font-weight: 700;
    color: #5a4a1a;
    margin-bottom: 10px;
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

@keyframes fadeInUp {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.result-name {
    font-size: 1.4rem;
    color: #7a6a4a;
    margin-bottom: 30px;
    font-style: italic;
    animation: fadeInUp 0.6s ease-out 0.5s both;
}

.result-divider {
    width: 150px;
    height: 2px;
    margin: 0 auto 30px;
    background: linear-gradient(90deg, transparent, #c9a227, transparent);
}

/* スコア表示 */
.result-scores {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 40px;
    animation: fadeInUp 0.6s ease-out 0.7s both;
}

.score-item {
    background: rgba(255,255,255,0.5);
    border: 1px solid #c9a227;
    border-radius: 3px;
    padding: 15px 10px;
}

.score-label {
    font-size: 0.8rem;
    color: #7a6a4a;
    margin-bottom: 8px;
}

.score-bar {
    height: 6px;
    background: rgba(139,105,20,0.2);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.score-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #c9a227, #8b6914);
    border-radius: 3px;
    width: 0%;
    transition: width 1s ease-out;
}

.score-value {
    font-family: 'Cinzel Decorative', serif;
    font-size: 1rem;
    color: #5a4a1a;
}

/* 認知機能表示 */
.cognitive-functions {
    margin-bottom: 40px;
    padding: 25px;
    background: rgba(255,255,255,0.3);
    border: 1px solid rgba(201, 162, 39, 0.3);
    border-radius: 5px;
    animation: fadeInUp 0.6s ease-out 0.9s both;
}

.cognitive-functions h4 {
    font-family: 'Cinzel Decorative', serif;
    font-size: 1rem;
    color: #5a4a1a;
    margin-bottom: 15px;
    letter-spacing: 0.1em;
}

.function-stack {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.function-item {
    padding: 8px 16px;
    background: rgba(201, 162, 39, 0.15);
    border: 1px solid #c9a227;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #5a4a1a;
}

.function-item:first-child {
    background: linear-gradient(135deg, #c9a227, #8b6914);
    color: #faf4e8;
    font-weight: bold;
}

/* 結果ボタン */
.result-btn {
    display: inline-block;
    padding: 18px 50px;
    background: linear-gradient(135deg, #c9a227, #8b6914);
    color: #faf4e8;
    text-decoration: none;
    border-radius: 3px;
    font-size: 1.1rem;
    transition: all 0.3s;
    box-shadow: 0 5px 20px rgba(139,105,20,0.3);
    border: none;
    cursor: pointer;
    animation: fadeInUp 0.6s ease-out 1.1s both;
}

.result-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(139,105,20,0.4);
}

/* リトライボタン */
.retry-btn {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 30px;
    background: transparent;
    border: 1px solid #c9a227;
    color: #5a4a1a;
    text-decoration: none;
    border-radius: 3px;
    font-size: 0.95rem;
    transition: all 0.3s;
    cursor: pointer;
}

.retry-btn:hover {
    background: rgba(201, 162, 39, 0.15);
}

/* ローディング */
.loading {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 3px solid rgba(201, 162, 39, 0.2);
    border-top-color: #c9a227;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: 1.1rem;
    color: #5a4a1a;
    letter-spacing: 0.1em;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .container {
        padding: 40px 15px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .question-card {
        padding: 35px 25px;
    }

    .question-text {
        font-size: 1.1rem;
    }

    .option {
        padding: 20px;
    }

    .option:hover {
        padding-left: 35px;
    }

    .result-scores {
        grid-template-columns: repeat(2, 1fr);
    }

    .version-select {
        flex-direction: column;
        gap: 15px;
    }

    .corner-decor {
        display: none;
    }

    .result-type {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .header-emblem {
        width: 80px;
        height: 80px;
        font-size: 2.5rem;
    }

    .question-text {
        font-size: 1rem;
        line-height: 1.8;
    }

    .option-text {
        font-size: 0.95rem;
    }

    .nav-buttons {
        flex-direction: column;
    }

    .nav-btn {
        width: 100%;
    }
}

/* 非表示ユーティリティ */
.hidden {
    display: none !important;
}