:root {
    --bg-primary: rgba(10, 10, 10, 0.95);
    --bg-secondary: rgba(20, 20, 20, 0.85);
    --bg-tertiary: rgba(31, 31, 31, 0.8);
    --text-primary: #ffffff;
    --text-secondary: rgba(160, 160, 160, 0.8);
    --text-tertiary: rgba(96, 96, 96, 0.7);
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #22c55e;
    --error: #ef4444;
    --border: rgba(42, 42, 42, 0.7);
    --border-light: rgba(51, 51, 51, 0.7);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --animation-duration: 0.3s;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    background-image: radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0);
    background-size: 30px 30px;
}

body.light-mode {
    --bg-primary: rgba(240, 240, 240, 0.95);
    --bg-secondary: rgba(225, 225, 225, 0.85);
    --bg-tertiary: rgba(210, 210, 210, 0.8);
    --text-primary: #222222;
    --text-secondary: rgba(60, 60, 60, 0.8);
    --text-tertiary: rgba(90, 90, 90, 0.7);
    --border: rgba(180, 180, 180, 0.7);
    --border-light: rgba(160, 160, 160, 0.7);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.app-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientPulse 3s infinite alternate;
}

@keyframes gradientPulse {
    0% { background-position: 0% 50%; filter: brightness(1); }
    50% { background-position: 100% 50%; filter: brightness(1.2); }
    100% { background-position: 0% 50%; filter: brightness(1); }
}

.creator-link {
    color: var(--text-secondary);
    margin-left: 8px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.creator-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.badge {
    background-color: var(--accent);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 600;
    animation: badgePulse 2s infinite alternate;
}

@keyframes badgePulse {
    0% { transform: scale(1); box-shadow: 0 0 0px var(--accent); }
    100% { transform: scale(1.1); box-shadow: 0 0 10px var(--accent); }
}

nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease, transform 0.2s ease;
    padding: 0.5rem 0;
    position: relative;
    overflow: hidden;
}

nav a:hover {
    color: var(--text-primary);
    transform: translateY(-3px);
    text-shadow: 0 0 15px var(--accent), 0 0 30px var(--accent);
    box-shadow: 0 0 15px var(--accent);
}

nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

nav a:hover::after {
    transform: scaleX(1);
}

nav a.active {
    color: var(--text-primary);
    position: relative;
}

nav a.active::after {
    content: '';
    position: absolute;
    bottom: -0.25rem;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent);
    border-radius: 2px;
    transform: scaleX(1);
    animation: glowLine 1.5s infinite alternate;
}

@keyframes glowLine {
    0% { box-shadow: 0 0 2px var(--accent); }
    100% { box-shadow: 0 0 8px var(--accent); }
}

.donate-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: white !important;
    background-color: var(--accent);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    animation: glowPulse 2s infinite alternate;
}

@keyframes glowPulse {
    0% { box-shadow: 0 0 5px var(--accent); }
    100% { box-shadow: 0 0 20px var(--accent); }
}

.donate-btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    animation: wiggle 0.5s ease;
}

@keyframes wiggle {
    0%, 100% { transform: translateY(-2px) rotate(0); }
    25% { transform: translateY(-2px) rotate(2deg); }
    75% { transform: translateY(-2px) rotate(-2deg); }
}

.donate-btn i {
    font-size: 0.8rem;
}

.donate-btn::after {
    display: none;
}

.user-actions {
    display: flex;
    gap: 0.75rem;
}

.icon-btn {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
    transform: translateY(-2px) rotate(15deg);
    box-shadow: 0 0 15px var(--accent);
}

/* Home page styles */
#home-page {
    display: flex;
    flex-direction: column;
    gap: 4rem;
    padding: 3rem 0;
}

.hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
    padding: 3rem 1rem;
    background-color: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow);
    animation: floatIn 1s ease-out forwards, glowBorder 3s infinite alternate;
}

