/* Custom Styling for TypeFlex */

/* General Styles & Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

/* Glassmorphism utility classes */
.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.dark .glass-panel {
    background: rgba(21, 31, 50, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(34, 49, 77, 0.5);
}

/* Typing Interface Styles */
.typing-container {
    user-select: none;
    position: relative;
    outline: none;
}

.word-box {
    font-size: 1.5rem;
    line-height: 2.25rem;
    letter-spacing: 0.05em;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    overflow: hidden;
}

.typing-word {
    display: inline-block;
    margin-right: 0.6em;
    margin-bottom: 0.2em;
    scroll-margin-top: 10px;
}

.typing-char {
    position: relative;
    transition: color 0.1s ease, border-color 0.1s ease;
}

/* Character states */
.char-default {
    color: #64748b; /* slate-500 */
}
.dark .char-default {
    color: #475569; /* slate-600 */
}

.char-correct {
    color: #0f172a; /* dark slate */
    font-weight: 500;
}
.dark .char-correct {
    color: #e2e8f0; /* slate-200 */
    font-weight: 500;
    text-shadow: 0 0 1px rgba(226, 232, 240, 0.4);
}

.char-incorrect {
    color: #ef4444; /* red-500 */
    border-bottom: 2px solid #ef4444;
}
.dark .char-incorrect {
    color: #f87171; /* red-400 */
    border-bottom: 2px solid #f87171;
    text-shadow: 0 0 4px rgba(248, 113, 113, 0.3);
}

.char-extra {
    color: #b91c1c; /* red-700 */
    opacity: 0.8;
}
.dark .char-extra {
    color: #f87171; /* red-400 */
    opacity: 0.6;
}

/* Caret / Cursor */
.typing-caret {
    position: absolute;
    width: 2px;
    background-color: #06b6d4; /* cyan-500 */
    box-shadow: 0 0 8px #06b6d4;
    animation: caretBlink 1s infinite;
    z-index: 10;
    transition: left 0.08s cubic-bezier(0.16, 1, 0.3, 1), top 0.08s cubic-bezier(0.16, 1, 0.3, 1), height 0.08s ease;
}

.typing-caret.no-blink {
    animation: none;
    opacity: 1 !important;
}

.typing-caret.shake-caret {
    animation: caretWiggle 0.08s ease-in-out 2;
}

@keyframes caretBlink {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

@keyframes caretWiggle {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* Virtual Keyboard Styles */
.keyboard-key {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.08s ease;
}

.keyboard-key.active {
    transform: scale(0.95);
    background-color: #06b6d4 !important; /* cyan-500 */
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.6);
}

/* Neon accents */
.neon-glow-cyan {
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.15);
}
.dark .neon-glow-cyan {
    box-shadow: 0 0 25px rgba(6, 182, 212, 0.25);
}

.neon-glow-purple {
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.15);
}
.dark .neon-glow-purple {
    box-shadow: 0 0 25px rgba(168, 85, 247, 0.25);
}

/* Home row dot indicator */
.key-home-dot::after {
    content: '';
    display: block;
    width: 4px;
    height: 4px;
    background-color: currentColor;
    border-radius: 50%;
    position: absolute;
    bottom: 4px;
    opacity: 0.5;
}
