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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
}

/* Page transitions */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo h1 {
    font-size: 3rem;
    color: #00ff88;
    text-shadow: 0 0 30px rgba(0,255,136,0.5);
    margin-bottom: 10px;
}

.tagline {
    font-size: 1.2rem;
    color: #aaa;
}

.login-box {
    background: #16213e;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    width: 100%;
    max-width: 450px;
}

.login-box h2 {
    text-align: center;
    color: #00ff88;
    margin-bottom: 10px;
}

.login-description {
    text-align: center;
    color: #888;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #ccc;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    background: #0f3460;
    border: 2px solid #1a4a7a;
    border-radius: 10px;
    color: white;
    outline: none;
    transition: border-color 0.3s;
}

.form-group input:focus {
    border-color: #00ff88;
}

.btn-primary {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: bold;
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: #1a1a2e;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0,255,136,0.4);
}

.footer-info {
    margin-top: 40px;
    text-align: center;
    color: #666;
}

.footer-info .domain {
    color: #00ff88;
    font-weight: bold;
    margin-top: 10px;
}

/* Language Selection Page */
.language-container {
    min-height: 100vh;
    padding: 30px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.language-header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.language-header h1 {
    font-size: 2.5rem;
    color: #00ff88;
    margin-bottom: 10px;
}

.language-header p {
    color: #aaa;
    font-size: 1.1rem;
}

.language-header .header-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 15px;
    align-items: center;
}

.language-search {
    max-width: 500px;
    margin: 0 auto 30px;
}

.language-search input {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.1rem;
    background: #16213e;
    border: 2px solid #1a4a7a;
    border-radius: 30px;
    color: white;
    outline: none;
    transition: border-color 0.3s;
}

.language-search input:focus {
    border-color: #00ff88;
}

.language-search input::placeholder {
    color: #666;
}

.language-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.language-card {
    background: #16213e;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.language-card:hover {
    transform: translateY(-5px);
    border-color: #00ff88;
    box-shadow: 0 8px 25px rgba(0,255,136,0.2);
}

.language-flag {
    font-size: 3rem;
    margin-bottom: 10px;
}

.language-code {
    font-size: 1.5rem;
    font-weight: bold;
    color: #00ff88;
    margin-bottom: 5px;
}

.language-name {
    font-size: 0.95rem;
    color: #ccc;
    margin-bottom: 10px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.language-count {
    font-size: 0.85rem;
    color: #888;
    background: #0f3460;
    padding: 5px 12px;
    border-radius: 15px;
    display: inline-block;
}

/* Language badge on recording page */
.language-badge {
    background: rgba(0,136,255,0.2);
    color: #00aaff;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
}

/* Back button */
.btn-back {
    background: transparent;
    border: 1px solid #00ff88;
    color: #00ff88;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.btn-back:hover {
    background: #00ff88;
    color: #1a1a2e;
}

/* Main App Styles */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #16213e, #0f3460);
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.contributor-badge {
    background: rgba(0,255,136,0.2);
    color: #00ff88;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.btn-logout {
    background: transparent;
    border: 1px solid #e94560;
    color: #e94560;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: #e94560;
    color: white;
}

.current-word {
    font-size: 3rem;
    font-weight: bold;
    color: #00ff88;
    text-shadow: 0 0 20px rgba(0,255,136,0.5);
    margin-bottom: 5px;
}

.english-word {
    font-size: 1.5rem;
    color: #00aaff;
    margin-bottom: 10px;
    font-style: italic;
}

.row-info {
    font-size: 1.2rem;
    color: #aaa;
}

/* Main content area */
.main-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
}

/* Video section */
.video-section {
    background: #16213e;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.video-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.video-container canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.camera-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: #00ff88;
    padding: 20px 40px;
    border-radius: 10px;
    font-size: 1.2rem;
}

.camera-status.hidden {
    display: none;
}

/* Reference video */
.reference-section {
    margin-top: 20px;
}

.reference-section h3 {
    margin-bottom: 10px;
    color: #00ff88;
}

