:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #62686f;
  --line: #d8ddd5;
  --paper: #fffdf7;
  --surface: #f6f7ef;
  --mint: #cde7d1;
  --mint-strong: #357a55;
  --coral: #f08a78;
  --sky: #b8dff2;
  --sun: #f6c95f;
  --wrong: #c63f3f;
  --right: #24754a;
  --shadow: 0 14px 38px rgba(32, 33, 36, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(246, 201, 95, 0.25), transparent 28rem),
    linear-gradient(135deg, #f9fbf2 0%, #eef6f8 55%, #fff7f0 100%);
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.92);
  padding: 24px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 3px solid #222;
  border-radius: 8px;
  background: var(--sun);
  font-size: 24px;
  font-weight: 900;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.05;
}

.brand p {
  color: var(--muted);
  margin-top: 4px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

select,
input[type="text"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 22px 0;
}

.stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px 8px;
  text-align: center;
}

.stats span {
  display: block;
  font-size: 24px;
  font-weight: 900;
}

.stats small {
  color: var(--muted);
  font-size: 12px;
}

.ghost-button,
.action-button,
.icon-button,
.mode-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  font-weight: 800;
}

.ghost-button {
  width: 100%;
}

.study-actions .ghost-button {
  width: auto;
}

.action-button {
  background: var(--mint-strong);
  border-color: var(--mint-strong);
  color: #fff;
}

.action-button.secondary {
  background: var(--sun);
  border-color: #d9a73a;
  color: #2b2617;
}

.workspace {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.7);
  padding: 14px 24px;
  overflow-x: auto;
}

.mode-button.active {
  background: #202124;
  border-color: #202124;
  color: #fff;
}

.view {
  min-width: 0;
  padding: 24px;
}

.view-header {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 18px;
}

.view-header h2 {
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1;
}

.view-header p {
  color: var(--muted);
  margin-top: 6px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.word-card {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 6px 18px rgba(32, 33, 36, 0.06);
  padding: 12px;
}

.word-top {
  display: flex;
  gap: 8px;
  align-items: start;
  justify-content: space-between;
}

.english {
  font-size: 20px;
  font-weight: 900;
  line-height: 1.15;
}

.spanish {
  color: var(--muted);
  margin-top: 6px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.tag {
  border-radius: 999px;
  background: var(--sky);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
}

.tag.hard {
  background: #ffd3cb;
}

.tag.known {
  background: var(--mint);
}

.icon-button {
  display: inline-grid;
  min-width: 42px;
  place-items: center;
  padding: 0;
}

.study-panel {
  display: grid;
  min-height: calc(100vh - 120px);
  place-items: center;
}

.big-card {
  width: min(720px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 42px);
}

.category-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  background: var(--mint);
  padding: 0 12px;
  font-weight: 900;
  margin-bottom: 18px;
}

.prompt-word {
  font-size: clamp(42px, 8vw, 82px);
  line-height: 0.95;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.translation {
  color: var(--muted);
  font-size: 26px;
  margin-top: 18px;
}

.study-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.options {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}

.option {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 850;
}

.option.correct {
  background: #dff1e5;
  border-color: var(--right);
}

.option.wrong {
  background: #ffe4df;
  border-color: var(--wrong);
}

.result-line {
  min-height: 28px;
  margin-top: 18px;
  font-size: 20px;
  font-weight: 900;
}

.result-line.good {
  color: var(--right);
}

.result-line.bad {
  color: var(--wrong);
}

.spelling-form {
  display: flex;
  gap: 10px;
  margin-top: 26px;
}

.spelling-form input {
  font-size: 24px;
  font-weight: 850;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  padding: 28px;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .view-header {
    align-items: stretch;
    flex-direction: column;
  }

  .spelling-form {
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .sidebar,
  .view {
    padding: 16px;
  }

  .mode-tabs {
    padding: 10px 16px;
  }

  .word-grid {
    grid-template-columns: 1fr;
  }
}
