:root {
    --bg-color: #f1f5f9;
    --terminal-bg: rgba(255, 255, 255, 0.8);
    --accent-color: #0ea5e9;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --success: #4f9d84;
    --error: #cf6f7d;
    --border-color: #e2e8f0;
    --font-mono: 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --desktop-scale: 0.9;
}

/* 夜间模式变量 */
html[data-theme="dark"] {
    --bg-color: #0f172a;
    --terminal-bg: rgba(30, 41, 59, 0.8);
    --accent-color: #38bdf8;
    --text-primary: rgba(255, 255, 255, 0.9);
    --text-secondary: #94a3b8;
    --success: #73c0a6;
    --error: #e38d99;
    --border-color: #334155;
}

html {
    font-size: 14px; /* Default is 16px, making everything 12.5% smaller */
}

[hidden] {
    display: none !important;
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 50% 50%, var(--gradient-mid, #e2e8f0) 0%, var(--bg-color) 100%);
    color: var(--text-primary);
    font-family: var(--font-sans);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    transform: translate3d(0, 0, 0); /* Force consistent rendering context */
}

html,
body {
    -webkit-text-size-adjust: 100%;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(14, 165, 233, 0.04), transparent 20%);
    opacity: 0.9;
}

body.feedback-open {
    overflow: hidden;
}

html[data-theme="dark"] body {
    --gradient-mid: #1e293b;
}

/* Global Scrollbar */
::-webkit-scrollbar {
    width: 0;
    height: 0;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #475569;
}
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

* {
    scrollbar-width: none;
}

.container {
    width: 95%;
    max-width: 920px; /* Reduced from 1200px */
    height: 85vh; /* Reduced from 90vh */
    display: flex;
    gap: 20px; /* Reduced from 24px */
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    isolation: isolate; /* Create new stacking context */
}

.install-banner {
    position: fixed;
    top: 18px;
    left: 50%;
    width: min(720px, calc(100vw - 32px));
    transform: translate(-50%, -120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.28s ease, opacity 0.28s ease;
    z-index: 220;
}

.install-banner.show {
    transform: translate(-50%, 0);
    opacity: 1;
    pointer-events: auto;
}

.install-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.9);
    color: #e2e8f0;
    border: 1px solid rgba(56, 189, 248, 0.22);
    box-shadow: 0 22px 60px rgba(2, 6, 23, 0.28);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.install-banner-title {
    font-size: 0.92rem;
    font-weight: 700;
}

.install-banner-text {
    margin-top: 4px;
    font-size: 0.82rem;
    line-height: 1.5;
    color: rgba(226, 232, 240, 0.84);
}

.install-banner-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.install-btn {
    border: none;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.install-btn-primary {
    color: #082f49;
    background: linear-gradient(180deg, #7dd3fc, #38bdf8);
}

.install-btn-ghost {
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.16);
}

@media (min-width: 769px) {
    .container {
        width: min(calc(95% / var(--desktop-scale)), 111.111%);
        max-width: calc(880px / var(--desktop-scale));
        height: calc(85vh / var(--desktop-scale));
        transform: scale(var(--desktop-scale));
        transform-origin: center;
    }
}

.container.sidebar-hidden .sidebar {
    width: 0;
    opacity: 0;
    margin-right: -24px;
    pointer-events: none;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transform: translateZ(0); /* Force GPU acceleration */
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.container:not(.sidebar-hidden) .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
}

@media (min-width: 769px) {
    .sidebar-overlay {
        display: none;
    }
}

.sidebar {
    width: 240px; /* Reduced from 280px */
    background-color: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    background-clip: padding-box;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    margin-bottom: 55px; /* Align with terminal window bottom */
}

html[data-theme="dark"] .sidebar {
    background-color: rgba(30, 41, 59, 0.55);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

.sidebar-header {
    padding: 12px 16px; /* Reduced from 16px 20px */
    background: linear-gradient(180deg, rgba(224, 242, 254, 0.58), rgba(248, 250, 252, 0.46));
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header-title {
    font-size: 0.95rem;
}

html[data-theme="dark"] .sidebar-header {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.56), rgba(15, 23, 42, 0.42));
}

.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0; /* Reduced from 10px 0 */
}

.exam-selector {
    padding: 8px 12px; /* Reduced from 10px 16px */
}

#exam-select {
    width: 100%;
    padding: 8px 10px; /* Reduced from 10px 12px */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    font-size: 0.8rem; /* Reduced from 0.85rem */
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

#exam-select:hover {
    border-color: var(--accent-color);
}

#exam-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.source-list {
    padding: 8px; /* Reduced from 10px */
    overflow-y: auto;
    flex-grow: 1;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.source-list::-webkit-scrollbar {
    display: none;
}

.source-item {
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    font-family: var(--font-sans);
    color: var(--text-secondary);
    margin-bottom: 4px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.4;
    position: relative;
}

.source-item span {
    font-family: inherit;
}

.source-item:hover {
    background: rgba(14, 165, 233, 0.08);
    color: var(--accent-color);
    transform: translateX(4px);
}

