@import url('https://fonts.googleapis.com/css2?family=Gabriela&family=Lato:wght@300;400;700&family=JetBrains+Mono&display=swap');

:root {
    --bg-color: #f0f0f5;
    --container-bg: #111111;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --accent-red: #ff3b30;
    --accent-yellow: #ffcc00;
    --accent-green: #34c759;
    --accent-blue: #0a84ff;
    --accent-purple: #bf5af2;
    --accent-orange: #ff9500;
    --border-radius: 16px;
    --font-heading: 'Gabriela', serif;
    --font-body: 'Lato', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-active: 0 20px 40px rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    background: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
    font-family: var(--font-body);
    color: #333;
    min-height: 100vh;
    padding-bottom: 80px;
}

/* ===== HEADER ===== */

header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    padding: 12px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

h1 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: #1a1a1a;
    letter-spacing: -0.5px;
}

.header-subtitle {
    font-size: 0.78rem;
    color: #888;
    font-weight: 400;
}

/* Progress Bar */
.progress-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-bar-track {
    width: 180px;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), #00e676);
    border-radius: 3px;
    width: 0%;
    transition: width 0.4s ease;
}

.progress-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #555;
    min-width: 36px;
    text-align: right;
    font-family: var(--font-mono);
}

/* Score board */
.score-board {
    display: flex;
    gap: 16px;
    background: #f2f2f7;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 700;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.score-correct { color: var(--accent-green); }
.score-wrong { color: var(--accent-red); }
.score-unfinished { color: #8e8e93; }

/* ===== FLOATING SCORE BADGE ===== */

.floating-score {
    position: fixed;
    bottom: 22px;
    right: 22px;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 1001;
    font-weight: 700;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: white;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    cursor: default;
    user-select: none;
}

.floating-correct { color: var(--accent-green); font-size: 1.05rem; }
.floating-sep { color: #555; }
.floating-total { color: #888; }
.floating-pct {
    background: var(--accent-blue);
    color: white;
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 0.78rem;
    margin-left: 4px;
}

/* ===== INTRO SECTION ===== */

.intro-section {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 28px 40px;
}

.intro-content {
    max-width: 820px;
}

.intro-badge {
    display: inline-block;
    background: var(--accent-blue);
    color: white;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 12px;
}

.intro-section h2 {
    font-family: var(--font-heading);
    font-size: 1.65rem;
    color: #1a1a1a;
    margin-bottom: 10px;
}

.intro-section p {
    color: #444;
    font-size: 0.97rem;
    line-height: 1.65;
    margin-bottom: 10px;
}

.intro-note {
    font-size: 0.88rem !important;
    color: #666 !important;
    background: rgba(0,0,0,0.04);
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 3px solid var(--accent-blue);
}

.category-legend {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
}

/* ===== CATEGORY BADGES ===== */

.cat-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.cat-mouse        { background: rgba(10, 132, 255, 0.18); color: var(--accent-blue);   border: 1px solid rgba(10, 132, 255, 0.5); }
.cat-keyboard     { background: rgba(191, 90, 242, 0.18); color: var(--accent-purple); border: 1px solid rgba(191, 90, 242, 0.5); }
.cat-form         { background: rgba(255, 149, 0, 0.18);  color: var(--accent-orange); border: 1px solid rgba(255, 149, 0, 0.5); }
.cat-understanding{ background: rgba(255, 204, 0, 0.18);  color: var(--accent-yellow); border: 1px solid rgba(255, 204, 0, 0.5); }
.cat-state        { background: rgba(52, 199, 89, 0.18);  color: var(--accent-green);  border: 1px solid rgba(52, 199, 89, 0.5); }
.cat-visual       { background: rgba(255, 59, 48, 0.18);  color: var(--accent-red);    border: 1px solid rgba(255, 59, 48, 0.5); }

/* ===== TEST GRID ===== */

.tests-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 28px;
    padding: 36px 40px;
    max-width: 1800px;
    margin: 0 auto;
}

/* ===== CARD ===== */

.test-card {
    background-color: var(--container-bg);
    color: var(--text-primary);
    border-radius: var(--border-radius);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--shadow-soft);
    border: 2px solid #2a2a2a;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    position: relative;
    overflow: hidden;
}

.test-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-active);
    border-color: #444;
}

