:root {
    --primary-red: #FF0000; /* YouTube Red */
    --primary-blue: #1c47f4; /* Primary Blue for accents */
    --light-bg: #F0F2F5; /* A softer light gray for general background */
    --medium-bg: #E0E4EB; /* Slightly darker background for separation */
    --card-bg: #FFFFFF; /* White for cards/main content */
    --text-dark: #212121; /* Darker text for readability */
    --text-medium: #616161; /* Medium gray for secondary text */
    --border-light: #E0E0E0; /* Light border color */
    --button-hover-red: #CC0000;
    --button-hover-blue: #1638C4;
    --correct-green: #4CAF50; /* Green for correct answers */
    --incorrect-red: #F44336; /* Red for incorrect answers */
    --shadow-light: rgba(0, 0, 0, 0.08); /* Lighter shadow for depth */
    --shadow-medium: rgba(0, 0, 0, 0.15); /* Medium shadow for interactive elements */
}


.main-body {
    display: flex;
    flex-direction: column;
    gap: 25px; /* Increased gap for better visual separation */
}

.main-content {
    background-color: #FFFFFF;
    border-radius: 20px; /* 더 둥근 모서리 */
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); /* 더 깊고 부드러운 그림자 */
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    animation: fadeInScale 0.6s ease-out forwards; /* 나타날 때 애니메이션 */
}

.sub-content {
    display: flex;
    background-color: rgba(28, 71, 244, 0.08); /* Lighter blue tint */
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(28, 71, 244, 0.1); /* Softer blue shadow */
    padding: 15px; /* More padding */
    text-align: center;
    border: 1px solid rgba(28, 71, 244, 0.15); /* Slightly more defined border */
    width: 100%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary-blue); /* Consistent blue color */
    font-weight: 600; /* Bolder text */
    transition: all 0.3s ease; /* Smooth transition for all properties */
}

.sub-content:hover {
    background-color: rgba(28, 71, 244, 0.15);
    box-shadow: 0 8px 20px rgba(28, 71, 244, 0.25);
    transform: translateY(-3px); /* Subtle lift on hover */
}

.sub-content h2 {
    margin: 0; /* Remove default margin */
    color: inherit; /* Inherit color from parent */
    background-color: transparent; /* Remove background */
}

.sub-content i {
    margin-left: 10px;
}

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

.content-layout > * {
    min-width: 0;
}

.title {
    color: var(--primary-red);
    font-size: 2.8em; /* Slightly larger title */
    font-weight: 800; /* Extra bold */
    margin-bottom: 25px; /* More space below title */
}

.main-content h2 {
    margin-bottom: 25px;
    color: var(--primary-blue);
    background-color: rgba(28,71,244,0.05); /* Very light blue background */
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1.7em; /* Consistent heading size */
    font-weight: 700;
}

.screen {
    display: none;
    animation: fadeIn 0.6s ease-out; /* Slightly longer fade-in */
}

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

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

/* Intro and Result Screens */
#intro-screen p {
    font-size: 1.4em; /* Larger, more inviting text */
    margin-bottom: 35px;
    line-height: 1.7;
    color: var(--text-medium);
}

.btn {
    background-color: var(--primary-red);
    color: white;
    padding: 16px 35px; /* More generous padding */
    border: none;
    border-radius: 10px; /* Softer rounded corners */
    font-size: 1.3em; /* Larger font size for buttons */
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.2); /* Red glow shadow */
}

.btn:hover {
    background-color: var(--button-hover-red);
    transform: translateY(-3px); /* More pronounced lift */
    box-shadow: 0 6px 16px rgba(255, 0, 0, 0.3); /* Enhanced red glow */
}

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

.timer-bar-container {
    flex-grow: 1;
    max-width: 350px; /* Slightly larger max width */
    background-color: var(--border-light);
    border-radius: 8px; /* Softer rounded corners */
    height: 12px; /* Thicker bar */
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1); /* Subtle inner shadow */
}

.timer-bar {
    width: 100%;
    height: 100%;
    background-color: var(--primary-red);
    animation: timerDrain linear forwards;
    border-radius: 8px; /* Match container border-radius */
}

.time-left {
    font-size: 1.3em; /* Larger font */
    font-weight: 700;
    color: var(--primary-red);
    width: 60px; /* Adjusted width */
    text-align: right; /* Align right for consistency */
}

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

.question-text {
    font-size: 1.6em; /* More prominent question */
    margin-bottom: 35px;
    font-weight: 700;
    color: var(--text-dark);
}

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

.option {
    background-color: var(--card-bg);
    border: 3px solid var(--border-light); /* Thicker border */
    border-radius: 15px; /* More rounded */
    overflow: hidden;
    width: calc(50% - 20px); /* Adjust for new gap */
    max-width: 400px; /* Slightly larger max width */
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px; /* More padding */
    box-shadow: 0 6px 18px var(--shadow-light); /* Softer shadow */
    justify-content: space-between;
}

.option:hover {
    transform: translateY(-8px); /* More significant lift */
    box-shadow: 0 12px 25px var(--shadow-medium); /* More prominent shadow on hover */
    border-color: var(--primary-blue); /* Border turns blue on hover */
}

.option.correct {
    border-color: var(--correct-green);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.5); /* Green glow */
}

.option.incorrect {
    border-color: var(--incorrect-red);
    box-shadow: 0 0 20px rgba(244, 67, 54, 0.5); /* Red glow */
}