.source-item.active {
    background: white;
    color: var(--accent-color);
    border-color: var(--border-color);
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

html[data-theme="dark"] .source-item.active {
    background: rgba(51, 65, 85, 0.8);
}

.source-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 3px;
    background: var(--accent-color);
    border-radius: 0 4px 4px 0;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.terminal-window {
    flex-grow: 1;
    background-color: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    background-clip: padding-box;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(14, 165, 233, 0.08), 0 10px 24px rgba(15, 23, 42, 0.05);
    transition: all 0.3s ease;
}

html[data-theme="dark"] .terminal-window {
    background-color: rgba(30, 41, 59, 0.55);
    box-shadow: 0 18px 48px rgba(2, 132, 199, 0.12), 0 12px 28px rgba(0, 0, 0, 0.24);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        min-height: 100svh;
        align-items: stretch;
        justify-content: flex-start;
        overflow-x: hidden;
        overflow-y: auto;
        padding-bottom: calc(88px + env(safe-area-inset-bottom));
    }

    .container {
        min-height: calc(100svh - 84px - env(safe-area-inset-bottom));
        height: auto;
        gap: 0;
        width: 100%;
        padding: 72px 10px 0;
        margin-top: 0;
    }

    .sidebar {
        position: absolute;
        left: 10px;
        top: 10px;
        bottom: 10px;
        width: min(82vw, 320px);
        margin-bottom: 0;
        z-index: 100;
        box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    }

    .main-content,
    .terminal-window,
    #terminal-body {
        min-height: 0;
    }

    .install-banner {
        top: 12px;
        width: calc(100vw - 24px);
    }

    .install-banner-content {
        align-items: flex-start;
        flex-direction: column;
    }

    .install-banner-actions {
        width: 100%;
    }

    .install-btn {
        flex: 1;
    }

    .container.sidebar-hidden .sidebar {
        transform: translateX(-110%);
        margin-right: 0;
    }

    .progress-container {
        margin: 0 15px;
    
    }

    .btn {
        min-height: 46px;
        padding: 10px 16px;
    }

    .feedback-fab {
        right: 14px;
        bottom: calc(14px + env(safe-area-inset-bottom));
        width: 38px;
        height: 38px;
        opacity: 0.9;
    }

    .feedback-panel {
        top: auto;
        left: 12px;
        right: 12px;
        bottom: calc(70px + env(safe-area-inset-bottom));
        width: auto;
        max-height: min(68vh, 640px);
        border-radius: 20px;
        transform: translateY(16px) scale(0.98);
    }

    .auth-fab {
        top: 12px;
        right: 12px;
        min-width: 82px;
        height: 40px;
        padding: 0 16px;
    }

    .auth-panel,
    .progress-panel,
    .stats-panel,
    .leaderboard-panel,
    .search-panel {
        top: auto;
        width: auto;
        left: 12px;
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom));
        max-height: min(78vh, 720px);
        border-radius: 22px 22px 18px 18px;
        transform: translateY(18px) scale(0.98);
    }

    .auth-panel.open,
    .progress-panel.open,
    .stats-panel.open,
    .leaderboard-panel.open,
    .search-panel.open,
    .feedback-panel.open {
        transform: translateY(0) scale(1);
    }

    .progress-summary-grid {
        grid-template-columns: 1fr;
    }

    .progress-stat-wide {
        grid-column: span 1;
    }

    .question-card {
        padding: 14px;
        border-radius: 16px;
    }

    .question-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .option-item {
        align-items: flex-start;
        min-height: 52px;
    }

    .footer-nav {
        position: sticky;
        bottom: calc(10px + env(safe-area-inset-bottom));
        z-index: 80;
        margin-top: 12px;
        padding: 10px 12px;
        border: 1px solid rgba(148, 163, 184, 0.2);
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.72);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
    }

    html[data-theme="dark"] .footer-nav {
        background: rgba(15, 23, 42, 0.72);
        border-color: rgba(148, 163, 184, 0.14);
        box-shadow: 0 16px 40px rgba(2, 6, 23, 0.28);
    }
}

@media (max-width: 480px) {
    body {
        min-height: 100svh;
    }

    .terminal-header {
        padding: 10px 15px;
    }

    .terminal-title {
        font-size: 0.75rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .footer-nav {
        flex-wrap: wrap;
        gap: 10px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }

    .progress-container {
        order: 3;
        width: 100%;
        margin: 0;
    }

    .btn {
        flex: 1;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }

    #prev-btn,
    #next-btn {
        flex: 1 1 calc(50% - 5px);
        padding-left: 14px;
        padding-right: 14px;
    }

    .feedback-fab {
        padding: 0;
    }

    .feedback-fab-mark {
        width: 100%;
        height: 100%;
        font-size: 0.66rem;
    }

    .feedback-panel {
        bottom: calc(68px + env(safe-area-inset-bottom));
    }

    .search-panel-form {
        flex-direction: column;
        align-items: stretch;
    }

    .search-panel-submit {
        justify-content: center;
    }

    .progress-item-header,
    .stats-section-header {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-rank-score {
        font-size: 1rem;
    }

    .question-text {
        font-size: 0.98rem;
        line-height: 1.55;
    }

    .option-item {
        padding: 12px 14px;
    }

    .option-prefix {
        margin-right: 12px;
    }
}

@media (max-width: 360px) {
    .btn span {
        display: none;
    }

    #prev-btn,
    #next-btn {
        flex-basis: auto;
    }

    .auth-fab {
        min-width: 74px;
        padding: 0 12px;
    }
}

.terminal-header {
    background: linear-gradient(180deg, rgba(224, 242, 254, 0.72), rgba(240, 249, 255, 0.52)); /* Slight blue tint for depth */
    padding: 8px 16px; /* Reduced from 12px 20px */
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--border-color);
}

html[data-theme="dark"] .terminal-header {
    background: rgba(15, 23, 42, 0.5);
}

html[data-theme="dark"] .toggle-btn {
    background: transparent;
    border-color: transparent;
}

