:root {
    --bg: #0f1115;
    --surface: #1a1d24;
    --surface-2: #23272f;
    --border: #2f333c;
    --text: #e8eaed;
    --text-muted: #9aa0a8;
    --accent: #4f9dfd;
    --accent-2: #34d399;
    --danger: #f87171;
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

/* Top bar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar h1 {
    font-size: 1.05rem;
    margin: 0;
    font-weight: 600;
}

.topbar-actions { display: flex; gap: 10px; }

.btn-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 10px;
    border-radius: 8px;
}

.btn-link.muted { color: var(--text-muted); }
.btn-link:active { background: var(--surface-2); }

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    padding: 12px 16px 0;
}

.tab-btn {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 10px 8px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.tab-btn.active {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--accent);
}

.tab-btn .count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Controls */
.controls {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#search {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.95rem;
}

.filter-btns {
    display: flex;
    gap: 8px;
}

.filter-btn {
    flex: 1;
    padding: 8px 6px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.filter-btn.active {
    background: var(--accent);
    color: #0b0f14;
    border-color: var(--accent);
    font-weight: 600;
}

/* List */
main { padding: 0 12px 32px; }

.item-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
}

.item.is-learned {
    opacity: 0.55;
}

.item label {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 2px 10px;
    align-items: center;
}

.item .learned-checkbox {
    grid-row: 1 / span 2;
    width: 22px;
    height: 22px;
    accent-color: var(--accent-2);
}

.item .de {
    font-weight: 600;
    font-size: 0.98rem;
}

.item.is-learned .de {
    text-decoration: line-through;
    text-decoration-color: var(--accent-2);
}

.item .tr {
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    width: 100%;
    max-width: 340px;
    text-align: center;
}

.login-box h1 { margin: 0 0 4px; font-size: 1.3rem; }
.login-box .subtitle { margin: 0 0 20px; color: var(--text-muted); font-size: 0.85rem; }

.login-box input {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 12px;
}

.login-box button {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: #0b0f14;
    font-weight: 600;
    font-size: 1rem;
}

.login-box .error { color: var(--danger); margin-top: 12px; font-size: 0.85rem; }

/* Card mode */
.card-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    min-height: calc(100vh - 60px);
}

.remaining {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.flashcard {
    width: 100%;
    max-width: 420px;
    min-height: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    cursor: pointer;
}

.flashcard-de {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 14px;
}

.flashcard-tr {
    font-size: 1.15rem;
    color: var(--accent);
    margin: 0;
}

.hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 14px 0 24px;
}

.card-actions {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 420px;
}

.btn-secondary, .btn-primary {
    flex: 1;
    padding: 14px;
    border-radius: 14px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-primary {
    background: var(--accent-2);
    color: #0b0f14;
}

.empty-msg {
    margin-top: 24px;
    font-size: 1.1rem;
    text-align: center;
}
