:root {
  --blue: #0f5fb8;
  --blue-dark: #0b3f79;
  --yellow: #ffd35a;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #18202a;
  --muted: #5f6b7a;
  --border: #d9e0ea;
  --green: #42b66b;
  --amber: #f7c948;
  --red: #ef5b5b;
  --gray: #c5ccd6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.site-header {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: white;
  padding: 24px;
}

.site-header h1,
.panel h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: inherit;
  opacity: 0.8;
  font-weight: 700;
}

.page-shell {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px 48px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(22, 34, 51, 0.08);
  padding: 24px;
}

.hidden { display: none !important; }

.helper,
.message {
  color: var(--muted);
  line-height: 1.4;
}

.message.error { color: #b00020; font-weight: 700; }
.message.success { color: #0f7a3b; font-weight: 700; }

.lookup-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
  margin-top: 18px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-size: 16px;
  font-family: inherit;
  background: white;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  background: var(--blue);
  color: white;
}

.secondary-button,
.small-button,
.language-button {
  background: #edf3fb;
  color: var(--blue-dark);
}

.language-button.active {
  background: var(--blue);
  color: white;
}

.dashboard-topline,
.practice-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.stat-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  background: #fbfcff;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 6px;
}

.stat-number {
  font-size: 36px;
  font-weight: 900;
}

.legend,
.study-actions,
.language-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 18px 0;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 700;
}

.dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.mastered { background: var(--green); }
.partial { background: var(--amber); }
.incorrect { background: var(--red); }
.not-tested { background: var(--gray); }

.unit-select-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.unit-select-label select {
  min-width: 180px;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.card-chip {
  min-width: 64px;
  border-radius: 999px;
  padding: 10px 14px;
  color: #111;
  border: 2px solid transparent;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.card-chip:hover,
.card-chip:focus {
  border-color: var(--blue-dark);
  transform: translateY(-1px);
}

.card-chip.mastered { background: #b9efc8; }
.card-chip.partial { background: #ffe58a; }
.card-chip.incorrect { background: #ffb2b2; }
.card-chip.not-tested { background: #e1e5eb; }

.practice-panel { margin-top: 20px; }

.card-viewer {
  display: grid;
  gap: 16px;
  margin: 16px 0;
}

.card-image {
  width: 100%;
  max-width: 720px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: white;
  padding: 6px;
}

.answer-box {
  max-width: 720px;
}

@media (max-width: 800px) {
  .lookup-form,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-topline,
  .practice-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

.practice-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
