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

:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --border: #e8e3da;
  --text-primary: #1a1814;
  --text-secondary: #6b6560;
  --text-muted: #9e9890;
  --accent: #2d5a27;
  --accent-light: #e8f0e6;
  --star-color: #c8963a;
  --memorize-color: #5a4b8a;
  --known-color: #2d5a27;
  --radius: 16px;
  --shadow: 0 2px 20px rgba(0,0,0,0.07);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px 48px;
}

.app {
  width: 100%;
  max-width: 540px;
}

/* Header */
header {
  margin-bottom: 32px;
  text-align: center;
}

.app-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.difficulty-tabs {
  display: inline-flex;
  background: var(--border);
  border-radius: 100px;
  padding: 3px;
  gap: 2px;
}

.tab {
  background: none;
  border: none;
  cursor: pointer;
  padding: 7px 18px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.tab.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.tab:hover:not(.active) {
  color: var(--text-primary);
}

/* Card */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-counter {
  padding: 14px 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.04em;
}

.card-body {
  padding: 40px 36px 32px;
}

.word {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.definition {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.reveal-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 8px 14px;
  transition: all 0.15s ease;
  margin-bottom: 20px;
}

.reveal-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-secondary);
}

.extras {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.extras.hidden { display: none; }

.etymology {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.5;
}

.example {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.65;
  padding-left: 14px;
  border-left: 3px solid var(--border);
}

/* Action buttons */
.actions {
  display: flex;
  border-top: 1px solid var(--border);
}

.action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 18px 8px;
  color: var(--text-muted);
  transition: all 0.15s ease;
  border-right: 1px solid var(--border);
}

.action-btn:last-child { border-right: none; }

.action-btn .icon { font-size: 20px; line-height: 1; }
.action-btn .label { font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }

.action-btn:hover { background: var(--bg); }

/* Active states */
#btnStar.active { color: var(--star-color); background: #fdf5e6; }
#btnMemorize.active { color: var(--memorize-color); background: #f0ecf9; }
#btnKnown.active { color: var(--known-color); background: var(--accent-light); }

#btnStar.active .icon { content: '★'; }

/* Nav */
.nav {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.nav-btn {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  box-shadow: var(--shadow);
  transition: all 0.15s ease;
}

.nav-btn:hover {
  background: var(--bg);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Back to list button */
.back-to-list {
  display: block;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0 0 16px 2px;
  text-align: left;
  transition: color 0.15s ease;
  width: 100%;
}

.back-to-list:hover { color: var(--text-primary); }

/* Word list (My Lists overview) */
.word-list {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.word-list-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  padding: 16px 20px;
  text-align: left;
  transition: background 0.12s ease;
}

.word-list-item:last-child { border-bottom: none; }
.word-list-item:hover { background: var(--bg); }

.wli-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wli-term {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.wli-level {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}

.wli-def {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hidden utility */
.hidden { display: none !important; }

/* List filter bar */
.list-filters {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}

.filter-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.filter-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }
.filter-btn.active { background: var(--text-primary); color: var(--surface); border-color: var(--text-primary); }

/* Word level badge */
.word-level {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* Empty state */
.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.6;
}

.empty-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Footer stats */
footer {
  margin-top: 24px;
  text-align: center;
}

.stats {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.stat-dot.star { background: var(--star-color); }
.stat-dot.memorize { background: var(--memorize-color); }
.stat-dot.known { background: var(--known-color); }
