.quiz-page {
    display: flex;
    min-height: 100vh;
    min-height: 100svh;
    align-items: center;
    justify-content: center;
    padding: clamp(0.75rem, 3vw, 2rem);
    background-color: #0a1121;
    background-image:
        linear-gradient(rgba(96, 165, 250, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(96, 165, 250, 0.045) 1px, transparent 1px),
        radial-gradient(circle at 88% 8%, rgba(59, 130, 246, 0.08), transparent 74%),
        radial-gradient(circle at bottom left, rgba(30, 64, 175, 0.18), transparent 50%);
    background-size: 34px 34px, 34px 34px, auto, auto;
    background-attachment: fixed;
}

.quiz-app {
    width: min(100%, 48rem);
    overflow: visible;
    border-radius: 1.75rem;
    background: transparent;
    box-shadow: none;
}

#start-screen,
#priority-screen,
#quiz-screen,
#loading-screen,
#results-screen {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 1.75rem;
    background-color: #fff;
    box-shadow: 0 24px 70px rgba(2, 6, 23, 0.32), 0 2px 8px rgba(2, 6, 23, 0.08);
}

#start-screen {
    position: relative;
    padding: clamp(1.5rem, 6vw, 4rem);
    background:
        radial-gradient(ellipse at 50% 0%, rgba(191, 219, 254, 0.72), transparent 46%),
        linear-gradient(180deg, #f8fbff 0%, #fff 72%);
}

#start-screen .mb-8.inline-flex {
    width: 6rem;
    height: 6rem;
    padding: 0.85rem;
    border-color: #bfdbfe;
    background: linear-gradient(145deg, #fff, #dbeafe);
    /* box-shadow: 0 12px 28px rgba(37, 99, 235, 0.16); */
}

#start-screen h1 {
    margin-bottom: 1.1rem;
    letter-spacing: -0.035em;
    background-image: linear-gradient(110deg, #1d4ed8 0%, #312e81 52%, #0f172a 100%);
}

#start-screen p {
    max-width: 31rem;
    margin-bottom: 2rem;
    color: #475569;
}

#start-btn {
    border-color: #1d4ed8;
    background: linear-gradient(115deg, #1d4ed8 0%, #3730a3 100%);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.28);
}

#start-btn > div {
    background: linear-gradient(115deg, #2563eb, #4338ca);
}

#start-screen > .relative.z-10 > .flex > span {
    border-color: #dbeafe;
    color: #475569;
    background: rgba(239, 246, 255, 0.9);
}

#start-screen > .relative.z-10 > .flex > span i {
    color: #3b82f6;
}

#start-btn:focus-visible {
    outline-color: #2563eb;
}

@media (hover: hover) {
    #start-btn:hover {
        box-shadow: 0 16px 34px rgba(37, 99, 235, 0.36);
    }
}

#priority-screen,
#quiz-screen {
    padding: clamp(1.15rem, 5vw, 3.5rem);
}

#priority-screen h2 {
    font-size: clamp(1.65rem, 5vw, 1.875rem);
}

.drop-zone {
    min-height: 4.25rem;
    gap: 0.55rem;
    padding: 0.7rem;
    border-radius: 1rem;
}

.category-chip {
    min-height: 2.8rem;
    touch-action: manipulation;
}

#quiz-screen .mb-8.flex {
    gap: 0.65rem;
}

#question-content.question-slide-out-left {
    animation: questionExitLeft 150ms ease-in both;
    pointer-events: none;
}

#question-content.question-slide-out-right {
    animation: questionExitRight 150ms ease-in both;
    pointer-events: none;
}

#question-content.question-slide-in-right {
    animation: questionEnterRight 260ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

#question-content.question-slide-in-left {
    animation: questionEnterLeft 260ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

@keyframes questionExitLeft {
    to {
        opacity: 0;
        transform: translateX(-2rem);
    }
}

@keyframes questionExitRight {
    to {
        opacity: 0;
        transform: translateX(2rem);
    }
}