@keyframes floatIn {
    0% { transform: translateY(30px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes glowBorder {
    0% { box-shadow: var(--shadow); }
    100% { box-shadow: var(--shadow), 0 0 20px var(--accent); }
}

.hero-section h1 {
    font-size: 3rem;
    background: linear-gradient(90deg, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s infinite alternate;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.hero-section p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
}

.cta-button {
    margin-top: 1rem;
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'JetBrains Mono', monospace;
    position: relative;
    overflow: hidden;
}

.cta-button:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    animation: pulse 1s infinite;
}

.cta-button::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(30deg);
    transition: transform 0.5s ease;
}

.cta-button:hover::after {
    transform: rotate(30deg) translate(10%, 10%);
}

.features {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.feature, .tip-card {
    flex: 1;
    min-width: 250px;
    padding: 2rem;
    background-color: var(--bg-secondary);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
    overflow: hidden;
    animation: slideUp 0.6s ease-out forwards, glowOnHover 3s infinite alternate;
}

@keyframes slideUp {
    0% { transform: translateY(50px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes glowOnHover {
    0% { box-shadow: var(--shadow); }
    100% { box-shadow: var(--shadow), 0 0 15px rgba(59, 130, 246, 0.3); }
}

.feature:nth-child(2) {
    animation-delay: 0.1s;
}

.feature:nth-child(3) {
    animation-delay: 0.2s;
}

.feature::before, .tip-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s ease;
}

.feature:hover::before, .tip-card:hover::before {
    transform: scaleX(1);
}

.feature:hover, .tip-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.3);
    border-color: var(--accent);
}

.feature i {
    font-size: 2.5rem;
    color: var(--accent);
    transition: transform 0.3s ease;
}

.feature:hover i {
    transform: scale(1.2) rotate(5deg);
    animation: iconPulse 1s infinite alternate;
}

@keyframes iconPulse {
    0% { transform: scale(1.2); filter: brightness(1); }
    50% { transform: scale(1.4); filter: brightness(1.3); }
    100% { transform: scale(1.2); filter: brightness(1); }
}

.feature h3 {
    font-size: 1.3rem;
}

.feature p {
    color: var(--text-secondary);
}

/* Main content styles */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem 0;
    gap: 2rem;
}

.typing-container {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.typing-container:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.typing-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.input-area {
    display: flex;
    gap: 1rem;
}

.start-btn-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.enter-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
}

.shift-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-left: 0.25rem;
    align-self: center;
}

.typing-field {
    position: absolute;
    opacity: 0;
    height: 0;
    width: 0;
    pointer-events: none;
}

.start-btn, .restart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 110px;
    font-family: 'JetBrains Mono', monospace;
}

.start-btn {
    background-color: var(--accent);
    color: white;
}

.start-btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.restart-btn {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.restart-btn:hover {
    background-color: var(--border);
    transform: translateY(-2px);
}

.timer {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    min-width: 80px;
    transition: all 0.3s ease;
    animation: timerGlow 2s infinite alternate;
}

@keyframes timerGlow {
    0% { box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1); }
    100% { box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 15px var(--accent); }
}

.timer.low-time {
    animation: timerPulse 1s infinite alternate;
    color: var(--error);
}

@keyframes timerPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

.stats {
    display: flex;
    gap: 1.5rem;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.stat-value.highlight {
    animation: statHighlight 1s ease-out;
}

@keyframes statHighlight {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: var(--accent); }
    100% { transform: scale(1); }
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.text-display {
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    height: 150px;
    overflow-y: auto;
    position: relative;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.text-content {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    line-height: 1.7;
    color: var(--text-secondary);
    word-break: break-word;
}

.text-content .correct {
    color: var(--text-primary);
}

.text-content .error {
    color: var(--error);
    background-color: rgba(239, 68, 68, 0.15);
    border-radius: 2px;
    text-decoration: none;
}

.text-content .current {
    background-color: rgba(59, 130, 246, 0.2);
    border-radius: 2px;
    position: relative;
    animation: highlightPulse 1.5s infinite alternate;
}

@keyframes highlightPulse {
    0% { background-color: rgba(59, 130, 246, 0.2); box-shadow: 0 0 5px var(--accent); }
    100% { background-color: rgba(59, 130, 246, 0.4); box-shadow: 0 0 20px var(--accent); }
}

.text-content .current.highlight-mode {
    background-color: rgba(59, 130, 246, 0.4);
    border-radius: 2px;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    animation: highlightPulse 1s infinite alternate;
}

@keyframes highlightPulse {
    0% { background-color: rgba(59, 130, 246, 0.4); box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }
    100% { background-color: rgba(59, 130, 246, 0.6); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3); }
}

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background-color: var(--accent);
    animation: blink 1s step-end infinite, cursorGlow 2s infinite alternate;
    vertical-align: middle;
    margin-left: 2px;
    box-shadow: 0 0 5px var(--accent);
}

