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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    min-height: 100vh;
    color: #e4e4e4;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: contain;
}

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

.timer-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.timer-display {
    background: #1a1a1a;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    color: #888888;
    border: 2px solid #888888;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-timer {
    background: #666666;
    color: #1a1a1a;
}

.btn-timer:hover {
    background: #555555;
    transform: scale(1.05);
}

.btn-timer.paused {
    background: #ff6b6b;
}

/* Screen */
.screen {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Paper Selection */
#selectionScreen h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #888888;
}

.mode-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.mode-btn {
    padding: 12px 30px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #888;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    border-color: #888888;
    color: #888888;
}

.mode-btn.active {
    background: linear-gradient(135deg, #666666 0%, #888888 100%);
    color: #1a1a1a;
    border-color: transparent;
}

.mode-description {
    text-align: center;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(136, 136, 136, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(136, 136, 136, 0.3);
}

.mode-description p {
    color: #aaa;
    font-size: 0.95rem;
    margin: 0;
}

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

.paper-item {
    background: linear-gradient(135deg, #2d2d44 0%, #1f1f35 100%);
    padding: 20px 30px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.paper-item:hover {
    border-color: #888888;
    transform: translateX(10px);
}

.paper-item h3 {
    color: #fff;
    font-size: 1.2rem;
}

.paper-item span {
    color: #888;
    font-size: 0.9rem;
}

/* Question Container */
.question-container {
    margin-bottom: 30px;
}

.question-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.question-num {
    background: #666666;
    color: #1a1a1a;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
}

.question-progress {
    color: #888;
}

.question-text {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    white-space: pre-wrap;
}

.options-container {
    display: grid;
    gap: 12px;
}

.option {
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.option:hover {
    border-color: #888888;
    background: rgba(136, 136, 136, 0.1);
}

.option.selected {
    border-color: #aaaaaa;
    background: rgba(170, 170, 170, 0.15);
}

.option-label {
    background: #666666;
    color: #1a1a1a;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.option.selected .option-label {
    background: #aaaaaa;
}

.option-text {
    flex: 1;
    line-height: 1.5;
}

/* Study Feedback */
.study-feedback {
    margin-top: 30px;
    padding: 25px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.feedback-header {
    margin-bottom: 20px;
    text-align: center;
}

.feedback-status {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1.3rem;
    font-weight: 700;
}

.feedback-status.correct {
    background: rgba(170, 170, 170, 0.2);
    color: #aaaaaa;
    border: 2px solid #aaaaaa;
}

.feedback-status.incorrect {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
    border: 2px solid #ff6b6b;
}

.feedback-content {
    margin-bottom: 20px;
}

.feedback-section {
    margin-bottom: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.feedback-section strong {
    display: block;
    color: #888888;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.feedback-section span,
.feedback-section p {
    color: #e4e4e4;
    line-height: 1.6;
    margin: 0;
}

.btn-continue {
    width: 100%;
    background: linear-gradient(135deg, #666666 0%, #888888 100%);
    color: #1a1a1a;
    padding: 15px;
    font-size: 1.1rem;
}

.btn-continue:hover {
    transform: scale(1.02);
}

/* Navigation */
.navigation {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.btn-nav {
    background: #2d2d44;
    color: #fff;
    min-width: 120px;
}

.btn-nav:hover {
    background: #3d3d54;
}

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

.btn-submit {
    background: linear-gradient(135deg, #888888 0%, #666666 100%);
    color: #1a1a1a;
    min-width: 150px;
}

.btn-submit:hover {
    transform: scale(1.05);
}

/* Question Palette */
.question-palette {
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 12px;
}

.question-palette h3 {
    margin-bottom: 15px;
    color: #888888;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
    margin-bottom: 15px;
}

.palette-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    background: #2d2d44;
    color: #fff;
    transition: all 0.2s ease;
}

.palette-btn:hover {
    transform: scale(1.1);
}

.palette-btn.answered {
    background: #aaaaaa;
    color: #1a1a1a;
}

.palette-btn.current {
    border: 3px solid #888888;
}

.palette-legend {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #888;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.answered {
    background: #aaaaaa;
}

.dot.unanswered {
    background: #2d2d44;
}

.dot.current {
    background: #2d2d44;
    border: 2px solid #888888;
}

/* Result Screen */
#resultScreen h2 {
    text-align: center;
    color: #888888;
    margin-bottom: 30px;
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 40px;
}

.result-card {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.result-card.correct {
    border-color: #aaaaaa;
}

.result-card.incorrect {
    border-color: #ff6b6b;
}

.result-card.time {
    border-color: #888888;
}

.result-label {
    display: block;
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.result-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
}

.result-card.correct .result-value {
    color: #aaaaaa;
}

.result-card.incorrect .result-value {
    color: #ff6b6b;
}

.result-card.time .result-value {
    color: #888888;
}

.detailed-results h3 {
    color: #888888;
    margin-bottom: 20px;
}

.review-container {
    max-height: 500px;
    overflow-y: auto;
}

.review-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 4px solid #888;
}

.review-item.correct {
    border-left-color: #aaaaaa;
}

.review-item.incorrect {
    border-left-color: #ff6b6b;
}

.review-item.unanswered {
    border-left-color: #ffa500;
}

.review-question {
    font-weight: 600;
    margin-bottom: 10px;
    color: #fff;
}

.review-answers {
    display: grid;
    gap: 5px;
    font-size: 0.9rem;
}

.review-answers span {
    padding: 5px 10px;
    border-radius: 5px;
}

.your-answer {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
}

.your-answer.correct {
    background: rgba(170, 170, 170, 0.2);
    color: #aaaaaa;
}

.correct-answer {
    background: rgba(170, 170, 170, 0.2);
    color: #aaaaaa;
}

.explanation {
    margin-top: 10px;
    padding: 10px;
    background: rgba(136, 136, 136, 0.1);
    border-radius: 5px;
    font-size: 0.85rem;
    color: #aaa;
}

.btn-primary {
    display: block;
    margin: 30px auto 0;
    background: linear-gradient(135deg, #666666 0%, #888888 100%);
    color: #1a1a1a;
    padding: 15px 40px;
    font-size: 1.1rem;
}

.btn-primary:hover {
    transform: scale(1.05);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888888;
    border-radius: 4px;
}

/* Header nav links */
.header-nav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-nav a {
    color: #888888;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.header-nav a:hover {
    text-decoration: underline;
}

.user-badge {
    color: #aaaaaa;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Locked question paywall banner */
.locked-banner {
    margin-top: 20px;
    padding: 16px 20px;
    background: rgba(136, 136, 136, 0.1);
    border: 1px solid rgba(136, 136, 136, 0.3);
    border-radius: 10px;
    text-align: center;
    color: #cfcfcf;
}

/* Auth Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    background: linear-gradient(135deg, #1f1f35 0%, #16213e 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal h2 {
    margin-bottom: 6px;
    font-size: 1.4rem;
}

.modal .modal-subtitle {
    color: #9aa3b2;
    margin-bottom: 20px;
    font-size: 0.92rem;
}

.modal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.modal-tab {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #888;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-tab.active {
    background: linear-gradient(135deg, #666666 0%, #888888 100%);
    color: #1a1a1a;
}

.modal-form {
    display: none;
    flex-direction: column;
    gap: 14px;
}

.modal-form.active {
    display: flex;
}

.modal-form label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: #c5ccd6;
}

.modal-form input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    font-size: 0.95rem;
}

.modal-form input:focus {
    outline: none;
    border-color: #888888;
}

.modal-form button[type="submit"] {
    margin-top: 6px;
    background: linear-gradient(135deg, #666666 0%, #888888 100%);
    color: #1a1a1a;
    padding: 13px;
    font-size: 1rem;
    font-weight: 700;
}

.modal-error {
    color: #ff6b6b;
    font-size: 0.85rem;
    min-height: 1em;
    text-align: center;
}

.modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 0.85rem;
    cursor: pointer;
    margin-top: 14px;
    width: 100%;
    text-align: center;
}

.modal-close:hover {
    color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

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

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

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