html[data-theme="dark"] .toggle-btn:hover {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.dot {
    width: 10px; /* Reduced from 12px */
    height: 10px; /* Reduced from 12px */
    border-radius: 50%;
    margin-right: 6px; /* Reduced from 8px */
}
.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.toggle-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid transparent;
    cursor: pointer;
    padding: 6px;
    color: var(--text-secondary);
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(148, 163, 184, 0.22);
    color: var(--accent-color);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.toggle-btn:active {
    transform: translateY(0) scale(0.96);
    box-shadow: none;
}

.terminal-title {
    margin-left: auto;
    margin-right: auto;
    font-family: var(--font-mono);
    font-size: 0.8rem; /* Reduced from 0.85rem */
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

#search-toggle-btn {
    margin-left: 10px;
}

#leaderboard-toggle-btn {
    margin-left: 4px;
}

#theme-toggle-btn {
    margin-left: 4px;
}

@keyframes btnPop {
    0% { transform: scale(1); opacity: 1; }
    40% { transform: scale(0.82); opacity: 0.7; }
    70% { transform: scale(1.12); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

#search-toggle-btn,
#auth-fab,
#feedback-fab {
    transition: transform 0.12s ease;
}

#search-toggle-btn:active,
#auth-fab:active,
#feedback-fab:active {
    transform: scale(0.88);
    animation: btnPop 0.36s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#terminal-body {
    padding: 16px; /* Reduced from 20px */
    overflow-y: auto;
    flex-grow: 1;
    font-family: var(--font-mono);
}

.log-line {
    margin-bottom: 6px; /* Reduced from 8px */
    display: flex;
    font-size: 0.8rem; /* Reduced from 0.85rem */
    animation: fadeIn 0.3s ease-out;
}

.log-line.random-login-prompt {
    font-family: var(--font-sans);
    font-size: 0.92rem;
    font-weight: 600;
}

.log-line.random-login-prompt .content {
    color: var(--text-primary);
}

.log-line.random-login-prompt .status-tag {
    font-weight: 700;
    letter-spacing: 0.04em;
}

.timestamp {
    color: var(--text-secondary);
    margin-right: 10px; /* Reduced from 12px */
    opacity: 0.6;
}

.status-tag {
    padding: 1px 4px; /* Reduced padding */
    border-radius: 3px;
    font-size: 0.65rem; /* Reduced from 0.7rem */
    margin-right: 8px; /* Reduced from 10px */
    font-weight: bold;
}

.status-info { background: rgba(56, 189, 248, 0.2); color: var(--accent-color); }
.status-success { background: rgba(79, 157, 132, 0.16); color: var(--success); }
.log-line:has(.status-error),
.log-line:has(.status-success) { display: none; }

.content {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgba(15, 23, 42, 0.68);
}

html[data-theme="dark"] .content {
    color: rgba(226, 232, 240, 0.68);
}

.question-card {
    margin-top: 12px; /* Reduced from 15px */
    padding: 16px; /* Reduced from 20px */
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    animation: slideUp 0.4s ease-out;
}

html[data-theme="dark"] .question-card {
    background: rgba(30, 41, 59, 0.4);
}

.question-empty-state {
    min-height: calc(100% - 8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px 24px 56px;
    text-align: center;
    color: var(--text-secondary);
}

.question-empty-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: rgba(14, 165, 233, 0.1);
    color: var(--accent-color);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

html[data-theme="dark"] .question-empty-icon {
    background: rgba(56, 189, 248, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.question-empty-title {
    margin: 0;
    font-size: 1.24rem;
    font-weight: 500;
    color: var(--text-primary);
}

.question-empty-text {
    max-width: 420px;
    margin: 0;
    font-size: 1.08rem;
    font-weight: 400;
    line-height: 1.7;
}

.question-empty-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 2px;
}

.question-empty-actions .btn {
    font-size: 1rem;
}

.random-login-state {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(248, 250, 252, 0.42));
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.05);
    transform: translateY(-24px);
}

html[data-theme="dark"] .random-login-state {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.54), rgba(15, 23, 42, 0.42));
    border-color: rgba(148, 163, 184, 0.14);
    box-shadow: 0 20px 54px rgba(2, 6, 23, 0.22);
}

.question-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.tag-badge.question-attempt-tag {
    margin-left: auto;
    background: rgba(139, 92, 246, 0.10);
    color: #6d28d9;
    border-color: rgba(139, 92, 246, 0.18);
}

html[data-theme="dark"] .tag-badge.question-attempt-tag {
    background: rgba(167, 139, 250, 0.14);
    color: #c4b5fd;
    border-color: rgba(167, 139, 250, 0.22);
}