@keyframes cursorGlow {
    0% { box-shadow: 0 0 5px var(--accent); }
    100% { box-shadow: 0 0 15px var(--accent), 0 0 30px var(--accent); }
}

.typing-cursor.hidden {
    display: none;
}

.options-panel {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.option {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 250px;
}

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

.option-buttons {
    display: flex;
    gap: 0.5rem;
}

.option-buttons.font-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.option-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    font-family: 'JetBrains Mono', monospace;
}

.option-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.option-btn.active {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
    animation: activeGlow 2s infinite alternate;
}

@keyframes activeGlow {
    0% { box-shadow: 0 0 5px var(--accent); }
    100% { box-shadow: 0 0 20px var(--accent), 0 0 40px var(--accent-hover); }
}

.font-buttons .option-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    font-size: 1rem;
    min-width: 140px;
}

.font-dropdown {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='gray' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
}

/* Tips page styles */
.page-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.page-header h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, var(--text-primary), var(--accent));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientFlow 3s linear infinite;
}

@keyframes gradientFlow {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.tip-card {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: fadeIn 0.5s ease forwards;
}

.tip-card:nth-child(2) {
    animation-delay: 0.1s;
}

.tip-card:nth-child(3) {
    animation-delay: 0.2s;
}

.tip-card:nth-child(4) {
    animation-delay: 0.3s;
}

.tip-card:nth-child(5) {
    animation-delay: 0.4s;
}

.tip-card:nth-child(6) {
    animation-delay: 0.5s;
}

.tip-card h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
}

.tip-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.tip-card:hover i {
    animation: spinIcon 1s ease;
}

@keyframes spinIcon {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.keyboard-diagram {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.keyboard-diagram h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.keyboard-image {
    margin-bottom: 1.5rem;
}

.finger-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.finger-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.finger-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.left-pinky { border-color: #ef4444; }
.left-ring { border-color: #f97316; }
.left-middle { border-color: #eab308; }
.left-index { border-color: #22c55e; }
.right-index { border-color: #3b82f6; }
.right-middle { border-color: #8b5cf6; } 
.right-ring { border-color: #d946ef; }
.right-pinky { border-color: #ec4899; }

.home-key {
    border-color: var(--accent);
    border-width: 3px;
}

/* Footer styles */
footer {
    padding: 1.5rem 0;
    border-top: 1px solid var(--border);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-content p, .footer-content .byline {
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.footer-content .byline a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-content .byline a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.footer-links a {
    color: var(--text-secondary);
    margin-left: 1rem;
    text-decoration: none;
    transition: color 0.2s ease;
    font-family: 'JetBrains Mono', monospace;
}

.footer-links a:hover {
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);
    transform: translateY(-2px);
}

.footer-links a.highlight {
    color: var(--accent);
    font-weight: 500;
}

.footer-links a.highlight:hover {
    text-decoration: underline;
}

button, .cta-button, .option-btn, .start-btn, .restart-btn, .donate-btn, .icon-btn, select {
    font-family: 'JetBrains Mono', monospace;
}

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

@keyframes blink {
    from, to { opacity: 1; }
    50% { opacity: 0; }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .options-panel {
        flex-direction: column;
    }
    
    .footer-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .features {
        flex-direction: column;
    }
    
    .tips-grid {
        grid-template-columns: 1fr;
    }
    
    .finger-legend {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-header h2 {
        font-size: 2rem;
    }
}

button, a, .option-btn, .icon-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button:hover, .option-btn:hover, .icon-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3);
}