@keyframes questionEnterRight {
    from {
        opacity: 0;
        transform: translateX(2rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes questionEnterLeft {
    from {
        opacity: 0;
        transform: translateX(-2rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

#question-text {
    min-width: 0;
    font-size: clamp(1.25rem, 4.6vw, 1.875rem);
    overflow-wrap: anywhere;
}

.answer-btn {
    min-height: 3.35rem;
    gap: 0.75rem;
    text-align: right;
    -webkit-tap-highlight-color: transparent;
}

#important-toggle {
    flex: 0 0 auto;
    min-width: 3rem;
}

#loading-screen {
    min-height: 25rem;
    padding: clamp(2rem, 8vw, 4rem);
}

#loading-screen p {
    max-width: 32rem;
    line-height: 1.7;
}

#results-screen {
    background: #f8fafc;
}

#results-container {
    width: min(100%, 35rem);
}

#results-screen .result-card,
#results-screen .coalition-no-match {
    min-width: 0;
    overflow-wrap: anywhere;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

#results-screen #share-btn,
#results-screen button[onclick] {
    min-height: 3.25rem;
}

.result-share-modal[hidden] {
    display: none;
}

.result-share-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(2, 6, 23, 0.78);
    backdrop-filter: blur(6px);
}

.result-share-dialog {
    width: min(100%, 31rem);
    max-height: min(92vh, 54rem);
    overflow: auto;
    padding: 1.15rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 1.4rem;
    background: #f8fafc;
    box-shadow: 0 24px 70px rgba(2, 6, 23, 0.4);
}

.result-share-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.result-share-heading h2 {
    margin: 0;
    color: #0f172a;
    font-size: 1.2rem;
    font-weight: 900;
}

.result-share-heading p {
    margin: 0.25rem 0 0;
    color: #64748b;
    font-size: 0.85rem;
    line-height: 1.5;
}

.result-share-close {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.8rem;
    background: #fff;
    color: #334155;
    font-size: 1.5rem;
    cursor: pointer;
}

.result-share-preview {
    display: block;
    width: min(100%, 20rem);
    max-height: 48vh;
    margin: 0 auto 0.8rem;
    border: 1px solid #dbeafe;
    border-radius: 1rem;
    background: #0f172a;
    object-fit: contain;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.15);
}

.result-share-status {
    min-height: 1.4em;
    margin: 0 0 0.55rem;
    color: #475569;
    font-size: 0.82rem;
    line-height: 1.5;
    text-align: center;
}

.result-share-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.result-share-actions button {
    display: inline-flex;
    min-height: 2.9rem;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 0.55rem;
    border: 1px solid #dbeafe;
    border-radius: 0.85rem;
    background: #fff;
    color: #1e3a8a;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
}

