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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #500000;
    min-height: 100vh;
    color: #1f2937;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: white;
    font-size: 2rem;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.mode-toggle {
    display: flex;
    background: rgba(255,255,255,0.2);
    border-radius: 25px;
    padding: 4px;
    backdrop-filter: blur(10px);
}

.mode-toggle button {
    flex: 1;
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    background: transparent;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-toggle button.active {
    background: white;
    color: #500000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hidden {
    display: none !important;
}

#debugMode {
    display: none !important;
}

.upload-area {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255,255,255,0.95);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.upload-btn {
    background: #500000;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    cursor: pointer;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(80, 0, 0, 0.4);
    transition: transform 0.2s ease;
}

.upload-btn:hover {
    transform: translateY(-2px);
}

.upload-description {
    text-align: left;
    margin-top: 20px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.upload-description p {
    margin-bottom: 10px;
}

.upload-description strong {
    color: #500000;
}

.csv-example {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
}

.upload-description code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.error-message {
    background: #ef4444;
    color: white;
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 0.9rem;
    text-align: center;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.control-btn {
    background: rgba(255,255,255,0.9);
    border: none;
    padding: 8px 16px;
    border-radius: 15px;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.small-controls {
    display: flex;
    gap: 8px;
}

.small-btn {
    background: rgba(255,255,255,0.7);
    border: none;
    padding: 6px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.small-btn:hover {
    opacity: 1;
}

.login-container {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255,255,255,0.95);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.logo {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(80, 0, 0, 0.2);
    display: block;
}

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

.header-logo {
    width: 32px;
    height: 32px;
    max-width: 32px;
    max-height: 32px;
    object-fit: contain;
    border-radius: 6px;
}

.pin-input {
    width: 200px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    font-size: 1.2rem;
    text-align: center;
    margin: 20px 0;
    outline: none;
    transition: border-color 0.3s ease;
}

.pin-input:focus {
    border-color: #500000;
}

.login-btn {
    background: #500000;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 15px;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(80, 0, 0, 0.4);
    transition: transform 0.2s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
}

.progress {
    background: rgba(255,255,255,0.9);
    padding: 8px 16px;
    border-radius: 15px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.flashcard {
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    margin: 20px 0;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.3s ease;
}

.flashcard:active {
    transform: scale(0.98);
}

.card-content {
    text-align: center;
    padding: 40px 30px;
    width: 100%;
}

.card-text {
    font-size: 1.5rem;
    line-height: 1.4;
    margin-bottom: 30px;
    word-wrap: break-word;
}

.flip-btn {
    background: #500000;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(80, 0, 0, 0.4);
    transition: transform 0.2s ease;
}

.flip-btn:hover {
    transform: translateY(-2px);
}

.navigation {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
}

.nav-btn {
    background: rgba(255,255,255,0.9);
    border: none;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    flex: 1;
    max-width: 120px;
}

.nav-btn:hover {
    transform: translateY(-2px);
    background: white;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.confidence-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.confidence-btn {
    border: none;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    flex: 1;
    max-width: 120px;
}

.confidence-btn.up {
    background: #10b981;
    color: white;
}

.confidence-btn.down {
    background: #ef4444;
    color: white;
}

.confidence-btn:hover {
    transform: translateY(-2px);
}

.debug-info {
    background: rgba(255,255,255,0.9);
    border-radius: 15px;
    padding: 15px;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.debug-text {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #333;
}

.manage-container {
    background: rgba(255,255,255,0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.manage-container h2 {
    text-align: center;
    margin-bottom: 25px;
    color: #333;
}

.add-card {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.input-field {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.input-field:focus {
    border-color: #500000;
}

.action-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #500000;
    color: white;
}

.action-btn.add {
    background: #10b981;
}

.action-btn:hover {
    transform: translateY(-2px);
}

.card-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.card-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
}

.card-info {
    flex: 1;
    font-size: 0.9rem;
}

.remove-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .card-text {
        font-size: 1.3rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-btn, .progress {
        text-align: center;
    }
    
    .manage-container {
        padding: 20px;
    }
}