.question-meta {
    color: var(--accent-color);
    font-size: 0.7rem; /* Reduced from 0.75rem */
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.question-text {
    font-family: var(--font-sans);
    font-size: 1.05rem; /* Reduced from 1.15rem */
    line-height: 1.45; /* Reduced from 1.5 */
    margin-bottom: 20px; /* Reduced from 24px */
    color: var(--text-primary);
    font-weight: 500;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px; /* Reduced from 10px */
}

.option-item {
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 10px 16px; /* Reduced from 12px 18px */
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-sans);
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

html[data-theme="dark"] .option-item {
    background: rgba(51, 65, 85, 0.6);
}

.option-item:hover {
    background: #f8fafc;
    border-color: var(--accent-color);
    transform: translateX(4px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

html[data-theme="dark"] .option-item:hover {
    background: rgba(51, 65, 85, 0.8);
}

.option-item.selected {
    border-color: var(--accent-color);
    background: rgba(14, 165, 233, 0.05);
}

.option-item.correct {
    border-color: var(--success);
    background: rgba(79, 157, 132, 0.09);
    color: var(--success);
    font-weight: 600;
}

.option-item.wrong {
    border-color: var(--error);
    background: rgba(207, 111, 125, 0.09);
    color: var(--error);
    font-weight: 600;
}

.option-prefix {
    font-family: var(--font-mono);
    font-weight: bold;
    margin-right: 15px;
    color: var(--accent-color);
}

.analysis-box {
    margin-top: 25px;
    padding: 20px;
    background: rgba(241, 245, 249, 0.96);
    border-left: 4px solid var(--accent-color);
    border-radius: 0 8px 8px 0;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

html[data-theme="dark"] .analysis-box {
    background: rgba(30, 41, 59, 0.74);
}

.question-feedback-link {
    margin-top: 14px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    cursor: pointer;
}

.question-feedback-link span {
    color: var(--accent-color);
}

.question-feedback-link:hover {
    color: var(--text-primary);
}

.feedback-fab {
    position: fixed;
    right: 4px;
    bottom: 4px;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    background: rgba(14, 165, 233, 0.18);
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    opacity: 0.62;
    box-shadow: 0 8px 18px rgba(14, 165, 233, 0.12);
    cursor: pointer;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.auth-fab {
    position: fixed;
    top: clamp(16px, 2vw, 24px);
    right: clamp(16px, 2vw, 24px);
    z-index: 150;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid rgba(14, 165, 233, 0.24);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(56, 189, 248, 0.98), rgba(14, 165, 233, 0.96));
    color: #f8fafc;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 12px 30px rgba(14, 165, 233, 0.28);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-fab:hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, rgba(14, 165, 233, 1), rgba(2, 132, 199, 0.98));
    box-shadow: 0 16px 36px rgba(14, 165, 233, 0.34);
}

@media (min-width: 1280px) {
    .auth-fab {
        top: 24px;
        right: 24px;
    }
}

.feedback-fab:hover {
    transform: translateY(-1px);
    opacity: 0.9;
    background: rgba(14, 165, 233, 0.3);
    box-shadow: 0 12px 24px rgba(14, 165, 233, 0.18);
}

.feedback-fab-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.72rem;
    font-weight: 700;
}

.feedback-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.36);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 160;
}

.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 160;
}

.auth-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.feedback-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.feedback-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    width: min(360px, calc(100vw - 32px));
    max-height: min(75vh, 640px);
    padding: 18px;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 25px 80px rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, calc(-50% + 16px)) scale(0.98);
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 170;
    overflow-y: auto;
}

.auth-panel,
.progress-panel,
.stats-panel,
.leaderboard-panel,
.search-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    width: min(420px, calc(100vw - 32px));
    max-height: min(80vh, 720px);
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.88);
    box-sizing: border-box;
    box-shadow: 0 25px 80px rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(26px);
    -webkit-backdrop-filter: blur(26px);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, calc(-50% + 16px)) scale(0.98);
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 170;
    overflow-y: auto;
}

.auth-panel {
    border-color: rgba(255, 255, 255, 0.5);
}

.progress-panel {
    width: min(680px, calc(100vw - 32px));
}

.stats-panel {
    width: min(760px, calc(100vw - 32px));
}

html[data-theme="dark"] .auth-panel,
html[data-theme="dark"] .progress-panel,
html[data-theme="dark"] .stats-panel,
html[data-theme="dark"] .leaderboard-panel,
html[data-theme="dark"] .search-panel {
    background: rgba(30, 41, 59, 0.9);
    box-shadow: 0 25px 80px rgba(2, 6, 23, 0.5);
}

html[data-theme="dark"] .auth-panel {
    border-color: rgba(255, 255, 255, 0.12);
}

.auth-panel.open,
.progress-panel.open,
.stats-panel.open,
.leaderboard-panel.open,
.search-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.search-panel {
    width: min(720px, calc(100vw - 32px));
}

.leaderboard-panel {
    width: min(560px, calc(100vw - 32px));
    max-height: min(74vh, 680px);
    transform: translate(-50%, calc(-50% + 20px)) scale(0.94);
    transition: opacity 0.24s ease, transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

.leaderboard-panel.open {
    transform: translate(-50%, -50%) scale(1);
}

.leaderboard-panel .feedback-panel-title {
    position: relative;
    padding-left: 12px;
    letter-spacing: 0.02em;
}

.leaderboard-total-note {
    color: rgba(100, 116, 139, 0.64);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.5;
}

.leaderboard-meta-row {
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.leaderboard-sort-note {
    color: rgba(100, 116, 139, 0.64);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.5;
}

html[data-theme="dark"] .leaderboard-total-note {
    color: rgba(148, 163, 184, 0.64);
}

html[data-theme="dark"] .leaderboard-sort-note {
    color: rgba(148, 163, 184, 0.64);
}

.leaderboard-panel .feedback-panel-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, #38bdf8, #0284c7);
}

.leaderboard-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.leaderboard-rank-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-rank-item {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.15);
    background: rgba(248, 250, 252, 0.72);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
    opacity: 0;
    transform: translateY(8px) scale(0.985);
    animation: leaderboardItemIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: var(--rank-delay, 0ms);
    position: relative;
    overflow: hidden;
}

html[data-theme="dark"] .leaderboard-rank-item {
    background: rgba(30, 41, 59, 0.62);
    border-color: rgba(148, 163, 184, 0.16);
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.22);
}

.leaderboard-rank-order {
    color: var(--accent-color);
    font-weight: 700;
    font-size: 0.9rem;
    font-family: var(--font-mono);
    width: 38px;
    height: 38px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.2);
    z-index: 1;
}

