html {
  overscroll-behavior: none;
}

body {
  font-family: "Noto Sans", sans-serif;
  background-color: #0f0f0f;
}

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

:root {
    --bg-primary: #f3f4f6;
    --bg-secondary: white;
    --bg-tertiary: #e6e6e6;
    --text-primary: #333;
    --text-secondary: #555;
    --text-tertiary: #666;
    --border-color: #ddd;
    --border-color-light: #eee;
    --success-color: #4CAF50;
    --error-color: #f44336;
    --info-color: #2196F3;
    --success-bg: #d9ffdb;
    --error-bg: #ffd9d9;
    --button-hover: #f0f0f0;
}

html.dark-mode {
    --bg-primary: #161616;
    --bg-secondary: #1f1f1f;
    --bg-tertiary: #3a3a3a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #909090;
    --border-color: #444;
    --border-color-light: #333;
    --success-color: #66bb6a;
    --error-color: #ef5350;
    --info-color: #42a5f5;
    --success-bg: #31653a;
    --error-bg: #801c29;
    --button-hover: #404040;
}


.logo {
    width: 90%;  /* 20% smaller = 80% of original */
    max-width: 500px;  /* Optional: set a max size */
    height: auto;  /* Maintains aspect ratio */
    display: block;
    margin: 10px auto;  /* Top margin + centered */
}

/* Dark mode logo swap is handled via inline JS to avoid broken image flash */

body {
    font-family: Noto Sans, sans-serif;
    background-color: var(--bg-primary);
    padding: 20px;
}

body.theme-ready {
  transition: background-color 0.3s ease;
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    background-color: var(--bg-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.theme-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.container {
    width: 80%;
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
}

h1 {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 30px;
}

h2 {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 20px;
    text-align: center;
}

h3 {
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-align: center;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Setup Screen */
.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.setting-group select,
.setting-group input {
    font-family: "Noto Sans", sans-serif;
    font-weight: 500;
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 16px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-primary {
    font-family: "Noto Sans", sans-serif;
    width: 100%;
    padding: 15px;
    background-color: var(--success-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 20px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: #429869;
}

.btn-primary:disabled {
    font-family: "Noto Sans", sans-serif;
    background-color: #ccc;
    cursor: not-allowed;
}

.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-tertiary);
    font-style: italic;
}

.hidden {
    display: none !important;
}

.error {
    font-family: "Noto Sans", sans-serif;
    padding: 15px;
    background-color: #ffebee;
    color: #c62828;
    border-radius: 5px;
    margin-top: 20px;
}

/* Quiz Screen */
.quiz-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color-light);
}

.progress,
.score {
    font-size: 18px;
    color: var(--text-secondary);
}

.student-display {
    text-align: center;
    margin-bottom: 30px;
}

.student-image {
    width:  350px;
    height: 350px;
    object-fit: contain;
    border-radius: 10px;
    margin-bottom: 15px;
    padding: 20px;
    background-color: var(--bg-tertiary);
}

#student-name {
    font-family: "Noto Sans", sans-serif;
    color: var(--text-primary);
    font-size: 24px;
}

