@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700;800&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --app-bg: #0f1014;
    --card-bg: #1c1c24;
    --surface-bg: #252534;
    --surface-bg-soft: #2a2a3b;
    --text-white: #ffffff;
    --text-gray: #a0a0a0;
    --option-bg: #292936;
    --orange-btn: #ff6b4a;
    --green-accent: #2ecc71;
    --error-accent: #ff5d7e;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--app-bg);
    color: var(--text-white);
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 24px 14px 40px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 33vh;
    background: var(--primary-gradient);
    border-bottom-left-radius: 36px;
    border-bottom-right-radius: 36px;
    z-index: -1;
}

.container {
    width: min(100%, 980px);
    background: var(--card-bg);
    margin-top: 62px;
    padding: 26px 28px 22px;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* Intro Page Styles */
.introArea {
    width: 100%;
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInUp 0.8s ease-out;
    padding: 40px 0;
}

.introContent {
    text-align: center;
    max-width: 600px;
    padding: 40px 20px;
    position: relative;
    z-index: 2;
}

.introVisual {
    position: relative;
    height: 160px;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floatingIcon {
    font-size: 60px;
    position: absolute;
    animation: float 6s ease-in-out infinite;
}

.floatingIcon.icon-one {
    animation-delay: 0s;
    left: 10%;
    top: 0;
}

.floatingIcon.icon-two {
    animation-delay: 2s;
    right: 10%;
    top: 20px;
}

.floatingIcon.icon-three {
    animation-delay: 1s;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.introTitle {
    font-size: clamp(36px, 8vw, 56px);
    font-weight: 800;
    margin: 0 0 12px 0;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.introSubtitle {
    font-size: clamp(18px, 4vw, 28px);
    font-weight: 600;
    color: var(--text-white);
    margin: 0 0 16px 0;
}

.introDescription {
    font-size: 16px;
    color: var(--text-gray);
    line-height: 1.6;
    margin: 0 0 32px 0;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.introFeatures {
    display: grid;
    gap: 12px;
    margin: 32px 0;
    text-align: left;
    background: rgba(102, 126, 234, 0.05);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    animation: fadeInUp 0.8s ease-out 0.3s both;
}

.featureRow {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    color: var(--text-gray);
    letter-spacing: 0.3px;
}

.featureIcon {
    font-size: 20px;
    min-width: 24px;
}

.introActions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 32px 0;
    flex-wrap: wrap;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.introActions .controlBtn {
    min-width: 140px;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.introActions .controlBtn:first-child {
    background: var(--orange-btn);
    color: white;
}

.introActions .controlBtn:first-child:hover {
    background: #ff5a3c;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(255, 107, 74, 0.3);
}

.introActions .signupBtn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.introActions .signupBtn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.introActionGroup {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    width: 100%;
}

.introLoggedInText {
    color: var(--text-gray);
    margin: 0 0 8px 0;
    font-size: 14px;
}

.introFooterText {
    font-size: 12px;
    color: var(--text-gray);
    margin: 20px 0 0 0;
    animation: fadeInUp 0.8s ease-out 0.5s both;
}

.hero {
    text-align: center;
    margin-bottom: 16px;
}

.main-title {
    font-size: clamp(28px, 5vw, 38px);
    font-weight: 800;
    margin: 0;
}

.highlight {
    color: #a18cd1;
}

.sub-text {
    color: var(--text-gray);
    margin: 9px 0 0;
    font-size: 14px;
    letter-spacing: 0.1px;
}

.panel {
    background: linear-gradient(180deg, var(--surface-bg) 0%, var(--surface-bg-soft) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 15px;
    margin-top: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

#authArea {
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

#authArea .noticeBox {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-gray);
    font-size: 11px;
    padding: 8px 10px;
}

.hide {
    display: none !important;
}

.auth-switch,
.rowActions,
.panelHeaderRow,
.topBar,
.topActions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.auth-switch,
.panelHeaderRow,
.topBar {
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.topActions {
    justify-content: flex-end;
    display: flex;
}

#appArea {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    display: grid;
    gap: 12px;
}

#setupArea {
    min-height: 0;
}

.noticeBox {
    background: rgba(255, 107, 74, 0.12);
    border: 1px solid rgba(255, 107, 74, 0.4);
    color: #ffd9ce;
    border-radius: 12px;
    padding: 10px;
    font-size: 12px;
    line-height: 1.5;
    margin: 10px 0 12px;
}

.formGrid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--text-gray);
    font-size: 13px;
}

input,
textarea,
select,
button {
    font: inherit;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: var(--option-bg);
    color: var(--text-white);
    border-radius: 12px;
    padding: 11px 12px;
}

textarea {
    resize: vertical;
}

.mutedText {
    color: var(--text-gray);
    font-size: 12px;
    line-height: 1.5;
    margin: 4px 0;
}

button {
    border: none;
    cursor: pointer;
    transition: transform 0.16s ease, opacity 0.16s ease;
}

button:hover {
    transform: translateY(-1px);
}

.controlBtn,
.smallBtn,
.ghostBtn,
.fileLikeBtn {
    border-radius: 28px;
    padding: 10px 15px;
    font-weight: 700;
}

.controlBtn {
    background: var(--orange-btn);
    color: #fff;
    box-shadow: 0 10px 20px rgba(255, 107, 74, 0.24);
}

.startQuizBtn {
    background: linear-gradient(135deg, #1ec97f 0%, #12a86a 100%);
    box-shadow: 0 12px 26px rgba(18, 168, 106, 0.4);
    letter-spacing: 0.2px;
}

.startQuizBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.smallBtn,
.fileLikeBtn {
    background: var(--primary-gradient);
    color: #fff;
}

.smallBtn.active {
    outline: 2px solid rgba(255, 255, 255, 0.25);
}

.ghostBtn {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.fileLikeBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.blockBtn {
    width: 100%;
    margin: 4px 0 0;
    min-height: 44px;
}

.textInputBlock {
    margin-top: 12px;
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(102, 126, 234, 0.32);
    background:
        radial-gradient(circle at 12% 14%, rgba(102, 126, 234, 0.16), transparent 42%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.08));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 24px rgba(0, 0, 0, 0.22);
}

.pasteTextArea {
    min-height: 160px;
    line-height: 1.5;
    border-radius: 13px;
    border: 1px solid rgba(122, 143, 255, 0.36);
    background: rgba(18, 21, 33, 0.82);
    font-size: 14px;
    padding: 12px 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.pasteTextArea:focus {
    outline: none;
    border-color: rgba(122, 143, 255, 0.85);
    background: rgba(18, 21, 33, 0.94);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.pasteHintText {
    margin: 0;
    color: #b7bad3;
    font-size: 12px;
    letter-spacing: 0.2px;
}

#pasteClipboardBtn {
    border-color: rgba(122, 143, 255, 0.46);
    background: rgba(102, 126, 234, 0.12);
}

#pasteClipboardBtn:hover {
    border-color: rgba(122, 143, 255, 0.78);
    background: rgba(102, 126, 234, 0.2);
}

.configGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.panelHeaderRow h3,
h3,
h2 {
    margin: 0;
}

.inlineBtn {
    width: auto;
}

.reviewCard {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px;
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.15);
}

.reviewCardActions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

#questionCount,
.timerBadge {
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    background: #10131c;
    font-size: 12px;
    padding: 5px 10px;
    color: var(--text-gray);
}

.progress-container {
    width: 100%;
    height: 8px;
    background: #2f3240;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 14px;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--orange-btn);
    transition: width 0.35s ease;
}

.quizHeader {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.quizHeaderTop {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.quizTitle {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.questionTracker {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(102, 126, 234, 0.16);
    border: 1px solid rgba(102, 126, 234, 0.28);
}

#questionCounter {
    color: var(--text-white);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.progressBarContainer {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

#progressBar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--orange-btn) 0%, #ff8c42 100%);
    border-radius: 8px;
    transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 8px rgba(255, 107, 74, 0.6);
}

.optionsWrap {
    display: grid;
    gap: 10px;
    margin: 6px 0 12px;
}

.optBtn {
    width: 100%;
    text-align: left;
    border-radius: 12px;
    background: var(--option-bg);
    color: #fff;
    border: 1px solid transparent;
    padding: 12px 13px;
}

.optBtn:hover {
    border-color: rgba(255, 255, 255, 0.28);
}

.optBtn.correct {
    border-color: rgba(46, 204, 113, 0.8);
    background: rgba(46, 204, 113, 0.16);
}

.optBtn.wrong {
    border-color: rgba(255, 93, 126, 0.7);
    background: rgba(255, 93, 126, 0.15);
}

.score-box {
    margin: 10px 0;
    padding: 16px;
    border-radius: 12px;
    background: #2a2e3b;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

#scoreText {
    color: var(--green-accent);
}

.resultSimple {
    max-width: 420px;
    margin: 0 auto;
    text-align: center;
    padding: 8px 6px 10px;
}

.trophyIcon {
    font-size: 56px;
    margin: 4px 0 10px;
    display: inline-block;
    animation: trophyPop 1.1s ease;
}

.resultScoreBox {
    padding: 22px 18px;
    border-radius: 16px;
    background: #2a2f40;
}

.resultScoreBox #scoreText {
    font-size: 40px;
    line-height: 1.05;
    margin: 0;
    letter-spacing: 0.3px;
}

.resultRestartBtn {
    width: 100%;
    max-width: 340px;
    margin-top: 14px;
    font-size: 18px;
    padding: 14px 18px;
    border-radius: 30px;
}

.resultSecondaryBtn {
    width: 100%;
    max-width: 340px;
    margin-top: 10px;
    padding: 12px 16px;
}

@keyframes trophyPop {
    0% { transform: scale(0.2) rotate(-10deg); opacity: 0; }
    55% { transform: scale(1.16) rotate(6deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); }
}

.attemptList {
    display: grid;
    gap: 8px;
}

.attemptItem {
    border-radius: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
}

.statusOk {
    color: var(--green-accent);
}

.statusError {
    color: var(--error-accent);
}

.appFooter {
    margin-top: 14px;
    text-align: center;
    padding-top: 4px;
}

.githubLink {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-gray);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.2s ease;
    opacity: 0.92;
}

.githubLink:hover {
    color: var(--text-white);
}

.githubIcon {
    width: 18px;
    height: 18px;
}

.flowFlash {
    animation: flowFlashAnim 0.42s ease;
}

.specialReveal {
    animation: specialRevealAnim 0.52s ease;
}

.startAction {
    animation: startActionAnim 0.34s ease;
}

@keyframes flowFlashAnim {
    0% { transform: translateY(0) scale(1); opacity: 0.9; }
    50% { transform: translateY(-2px) scale(1.01); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes specialRevealAnim {
    0% { transform: scale(0.92); opacity: 0; }
    65% { transform: scale(1.03); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes startActionAnim {
    0% { transform: scale(1); }
    50% { transform: scale(0.97); }
    100% { transform: scale(1); }
}

.settingsRow {
    margin: 20px 0;
    padding: 18px;
    background: var(--surface-bg-soft);
    border-radius: 14px;
    border-left: 4px solid var(--primary-gradient);
}

.settingGroup {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.settingLabel {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-white);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quantityButtons {
    display: flex;
    gap: 10px;
    width: 100%;
}

.quantityBtn {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid var(--text-gray);
    background: transparent;
    color: var(--text-gray);
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quantityBtn:hover {
    border-color: var(--orange-btn);
    color: var(--orange-btn);
    transform: translateY(-2px);
}

.quantityBtn.active {
    background: var(--orange-btn);
    border-color: var(--orange-btn);
    color: white;
    box-shadow: 0 8px 16px rgba(255, 107, 74, 0.3);
}

.scoreHistoryList {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scoreHistoryItem {
    display: grid;
    grid-template-columns: 50px 1fr 1fr;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    background: var(--surface-bg-soft);
    border-radius: 10px;
    border-left: 4px solid var(--orange-btn);
    animation: slideInRight 0.4s ease;
}

.scoreHistoryRank {
    text-align: center;
    color: var(--orange-btn);
    font-size: 13px;
    font-weight: 700;
}

.scoreHistoryScore {
    color: var(--text-white);
    font-size: 15px;
    font-weight: 600;
}

.scoreHistoryScore span {
    color: var(--text-gray);
    font-size: 13px;
}

.scoreHistoryDate {
    text-align: right;
    font-size: 12px;
    color: var(--text-gray);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.scoreDate {
    font-weight: 600;
}

.scoreTime {
    font-size: 11px;
    opacity: 0.8;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 640px) {
    .container {
        margin-top: 36px;
        padding: 14px 13px 12px;
    }

    .topBar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topActions {
        width: auto;
        justify-content: flex-end;
    }

    #appArea {
        max-width: 100%;
    }

    .rowActions .controlBtn,
    .rowActions .ghostBtn {
        width: 100%;
    }

    .main-title {
        font-size: 32px;
    }

    .sub-text {
        font-size: 13px;
    }

    .panelHeaderRow {
        align-items: flex-start;
    }

    .resultScoreBox #scoreText {
        font-size: 32px;
    }

    .introContent {
        padding: 20px 16px;
    }

    .introTitle {
        font-size: 32px;
        margin-bottom: 8px;
    }

    .introSubtitle {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .introDescription {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .introFeatures {
        margin: 20px 0;
        padding: 16px;
        gap: 10px;
    }

    .featureRow {
        font-size: 13px;
        gap: 10px;
    }

    .introActions {
        margin: 20px 0;
        gap: 10px;
    }

    .introActions .controlBtn {
        min-width: 120px;
        padding: 12px 24px;
        font-size: 14px;
    }

    .textInputBlock {
        padding: 12px;
    }

    .pasteTextArea {
        min-height: 140px;
    }

    .quizTitle {
        font-size: 20px;
    }

    .quizHeaderTop {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .questionTracker {
        min-width: 70px;
        padding: 5px 12px;
        font-size: 13px;
    }

    .floatingIcon {
        height: 100px;
    }

    .floatingIcon {
        font-size: 48px;
    }

    .introVisual {
        height: 120px;
        margin-bottom: 24px;
    }

    .quantityButtons {
        flex-direction: column;
    }

    .quantityBtn {
        width: 100%;
    }

    .scoreHistoryItem {
        grid-template-columns: 1fr;
    }

    .scoreHistoryRank {
        text-align: left;
        margin-bottom: 8px;
    }

    .scoreHistoryDate {
        text-align: left;
        margin-top: 8px;
    }
}

.optBtn {
    width: 100%;
    padding: 18px 25px;
    margin-bottom: 15px;
    background-color: #292936;
    color: white;
    border: 2px solid transparent;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    text-align: left;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
}

.optBtn:hover {
    background-color: #343446;
    border-color: #667eea;
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.optBtn:active {
    transform: scale(0.98); 
}