.test-card[data-status="correct"] {
    background: linear-gradient(135deg, #0f3d18, #1a5c25);
    border-color: var(--accent-green);
}

.test-card[data-status="wrong"] {
    background: linear-gradient(135deg, #3d0f0f, #5c1818);
    border-color: var(--accent-red);
}

.test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 10px;
    gap: 8px;
    flex-wrap: wrap;
}

.test-id {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent-orange);
    letter-spacing: 1px;
}

.test-type {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    flex: 1;
    text-align: center;
}

.test-instruction {
    font-size: 1rem;
    line-height: 1.55;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.92);
}

.test-instruction strong {
    color: var(--accent-yellow);
    font-weight: 700;
}

.test-instruction code {
    background: rgba(255, 255, 255, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    color: var(--accent-blue);
    font-size: 0.9em;
}

.test-instruction em {
    color: var(--text-secondary);
    font-style: italic;
}

.test-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Card result badge */
.card-status-badge {
    display: none;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
    align-self: flex-start;
    margin-top: 2px;
}

.badge-correct {
    display: inline-block;
    background: rgba(52, 199, 89, 0.15);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

.badge-wrong {
    display: inline-block;
    background: rgba(255, 59, 48, 0.15);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

/* ===== CONTROLS ===== */

button.action-btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 11px 22px;
    border-radius: 12px;
    font-size: 0.93rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-body);
}

button.action-btn:hover {
    filter: brightness(1.15);
}

button.action-btn:active {
    transform: scale(0.97);
}

button.action-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    filter: none;
}

input,
textarea,
select {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 11px;
    border-radius: 10px;
    color: white;
    font-family: var(--font-body);
    font-size: 0.97rem;
    outline: none;
    transition: border 0.3s, background 0.3s;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.12);
}

select option {
    background: #222;
    color: white;
}

/* ===== DRAG & DROP ===== */

