* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --mark-1: #dcfce7;
  --mark-0: #fef3c7;
  --mark--1: #fee2e2;
}

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.app-header {
  background: var(--primary);
  color: white;
  padding: 1rem;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header h1 { font-size: 1.25rem; font-weight: 700; }
.app-header p { font-size: 0.875rem; opacity: 0.9; margin-top: 0.25rem; }

.app-nav {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.nav-btn {
  flex-shrink: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  background: white;
  color: var(--text-muted);
  border-radius: 9999px;
  font-size: 0.875rem;
  cursor: pointer;
  white-space: nowrap;
}

.nav-btn:hover { background: #f1f5f9; color: var(--text); }
.nav-btn.active { background: var(--primary); color: white; border-color: var(--primary); }


.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text); }
.btn-outline:hover { background: #f8fafc; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }

.btn-full { width: 100%; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }

main { padding: 1rem; max-width: 600px; margin: 0 auto; }

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
  background: var(--surface);
  padding: 1rem;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.filter-group { display: flex; flex-direction: column; gap: 0.5rem; }

.filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.filter-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 0.95rem;
  color: var(--text);
}

.flashcard-container { perspective: 1000px; margin-bottom: 1rem; }

.flashcard {
  width: 100%;
  height: 260px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.flashcard.flipped { transform: rotateY(180deg); }

.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-shadow: inset 0 0 0 1px var(--border);
}

.flashcard-front { background: white; }
.flashcard-back { background: var(--primary); color: white; transform: rotateY(180deg); }

.cs-word { font-size: 2.5rem; font-weight: 800; margin-bottom: 0.5rem; word-break: break-word; }
.de-word { font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem; word-break: break-word; }

.pos-tag { font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.example-sentence { font-size: 1rem; margin-top: 1rem; font-style: italic; color: var(--text-muted); }

.description-box {
  font-size: 0.9rem;
  margin-top: 1rem;
  padding: 0.75rem;
  background: #f1f5f9;
  border-radius: 8px;
  color: var(--text-muted);
  text-align: left;
}

.flip-hint {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.7;
}



.mark-bar { display: flex; justify-content: center; gap: 0.5rem; margin-top: 1rem; }

.mark-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid transparent;
  background: white; color: var(--text-muted); font-size: 1.5rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center;
}

.mark-btn:hover { transform: scale(1.1); border-color: var(--primary); }
.mark-btn.mark--1 { background: var(--mark--1); color: var(--danger); }
.mark-btn.mark-0  { background: var(--mark-0); color: var(--warning); }
.mark-btn.mark-1  { background: var(--mark-1); color: var(--success); }
.mark-btn.active { border-color: var(--text); transform: scale(1.15); box-shadow: 0 0 0 3px rgba(0,0,0,0.1); }

.word-list { display: flex; flex-direction: column; gap: 0.5rem; }

.word-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; background: white; border: 1px solid var(--border);
  border-radius: 12px; transition: all 0.2s;
}

.word-row:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.word-row.mark--1 { border-left: 4px solid var(--danger); }
.word-row.mark-0  { border-left: 4px solid var(--warning); }
.word-row.mark-1  { border-left: 4px solid var(--success); }

.word-info { flex: 1; }
.word-info .cs { font-weight: 700; font-size: 1rem; }
.word-info .de { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.125rem; }
.word-meta { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-card { background: white; padding: 1rem; border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.result-correct { color: var(--success); font-weight: 700; }
.result-wrong   { color: var(--danger); font-weight: 700; }

.overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px); z-index: 200; display: none;
  align-items: center; justify-content: center; padding: 1rem;
}
.overlay.active { display: flex; }

.modal {
  background: white; border-radius: 20px; padding: 1.5rem;
  max-width: 420px; width: 100%;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}
.modal h2 { margin-bottom: 1rem; font-size: 1.25rem; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state h3 { margin-bottom: 0.5rem; color: var(--text); }

@media (max-width: 480px) {
  .cs-word { font-size: 2rem; }
  .de-word { font-size: 1.75rem; }
  .stats-grid { grid-template-columns: 1fr; }
}

.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-2 { margin-top: 0.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