.leaderboard-rank-icon {
    color: #0f172a;
}

.leaderboard-rank-icon.rank-gold {
    background: linear-gradient(180deg, #fde68a, #f59e0b);
    border-color: rgba(180, 83, 9, 0.35);
}

.leaderboard-rank-icon.rank-silver {
    background: linear-gradient(180deg, #e2e8f0, #94a3b8);
    border-color: rgba(100, 116, 139, 0.35);
}

.leaderboard-rank-icon.rank-bronze {
    background: linear-gradient(180deg, #fdba74, #c2410c);
    border-color: rgba(154, 52, 18, 0.35);
}

html[data-theme="dark"] .leaderboard-rank-icon {
    color: #0f172a;
}

.leaderboard-rank-student {
    min-width: 0;
    font-weight: 600;
    font-size: 0.94rem;
    color: var(--text-primary);
    letter-spacing: 0.04em;
    font-family: var(--font-mono);
    z-index: 1;
}

.leaderboard-rank-score {
    font-size: 1.16rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: var(--font-mono);
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    z-index: 1;
}

.leaderboard-score-value {
    font-size: 1.2em;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.leaderboard-score-unit {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-weight: 600;
}

.leaderboard-rank-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: calc(var(--score-ratio, 0) * 100%);
    pointer-events: none;
    background: linear-gradient(90deg, rgba(14, 165, 233, 0.16), rgba(56, 189, 248, 0.06));
    z-index: 0;
}

.rank-top-1,
.rank-top-2,
.rank-top-3 {
    border-color: rgba(14, 165, 233, 0.26);
    background: linear-gradient(180deg, rgba(224, 242, 254, 0.68), rgba(248, 250, 252, 0.76));
}

html[data-theme="dark"] .rank-top-1,
html[data-theme="dark"] .rank-top-2,
html[data-theme="dark"] .rank-top-3 {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.74), rgba(15, 23, 42, 0.68));
    border-color: rgba(56, 189, 248, 0.28);
}

.rank-top-1 {
    min-height: 58px;
    border-color: rgba(245, 158, 11, 0.38);
    background: linear-gradient(180deg, rgba(255, 247, 208, 0.95), rgba(254, 240, 138, 0.5));
    box-shadow: 0 12px 26px rgba(245, 158, 11, 0.24), 0 0 0 1px rgba(251, 191, 36, 0.2);
    animation: leaderboardItemIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) forwards,
        leaderPulse 2.8s ease-in-out infinite;
    animation-delay: var(--rank-delay, 0ms), calc(var(--rank-delay, 0ms) + 220ms);
}

html[data-theme="dark"] .rank-top-1 {
    background: linear-gradient(180deg, rgba(120, 53, 15, 0.58), rgba(69, 26, 3, 0.54));
    border-color: rgba(251, 191, 36, 0.45);
    box-shadow: 0 14px 30px rgba(245, 158, 11, 0.24), 0 0 0 1px rgba(251, 191, 36, 0.24);
}

.leaderboard-my-rank {
    margin-top: 6px;
    border-radius: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-secondary);
    font-size: 0.84rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.leaderboard-my-rank strong {
    color: var(--text-primary);
    margin-left: 2px;
    margin-right: auto;
    padding-left: 6px;
}

.leaderboard-my-rank span {
    color: var(--text-primary);
    font-weight: 600;
}

.leaderboard-my-rank-muted {
    justify-content: center;
}

html[data-theme="dark"] .leaderboard-my-rank {
    background: rgba(15, 23, 42, 0.46);
    border-color: rgba(148, 163, 184, 0.16);
}

@keyframes leaderPulse {
    0%,
    100% {
        box-shadow: 0 12px 26px rgba(245, 158, 11, 0.24), 0 0 0 1px rgba(251, 191, 36, 0.2), 0 0 0 0 rgba(251, 191, 36, 0.16);
    }
    50% {
        box-shadow: 0 16px 30px rgba(245, 158, 11, 0.3), 0 0 0 1px rgba(251, 191, 36, 0.26), 0 0 28px 4px rgba(251, 191, 36, 0.18);
    }
}

@keyframes leaderboardItemIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.search-panel[hidden],
.feedback-panel[hidden],
.auth-overlay[hidden] {
    display: none !important;
}

.feedback-overlay[hidden] {
    display: none !important;
}

.search-panel-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.search-panel-form {
    display: block;
}

.search-panel-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-panel-input {
    width: 100%;
    height: 44px;
    padding: 0 52px 0 16px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.92rem;
    outline: none;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.search-panel-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12), 0 12px 26px rgba(14, 165, 233, 0.16);
}

html[data-theme="dark"] .search-panel-input {
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(148, 163, 184, 0.28);
    box-shadow: 0 12px 26px rgba(2, 6, 23, 0.28);
}

.search-panel-icon-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    width: 32px;
    height: 32px;
    transform: translateY(-50%);
    border: none;
    border-radius: 999px;
    color: #ffffff;
    background: linear-gradient(180deg, #38bdf8, #0284c7);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(14, 165, 233, 0.34);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.search-panel-icon-btn:hover {
    transform: translateY(-50%) scale(1.03);
    box-shadow: 0 10px 20px rgba(14, 165, 233, 0.4);
    filter: saturate(1.05);
}

.search-panel-icon-btn:active {
    transform: translateY(-50%) scale(0.97);
}

.search-panel-icon-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