.drag-zone {
    border: 2px dashed rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    padding: 18px;
    text-align: center;
    color: var(--text-secondary);
    transition: background 0.3s;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drag-zone.drag-over {
    background: rgba(52, 199, 89, 0.18);
    border-color: var(--accent-green);
    color: white;
}

.draggable-item {
    background: var(--accent-purple);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: grab;
    display: inline-block;
    font-weight: bold;
    user-select: none;
}

/* ===== SCROLL BOX ===== */

.scroll-box {
    height: 120px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.scroll-content {
    height: 400px;
    position: relative;
}

.scroll-target {
    position: absolute;
    bottom: 10px;
    left: 10px;
    color: var(--accent-yellow);
    font-weight: 600;
}

/* ===== COLOR SWATCHES ===== */

.color-swatch-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.color-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* ===== TOGGLE SWITCH ===== */

.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #555;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-green);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* ===== CONTEXT/EVENT AREA ===== */

.context-area {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dotted rgba(255, 255, 255, 0.25);
    height: 90px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: context-menu;
    user-select: none;
    font-size: 0.9rem;
}

/* ===== KEYBOARD ELEMENTS ===== */

kbd {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom-width: 2px;
    border-radius: 5px;
    padding: 2px 7px;
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: white;
}

/* Escape overlay (within card) */
.esc-overlay-wrap {
    position: relative;
    min-height: 72px;
}

.esc-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    gap: 6px;
    z-index: 5;
}

/* Arrow nav list */
.arrow-nav-wrap {
    outline: none;
}

.arrow-nav-wrap ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.arrow-nav-wrap li {
    padding: 7px 12px;
    border: 1px solid #444;
    margin-bottom: 3px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.9rem;
    user-select: none;
}

.arrow-nav-wrap li:hover {
    background: rgba(255,255,255,0.07);
}

.arrow-nav-hint {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* ===== COMPREHENSION TEXT ===== */

.comprehend-text {
    background: rgba(255, 255, 255, 0.06);
    padding: 10px 13px;
    border-radius: 8px;
    font-size: 0.88rem;
    line-height: 1.6;
    border-left: 3px solid var(--accent-blue);
    color: rgba(255,255,255,0.88);
}

.comprehend-q {
    font-weight: 700;
    font-size: 0.9rem;
    margin: 10px 0 8px;
    color: var(--accent-yellow);
}

.comprehend-options {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.comprehend-options button.action-btn {
    padding: 7px 14px;
    font-size: 0.85rem;
}

/* ===== DATA TABLE ===== */

.data-table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 10px;
    font-size: 0.88rem;
    border-radius: 6px;
    overflow: hidden;
}

.data-table th {
    padding: 7px 10px;
    border: 1px solid #444;
    background: #1e1e1e;
    text-align: left;
    font-weight: 700;
    color: var(--accent-yellow);
}

.data-table td {
    padding: 7px 10px;
    border: 1px solid #333;
    color: rgba(255,255,255,0.85);
}

.data-table tr:nth-child(even) td {
    background: rgba(255,255,255,0.03);
}

/* ===== COUNTER ===== */

.counter-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.counter-display {
    font-size: 1.6rem;
    font-weight: 900;
    font-family: var(--font-mono);
    min-width: 40px;
    text-align: center;
    color: white;
}

/* ===== ACCORDION ===== */

.accordion-header {
    padding: 11px 14px;
    background: #1e1e1e;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    user-select: none;
    border: 1px solid #333;
    transition: background 0.2s;
}

.accordion-header:hover {
    background: #2a2a2a;
}

.accordion-body {
    display: none;
    padding-top: 8px;
    flex-direction: column;
    gap: 6px;
}

.accordion-body.open {
    display: flex;
}

/* ===== PASSWORD REVEAL ===== */

.password-field-wrap {
    position: relative;
}

.password-field-wrap input {
    padding-right: 44px;
}

.eye-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-secondary);
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.eye-btn:hover {
    color: white;
}

/* ===== SORTABLE LIST ===== */

.sortable-list {
    list-style: none;
    padding: 0;
}

.sortable-list li {
    padding: 8px 12px;
    border: 1px solid #444;
    margin-bottom: 5px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s, opacity 0.2s;
    font-size: 0.9rem;
}

.sortable-list li:hover {
    background: rgba(255, 255, 255, 0.07);
}

/* ===== MOBILE ===== */

@media (max-width: 700px) {
    .tests-wrapper {
        padding: 15px;
        grid-template-columns: 1fr;
        gap: 18px;
    }

    header {
        flex-direction: column;
        gap: 10px;
        padding: 12px 16px;
        align-items: flex-start;
    }

    .header-right {
        align-items: flex-start;
        width: 100%;
    }

    .progress-bar-track {
        width: 100%;
        flex: 1;
    }

    .progress-wrap {
        width: 100%;
    }

    .score-board {
        gap: 12px;
        font-size: 0.82rem;
    }

    .intro-section {
        padding: 20px 16px;
    }

    .floating-score {
        bottom: 12px;
        right: 12px;
        font-size: 0.85rem;
        padding: 8px 12px;
    }
}

/* ===== ANIMATIONS ===== */

@keyframes flash {
    0%   { background-color: var(--container-bg); }
    50%  { background-color: #333; }
    100% { background-color: var(--container-bg); }
}

.flash-anim {
    animation: flash 0.5s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.test-card {
    animation: fadeInUp 0.3s ease both;
}