.result-share-actions .result-share-primary {
    grid-column: 1 / -1;
    border-color: transparent;
    background: linear-gradient(120deg, #2563eb, #4f46e5);
    color: #fff;
}

.result-share-actions button:focus-visible,
.result-share-close:focus-visible {
    outline: 3px solid #60a5fa;
    outline-offset: 2px;
}

.quiz-page button:focus-visible,
.quiz-page [tabindex]:focus-visible {
    outline: 3px solid #60a5fa;
    outline-offset: 3px;
}

@media (max-width: 640px) {
    .quiz-page {
        align-items: flex-start;
        padding: max(0.6rem, env(safe-area-inset-top)) 0.6rem max(0.6rem, env(safe-area-inset-bottom));
        background-attachment: scroll;
    }

    .quiz-app {
        width: 100%;
        margin: auto 0;
    }

    #start-screen,
    #priority-screen,
    #quiz-screen,
    #loading-screen,
    #results-screen {
        border-radius: 1.35rem;
    }

    .result-share-modal {
        align-items: flex-end;
        padding: 0.5rem;
    }

    .result-share-dialog {
        max-height: 94vh;
        padding: 0.9rem;
        border-radius: 1.25rem;
    }

    .result-share-preview {
        width: min(100%, 15rem);
        max-height: 38vh;
    }

    #start-screen {
        padding: 1.75rem 1.15rem;
    }

    #start-screen h1 {
        margin-bottom: 1rem;
        font-size: clamp(2rem, 9vw, 2.8rem);
        line-height: 1.15;
    }

    #start-screen p {
        margin-bottom: 1.75rem;
        font-size: 1rem;
        line-height: 1.65;
    }

    #start-screen .mb-8.inline-flex {
        width: 5rem;
        height: 5rem;
        margin-bottom: 1.25rem;
        border-radius: 1.4rem;
    }

    #start-btn,
    #start-quiz-btn,
    #skip-priority-btn {
        min-height: 3.4rem;
        padding: 0.85rem 1.1rem;
        font-size: 1rem;
    }

    #priority-screen,
    #quiz-screen {
        padding: 1.25rem 1rem;
    }

    #priority-screen > .text-center {
        margin-bottom: 1.35rem;
    }

    #priority-screen > .text-center p {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    #priority-screen h3 {
        font-size: 0.95rem;
        line-height: 1.4;
    }

    .drop-zone {
        min-height: 3.75rem;
        padding: 0.55rem;
    }

    .category-chip {
        flex: 1 1 calc(50% - 0.55rem);
        justify-content: center;
        padding: 0.6rem 0.5rem;
        font-size: 0.88rem;
        cursor: grab;
    }

    #priority-screen > .mt-10 {
        margin-top: 1.5rem;
        gap: 0.65rem;
    }

    #quiz-screen .mb-8.flex {
        align-items: flex-start;
        margin-bottom: 1.25rem;
    }

    #quiz-screen .mb-8.flex > div {
        padding: 0.45rem 0.7rem;
        font-size: 0.75rem;
    }

    #quiz-screen .w-full.bg-slate-100 {
        margin-bottom: 1.6rem;
    }

    #quiz-screen .flex.flex-col.mb-5 > .flex {
        gap: 0.6rem;
    }

    #question-text {
        font-size: 1.25rem;
        line-height: 1.55;
    }

    #important-toggle > div {
        width: 2.65rem;
        height: 2.65rem;
    }

    .answer-btn {
        min-height: 3.1rem;
        padding: 0.75rem 0.9rem;
        border-radius: 1rem;
        font-size: 0.98rem;
    }

    #question-description.desc-open {
        max-height: 15rem;
        margin-bottom: 1rem;
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    #loading-screen {
        min-height: 22rem;
        padding: 2.5rem 1.2rem;
    }

    #loading-screen h2 {
        font-size: 1.55rem;
    }

    #loading-screen p {
        font-size: 0.95rem;
    }

    #results-screen > div:first-child {
        padding: 1.5rem 1rem 1.75rem !important;
        border-radius: 1.3rem 1.3rem 0 0 !important;
    }

    #results-screen > div:last-child {
        padding: 1rem 0.75rem 0.9rem !important;
    }

    #results-screen .result-card {
        padding: 0.9rem !important;
        border-radius: 1rem !important;
    }

    #results-screen .result-card h3 {
        font-size: 1.1rem !important;
        overflow-wrap: anywhere;
    }

    #results-screen .result-card > div:first-child {
        gap: 0.5rem !important;
    }

    #results-screen .result-card [style*="min-width:72px"] {
        min-width: 4.1rem !important;
        padding: 0.4rem 0.5rem !important;
    }

    #results-screen .result-card [style*="font-size:1.9rem"] {
        font-size: 1.5rem !important;
    }

    #results-screen .result-card > div[style*="padding:1rem 1.1rem"] {
        padding: 0.8rem !important;
        gap: 0.55rem !important;
    }

    #results-screen .result-card > div[style*="padding:1rem 1.1rem"] > div:nth-child(2) {
        min-width: 0;
        flex: 1;
    }

    #results-screen .result-card [data-coalition-open] {
        font-size: 0.85rem;
    }
}

@media (max-width: 360px) {
    #quiz-screen .mb-8.flex {
        flex-wrap: wrap;
    }

    #quiz-screen .mb-8.flex > div:last-child {
        max-width: 100%;
    }

    .category-chip {
        flex-basis: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    #question-content.question-slide-out-left,
    #question-content.question-slide-out-right,
    #question-content.question-slide-in-right,
    #question-content.question-slide-in-left {
        animation-duration: 0.01ms !important;
    }

    .quiz-page *,
    .quiz-page *::before,
    .quiz-page *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
