:root {
    --bg-main: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.9);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-border: 1px solid rgba(255, 255, 255, 0.05);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.1) 0%, transparent 50%);
    background-attachment: fixed;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

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

.header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    color: var(--accent-blue);
    width: 28px;
    height: 28px;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.highlight {
    color: var(--accent-blue);
}

.wpm-display {
    background: var(--bg-card);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: var(--glass-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

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

.wpm-value {
    font-weight: 700;
    color: var(--accent-green);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: rgba(15, 23, 42, 0.5);
    padding: 0.5rem;
    border-radius: 12px;
    border: var(--glass-border);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tab-btn i {
    width: 18px;
    height: 18px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out forwards;
}

.tab-content.active {
    display: block;
}

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

/* Cards */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    border: var(--glass-border);
    padding: 2rem;
    box-shadow: var(--glass-shadow);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

textarea {
    width: 100%;
    min-height: 200px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
    margin-bottom: 1.5rem;
}

textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* Forms & Buttons */
.options {
    margin-bottom: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background: var(--accent-blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

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

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.result-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease;
}

.result-card:hover {
    transform: translateY(-2px);
}

.result-card.primary {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

.result-card.primary .icon-wrapper {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
}

.icon-wrapper {
    background: rgba(255, 255, 255, 0.05);
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.result-info h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.result-info p {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Calibrator */
.calibration-text {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.calibration-controls {
    display: flex;
    gap: 1rem;
}

.calibration-result {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    text-align: center;
}

.calibration-result h3 {
    color: var(--accent-green);
    margin-bottom: 0.5rem;
}

.calibration-result p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.calibration-result #calibrated-wpm {
    font-size: 1.5rem;
}

/* Trainer */
.trainer-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.setting-group input, .setting-group select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.rsvp-display {
    background: #000;
    border-radius: 12px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 1rem;
    overflow: hidden;
}

.focus-line {
    position: absolute;
    left: 50%;
    width: 2px;
    height: 15px;
    background-color: var(--accent-red);
    transform: translateX(-50%);
}

.focus-line.top { top: 0; }
.focus-line.bottom { bottom: 0; }

.rsvp-word {
    font-size: 3rem;
    font-weight: 700;
    text-align: center;
    width: 100%;
    padding: 0 1rem;
}

.rsvp-word .focus-letter {
    color: var(--accent-red);
}

.progress-container {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent-blue);
    width: 0%;
    transition: width 0.1s linear;
}

.trainer-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(16, 185, 129, 0.9);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Responsive */
@media (max-width: 600px) {
    .app-container {
        padding: 1rem;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .header-content h1 {
        font-size: 1.5rem;
    }

    .rsvp-word {
        font-size: 2rem;
    }
}