html[data-theme="dark"] .search-panel-icon-btn {
    background: linear-gradient(180deg, #38bdf8, #0369a1);
    box-shadow: 0 10px 22px rgba(2, 132, 199, 0.36);
}

.search-suggestion-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-suggestion-title {
    font-size: 0.82rem;
    color: rgba(71, 85, 105, 0.9);
    font-weight: 600;
}

.search-suggestion-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.search-suggestion-chip {
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.82);
    color: var(--text-secondary);
    padding: 5px 11px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-suggestion-chip:hover {
    color: var(--accent-color);
    border-color: rgba(14, 165, 233, 0.34);
    background: rgba(224, 242, 254, 0.72);
}

.search-panel-count {
    min-height: 18px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.search-panel-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 96px;
    max-height: min(46vh, 420px);
    overflow-y: auto;
    padding-right: 2px;
}

.search-panel .auth-panel-header {
    margin-bottom: 20px;
}

.search-panel .feedback-panel-title {
    font-size: 1.16rem;
    font-weight: 800;
}

.search-panel .feedback-panel-subtitle {
    color: rgba(71, 85, 105, 0.88);
}

.search-panel .feedback-close-btn {
    opacity: 0.9;
    color: rgba(71, 85, 105, 0.95);
    padding: 7px;
}

.search-panel .feedback-close-btn:hover {
    background: rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] .search-suggestion-title {
    color: rgba(148, 163, 184, 0.9);
}

html[data-theme="dark"] .search-suggestion-chip {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(148, 163, 184, 0.26);
    color: rgba(148, 163, 184, 0.92);
}

html[data-theme="dark"] .search-suggestion-chip:hover {
    background: rgba(14, 116, 144, 0.26);
    border-color: rgba(56, 189, 248, 0.34);
    color: #7dd3fc;
}

html[data-theme="dark"] .search-panel .feedback-panel-subtitle {
    color: rgba(148, 163, 184, 0.88);
}

html[data-theme="dark"] .search-panel .feedback-close-btn {
    color: rgba(148, 163, 184, 0.96);
}

.search-result-item {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.54);
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.search-result-item:hover {
    border-color: rgba(14, 165, 233, 0.3);
    background: rgba(14, 165, 233, 0.06);
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

html[data-theme="dark"] .search-result-item {
    background: rgba(15, 23, 42, 0.6);
}

html[data-theme="dark"] .search-result-item:hover {
    background: rgba(30, 41, 59, 0.76);
    box-shadow: 0 14px 30px rgba(2, 6, 23, 0.24);
}

.search-result-question {
    color: var(--text-primary);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.55;
}

.search-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.search-result-meta span {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    font-size: 1rem;
}

.search-empty-state {
    padding: 30px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.search-empty-icon {
    margin-bottom: 12px;
    opacity: 0.52;
}

.search-empty-text {
    font-size: 0.88rem;
    line-height: 1.6;
}

html[data-theme="dark"] .feedback-panel {
    background: rgba(30, 41, 59, 0.88);
    box-shadow: 0 25px 80px rgba(2, 6, 23, 0.45);
}

.feedback-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.feedback-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.feedback-panel-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.feedback-panel-subtitle {
    margin-top: 4px;
    font-size: 0.8rem;
    color: rgba(100, 116, 139, 0.78);
    line-height: 1.5;
}

html[data-theme="dark"] .feedback-panel-subtitle {
    color: rgba(148, 163, 184, 0.78);
}

.feedback-close-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 3px;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.72;
}

.feedback-close-btn:hover {
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-primary);
    opacity: 1;
}

.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-panel-header {
    margin-bottom: 16px;
}

.auth-actions {
    display: flex;
    justify-content: stretch;
    margin-top: 14px;
}

.auth-submit-btn {
    width: 100%;
    justify-content: center;
    font-family: var(--font-sans);
    font-weight: 700;
    letter-spacing: 0.04em;
    background: linear-gradient(90deg, rgba(2, 132, 199, 0.98), rgba(56, 189, 248, 1));
    border-color: rgba(14, 165, 233, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 14px 34px rgba(14, 165, 233, 0.26);
}

.auth-submit-btn:hover {
    background: linear-gradient(90deg, rgba(3, 105, 161, 1), rgba(14, 165, 233, 1));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 18px 38px rgba(14, 165, 233, 0.32);
}

.auth-secondary-actions {
    display: flex;
    justify-content: center;
    margin-top: 2px;
}

.auth-text-action {
    border: none;
    background: transparent;
    padding: 0;
    color: var(--accent-color);
    font-family: var(--font-sans);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.auth-text-action:hover {
    color: #0284c7;
}

html[data-theme="dark"] .auth-text-action:hover {
    color: #7dd3fc;
}

.auth-text-action[hidden] {
    display: none;
}

.auth-user-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-user-card {
    padding: 16px;
    border-radius: 16px;
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.14);
}

.auth-user-title {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.auth-user-id {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.06em;
}

.auth-user-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-user-btn {
    justify-content: center;
}

.progress-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.progress-stat-card {
    padding: 16px;
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.72);
    border: 1px solid var(--border-color);
}

html[data-theme="dark"] .progress-stat-card {
    background: rgba(15, 23, 42, 0.62);
}

.progress-stat-wide {
    grid-column: span 2;
}

.progress-stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.progress-stat-value {
    font-size: 1.28rem;
    font-weight: 700;
    color: var(--text-primary);
}

.progress-stat-action {
    display: flex;
    align-items: center;
    min-height: 32px;
}

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

.progress-panel-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
}

.progress-logout-btn {
    justify-content: center;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    box-shadow: none;
}

.stats-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.stats-section {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.56);
    border: 1px solid var(--border-color);
}

