:root {
    --primary-color: #FF0000; /* YouTube Red */
    --secondary-color: #F8F8F8; /* Light Gray Background */
    --text-color: #333333; /* Dark Text */
    --background-color: #EFEFEF; /* Lighter Background */
    --card-background: #FFFFFF; /* White Card */
    --border-color: #DDDDDD;
    --button-hover: #CC0000;
    --correct-color: #4CAF50; /* Green */
    --incorrect-color: #F44336; /* Red */
}

.main-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.main-content {
    background-color: var(--secondary-color);
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    padding: 40px;
    text-align: center;
    border: 1px solid var(--border-color);
    min-height: 400px;
    align-self: start;
    overflow: auto;
    width: 100%;
}

.sub-content {
    display: flex;
    background-color: rgba(28, 71, 244, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(28, 71, 244, 0.3);
    padding: 10px;
    text-align: center;
    border: 1px solid rgba(28, 71, 244, 0.3);
    width: 100%;
    align-items: center;
    height: 60px;
    justify-content: center;
    cursor: pointer;
    color: #1c47f4;
}

.sub-content {
    transition: background-color 1s ease, border-color 1s ease, box-shadow 1s ease, color 1s ease;
}

.content-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
}

.content-layout > * {
    min-width: 0; /* 기본적으로 그리드 셀 내 아이템이 줄어들게 강제 */
}

.title {
    color: var(--primary-color);
    font-size: 2.5em;
    font-weight: 700;
}

.main-content h2 {

    margin-bottom: 20px;
    color: rgb(28, 71, 244);
    background-color: rgba(28,71,244,0.1);
}

.screen {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.screen.active {
    display: block;
    max-width: 100%;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Intro and Result Screens */
#intro-screen p {
    font-size: 1.3em;
    margin-bottom: 30px;
    line-height: 1.6;
}

.btn {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    font-weight: 700;
}

.btn:hover {
    background-color: var(--button-hover);
    transform: translateY(-2px);
}

/* Test Screen */
.timer-area {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
}

.timer-bar-container {
    flex-grow: 1; /* 바가 사용 가능한 공간을 채우도록 */
    max-width: 300px; /* 최대 너비 지정 */
    background-color: var(--border-color);
    border-radius: 5px;
    height: 10px;
    overflow: hidden;
}

.timer-bar {
    width: 100%;
    height: 100%;
    background-color: var(--primary-color);
    animation: timerDrain linear forwards;
}

.time-left {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--primary-color);
    width: 50px; /* 텍스트가 흔들리지 않게 고정 너비 */
    text-align: left;
}

.question-number {
    font-size: 1.1em;
    color: var(--primary-color);
    margin-bottom: 15px;
    font-weight: 700;
}

.question-text {
    font-size: 1.4em;
    margin-bottom: 30px;
    font-weight: 700;
}

.options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
    margin-bottom: 30px;
}

.option {
    background-color: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    width: calc(50% - 15px); /* Two columns with gap */
    max-width: 380px; /* Max width for each option */
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    justify-content: space-between;
}

.option:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-color);
}

.option.correct {
    border-color: var(--correct-color);
    box-shadow: 0 0 15px var(--correct-color);
}

.option.incorrect {
    border-color: var(--incorrect-color);
    box-shadow: 0 0 15px var(--incorrect-color);
}

.choice-btn {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 25px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-weight: 700;
}

.choice-btn:hover {
    background-color: var(--button-hover);
}

.status-message {
    font-size: 1.2em;
    margin-top: 20px;
    min-height: 30px;
    font-weight: 700;
    color: var(--text-color);
}

/* Result Screen */
.result-title {
    font-size: 2em;
    margin-bottom: 20px;
}

#result-screen .score-text {
    font-size: 3em;
    margin-bottom: 15px;
    font-weight: 700;
}

.score-text span {
    color: var(--correct-color);
}

.result-description {
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 40px;
}

.explanation-box {
    margin-top: 10px;
    padding: 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
    font-size: 0.9em;
    color: #333;
    display: none; /* <-- 기본적으로 숨김 */
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    font-weight: 700;
    font-size: 1em;
}

.explanation-box.show {
    display: block; /* <-- 보일 때 블록으로 변경 */
    opacity: 1;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
    order: 2;
}

.sidebar-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    overflow: auto;
}

.sidebar-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 16px;
}

.publish-time {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #6b7280;
    font-size: 14px;
}

.trending-list {
    display: flex
;
    flex-direction: column;
    gap: 12px;
}

.trending-item {
    display: flex
;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.rank {
    min-width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
}

.keyword {
    flex: 1;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank.up {
    background: #dc2626;
}
.sidebar-title i {
    color: #dc2626;
}

.video-grid {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    white-space: nowrap;
    margin-bottom: 30px;
    min-width: 0;
}

.card-video {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: box-shadow 0.2s;
    width: 200px;
    min-width: 200px;
    flex-shrink: 0;
}

.growth {
    background: #ef4444;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.video-title {
    font-size: 1.3rem;
    font-weight: 600;
    overflow: hidden;
    padding: 10px;
    text-overflow: ellipsis;
}

.video-grid .video-title {
    font-size: 1rem;
}

.screen h2 {
    margin: 10px 0;
    background: mistyrose;
    border-radius: 10px;
}

#result-screen p {
    font-size: 1.3em;
    margin-bottom: 10px;
    line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 768px) {

    .content-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .title {
        font-size: 2em;
    }

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

    .options-container {
        flex-direction: column;
        gap: 20px;
    }

    .option {
        width: 100%;
        max-width: 100%;
    }

    .btn {
        padding: 12px 25px;
        font-size: 1.1em;
    }

    .timer-bar-container {
        max-width: 100%;
    }

    #intro-screen p, #result-screen p {
        font-size: 1.1em;
        margin-bottom: 10px;
        line-height: 1.6;
    }

    .result-title {
        font-size: 1.5em;
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.8em;
    }
    .question-text {
        font-size: 1.1em;
    }
    .video-title {
        font-size: 0.95em;
        min-height: 35px;
    }
    .choice-btn {
        padding: 8px 20px;
        font-size: 0.9em;
    }
    .score-text {
        font-size: 1.5em;
    }
}