* { box-sizing: border-box; }
body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
    max-width: 900px; 
    margin: 0 auto; 
    padding: 20px; 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}
.container {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
h1, h2, h3 { color: #333; margin-top: 0; }
.btn { 
    display: inline-block;
    padding: 12px 24px; 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; 
    text-decoration: none; 
    border-radius: 8px; 
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn:hover { 
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
.btn-sync { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.btn-secondary { background: linear-gradient(135deg, #b8c6db 0%, #f5f7fa 100%); color: #333; }
.btn-danger { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.card { 
    border: none;
    padding: 25px; 
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    background: #fafafa;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.card-muted { background: #f4f6fb; border: 1px solid #e5e7eb; }
.card-body { width: 100%; }
.anki-html { line-height: 1.6; text-align: left; word-break: break-word; }
.anki-html p { margin: 0 0 12px; }
.anki-html h1, .anki-html h2, .anki-html h3, .anki-html h4 { margin: 12px 0 8px; }
.anki-html ul, .anki-html ol { padding-left: 20px; margin: 8px 0 12px; }
.anki-html blockquote { margin: 8px 0 12px; padding-left: 12px; border-left: 3px solid #e5e7eb; color: #555; }
.anki-html pre { background: #0b1221; color: #e8e8e8; padding: 12px; border-radius: 8px; overflow-x: auto; }
.anki-html code { background: #eef2ff; padding: 2px 4px; border-radius: 4px; font-family: SFMono-Regular, Consolas, Menlo, monospace; }
.anki-html img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 8px auto; }
.anki-html table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.anki-html th, .anki-html td { border: 1px solid #e5e7eb; padding: 8px; }
.anki-html audio, .anki-html video { width: 100%; margin: 10px 0; }
.stats { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 15px; 
    margin: 20px 0;
}
.stat-box {
    text-align: center;
    padding: 15px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}
.stat-box.new { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.stat-box.learning { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); color: white; }
.stat-box.review { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); color: white; }
.stat-number { font-size: 32px; font-weight: bold; }
.stat-label { font-size: 14px; opacity: 0.9; }
.deck-list { list-style: none; padding: 0; }
.deck-item { 
    padding: 15px; 
    margin: 8px 0; 
    background: #f8f9fa; 
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}
.deck-item:hover { 
    background: #e9ecef;
    transform: translateX(5px);
}
.deck-item.active { 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}
.deck-counts { font-size: 14px; opacity: 0.8; }
select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 20px;
}
.btn-group { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: stretch; }
.btn-group form, .btn-group a { flex: 1; min-width: 120px; }
.btn-group .btn { width: 100%; text-align: center; }
.answer-btn { padding: 15px; font-size: 16px; }
.again { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.hard { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); color: #333; }
.good { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.easy { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.nav { margin-bottom: 20px; }
.nav a { color: #667eea; text-decoration: none; }
.nav a:hover { text-decoration: underline; }
audio { width: 100%; margin: 10px 0; }
.cloze { 
    color: #667eea; 
    font-weight: bold; 
    background: #f0f0ff; 
    padding: 2px 6px; 
    border-radius: 4px; 
    display: inline; /* Ensure inline display */
}
.success-msg { color: #38ef7d; font-weight: bold; }
.error-msg { color: #f5576c; font-weight: bold; }
.progress-bar {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    margin: 15px 0;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s;
}
.undo-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 20px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    z-index: 1000;
}
.keyboard-hint {
    font-size: 12px;
    color: #999;
    text-align: center;
    margin-top: 10px;
}

@media (max-width: 600px) {
    body {
        padding: 4px;
    }
    .container {
        padding: 8px;
    }
    .card {
        padding: 0;
    }
    .stats {
        grid-template-columns: 1fr;
    }
    .btn {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }
    .nav {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    .nav span {
        float: none !important;
        display: block;
        margin-top: 5px;
    }
}

/* Fixed bottom action bar */
.fixed-bottom-action {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px;
    padding-bottom: calc(15px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    z-index: 9999;
    display: flex;
    justify-content: center;
}

.fixed-bottom-action-content {
    width: 100%;
    max-width: 900px;
    display: flex;
    gap: 10px;
}

.fixed-bottom-action-content form {
    flex: 1;
}

/* Add padding to body to prevent content from being hidden */
body {
    padding-bottom: 120px !important;
}