html[data-theme="dark"] .stats-section {
    background: rgba(15, 23, 42, 0.58);
}

.stats-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.stats-section-title {
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stats-section-note {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.stats-rank-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stats-rank-item {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

html[data-theme="dark"] .stats-rank-item {
    background: rgba(30, 41, 59, 0.62);
}

.stats-rank-order {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-color);
    background: rgba(14, 165, 233, 0.1);
}

.stats-rank-main {
    min-width: 0;
}

.stats-rank-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stats-rank-meta {
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.stats-rank-score {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stats-heatmap-scroll {
    overflow-x: auto;
    padding-bottom: 4px;
}

.stats-heatmap-grid {
    display: inline-flex;
    gap: 6px;
    min-width: 100%;
}

.stats-heatmap-column {
    display: grid;
    grid-template-rows: repeat(7, 12px);
    gap: 6px;
}

.stats-heatmap-cell,
.stats-legend-cell {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.08);
}

.stats-heatmap-cell.level-1,
.stats-legend-cell.level-1 {
    background: rgba(56, 189, 248, 0.28);
    border-color: rgba(56, 189, 248, 0.18);
}

.stats-heatmap-cell.level-2,
.stats-legend-cell.level-2 {
    background: rgba(14, 165, 233, 0.46);
    border-color: rgba(14, 165, 233, 0.24);
}

.stats-heatmap-cell.level-3,
.stats-legend-cell.level-3 {
    background: rgba(2, 132, 199, 0.72);
    border-color: rgba(2, 132, 199, 0.3);
}

.stats-heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.progress-item {
    padding: 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.64);
    border: 1px solid var(--border-color);
}

html[data-theme="dark"] .progress-item {
    background: rgba(15, 23, 42, 0.62);
}

.progress-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.progress-item-meta {
    font-size: 0.8rem;
    color: var(--accent-color);
    font-weight: 600;
}

.progress-item-question {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.progress-item-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.progress-item-stats span {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
}

.progress-jump {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    padding: 8px 14px;
    background: rgba(14, 165, 233, 0.14);
    color: var(--accent-color);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}

.progress-jump.ghost {
    padding: 6px 12px;
}

.progress-jump:hover {
    background: rgba(14, 165, 233, 0.22);
}

.progress-muted,
.progress-empty,
.progress-loading {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.progress-empty,
.progress-loading {
    padding: 20px 0;
}

.feedback-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.feedback-select,
.feedback-textarea,
.feedback-input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.92rem;
    padding: 12px 14px;
    box-sizing: border-box;
}

.feedback-input::placeholder {
    color: rgba(100, 116, 139, 0.9);
}

html[data-theme="dark"] .feedback-select,
html[data-theme="dark"] .feedback-textarea,
html[data-theme="dark"] .feedback-input {
    background: rgba(15, 23, 42, 0.88);
}

html[data-theme="dark"] .feedback-input::placeholder {
    color: rgba(148, 163, 184, 0.9);
}

.feedback-select {
    appearance: none;
    -webkit-appearance: none;
    border-color: rgba(148, 163, 184, 0.4);
    background-color: #ffffff;
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.98));
    background-repeat: no-repeat;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.36);
}

html[data-theme="dark"] .feedback-select {
    border-color: rgba(148, 163, 184, 0.28);
    background-color: #0f172a;
    background-image: linear-gradient(180deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.feedback-select:focus,
.feedback-textarea:focus,
.feedback-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12), 0 0 18px rgba(14, 165, 233, 0.12);
}

.feedback-select:hover {
    border-color: rgba(14, 165, 233, 0.35);
}

.feedback-select option {
    color: #0f172a;
    background: #ffffff;
}

html[data-theme="dark"] .feedback-select option {
    color: #f1f5f9;
    background: #0f172a;
}

.feedback-textarea {
    min-height: 130px;
    resize: vertical;
}

.feedback-message {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.82rem;
    line-height: 1.5;
}

.feedback-message-info {
    background: rgba(14, 165, 233, 0.1);
    color: var(--accent-color);
}

.feedback-message-success {
    background: rgba(79, 157, 132, 0.12);
    color: var(--success);
}

.feedback-message-error {
    background: rgba(207, 111, 125, 0.12);
    color: var(--error);
}

.feedback-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 6px;
}

.feedback-cancel-btn {
    min-width: 72px;
}

code {
    font-family: var(--font-mono);
    background: rgba(14, 165, 233, 0.1);
    color: var(--accent-color);
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.9em;
}

pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 15px 0;
    font-family: var(--font-mono);
    line-height: 1.5;
    font-size: 0.9rem;
}

html[data-theme="dark"] pre {
    background: #0f172a;
    border: 1px solid var(--border-color);
}

pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.question-text p,
.option-text p,
.analysis-box p {
    margin: 0 0 10px 0;
}

.question-text p:last-child,
.option-text p:last-child,
.analysis-box p:last-child {
    margin-bottom: 0;
}

.option-text {
    flex: 1;
}

.footer-nav {
    margin-top: 15px; /* Reduced from 25px */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.btn {
    padding: 10px 18px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 0.85rem; /* Reduced from 0.9rem */
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

#prev-btn,
#next-btn {
    font-family: var(--font-sans);
    font-weight: 700;
    letter-spacing: 0.04em;
    font-size: 0.88rem;
}

.btn-primary {
    background: linear-gradient(180deg, rgba(125, 211, 252, 0.98), rgba(14, 165, 233, 0.96));
    color: #fff;
    border-color: rgba(14, 165, 233, 0.24);
    box-shadow: 0 12px 30px rgba(14, 165, 233, 0.24);
}

.btn-primary:hover {
    background: linear-gradient(180deg, rgba(56, 189, 248, 1), rgba(2, 132, 199, 0.98));
    box-shadow: 0 16px 36px rgba(14, 165, 233, 0.32);
    transform: translateY(-1px);
}

#next-btn {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.26),
        inset 0 -2px 6px rgba(3, 105, 161, 0.2),
        0 12px 30px rgba(14, 165, 233, 0.24);
}

