* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #2d3436;
}

.quiz-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 800px;
    backdrop-filter: blur(10px);
}

.quiz-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.progress-text {
    font-size: 1rem;
    color: #6c5ce7;
    font-weight: 600;
}

.progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    margin-bottom: 25px;
    overflow: hidden;
    flex-grow: 1;
    margin: 0 15px;
}

.progress {
    height: 100%;
    background: #6c5ce7;
    transition: width 0.3s ease;
}

.retry-prompt {
    background-color: #fff3cd;
    border: 2px solid #ffeeba;
    color: #856404;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    animation: fadeInDown 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.retry-prompt::before {
    content: "⚠️";
    font-size: 1.2em;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.question-text.retry {
    border: 2px solid #ffeeba;
    background: #fffbf3;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.question-text {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 20px;
    transition: font-size 0.3s ease;
}

.question-text.long {
    font-size: 1.1rem;
}

.question-text.very-long {
    font-size: 1rem;
}

.quiz-header {
    margin-bottom: 25px;
}

.file-input-container {
    margin-bottom: 15px;
    text-align: center;
}

.url-input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    padding: 0 20px;
}

.url-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.url-input:focus {
    outline: none;
    border-color: #6c5ce7;
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.1);
}

.url-load-btn {
    background: #6c5ce7;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.url-load-btn:hover {
    background: #5b4ccd;
    transform: translateY(-2px);
}

.custom-file-input {
    background: #6c5ce7;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-block;
    transition: all 0.3s ease;
}

.custom-file-input:hover {
    background: #5b4ccd;
    transform: translateY(-2px);
}

#fileInput {
    display: none;
}

.options {
    display: grid;
    gap: 15px;
}

.option {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 12px;
    border: 2px solid #e9ecef;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.options {
    display: grid;
    //grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.option:hover {
    border-color: #6c5ce7;
    background: #f3f0ff;
}

.option.selected {
    background: #f3f0ff;
    border-color: #6c5ce7;
}

.option.correct {
    background: #c3fabe;
    border-color: #00b894;
}

.option.wrong {
    background: #ffe3e3;
    border-color: #ff7675;
}

.explanation {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #6c5ce7;
    display: none;
    position: relative;
}

.explanation.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

.explanation.show::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #6c5ce7;
    animation: progressBar var(--progress-duration) linear forwards;
}

@keyframes progressBar {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.settings-container {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.custom-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #6c5ce7;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.custom-checkbox:hover {
    background: #f3f0ff;
}

#autoNext {
    display: none;
}

#autoNext:checked + .custom-checkbox {
    background: #6c5ce7;
}

#autoNext:checked + .custom-checkbox::after {
    content: "✓";
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.controls {
    margin-top: 25px;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

#submit-btn {
    background: #6c5ce7;
    color: white;
}

#next-btn {
    background: #00b894;
    color: white;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

#score {
    margin-top: 20px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3436;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.final-result {
    text-align: center;
    padding: 30px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.5s ease-out;
}

.result-header {
    font-size: 1.8rem;
    color: #2d3436;
    margin-bottom: 25px;
    font-weight: bold;
}

.statistics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 25px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2d3436;
}

.stat-value.good {
    color: #00b894;
}

.stat-value.medium {
    color: #fdcb6e;
}

.stat-value.poor {
    color: #ff7675;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: #6c5ce7;
    color: white;
}

.btn-primary:hover {
    background: #5b4ccd;
}

.btn-secondary {
    background: #e9ecef;
    color: #2d3436;
}

.btn-secondary:hover {
    background: #dee2e6;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#focus-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.focus-content {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.focus-header {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2d3436;
    margin-bottom: 1rem;
}

.focus-message {
    color: #636e72;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.focus-timer {
    font-size: 4rem;
    font-weight: bold;
    color: #6c5ce7;
    margin: 1.5rem 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.focus-progress-container {
    width: 100%;
    padding: 0 1rem;
}

.focus-progress {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.focus-progress-bar {
    height: 100%;
    background: #6c5ce7;
    width: 0%;
    transition: width 0.3s linear;
    border-radius: 4px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.focus-content {
    animation: fadeIn 0.3s ease-out;
}

/* 新增道具相關樣 */
.powerup-display {
    width: 100%;
    padding: 15px 20px;
    background: #f3f0ff;
    border-radius: 8px;
    border: 2px solid #6c5ce7;
}

.powerup-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.streak-counter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.streak-label {
    font-weight: 600;
    color: #2d3436;
}

.streak-stars {
    font-size: 1.2em;
    letter-spacing: 2px;
}

.streak-count {
    color: #6c5ce7;
    font-weight: 600;
    padding: 4px 8px;
    background: white;
    border-radius: 12px;
    font-size: 0.9em;
}

.powerup-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(108, 92, 231, 0.2);
}

.powerup-icon {
    font-size: 1.2em;
    color: #6c5ce7;
}

.powerup-count {
    font-weight: 600;
    color: #6c5ce7;
}

.powerup-btn {
    display: block;
    width: 100%;
    margin-top: 15px;
    padding: 10px;
    background: #6c5ce7;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.powerup-btn:hover {
    background: #5b4ccd;
    transform: translateY(-2px);
}

.powerup-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #6c5ce7;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    font-weight: 600;
    animation: slideInRight 0.5s ease, fadeOut 0.5s ease 1.5s forwards;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.2);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* 成績上傳相關樣式 */
.upload-score-section {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #e9ecef;
}

.upload-score-section h3 {
    margin-bottom: 15px;
    color: #2d3436;
    font-size: 1.2rem;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group label {
    min-width: 60px;
    color: #4a4a4a;
    font-weight: 500;
}

.form-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #6c5ce7;
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.1);
}

#uploadScoreBtn {
    margin-top: 10px;
    width: 100%;
    padding: 12px;
    background: #6c5ce7;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#uploadScoreBtn:hover:not(:disabled) {
    background: #5b4ccd;
    transform: translateY(-2px);
}

#uploadScoreBtn:disabled {
    background: #a8a8a8;
    cursor: not-allowed;
}

#uploadScoreBtn.uploaded {
    background: #00b894;
    cursor: not-allowed;
}

.upload-score-section.uploaded {
    border-color: #00b894;
    background: #f0fff4;
}

.user-info-display {
    flex: 1;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    color: #2d3436;
    font-weight: 500;
}

.top-bar {
    background: #fff;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

#welcomeMessage {
    font-weight: 600;
    color: #2d3436;
}