.reference-video {
    width: 100%;
    border-radius: 10px;
    background: #000;
}

/* Progress bar */
.progress-container {
    margin-top: 15px;
}

.progress-bar {
    height: 30px;
    background: #0f3460;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #00cc6a);
    width: 0%;
    transition: width 0.1s ease;
    border-radius: 15px;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Control panel */
.control-panel {
    background: #16213e;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.control-section {
    margin-bottom: 25px;
}

.control-section h3 {
    color: #00ff88;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #0f3460;
}

/* Record button */
.record-btn {
    width: 100%;
    padding: 20px;
    font-size: 1.3rem;
    font-weight: bold;
    background: linear-gradient(135deg, #e94560, #c73659);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.record-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(233,69,96,0.4);
}

.record-btn:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.record-btn.recording {
    background: linear-gradient(135deg, #ff0000, #cc0000);
    animation: pulse 1s infinite;
}

.record-btn.record-again {
    background: linear-gradient(135deg, #ff9800, #f57c00);
}

.record-btn.record-again:hover {
    box-shadow: 0 5px 20px rgba(255,152,0,0.4);
}

.recording-status {
    text-align: center;
    margin-top: 10px;
    padding: 8px;
    border-radius: 5px;
    font-weight: bold;
}

.recording-status.has-recording {
    background: rgba(0,255,136,0.2);
    color: #00ff88;
}

.recording-status.no-recording {
    background: rgba(255,152,0,0.2);
    color: #ff9800;
}

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

.keyboard-hint {
    text-align: center;
    color: #888;
    margin-top: 10px;
    font-size: 0.9rem;
}

.keyboard-hint kbd {
    background: #0f3460;
    padding: 5px 12px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 1rem;
}

/* Navigation */
.nav-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.nav-btn {
    flex: 1;
    padding: 12px;
    font-size: 1rem;
    background: #0f3460;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: #1a4a7a;
}

/* Row skip input */
.skip-row {
    display: flex;
    gap: 10px;
}

.skip-row input {
    flex: 1;
    padding: 12px;
    font-size: 1rem;
    background: #0f3460;
    border: 2px solid #1a4a7a;
    border-radius: 8px;
    color: white;
    outline: none;
}

.skip-row input:focus {
    border-color: #00ff88;
}

.skip-row button {
    padding: 12px 20px;
    font-size: 1rem;
    background: #00ff88;
    color: #1a1a2e;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.skip-row button:hover {
    background: #00cc6a;
}

/* Download button */
.btn-download {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    font-weight: bold;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(76,175,80,0.4);
}

.btn-download:disabled {
    background: #555;
    cursor: not-allowed;
}

.download-info {
    text-align: center;
    margin-top: 10px;
    color: #888;
}

/* Status display */
.status-box {
    background: #0f3460;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.status-label {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.status-value {
    font-size: 1.1rem;
    color: #00ff88;
}

.status-value.recording {
    color: #e94560;
    animation: pulse 1s infinite;
}

/* Settings */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #0f3460;
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-row input[type="number"] {
    width: 80px;
    padding: 8px;
    background: #0f3460;
    border: 1px solid #1a4a7a;
    border-radius: 5px;
    color: white;
    text-align: center;
}

/* Countdown overlay */
.countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.countdown-overlay.active {
    display: flex;
}

.countdown-number {
    font-size: 15rem;
    font-weight: bold;
    color: #00ff88;
    text-shadow: 0 0 50px rgba(0,255,136,0.8);
    animation: countdownPulse 1s ease-in-out infinite;
}

@keyframes countdownPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #00ff88;
    color: #1a1a2e;
    padding: 15px 30px;
    border-radius: 10px;
    font-weight: bold;
    box-shadow: 0 5px 20px rgba(0,255,136,0.4);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1001;
}

.toast.show {
    opacity: 1;
}

/* Responsive */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .logo h1 {
        font-size: 2rem;
    }

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

    .login-box {
        padding: 25px;
    }
}