.answer-container {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

.answer-container.multiple-choice {
    font-family: "Noto Sans", sans-serif;
    grid-template-columns: repeat(2, 1fr);
}

.answer-container.type-in {
    font-family: "Noto Sans", sans-serif;
    max-width: 500px;
    margin: 0 auto 20px;
}

.answer-btn {
    font-family: "Noto Sans", sans-serif;
    padding: 15px;
    font-size: 18px;
    border: 2px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.answer-btn:hover {
    font-family: "Noto Sans", sans-serif;
    background-color: var(--button-hover);
    border-color: var(--text-tertiary);
}

.answer-btn.correct {
    font-family: "Noto Sans", sans-serif;
    background-color: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.answer-btn.incorrect {
    font-family: "Noto Sans", sans-serif;
    background-color: var(--error-color);
    color: white;
    border-color: var(--error-color);
}

.answer-btn:disabled {
    font-family: "Noto Sans", sans-serif;
    cursor: not-allowed;
}

.type-in-group {
    display: flex;
  justify-content: center;

    gap: 10px;
}

.type-in-input {
    flex: 1;
    font-family: "Noto Sans", sans-serif;
    padding: 15px;
    font-size: 18px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.submit-answer-btn {
    font-family: "Noto Sans", sans-serif;
    padding: 15px 30px;
    font-size: 18px;
    background-color: var(--info-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.submit-answer-btn:hover {
    background-color: #1976D2;
}

.submit-answer-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.feedback {
    text-align: center;
    padding: 20px;
    border-radius: 5px;
    margin-top: 20px;
}

.feedback.correct {
    background-color: var(--success-bg);
}

.feedback.incorrect {
    background-color: var(--error-bg);
}

#feedback-text {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Results Screen */
.final-score {
    text-align: center;
    margin-bottom: 40px;
}

.final-score p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.score-large {
    font-size: 48px !important;
    font-weight: bold;
    color: var(--success-color) !important;
}

.percentage {
    font-size: 32px !important;
    color: var(--info-color) !important;
}

.results-details {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    background-color: var(--bg-tertiary);
}

.result-item.correct-answer {
    border-left: 4px solid var(--success-color);
}

.result-item.incorrect-answer {
    border-left: 4px solid var(--error-color);
}

.result-item img {
    width: 30px;
    height: 40px;
    object-fit: contain;
    border-radius: 5px;
}

.result-info {
    flex: 1;
}

.result-info strong {
    display: block;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.result-info span {
    color: var(--text-tertiary);
    font-size: 14px;
}

.result-status {
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 3px;
}

.feedback-icon {
    width: 1.1em;
    height: 1.1em;
    vertical-align: middle;
    object-fit: contain;
}

.result-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.result-status.correct {
    background-color: var(--success-color);
    color: white;
}

.result-status.incorrect {
    background-color: var(--error-color);
    color: white;
}


/* Attribution Footer */
.attribution-footer {
    margin-top: 40px;
    padding: 30px 20px;
    text-align: center;
    border-top: 2px solid var(--border-color-light);
}

.attribution-content {
    max-width: 800px;
    margin: 0 auto;
}

.made-by {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.made-by strong {
    color: var(--text-primary);
    font-size: 20px;
}

.ba-attribution {
    font-size: 14px;
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.social-link:hover {
    background-color: var(--button-hover);
    border-color: var(--info-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.social-icon {
    font-size: 20px;
}

.social-text {
    font-weight: 500;
    font-size: 16px;
}

.x-share-container {
    display: flex;
    justify-content: center;
    margin-top: 25px;
}
.x-share-button {
    font-family: "Noto Sans", sans-serif;
    font-size: 17px;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 50px;
    padding: 10px 20px;
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.x-share-button:hover {
    background-color: var(--button-hover);
    border-color: var(--info-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.x-share-button .fa-x-twitter {
    font-size: 20px;
    color: #ffffff;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .container {
        width: 100%;
        padding: 20px 15px;
        border-radius: 8px;
    }

    .logo {
        width: 95%;
    }

    .student-image {
        width: min(260px, 80vw);
        height: min(260px, 80vw);
    }

    #student-name {
        font-size: 18px;
    }

    .quiz-header {
        flex-wrap: wrap;
        gap: 4px;
        margin-bottom: 20px;
    }

    .progress,
    .score,
    .timer-display {
        font-size: 15px;
    }

    .answer-container.multiple-choice {
        grid-template-columns: 1fr;
    }

    .answer-btn {
        font-size: 16px;
        padding: 12px 10px;
    }

    .answer-container.type-in {
        max-width: 100%;
    }

    .score-large {
        font-size: 36px !important;
    }

    .percentage {
        font-size: 24px !important;
    }

    .social-links {
        flex-direction: column;
        align-items: center;
    }

    .social-link {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }

    .x-share-btn {
        width: 90%;
        max-width: 300px;
    }

    .theme-toggle {
        top: 10px;
        right: 10px;
        width: 44px;
        height: 44px;
    }
}

/* Custom Checkbox */
.setting-group label[for="timer-enabled"] {
    font-family: "Noto Sans", sans-serif;
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.setting-group input[type="checkbox"] {
    font-family: "Noto Sans", sans-serif;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-secondary);
    cursor: pointer;
    position: relative;
    margin-right: 10px;
    transition: all 0.3s ease;
}

.setting-group input[type="checkbox"]:hover {
    border-color: var(--success-color);
}

.setting-group input[type="checkbox"]:checked {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.setting-group input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 45%;
    width: 4px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -50%) rotate(45deg);
}

/* Timer Options (Radio Buttons) */
.timer-options {
    display: flex;
    flex-direction: column;
    margin-top: 15px;
}

.timer-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 5px;
    transition: background-color 0.2s;
    min-height: 44px;
}

.timer-option:hover {
    background-color: var(--bg-tertiary);
}

.timer-option > span:first-of-type {
    margin-right: auto;
    padding-bottom: 2px;
}

.timer-option > span {
    align-items: center;  /* Change this to: flex-start, flex-end, or baseline */
    font-size: 17px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    line-height: 2;  /* Adjust this: 0.9, 1, 1.2, etc. */
    flex: 1;
    min-height: 24px;
}

/* Custom Radio Button */
.timer-option input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background-color: var(--bg-secondary);
    cursor: pointer;
    position: relative;
    margin-right: 12px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    top: 5px;
}

.timer-option input[type="radio"]:hover {
    border-color: var(--info-color);
}

.timer-option input[type="radio"]:checked {
    border-color: var(--info-color);
}

.timer-option input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--info-color);
    transform: translate(-50%, -50%);
}

/* Custom timer input wrapper */
.timer-option .timer-custom-wrapper {
    display: flex;
    margin-top: 10px;
    align-items: center;
    gap: 8px;
}

#custom-questions-wrapper {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

#custom-questions {
    font-family: "Noto Sans", sans-serif;
    width: 80px;
    padding: 8px 10px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* Timer Display */
.timer-display {
    font-size: 18px;
    color: #666666;
    font-weight: bold;
}

/* Dark mode - white timer */
html.dark-mode .timer-display {
    color: #ffffff;
}

/* Warning state (<=10 seconds) */
.timer-display.warning {
    color: #ff9800;
    animation: pulse 0.9s infinite;
}

html.dark-mode .timer-display.warning {
    color: #ffb74d;
}

/* Danger state (<=5 seconds) */
.timer-display.danger {
    color: #f44336;
    animation: pulse 0.45s infinite;
}

html.dark-mode .timer-display.danger {
    color: #ff5252;
}

/* Pulse animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}
