/* ── Personality Test Page ── */
.test-container {
    position: relative;
    z-index: 2;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.test-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0 0.8rem;
    gap: 0.5rem;
}

.test-back-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}
.test-back-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.test-logo {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-dark);
    letter-spacing: 0.05em;
}

/* ── Start Screen ── */
.start-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 0;
    animation: fadeInUp 0.6s ease;
}

.start-scroll-icon {
    font-size: 3.5rem;
    margin-bottom: 1.2rem;
    filter: drop-shadow(0 4px 12px rgba(193,102,75,0.2));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.start-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 0.6rem;
}

.start-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

.start-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 1rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--accent-light);
    background: var(--accent-glow);
    color: var(--accent-dark);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 2rem;
}

.start-btn {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 2.8rem;
    border: none;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: #fff;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.06em;
    box-shadow: 0 4px 20px rgba(193,102,75,0.3);
    transition: all 0.3s ease;
}
.start-btn:hover {
    background: var(--accent-dark);
    box-shadow: 0 6px 28px rgba(155,74,53,0.4);
    transform: translateY(-2px);
}
.start-btn:active {
    transform: translateY(0);
}

.start-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
    margin-top: 1.8rem;
}

.start-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.3rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--surface-muted);
}

.start-disclaimer {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 1.2rem;
    line-height: 1.6;
    opacity: 0.7;
}

/* ── Question Screen ── */
.question-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0 2rem;
    animation: fadeInScale 0.4s ease;
}

.progress-wrap {
    margin-bottom: 1.5rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.progress-bar {
    height: 6px;
    background: var(--surface-muted);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.question-card {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.question-number {
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.6rem;
    letter-spacing: 0.04em;
}

.question-text {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 1.8rem;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.option-btn {
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    width: 100%;
    padding: 1rem 1.2rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    cursor: pointer;
    text-align: left;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.5;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
}
.option-btn:hover {
    border-color: var(--accent);
    background: var(--surface-elevated);
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}
.option-btn:active {
    transform: translateX(2px);
}
.option-btn.selected {
    border-color: var(--accent);
    background: var(--accent-glow);
    box-shadow: 0 0 0 3px rgba(193,102,75,0.08);
}

.option-letter {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: var(--surface-muted);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.25s ease;
}
.option-btn.selected .option-letter {
    background: var(--accent);
    color: #fff;
}

.option-body {
    flex: 1;
}

.option-icon {
    font-size: 0.9rem;
    opacity: 0.5;
    transition: opacity 0.25s ease;
}
.option-btn.selected .option-icon {
    opacity: 1;
}

.skip-hint {
    display: block;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 1rem;
    font-style: italic;
}

.question-nav {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
}

.nav-btn {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--surface);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.nav-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.nav-btn.nav-next {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 600;
}
.nav-btn.nav-next:hover {
    background: var(--accent-dark);
}
.nav-btn.nav-next:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ── Result Screen ── */
.result-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0 2rem;
    animation: fadeInUp 0.6s ease;
}

.result-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.result-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    margin-bottom: 0.3rem;
}

.result-emoji {
    font-size: 4rem;
    display: block;
    margin-bottom: 0.6rem;
    filter: drop-shadow(0 4px 16px rgba(193,102,75,0.15));
}

.result-code {
    display: none;
}

.result-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.result-shinchen {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-dark);
    margin-bottom: 0;
    letter-spacing: 0.04em;
}

.result-time-range {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.4rem;
    letter-spacing: 0.04em;
}

/* ── Result Card ── */
.result-card {
    width: 100%;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 1.5rem;
}

.result-slogan {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-dark);
    text-align: center;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    background: var(--accent-glow);
    border-radius: var(--radius-md);
    line-height: 1.5;
}

.result-desc {
    font-size: 0.93rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1.2rem;
    text-align: justify;
}

.result-yiji {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.yiji-box {
    padding: 0.9rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.yiji-box h4 {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.yiji-box.dos h4 { color: #4a8c5c; }
.yiji-box.donts h4 { color: #c1664b; }

.yiji-box ul {
    list-style: none;
    padding: 0;
    text-align: center;
}

.yiji-box li {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ── Result Actions ── */
.result-actions {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    width: 100%;
}

.result-btn {
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.85rem 1.5rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--surface);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}
.result-btn:hover {
    background: var(--surface-elevated);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: var(--shadow-md);
}
.result-btn:active {
    transform: scale(0.98);
}

.result-btn.primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 700;
    font-family: var(--font-display);
    letter-spacing: 0.05em;
    box-shadow: 0 4px 16px rgba(193,102,75,0.25);
}
.result-btn.primary:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    color: #fff;
}

.result-btn.secondary {
    background: var(--surface-muted);
    border-color: transparent;
}

.result-disclaimer {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 1rem;
    line-height: 1.6;
    opacity: 0.7;
}

.result-btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    width: 100%;
}

/* ── Share Modal ── */
.share-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.share-modal.is-open {
    display: flex;
}

.share-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12,10,8,0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.share-panel {
    position: relative;
    z-index: 1;
    width: min(380px, 90vw);
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.4rem;
    box-shadow: var(--shadow-xl);
    text-align: center;
}

.share-panel-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

.share-panel-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.share-img-wrap {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1rem;
    border: 1px solid var(--border-strong);
}

.share-img-wrap img {
    display: block;
    width: 100%;
    height: auto;
}

.share-panel-actions {
    display: flex;
    gap: 0.6rem;
}

.share-panel-btn {
    flex: 1;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}
.share-panel-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.share-panel-btn.primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.share-panel-btn.primary:hover {
    background: var(--accent-dark);
}

.share-close {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
}
.share-close:hover {
    color: var(--text-primary);
    background: var(--surface-muted);
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .start-title {
        font-size: 1.6rem;
    }
    .question-text {
        font-size: 1.15rem;
    }
    .result-code {
        font-size: 2.4rem;
    }
    .result-title {
        font-size: 1.3rem;
    }
    .result-emoji {
        font-size: 3rem;
    }
    .result-shinchen {
        font-size: 1.25rem;
    }
    .result-time-range {
        font-size: 0.92rem;
    }
    .result-yiji {
        grid-template-columns: 1fr;
    }
    .result-card {
        padding: 1.1rem;
    }
    .test-container {
        padding: 0 0.6rem 1.5rem;
    }

    /* Share modal — compact for mobile */
    .share-modal {
        padding: 0.5rem;
        align-items: flex-end;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    }
    .share-panel {
        width: 100%;
        max-width: 100%;
        max-height: 75vh;
        overflow-y: auto;
        padding: 1rem 1rem calc(0.8rem + env(safe-area-inset-bottom));
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
    .share-panel-title {
        font-size: 0.95rem;
        margin-bottom: 0.2rem;
    }
    .share-panel-hint {
        font-size: 0.75rem;
        margin-bottom: 0.6rem;
    }
    .share-img-wrap {
        max-height: 42vh;
        overflow: hidden;
        margin-bottom: 0.6rem;
    }
    .share-img-wrap img {
        max-height: 42vh;
        width: auto;
        max-width: 100%;
        margin: 0 auto;
    }
    .share-panel-actions {
        gap: 0.4rem;
    }
    .share-panel-btn {
        font-size: 0.82rem;
        padding: 0.55rem 0.8rem;
    }
    .share-close {
        top: 0.4rem;
        right: 0.4rem;
    }
}
