/* 引入 Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Bungee&family=ZCOOL+KuaiLe&family=Caprasimo&display=swap');

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

:root {
    --blue: #0E1B4F;
    --red: #D11B3D;
    --yellow: #F6AC00;
    --cream: #F5E8C7;
    --text: #0E1B4F;
    --border: 3px solid var(--blue);
    --radius: 0px;
}

body {
    font-family: "ZCOOL KuaiLe", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    font-weight: 410;
    letter-spacing: 2.8px;
    background-color: var(--cream);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.5;
}

header {
    width: 100%;
    background-color: var(--blue);
    color: var(--cream);
    padding: 10px 10px;
    text-align: center;
    border-bottom: var(--border);
}

header .brand {
    font-family: 'Caprasimo', serif;
    font-size: 16px;
    font-weight: lighter;
    letter-spacing: 5px;
    color: var(--yellow);
}

header h1 {
    font-family: 'Caprasimo', cursive;
    font-size: 50px;
    font-weight: 500;
    letter-spacing: 30px;
    color: var(--red);
    text-shadow: 2px 2px 0 var(--cream);
    margin: 0;
}

main {
    width: 100%;
    max-width: 760px;
    padding: 30px 20px 80px;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

#intro {
    text-align: center;
    padding-top: 20px;
}

#intro h2 {
    font-size: 26px;
    color: var(--red);
    margin-bottom: 20px;
}

#intro .desc {
    font-size: 16px;
    margin-bottom: 15px;
}

button {
    font-family: "ZCOOL KuaiLe", cursive;
    border: var(--border);
    cursor: pointer;
    font-size: 16px;
    letter-spacing: 2px;
    border-radius: var(--radius);
    box-shadow: 4px 4px 0 var(--blue);
    transition: all 0.1s ease;
}

button:active {
    transform: translate(4px, 4px);
    box-shadow: 0 0 0 var(--blue);
}

.btn-primary {
    display: inline-block;
    background-color: var(--red);
    color: var(--cream);
    padding: 16px 48px;
    margin-top: 10px;
}

.btn-secondary {
    display: inline-block;
    background-color: var(--yellow);
    color: var(--blue);
    padding: 12px 28px;
}

#intro .author, #intro .note {
    margin-top: 25px;
    font-size: 16px;
}

#intro .author a {
    color: var(--red);
    text-decoration: none;
    border-bottom: 2px solid var(--red);
}

.progress-wrap {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.progress-bar {
    flex: 1;
    height: 14px;
    background-color: var(--cream);
    border: var(--border);
}

.progress-fill {
    height: 100%;
    width: 0;
    background-color: var(--red);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 14px;
    white-space: nowrap;
}

.hint {
    font-size: 12px;
    margin-bottom: 5px;
    color: var(--blue);
}

.hint-action-link {
    text-decoration: underline;
    color: #06c;
    cursor: pointer;
}

.quiz-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.quiz-actions .btn-secondary:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
}

.question {
    background-color: var(--cream);
    padding: 30px 24px;
    border: var(--border);
    box-shadow: 6px 6px 0 var(--blue);
    margin-bottom: 25px;
}

.question-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    font-family: 'Bungee', cursive;
    font-weight: 200;
    letter-spacing: -2px;
    font-size: 18px;
}

.badge {
    background-color: var(--yellow);
    padding: 4px 6px;
    border: 2px solid var(--blue);
    box-shadow: 6px 6px 0 var(--blue);
    color: var(--blue);
}

.question-title {
    font-size: 18px;
    margin-bottom: 25px;
    white-space: pre-wrap;
    color: var(--blue);
}

.options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option-btn {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    text-align: left;
    background-color: var(--cream);
    color: var(--blue);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    /* Remove active transform since selected state will handle it */
}

.option-btn:active {
    transform: none;
    box-shadow: 4px 4px 0 var(--blue);
}

.option-btn:hover {
    background-color: #f7eed7;
}

.option-code {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background-color: var(--blue);
    color: var(--cream);
    font-family: 'Caprasimo', cursive;
    font-size: 18px;
    border: 2px solid var(--blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: -2px;
    z-index: 2;
}

.option-btn > div:last-child {
    z-index: 2;
    position: relative;
}

.option-btn.selected {
    background-color: var(--yellow);
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--blue);
}

.option-btn.selected .option-code {
    background-color: var(--red);
    color: var(--cream);
    border-color: var(--blue);
}

