:root {
    --ios-bg: #F2F2F7;
    --ios-card-bg: rgba(255, 255, 255, 0.85);
    /* Slightly transparent for glassmorphism */
    --ios-blue: #007AFF;
    --ios-green: #34C759;
    --ios-red: #FF3B30;
    --ios-text: #1C1C1E;
    --ios-text-secondary: #8E8E93;
    --ios-separator: #C6C6C8;
    --ios-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    /* Softer, deeper shadow */
    --ios-gradient-blue: linear-gradient(135deg, #007AFF, #00C6FF);
    --ios-gradient-purple: linear-gradient(135deg, #AF52DE, #FF2D55);
    --ios-gradient-orange: linear-gradient(135deg, #FF9500, #FF3B30);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--ios-bg);
    color: var(--ios-text);
    margin: 0;
    padding: 0;
    line-height: 1.5;
    padding-bottom: 90px;
    /* More space for tab bar */
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

/* Header */
.ios-header {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 52px;
    transition: all 0.3s ease;
}

.ios-header h1 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: var(--ios-text);
}

.header-btn {
    color: var(--ios-blue);
    font-size: 17px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    font-weight: 500;
    display: flex;
    align-items: center;
}

/* Main Content */
.container {
    padding: 24px 20px;
    max-width: 600px;
    margin: 0 auto;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--ios-card-bg);
    padding: 16px 10px;
    border-radius: 16px;
    text-align: center;
    box-shadow: var(--ios-shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    background: var(--ios-gradient-blue);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.stat-label {
    font-size: 11px;
    color: var(--ios-text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* Lists & Cards */
.list-group {
    border-radius: 16px;
    overflow: hidden;
    /* For rounded corners on first/last child */
    margin-bottom: 30px;
    background-color: transparent;
    /* No background for container itself */
    box-shadow: var(--ios-shadow);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.list-header {
    font-size: 13px;
    color: var(--ios-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 10px 20px;
    font-weight: 600;
}

.card {
    background-color: var(--ios-card-bg);
    /* Glassmorphism start */
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

/* Specific styling for Mode Card in Index */
.mode-card {
    background-color: var(--ios-card-bg);
    border-radius: 16px;
    /* Standalone cards */
    margin-bottom: 12px;
    box-shadow: var(--ios-shadow);
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.mode-card:active {
    transform: scale(0.98);
}

.mode-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 16px;
    color: white;
}

.card:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 0;
    height: 0.5px;
    background-color: rgba(60, 60, 67, 0.18);
    /* Default separator color */
}

.card:active {
    background-color: #E5E5EA;
}

/* Remove separator for Mode Cards since they might be standalone or grid */
.mode-card::after {
    display: none;
}


.card-content {
    flex: 1;
}

.card-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--ios-text);
}

.card-subtitle {
    font-size: 14px;
    color: var(--ios-text-secondary);
    font-weight: 400;
}

.card-arrow {
    color: #C7C7CC;
    font-weight: bold;
    margin-left: 10px;
}


/* Question Styles */
.question-card {
    background-color: var(--ios-card-bg);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--ios-shadow);
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.question-status-pill {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ios-blue);
    background-color: rgba(0, 122, 255, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.question-stem {
    font-size: 18px;
    /* Larger font for readability */
    font-weight: 600;
    margin-bottom: 24px;
    line-height: 1.5;
    color: #000;
}

.question-stem img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 16px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: block;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.option-item {
    background-color: rgba(242, 242, 247, 0.8);
    border-radius: 14px;
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 2px solid transparent;
}

.option-item:hover {
    background-color: #E5E5EA;
}

.option-item.selected {
    border-color: var(--ios-blue);
    background-color: rgba(0, 122, 255, 0.1);
}

.option-item.correct {
    border-color: var(--ios-green);
    background-color: rgba(52, 199, 89, 0.15);
}

.option-item.wrong {
    border-color: var(--ios-red);
    background-color: rgba(255, 59, 48, 0.15);
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }

    100% {
        transform: translateX(0);
    }
}


.option-key {
    font-weight: 700;
    margin-right: 14px;
    min-width: 24px;
    color: var(--ios-text-secondary);
}

.option-item.selected .option-key {
    color: var(--ios-blue);
}

.option-item.correct .option-key {
    color: var(--ios-green);
}

.option-item.wrong .option-key {
    color: var(--ios-red);
}


.option-text img {
    max-width: 100%;
    vertical-align: middle;
}

/* Buttons */
.btn-primary {
    background: var(--ios-blue);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 16px;
    width: 100%;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 24px;
    box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3);
    transition: transform 0.1s, box-shadow 0.1s;
}

.btn-primary:active {
    transform: scale(0.97);
    box-shadow: 0 2px 6px rgba(0, 122, 255, 0.2);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #CCC;
    box-shadow: none;
}

/* Feedback */
/* Feedback (Top Toast Style) */
.feedback-area {
    position: fixed;
    top: 60px;
    /* Below header */
    left: 20px;
    right: 20px;
    margin: 0 auto;
    max-width: 500px;
    padding: 16px 20px;
    border-radius: 16px;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    display: none;
    border-left: none;
    /* Removed simpler border */
    z-index: 300;
    /* Above everything */
    text-align: center;
    transform-origin: top center;
}

.feedback-area.show {
    display: block;
    animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.feedback-title {
    font-weight: 700;
    margin-bottom: 4px;
    font-size: 17px;
}

/* Specific colors for feedback types */
.feedback-area.feedback-correct {
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(52, 199, 89, 0.2);
    color: var(--ios-green);
}

.feedback-area.feedback-correct .feedback-title {
    color: var(--ios-green);
}

.feedback-area.feedback-wrong {
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 59, 48, 0.2);
    color: var(--ios-red);
}

.feedback-area.feedback-wrong .feedback-title {
    color: var(--ios-red);
}

/* Adjust feedback content text color */
#feedback-content {
    color: var(--ios-text-secondary);
    font-size: 14px;
}

.feedback-area.feedback-wrong #feedback-content {
    color: var(--ios-text);
    /* Darker for readability */
}


/* Tab Bar */
.tab-bar {
    position: fixed;
    bottom: 20px;
    /* Floating look */
    left: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: 24px;
    /* Rounded pill shape */
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    height: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    /* Floating shadow */
    border: 1px solid rgba(255, 255, 255, 0.5);
    z-index: 200;
}

.tab-item {
    font-size: 11px;
    font-weight: 500;
    padding: 0;
}

.tab-icon {
    font-size: 22px;
    margin-bottom: 4px;
    transition: transform 0.2s;
}

.tab-item.active .tab-icon {
    transform: translateY(-2px);
}

.tab-item.active {
    color: var(--ios-blue);
    font-weight: 600;
}

/* Fixed Action Bar for Practice Page */
.action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 0.5px solid rgba(0, 0, 0, 0.1);
    padding: 16px 20px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.action-bar .btn-primary {
    margin-top: 0;
    margin-bottom: 0;
}

.container-pb-large {
    padding-bottom: 120px;
    /* Space for the fixed action bar */
}

/* Result View */
.result-card {
    text-align: center;
    padding: 40px 24px;
    background-color: var(--ios-card-bg);
    border-radius: 24px;
    box-shadow: var(--ios-shadow);
    border: 1px solid rgba(255, 255, 255, 0.8);
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-icon {
    font-size: 72px;
    margin-bottom: 16px;
    display: block;
    animation: bounceIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

.result-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--ios-text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.result-score {
    font-size: 64px;
    font-weight: 800;
    background: var(--ios-gradient-blue);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
    line-height: 1;
    font-feature-settings: "tnum";
}

.result-subtitle {
    font-size: 15px;
    color: var(--ios-text-secondary);
    margin-bottom: 40px;
    background-color: rgba(0, 0, 0, 0.03);
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}