:root {
    /* Main Backgrounds */
    --main-bg-1: #222222;
    --main-bg-2: #575760;
    --main-bg-3: #978474;
    /* Secondary Backgrounds */
    --secondary-bg-1: #333333;
    --secondary-bg-2: #575760;
    --secondary-bg-3: #b2b2be;
    --secondary-bg-4: #4d1900;
    /* Text Colors */
    --text-1: #ffffff;
    --text-2: #f7f8f9;
    --text-3: #f0f0f0;
    /* Accent Color */
    --accent: #ff661a;
    /* Shadows */
    --card-shadow: none;
}


/* ─── WRAPPER ────────────────────────────────── */

.mc-wrap {
    margin: 0 auto;
}


/* ─── SPEED TRAINER PANEL ────────────────────── */

.speed-trainer {
    background: var(--secondary-bg-1);
    padding: 28px 30px;
    margin-bottom: 26px;
    border: 1.5px solid var(--contrast-3, #b2b2be);
}

.panel-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-2);
    margin-bottom: 20px;
}

.speed-trainer p {
    font-size: 0.92rem;
    color: var(--text-3);
    margin-bottom: 20px;
    opacity: 0.9;
}

.speed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.ctrl-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-3);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ctrl-val {
    background: var(--red-1, #9e3500);
    color: var(--text-1);
    padding: 3px 12px;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 600;
}


/* Speed bookmark buttons */

.bookmark-section {
    margin-top: 16px;
}

.speed-bookmarks {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.bm-btn {
    padding: 9px 18px;
    border: 1px solid var(--contrast-3, #b2b2be);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    background: var(--red-1, #9e3500);
    color: var(--base-3, #ffffff);
    transition: all 0.2s;
}

.bm-btn:hover,
.bm-btn.active {
    background: var(--highlight-1, #ff661a);
    color: var(--contrast, #222222);
    border-color: var(--contrast-3, #b2b2be);
}

.bm-btn .bm-label {
    font-weight: 400;
    font-size: 0.75rem;
    display: block;
    opacity: 0.8;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 40px;
    appearance: none;
    background: linear-gradient(to right, var(--accent, #1e73be) var(--pct, 50%), var(--base-2, #f7f8f9) var(--pct, 50%));
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    border: 1px solid var(--contrast-3, #b2b2be);
}

.mc-wrap select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--contrast-3, #b2b2be);
    font-size: 0.98rem;
    color: var(--text-2);
    background: var(--contrast-2, #575760);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23f7f8f9'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}


/* ─── SETTINGS ROW ───────────────────────────── */

.settings-row {
    padding: 28px 30px;
    margin-bottom: 26px;
    border: 1.5px solid var(--contrast-3, #b2b2be);
}

.settings-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}


/* ─── START BUTTON ───────────────────────────── */

.btn-start {
    width: 100%;
    padding: 18px;
    border: none;
    background: var(--red-1, #9e3500);
    color: var(--base-3, #ffffff);
    border: 1px solid var(--contrast-3, #b2b2be);
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.25s;
    letter-spacing: 0.01em;
}

.btn-start:hover,
.btn-start:active {
    background: var(--highlight-1, #ff661a);
    color: var(--contrast, #222222);
}


/* ─── PRACTICE SECTION ───────────────────────── */

.practice-section {
    display: none;
}


/* Session timer bar */

.session-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    margin-bottom: 22px;
    border: 1.5px solid var(--contrast-3, #b2b2be);
    flex-wrap: wrap;
    gap: 14px;
}

.session-clock {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.1rem;
}

.clock-val {
    font-size: 1.25rem;
    color: var(--highlight-2, #FFB366);
    font-weight: 800;
}

.progress-container {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.session-remain {
    font-size: 0.8rem;
    color: var(--highlight-2, #FFB366);
    text-align: right;
    opacity: 0.8;
}

.session-actions {
    display: flex;
    gap: 12px;
}


/* Practice card */

.practice-card {
    border: 1.5px solid var(--contrast-3, #b2b2be);
    padding: 36px 32px 32px;
    margin-bottom: 26px;
    text-align: center;
}

.char-stage {
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(4.5rem, 15vw, 7.5rem);
    font-weight: 800;
    color: var(--highlight-2, #FFB366);
    line-height: 1;
    margin-bottom: 16px;
    transition: opacity 0.2s;
}

.morse-display {
    font-size: 1.5rem;
    letter-spacing: 8px;
    color: var(--base, #ffffff);
    min-height: 42px;
    margin-bottom: 26px;
    opacity: 0.9;
}

.practice-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 26px;
}

.btn {
    padding: 14px 26px;
    border: none;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--red-1, #9e3500);
    border: 1px solid var(--contrast-3, #b2b2be);
    color: var(--base, #ffffff);
}

.btn-primary:hover {
    background: var(--highlight-1, #ff661a);
    color: var(--contrast, #222222);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--contrast-3, #b2b2be);
    color: var(--base, #ffffff);
}

.btn-outline:hover {
    border-color: var(--hightlight-1, #ff661a);
    color: var(--highlight-2, #FFB366);
}

.btn-success {
    background: var(--highlight-1, #ff661a);
    color: var(--contrast, #222222);
}

.btn-success:hover {
    background: var(--red-1, #9e3500);
    color: var(--base, #ffffff);
}


/* Answer row */

.answer-row {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: center;
    margin-bottom: 22px;
}

.answer-input {
    width: 90px;
    padding: 16px;
    border: 2px solid var(--contrast-3, #b2b2be);
    text-align: center;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--base, #ffffff);
    background: var(--contrast, #222222);
    outline: none;
    transition: border 0.2s;
    text-transform: uppercase;
}

.answer-input:focus {
    border-color: var(--accent);
}


/* Feedback */

.feedback {
    padding: 15px 26px;
    font-weight: 700;
    font-size: 1rem;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.25s;
}

.fb-correct {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
    border: 2px solid #2ecc71;
}

.fb-incorrect {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    border: 2px solid #e74c3c;
}

.fb-hint {
    background: rgba(255, 102, 26, 0.1);
    color: var(--base, #ffffff);
}


/* ─── STATS ──────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 26px;
}

.stat-card {
    background: var(--contrast, #222222);
    border: 1.5px solid var(--contrast-3, #b2b2be);
    padding: 20px 12px;
    text-align: center;
}

.stat-val {
    font-size: 2rem;
    font-weight: 800;
    color: var(--highlight-2, #FFB366);
    line-height: 1;
}

.stat-lbl {
    font-size: 0.82rem;
    color: var(--text-3);
    margin-top: 6px;
    font-weight: 600;
    opacity: 0.9;
}


/* ─── AI COACH ───────────────────────────────── */

.ai-coach {
    background: var(--contrast, #222222);
    border-left: 4px solid var(--highlight-1, #ff661a);
    border-radius: 16px;
    padding: 20px 24px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 26px;
}

.ai-text {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--text-2);
}

.ai-text strong {
    color: var(--highlight-2, #FFB366);
}


/* ─── PROGRESS TIMER TRACK ───────────────────── */

.progress-track {
    height: 10px;
    background: var(--secondary-bg-2);
    border-radius: 40px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 40px;
    background: linear-gradient(90deg, var(--accent), #ff854d);
    transition: width 0.6s ease;
    width: 0%;
}


/* ─── REFERENCE ──────────────────────────────── */

.ref-panel {
    padding: 28px 30px;
    margin-bottom: 26px;
    border: 1.5px solid var(--contrast-3, #b2b2be);
}

.ref-panel h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--base, #ffffff);
    margin-bottom: 6px;
}

.ref-panel p {
    font-size: 0.88rem;
    color: var(--base, #ffffff);
    margin-bottom: 18px;
    opacity: 0.9;
}

.ref-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ref-tab {
    padding: 8px 18px;
    border: 1px solid var(--contrast-3, #b2b2be);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    background: var(--red-1, #9e3500);
    color: var(--base-3, #ffffff);
    transition: all 0.2s;
}

.ref-tab.active,
.ref-tab:hover {
    background: var(--highlight-1, #ff661a);
    color: var(--contrast, #222222);
}

.ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 10px;
}

.ref-item {
    background: var(--contrast, #222222);
    border: 1px solid var(--contrast-3, #b2b2be);
    border-radius: 5px;
    padding: 12px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.ref-item:hover {
    border-color: var(--contrast-3, #b2b2be);
    background: var(--red-dark, #4d1900);
}

.ref-char {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--base, #ffffff);
}

.ref-code {
    font-size: 0.82rem;
    color: var(--highlight-2, #FFB366);
    margin-top: 4px;
    letter-spacing: 1px;
}


/* ─── SHORTCUTS ──────────────────────────────── */

.shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    padding: 18px;
    border: 1.5px solid var(--contrast-3, #b2b2be);
    margin-bottom: 26px;
}

.shortcut {
    font-size: 0.85rem;
    color: var(--base, #ffffff);
    display: flex;
    align-items: center;
    gap: 8px;
}

kbd {
    background: var(--red-1, #9e3500);
    padding: 4px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--base, #ffffff);
}


/* ─── DOWNLOAD LOG ───────────────────────────── */

.log-section {
    padding: 28px 30px;
    border: 1.5px solid var(--contrast-3, #b2b2be);
    margin-bottom: 26px;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.log-list {
    max-height: 220px;
    overflow-y: auto;
    margin-top: 18px;
    font-size: 0.85rem;
    color: var(--text-3);
    background: var(--contrast, #222222);
    border-radius: 14px;
    padding: 14px 18px;
    line-height: 2.1;
    font-family: monospace;
}

.log-list .log-correct {
    color: #2ecc71;
}

.log-list .log-wrong {
    color: #e74c3c;
}


/* ─── SEO CONTENT STRIP ──────────────────────── */


/* Animations */

@keyframes shake {
    0%,
    100% {
        transform: translateX(0);
    }
    20%,
    60% {
        transform: translateX(-6px);
    }
    40%,
    80% {
        transform: translateX(6px);
    }
}

@keyframes pop {
    0% {
        transform: scale(0.92);
    }
    70% {
        transform: scale(1.08);
    }
    100% {
        transform: scale(1);
    }
}

.anim-pop {
    animation: pop 0.3s ease;
}

.anim-shake {
    animation: shake 0.45s ease;
}


/* Responsive Design */

@media (max-width: 768px) {
    .mc-wrap {
        padding: 24px 16px 60px;
    }
    .mc-hero {
        padding: 32px 24px 28px;
    }
    .mc-hero h1 {
        font-size: clamp(1.6rem, 6vw, 2.2rem);
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .practice-actions {
        gap: 10px;
    }
    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    .answer-input {
        width: 80px;
        font-size: 1.5rem;
    }
    .ref-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    .session-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    .progress-container {
        min-width: auto;
    }
    .session-actions {
        justify-content: center;
    }
}