/* Lastech Typing Lab */

.tl-page {
    background: linear-gradient(180deg, #f0f9ff 0%, #fff 40%, #f8fafc 100%);
    min-height: 80vh;
    padding-bottom: 4rem;
}

.tl-hero {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
}

.tl-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem 0.4rem 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #0369a1;
    background: #fff;
    border: 1px solid rgba(4, 159, 217, 0.25);
    border-radius: 999px;
    box-shadow: 0 4px 20px rgba(4, 159, 217, 0.12);
}

.tl-hero__icon {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #049fd9, #6366f1);
    border-radius: 10px;
    color: #fff;
}

.tl-hero__title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}

.tl-hero__sub {
    font-size: 1rem;
    color: #64748b;
    max-width: 36rem;
    margin: 0 auto;
    line-height: 1.65;
}

/* AI Coach */
.tl-coach {
    max-width: 1100px;
    margin: 1.25rem auto 0;
    padding: 0 1.5rem;
}

.tl-coach__card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.08);
}

.tl-coach__avatar {
    width: 3rem;
    height: 3rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1 0%, #049fd9 100%);
    border-radius: 14px;
    color: #fff;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.tl-coach__name {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6366f1;
    margin-bottom: 0.25rem;
}

.tl-coach__msg {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #334155;
}

/* Level grid */
.tl-levels {
    max-width: 1100px;
    margin: 2rem auto 0;
    padding: 0 1.5rem;
}

.tl-levels__title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 1rem;
}

.tl-levels__grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 640px) {
    .tl-levels__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .tl-levels__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.tl-level-card {
    position: relative;
    text-align: left;
    padding: 1.35rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    overflow: hidden;
}

.tl-level-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--tl-color, #049fd9);
}

.tl-level-card:hover:not(:disabled) {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(4, 159, 217, 0.15);
    border-color: rgba(4, 159, 217, 0.35);
}

.tl-level-card:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.tl-level-card__icon {
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.85rem;
    background: color-mix(in srgb, var(--tl-color) 12%, white);
    border-radius: 12px;
    color: var(--tl-color);
}

.tl-level-card__num {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #94a3b8;
}

.tl-level-card__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0.2rem 0;
}

.tl-level-card__desc {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.tl-level-card__bar {
    height: 6px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
}

.tl-level-card__fill {
    height: 100%;
    background: var(--tl-color);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.tl-level-card__lock {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.1rem;
}

/* Practice */
.tl-practice {
    max-width: 1100px;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem;
}

.tl-practice__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.tl-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
}

.tl-back:hover {
    color: #049fd9;
    border-color: #049fd9;
}

.tl-stats {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.tl-stat {
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    text-align: center;
    min-width: 4.5rem;
}

.tl-stat strong {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
}

.tl-stat span {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
}

.tl-typing-box {
    padding: 1.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.06);
    margin-bottom: 1.25rem;
}

.tl-lesson-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #049fd9;
    margin-bottom: 1rem;
}

.tl-text-display {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    line-height: 1.9;
    letter-spacing: 0.04em;
    word-break: break-word;
}

.tl-text-display--story {
    max-height: 14rem;
    overflow-y: auto;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 12px;
    font-size: 1.05rem;
    line-height: 2;
}

.tl-typing-box--story {
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.1);
}

/* Story panel */
.tl-story-panel {
    margin-bottom: 1.25rem;
    padding: 1.35rem;
    background: linear-gradient(135deg, #fffbeb 0%, #fff 50%, #f0f9ff 100%);
    border: 1px solid #fde68a;
    border-radius: 20px;
    box-shadow: 0 8px 28px rgba(245, 158, 11, 0.12);
}

.tl-story-panel__head {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.tl-story-panel__tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #b45309;
    margin-bottom: 0.35rem;
}

.tl-story-panel__title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.35rem;
}

.tl-story-panel__intro {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.55;
    max-width: 36rem;
}

.tl-story-panel__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tl-story-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.15rem;
    font-size: 0.875rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.tl-story-btn--audio {
    color: #fff;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

.tl-story-btn--audio:hover:not(:disabled) {
    transform: translateY(-1px);
}

.tl-story-btn--audio:disabled {
    opacity: 0.85;
    cursor: wait;
}

.tl-story-btn--ghost {
    color: #64748b;
    background: #fff;
    border: 1px solid #e2e8f0;
}

.tl-story-panel__media {
    margin-bottom: 0.75rem;
}

.tl-story-video {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    border-radius: 14px;
    overflow: hidden;
    background: #0f172a;
}

.tl-story-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.tl-story-visual {
    text-align: center;
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 14px;
    color: #fff;
}

.tl-story-visual__icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 158, 11, 0.2);
    border-radius: 16px;
    color: #fbbf24;
}

.tl-story-visual__hint {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 0.35rem;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

.tl-story-progress {
    height: 6px;
    background: #fef3c7;
    border-radius: 999px;
    overflow: hidden;
}

.tl-story-progress__fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #049fd9);
    border-radius: 999px;
    transition: width 0.2s ease;
}

.tl-char--ok {
    color: #16a34a;
    background: rgba(22, 163, 74, 0.08);
}

.tl-char--err {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
    text-decoration: underline;
}

.tl-char--cur {
    color: #0f172a;
    background: rgba(4, 159, 217, 0.2);
    border-bottom: 2px solid #049fd9;
    animation: tl-blink 1s step-end infinite;
}

@keyframes tl-blink {
    50% { border-color: transparent; }
}

.tl-input-hidden {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

/* Keyboard */
.tl-keyboard {
    padding: 1.25rem;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    overflow-x: auto;
}

.tl-kb-row {
    display: flex;
    justify-content: center;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.tl-key {
    min-width: 2.25rem;
    height: 2.35rem;
    padding: 0 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    color: #475569;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 2px 0 #cbd5e1;
    transition: all 0.15s;
}

.tl-key--wide {
    min-width: 3rem;
}

.tl-key--space {
    min-width: 12rem;
}

.tl-key--next {
    color: #fff !important;
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%) !important;
    border-color: #15803d !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35), 0 3px 0 #15803d !important;
    transform: translateY(-2px);
}

/* Success modal */
.tl-success {
    margin-top: 1.5rem;
    padding: 1.5rem;
    text-align: center;
    background: linear-gradient(135deg, #ecfdf5 0%, #f0f9ff 100%);
    border: 1px solid #86efac;
    border-radius: 16px;
}

.tl-success h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.tl-success p {
    color: #64748b;
    margin-bottom: 1rem;
}

.tl-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    background: linear-gradient(135deg, #049fd9, #6366f1);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(4, 159, 217, 0.35);
}

.tl-btn:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.tl-btn--ghost {
    background: #fff;
    color: #334155;
    border: 1px solid #e2e8f0;
    box-shadow: none;
    margin-left: 0.5rem;
}

.tl-exclusive {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #6366f1;
}
