:root {
    --ios-blue: #007aff;
    --ios-green: #28cd41;
    --ios-red: #ff3b30;
    --ios-bg: #f2f2f7;
    --ios-white: #ffffff;
    --ios-gray: #8e8e93;
    --ios-text: #000000;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Helvetica", Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #000;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 100%;
    max-width: 500px;
    height: 100dvh;
    background-color: var(--ios-bg);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

@media (min-width: 600px) {
    .app-container {
        height: 90vh;
        max-height: 850px;
        border-radius: 40px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        border: 8px solid #1c1c1e;
    }
}

.screen {
    display: none;
    flex: 1;
    flex-direction: column;
    padding: 15px;
    overflow-y: auto;
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.screen::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.screen.active {
    display: flex;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header Decoration */
.header-decoration {
    font-size: 60px;
    text-align: center;
    margin: 20px 0 10px;
}

.title-large {
    font-size: 28px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.desc-large {
    text-align: center;
    color: var(--ios-gray);
    font-size: 16px;
    margin-bottom: 20px;
}

/* Settings Card */
.settings-card {
    background: var(--ios-white);
    border-radius: 20px;
    padding: 5px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.setting-item {
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    border-bottom: 1px solid #efeff4;
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item label {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 10px;
}

.setting-item select {
    background: #f2f2f7;
    border: none;
    padding: 10px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    color: var(--ios-blue);
}

/* Toggle Group */
.toggle-group {
    display: flex;
    background: #f2f2f7;
    padding: 3px;
    border-radius: 10px;
}

.toggle-group label {
    flex: 1;
    margin-bottom: 0;
    padding: 6px;
    text-align: center;
    font-size: 13px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}

.toggle-group input:checked+label {
    background: var(--ios-white);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-group input {
    display: none;
}

.exam-mode-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.ios-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 28px;
}

.ios-switch input {
    display: none;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e5e5ea;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

input:checked+.slider {
    background-color: var(--ios-green);
}

input:checked+.slider:before {
    transform: translateX(18px);
}

/* Buttons */
.primary-btn {
    background: var(--ios-blue);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 122, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

#start-btn {
    margin-top: 35px;
    /* Added 1.2x top margin as requested */
}

.primary-btn:active {
    transform: scale(0.96);
    opacity: 0.9;
}

.large-btn {
    width: 100%;
    padding: 20px;
    font-size: 20px;
}

.primary-btn[disabled] {
    background: #d1d1d6;
    box-shadow: none;
    cursor: not-allowed;
}

/* Quiz Header */
.quiz-header {
    background: rgba(242, 242, 247, 0.9);
    backdrop-filter: blur(20px);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    position: relative;
    padding-top: 5px;
    height: 30px;
}

.exit-btn {
    background: transparent;
    border: none;
    color: var(--ios-blue);
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    z-index: 2;
}

#progress-text {
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    pointer-events: none;
}

#score-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--ios-blue);
    z-index: 2;
}

.progress-container {
    height: 4px;
    background: #e5e5ea;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-bar {
    height: 100%;
    background: var(--ios-blue);
    transition: width 0.3s ease;
}

.quiz-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.encouragement-text {
    text-align: center;
    min-height: 24px;
    font-weight: 600;
    font-size: 15px;
    transition: 0.3s;
    margin-top: 10px;
    margin-bottom: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ios-red);
}

.encouragement-text.success {
    color: var(--ios-red);
}

.encouragement-text.error {
    color: var(--ios-red);
}

/* Question UI */
.question-text {
    font-size: clamp(17px, 4.5vw, 21px);
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 20px;
    color: #1c1c1e;
}

.options-list {
    display: grid;
    gap: 10px;
}

.option-btn {
    background: var(--ios-white);
    border: none;
    padding: 14px 18px;
    border-radius: 16px;
    text-align: left;
    display: flex;
    align-items: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: 0.2s;
    font-size: 17px;
    font-weight: 500;
}

.option-index {
    width: 26px;
    height: 26px;
    background: #f2f2f7;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 12px;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

/* Footer Control */
.quiz-footer {
    padding: 50px 0 20px;
    display: flex;
    justify-content: center;
}

/* Status Classes */
.option-btn.selected {
    background: var(--ios-blue);
    color: white;
}

.option-btn.correct {
    background: var(--ios-green);
    color: white;
}

.option-btn.correct .option-index {
    background: white;
    color: var(--ios-green);
}

.option-btn.wrong {
    background: var(--ios-red);
    color: white;
}

.option-btn.wrong .option-index {
    background: white;
    color: var(--ios-red);
}

.option-btn.selected {
    background: var(--ios-blue);
    color: white;
}

.option-btn.selected .option-index {
    background: white;
    color: var(--ios-blue);
}

/* Result Page */
.result-card {
    text-align: center;
}

.result-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

.final-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    background: var(--ios-white);
    padding: 15px;
    border-radius: 20px;
    margin: 15px 0;
}

.stat-item span {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: #1c1c1e;
}

.wrong-list {
    flex: 1;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 5px;
}

.wrong-list::-webkit-scrollbar {
    width: 4px;
    display: block !important;
}

.wrong-item {
    background: #fff;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 10px;
    text-align: left;
}

.secondary-btn {
    width: 100%;
    background: #e5e5ea;
    border: none;
    padding: 14px;
    border-radius: 14px;
    margin-top: 15px;
    font-weight: 600;
}

.stat-item {
    font-size: 14px;
}

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.03);
    }

    100% {
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 2s infinite ease-in-out;
}

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-thumb {
    background: #d1d1d6;
    border-radius: 10px;
}