.video-thumbnail {
    width: 100%; /* Ensure thumbnail fills its container */
    height: auto;
    border-radius: 10px; /* Rounded corners for thumbnails */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* Subtle shadow for thumbnails */
}


.status-message {
    font-size: 1.3em; /* Larger status message */
    /* margin-top: 25px;
    min-height: 35px; */
    font-weight: 700;
    color: var(--text-dark);
}

/* Result Screen */
.result-title {
    font-size: 2.5em; /* Larger result title */
    margin-bottom: 25px;
    color: var(--primary-blue);
}

#result-screen .score-text {
    font-size: 3.5em; /* Very large score text */
    margin-bottom: 20px;
    font-weight: 800; /* Extra bold */
}

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

.result-description {
    font-size: 1.2em;
    line-height: 1.7;
    margin-bottom: 30px;
    color: var(--text-medium);
}

.score-breakdown {
    background-color: var(--medium-bg);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 40px;
    text-align: left;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05); /* Inner shadow for depth */
}

.score-breakdown p {
    font-size: 1.15em;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.score-breakdown p:last-child {
    margin-bottom: 0;
}

.explanation-box {
    margin-top: 20px; /* More space above explanation */
    padding: 15px;
    background-color: var(--medium-bg); /* Use medium background for contrast */
    border-radius: 8px;
    font-size: 1em;
    color: var(--text-dark);
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    font-weight: 600;
    text-align: left; /* Align text left within explanation box */
}

.explanation-box.show {
    display: block;
    opacity: 1;
}

.video-grid {
    display: flex;
    gap: 1.8rem; /* Increased gap in video grid */
    overflow-x: auto;
    white-space: nowrap;
    margin-bottom: 35px;
    min-width: 0;
    padding-bottom: 10px; /* Add padding for scrollbar visibility */
    /* Custom scrollbar for better aesthetics */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-red) var(--medium-bg);
}

.video-grid::-webkit-scrollbar {
    height: 8px;
}

.video-grid::-webkit-scrollbar-track {
    background: var(--medium-bg);
    border-radius: 10px;
}

.video-grid::-webkit-scrollbar-thumb {
    background-color: var(--primary-red);
    border-radius: 10px;
    border: 2px solid var(--medium-bg);
}

.card-video {
    background: var(--card-bg);
    border-radius: 0.8rem; /* More rounded cards */
    box-shadow: 0 3px 10px var(--shadow-light);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 220px; /* Slightly larger video cards */
    min-width: 220px;
    flex-shrink: 0;
}

.card-video:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px var(--shadow-medium);
}

.card-video img {
    width: 100%;
    height: 120px; /* Fixed height for consistency */
    object-fit: cover; /* Ensure image covers the area */
    display: block;
}

.video-info {
    padding: 15px;
    text-align: left;
}

.growth {
    background: var(--incorrect-red); /* Using incorrect-red for growth indication */
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 0.35rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.video-title {
    font-size: 1.1em; /* Adjusted font size */
    font-weight: 700;
    color: var(--text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal; /* Allow text to wrap */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    -webkit-box-orient: vertical;
    min-height: 44px; /* Ensure consistent height for 2 lines */
    line-height: 1.3;
    margin-bottom: 5px;
}

.video-views {
    font-size: 0.9em;
    color: var(--text-medium);
    margin-bottom: 5px;
}

.video-channel {
    font-size: 0.9em;
    color: var(--text-medium);
}

#intro-screen p, #result-screen p {
    font-size: 1.2em;
    margin-bottom: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }

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

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

    .main-content h2 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }

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

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

    .option {
        width: 100%;
        max-width: 100%;
        padding: 10px;
    }

    .btn {
        padding: 14px 30px;
        font-size: 1.2em;
    }

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

    .timer-area {
        margin-bottom: 5px;
    }

    .question-number {
        margin-bottom: 5px;
    }

    #intro-screen p, #result-screen p {
        font-size: 1.2em;
        margin-bottom: 15px;
    }

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

    .score-breakdown {
        padding: 20px;
        margin-bottom: 30px;
    }

    .score-breakdown p {
        font-size: 1.05em;
    }

    .sidebar {
        order: 3; /* Move sidebar below main content on smaller screens */
        gap: 20px;
    }

    .sidebar-section {
        padding: 20px;
    }

    .sidebar-title {
        font-size: 1.2em;
        margin-bottom: 15px;
    }

    .video-grid {
        gap: 1rem;
        padding-bottom: 5px;
    }

    .card-video {
        width: 180px;
        min-width: 180px;
    }

    .video-title {
        font-size: 1em;
        min-height: 40px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 25px;
    }

    .title {
        font-size: 1.9em;
    }
    .main-content h2 {
        font-size: 1.3em;
    }
    .question-text {
        font-size: 1.2em;
        margin-bottom: 10px;
    }
    .score-text {
        font-size: 2.8em;
    }
    .result-title {
        font-size: 1.8em;
    }
    .sidebar-title {
        font-size: 1.1em;
    }
    .rank {
        min-width: 22px;
        height: 22px;
        font-size: 0.85em;
    }
    .keyword {
        font-size: 0.95em;
    }
    .card-video {
        width: 160px;
        min-width: 160px;
    }
    .video-title {
        font-size: 0.95em;
        min-height: 38px;
    }
    .video-info {
        padding: 10px;
    }
    .growth {
        font-size: 0.85rem;
        padding: 0.2rem 0.5rem;
    }
    .video-views, .video-channel {
        font-size: 0.8em;
    }
}