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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f2df0c;
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.main-container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.quiz-title {
    color: #2c3e50;
    font-size: 2.5em;
    margin-bottom: 20px;
    font-weight: 700;
}

.timer-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
}

.current-time {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
    color: #555;
}

.clock-icon {
    width: 24px;
    height: 24px;
    fill: #555;
}

.circular-timer {
    position: relative;
    width: 120px;
    height: 120px;
}

.circular-timer svg {
    transform: rotate(-90deg);
}

.timer-background {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: #4caf50;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.timer-progress.warning {
    stroke: #ff9800;
}

.timer-progress.danger {
    stroke: #f44336;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5em;
    font-weight: 600;
    color: #333;
}

.timer-text.danger {
    animation: blink 1s infinite;
    color: #f44336;
}

.instructions-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 25px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.answer-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 25px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.answer-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.instructions-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.questions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

@media (min-width: 768px) {
    .questions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .questions-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.question-tile {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.question-tile:nth-child(4n+1) {
    background: #e8f5e9;
}

.question-tile:nth-child(4n+2) {
    background: #e3f2fd;
}

.question-tile:nth-child(4n+3) {
    background: #fce4ec;
}

.question-tile:nth-child(4n) {
    background: #fff3e0;
}

.question-tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.question-number {
    display: inline-block;
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    margin-bottom: 15px;
    font-weight: 600;
}

.question-text {
    color: #2c3e50;
    font-size: 1em;
    line-height: 1.5;
    margin-bottom: 15px;
    flex-grow: 1;
}

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

.option {
    background: white;
    border: 2px solid transparent;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.option:hover {
    border-color: #2196f3;
    background: #f0f7ff;
}

.option input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #2196f3;
}

.option label {
    cursor: pointer;
    color: #555;
    flex: 1;
}

.submit-section {
    text-align: center;
    margin-top: 40px;
}

.submit-button {
    background: linear-gradient(135deg, #2196f3, #1976d2);
    color: white;
    border: none;
    padding: 15px 50px;
    border-radius: 30px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(33, 150, 243, 0.4);
}

/* Instructions Drawer */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 999;
}

.drawer {
    position: fixed;
    right: -400px;
    top: 0;
    width: 400px;
    height: 100%;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.drawer.open {
    right: 0;
}

.drawer-header {
    background: #f8f9fa;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-title {
    font-size: 1.5em;
    color: #333;
    font-weight: 600;
}

.close-drawer {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #666;
    padding: 5px;
}

.close-drawer:hover {
    color: #333;
}

.drawer-content {
    padding: 30px;
}

.instruction-item {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.instruction-item:last-child {
    border-bottom: none;
}

.instruction-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.instruction-text {
    color: #666;
    line-height: 1.6;
}

.loading {
    text-align: center;
    padding: 60px;
    color: #666;
}

.loading-spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #2196f3;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 600px) {
    .drawer {
        width: 100%;
        right: -100%;
    }

    .questions-grid {
        grid-template-columns: 1fr;
    }

    .timer-section {
        gap: 20px;
    }

    .circular-timer {
        width: 100px;
        height: 100px;
    }

    .timer-text {
        font-size: 1.2em;
    }
}

/* Result chooser popup */
body.modal-open {
    overflow: hidden;
}

.result-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(17, 24, 39, 0.62);
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.result-popup-overlay.open {
    opacity: 1;
    visibility: visible;
}

.result-popup {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 1101;
    width: min(92vw, 470px);
    transform: translate(-50%, -46%) scale(0.96);
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 28px 80px rgba(17, 24, 39, 0.34);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}

.result-popup.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
}

.result-popup-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: #eef1f4;
    color: #344054;
    font-size: 27px;
    line-height: 1;
    cursor: pointer;
}

.result-popup-close:hover,
.result-popup-close:focus-visible {
    background: #dde3e9;
    outline: 3px solid rgba(33, 150, 243, 0.2);
}

.result-popup-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin: 0 auto 14px;
    border-radius: 18px;
    background: linear-gradient(135deg, #2196f3, #1976d2);
    color: #fff;
    font-size: 29px;
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(33, 150, 243, 0.28);
}

.result-popup h2 {
    margin: 0 0 22px;
    color: #1f2937;
    text-align: center;
    font-size: 1.55rem;
    line-height: 1.2;
}

.result-popup-options {
    display: grid;
    gap: 13px;
}

.result-option {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 24px;
    align-items: center;
    gap: 13px;
    min-height: 82px;
    padding: 14px 16px;
    border: 2px solid #e6eaf0;
    border-radius: 17px;
    background: #fff;
    color: #1f2937;
    text-decoration: none;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.result-option:hover,
.result-option:focus-visible {
    transform: translateY(-2px);
    border-color: #2196f3;
    background: #f7fbff;
    box-shadow: 0 12px 28px rgba(31, 41, 55, 0.11);
    outline: none;
}

.result-option-number {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: #edf1f5;
    color: #344054;
    font-size: 1.05rem;
    font-weight: 800;
}

.result-option-ab .result-option-number {
    background: #e8f5e9;
    color: #16803c;
}

.result-option-copy {
    display: block;
    min-width: 0;
}

.result-option-copy strong,
.result-option-copy small {
    display: block;
}

.result-option-copy strong {
    margin-bottom: 4px;
    font-size: 1.02rem;
}

.result-option-copy small {
    color: #667085;
    font-size: 0.84rem;
    line-height: 1.35;
}

.result-option-arrow {
    color: #98a2b3;
    font-size: 2rem;
    line-height: 1;
}

@media (max-width: 520px) {
    .result-popup {
        width: calc(100vw - 28px);
        padding: 26px 17px 18px;
        border-radius: 20px;
    }

    .result-popup h2 {
        margin-bottom: 17px;
        font-size: 1.3rem;
    }

    .result-popup-icon {
        width: 50px;
        height: 50px;
        font-size: 25px;
    }

    .result-option {
        grid-template-columns: 42px minmax(0, 1fr) 18px;
        min-height: 76px;
        padding: 12px;
        gap: 10px;
    }

    .result-option-number {
        width: 40px;
        height: 40px;
    }

    .result-option-copy strong {
        font-size: 0.96rem;
    }

    .result-option-copy small {
        font-size: 0.78rem;
    }
}