/* Very subtle Halftone animation for selected button */
.option-btn.selected::after {
    content: "";
    position: absolute;
    top: -50px;
    right: -50px;
    bottom: -50px;
    left: -50px;
    pointer-events: none;
    z-index: 1;
    background-image: radial-gradient(rgba(14, 27, 79, 0.03) 20%, transparent 20%),
    radial-gradient(rgba(14, 27, 79, 0.03) 20%, transparent 20%);
    background-size: 10px 10px;
    background-position: 0 0, 5px 5px;
    animation: halftoneMove 1.5s linear infinite;
}

@keyframes halftoneMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(-20px, 20px);
    }
}

#result .result-card {
    background-color: var(--cream);
    padding: 30px;
    border: var(--border);
    box-shadow: 8px 8px 0 var(--blue);
    margin-bottom: 25px;
}

#result .top-info {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: var(--border);
    padding-bottom: 20px;
}

#result .type-kicker {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--red);
}

#result .type-name {
    font-family: 'Caprasimo', 'ZCOOL KuaiLe', cursive;
    font-size: 48px;
    font-weight: 500;
    color: var(--blue);
    margin-bottom: 15px;
}

#result .match {
    display: inline-block;
    background-color: var(--yellow);
    color: var(--blue);
    border: 3px solid var(--blue);
    padding: 6px 16px;
    margin-bottom: 15px;
}

#result .type-subname {
    font-size: 14px;
    color: var(--blue);
}

.poster-box {
    border: var(--border);
    background-color: var(--cream);
    padding: 15px;
    margin-bottom: 25px;
    box-shadow: 4px 4px 0 var(--blue);
}

.poster-image {
    width: 100%;
    border: var(--border);
    display: block;
}

.poster-image--glow {
    animation: solarGlow 1.8s ease-in-out infinite;
    filter: brightness(1.16) saturate(1.35) drop-shadow(0 0 10px rgba(246, 172, 0, 0.75)) drop-shadow(0 0 22px rgba(209, 27, 61, 0.35));
    box-shadow: 0 0 14px rgba(246, 172, 0, 0.75), 0 0 30px rgba(246, 172, 0, 0.45), 0 0 58px rgba(209, 27, 61, 0.18);
    transform-origin: center;
    will-change: transform, filter, box-shadow;
}

.poster-box.no-image .poster-image {
    display: none;
}

@keyframes solarGlow {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1.12) saturate(1.28) drop-shadow(0 0 8px rgba(246, 172, 0, 0.65)) drop-shadow(0 0 18px rgba(209, 27, 61, 0.24));
        box-shadow: 0 0 12px rgba(246, 172, 0, 0.7), 0 0 26px rgba(246, 172, 0, 0.38), 0 0 50px rgba(209, 27, 61, 0.14);
    }

    50% {
        transform: scale(1.015);
        filter: brightness(1.28) saturate(1.5) drop-shadow(0 0 16px rgba(246, 172, 0, 0.92)) drop-shadow(0 0 34px rgba(255, 235, 140, 0.55));
        box-shadow: 0 0 18px rgba(246, 172, 0, 0.9), 0 0 40px rgba(246, 172, 0, 0.58), 0 0 78px rgba(255, 235, 140, 0.25);
    }
}

.poster-caption {
    margin-top: 15px;
    color: var(--blue);
    text-align: center;
}

.analysis-box, .dim-box, .note-box {
    border: var(--border);
    padding: 20px;
    margin-bottom: 20px;
    background-color: var(--cream);
    box-shadow: 4px 4px 0 var(--blue);
}

.analysis-box h3, .dim-box h3, .note-box h3 {
    font-size: 16px;
    font-weight: 520;
    margin-bottom: 15px;
    color: var(--red);
    border-bottom: 2px solid var(--blue);
    padding-bottom: 8px;
}

#resultDesc, .note-box p {
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
}

.dim-list {
    display: grid;
    gap: 15px;
}

.dim-item {
    border: var(--border);
    padding: 15px;
    background-color: var(--yellow);
}

.dim-item-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.dim-item-score {
    color: var(--red);
}

.dim-item p {
    font-size: 14px;
    color: var(--blue);
}


.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

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

.question {
    animation: fadeUp 0.25s ease;
}

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

    .type-name {
        font-size: 34px;
    }

    .btn-primary {
        padding: 14px 32px;
    }
}

.mini-spinner {
    display: inline-block;
    width: 0.9em;
    height: 0.9em;
    border: 2px solid #ccc;
    border-top-color: #333;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

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

@keyframes fadein {
    to {
        opacity: 1;
    }
}

.flip-all {
    transform: rotate(180deg);
}
