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

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1e293b;
    --card-bg: #1e293b;
    --card-border: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    margin-bottom: 30px;
    animation: slideDown 0.6s ease-out;
}

.header-content {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow-md);
}

.logo {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    letter-spacing: -0.5px;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(51, 65, 85, 0.8);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.progress-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: right;
}

/* Card Container */
.card-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 30px;
    min-height: 400px;
}

.card-stack {
    width: 100%;
    max-width: 400px;
    height: 500px;
    position: relative;
    perspective: 1000px;
}

.vocab-card {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(51, 65, 85, 0.95) 100%);
    backdrop-filter: blur(20px);
    border: 2px solid var(--card-border);
    border-radius: 24px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    touch-action: none;
    box-shadow: var(--shadow-xl);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.vocab-card:active {
    cursor: grabbing;
}

.vocab-card.top-card {
    z-index: 10;
    transform: scale(1) translateY(0);
}

.vocab-card.next-card {
    z-index: 9;
    transform: scale(0.95) translateY(10px);
    opacity: 0.7;
}

.vocab-card.hidden-card {
    z-index: 8;
    transform: scale(0.9) translateY(20px);
    opacity: 0.4;
}

.card-word {
    font-family: 'Playfair Display', serif;
    font-size: 48px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    text-align: center;
    letter-spacing: -1px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.card-meaning {
    font-size: 18px;
    color: var(--text-secondary);
    text-align: center;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.4s ease, max-height 0.4s ease, margin 0.4s ease;
    line-height: 1.6;
}

.card-meaning.visible {
    opacity: 1;
    max-height: 200px;
    margin-top: 20px;
}

.card-tap-hint {
    position: absolute;
    bottom: 30px;
    font-size: 14px;
    color: var(--text-muted);
    animation: pulse 2s ease-in-out infinite;
}

/* Swipe Indicators */
.swipe-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 5;
}

.swipe-left {
    left: -20px;
}

.swipe-right {
    right: -20px;
}

.swipe-indicator.active {
    opacity: 1;
}

.indicator-content {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: 2px solid;
    box-shadow: var(--shadow-lg);
}

.swipe-left .indicator-content {
    border-color: var(--danger-color);
}

.swipe-right .indicator-content {
    border-color: var(--success-color);
}

.indicator-icon {
    font-size: 32px;
}

.indicator-text {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.swipe-left .indicator-text {
    color: var(--danger-color);
}

.swipe-right .indicator-text {
    color: var(--success-color);
}

/* Instructions */
.instructions {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
    animation: slideUp 0.6s ease-out 0.2s both;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.instruction-item:not(:last-child) {
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.instruction-icon {
    font-size: 20px;
}

/* Stats Panel */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    animation: slideUp 0.6s ease-out 0.4s both;
}

.stat-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-learned .stat-number {
    color: var(--success-color);
}

.stat-review .stat-number {
    color: var(--danger-color);
}

.stat-total .stat-number {
    color: var(--primary-light);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Completion Screen */
.completion-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.completion-screen.visible {
    opacity: 1;
    pointer-events: all;
}

.completion-content {
    text-align: center;
    padding: 40px;
    animation: scaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.completion-icon {
    font-size: 100px;
    margin-bottom: 20px;
    animation: bounce 1s ease-in-out;
}

.completion-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.completion-message {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.completion-stats {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin-bottom: 40px;
}

.completion-stat {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.completion-stat-value {
    font-size: 48px;
    font-weight: 700;
}

.completion-stat:first-child .completion-stat-value {
    color: var(--success-color);
}

.completion-stat:last-child .completion-stat-value {
    color: var(--danger-color);
}

.completion-stat-label {
    font-size: 14px;
    color: var(--text-muted);
}

.restart-button {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 16px;
    padding: 18px 48px;
    font-size: 18px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.restart-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.restart-button:active {
    transform: translateY(0);
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .app-container {
        padding: 16px;
    }

    .card-word {
        font-size: 36px;
    }

    .card-meaning {
        font-size: 16px;
    }

    .stat-number {
        font-size: 28px;
    }

    .completion-title {
        font-size: 28px;
    }

    .completion-stat-value {
        font-size: 36px;
    }
}