#next-btn:hover {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.34),
        inset 0 -2px 8px rgba(3, 105, 161, 0.24),
        0 16px 36px rgba(14, 165, 233, 0.32);
}

#next-btn:active {
    box-shadow:
        inset 0 2px 10px rgba(3, 105, 161, 0.26),
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 8px 18px rgba(14, 165, 233, 0.18);
}

html[data-theme="dark"] #next-btn {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        inset 0 -2px 6px rgba(2, 132, 199, 0.24),
        0 12px 30px rgba(2, 132, 199, 0.2);
}

html[data-theme="dark"] #next-btn:hover {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -2px 8px rgba(2, 132, 199, 0.3),
        0 16px 36px rgba(2, 132, 199, 0.26);
}

html[data-theme="dark"] #next-btn:active {
    box-shadow:
        inset 0 2px 10px rgba(2, 132, 199, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 8px 18px rgba(2, 132, 199, 0.16);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.42);
    border-color: rgba(148, 163, 184, 0.22);
    color: var(--text-primary);
}

#prev-btn {
    padding: 8px 20px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.92), rgba(226, 232, 240, 0.9));
    border-color: rgba(148, 163, 184, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 10px 22px rgba(15, 23, 42, 0.06);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.58);
    border-color: rgba(14, 165, 233, 0.24);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.1);
    transform: translateY(-1px);
}

#prev-btn:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(226, 232, 240, 0.96));
    border-color: rgba(148, 163, 184, 0.38);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 12px 26px rgba(15, 23, 42, 0.08);
    transform: none;
}

html[data-theme="dark"] #prev-btn {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.86));
    border-color: rgba(148, 163, 184, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 22px rgba(2, 6, 23, 0.16);
    color: var(--text-secondary);
}

html[data-theme="dark"] #prev-btn:hover {
    background: linear-gradient(180deg, rgba(51, 65, 85, 0.96), rgba(30, 41, 59, 0.92));
    border-color: rgba(148, 163, 184, 0.24);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 12px 26px rgba(2, 6, 23, 0.2);
}

.btn:active {
    transform: translateY(0);
}

html[data-theme="dark"] .btn-outline {
    background: rgba(15, 23, 42, 0.44);
    border-color: rgba(148, 163, 184, 0.18);
    color: var(--text-primary);
}

html[data-theme="dark"] .btn-outline:hover {
    background: rgba(30, 41, 59, 0.72);
    border-color: rgba(56, 189, 248, 0.26);
    box-shadow: 0 14px 30px rgba(2, 6, 23, 0.24);
}

.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.progress-container {
    flex-grow: 1;
    margin: 0 30px; /* Reduced from 40px */
    background: rgba(148, 163, 184, 0.42);
    height: 6px;
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    transition: box-shadow 0.2s ease, background 0.2s ease, filter 0.2s ease;
}

html[data-theme="dark"] .progress-container {
    background: rgba(148, 163, 184, 0.2);
}

.progress-container:hover {
    background: rgba(148, 163, 184, 0.58);
    box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.22), 0 0 16px rgba(14, 165, 233, 0.28);
    filter: brightness(1.05);
}

.progress-container.progress-container-disabled {
    cursor: default;
    background: rgba(148, 163, 184, 0.24);
    box-shadow: none;
    filter: none;
}

html[data-theme="dark"] .progress-container:hover {
    background: rgba(148, 163, 184, 0.28);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.22), 0 0 18px rgba(14, 165, 233, 0.32);
}

html[data-theme="dark"] .progress-container.progress-container-disabled {
    background: rgba(148, 163, 184, 0.14);
    box-shadow: none;
}

.progress-container.progress-container-disabled:hover {
    background: rgba(148, 163, 184, 0.24);
    box-shadow: none;
    filter: none;
}

html[data-theme="dark"] .progress-container.progress-container-disabled:hover {
    background: rgba(148, 163, 184, 0.14);
    box-shadow: none;
}

.progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--accent-color);
    border-radius: 999px;
    transition: width 0.4s ease;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.3);
    pointer-events: none;
}

.progress-container:hover .progress-bar {
    box-shadow: 0 0 14px rgba(14, 165, 233, 0.45), 0 0 22px rgba(14, 165, 233, 0.18);
}

.progress-bar::after {
    content: '';
    position: absolute;
    right: -5.5px;
    top: 50%;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--accent-color);
    transform: translateY(-50%);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.08), 0 0 10px rgba(14, 165, 233, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.progress-container:hover .progress-bar::after {
    transform: translateY(-50%) scale(1.18);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.14), 0 0 16px rgba(14, 165, 233, 0.34);
}

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

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

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: rgba(14, 165, 233, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(14, 165, 233, 0.2);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font-sans);
}

.vice-tag-badge {
    background: rgba(20, 184, 166, 0.1);
    color: #0d9488;
    border-color: rgba(20, 184, 166, 0.2);
}

html[data-theme="dark"] .vice-tag-badge {
    background: rgba(20, 184, 166, 0.15);
    color: #2dd4bf;
    border-color: rgba(20, 184, 166, 0.25);
}
