@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+Georgian:wght@400;600&family=Inter:wght@400;500;600;700&display=swap");

:root {
  --ink: #111827;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #d7dee8;
  --muted: #64748b;
  --text: #172033;
  --brand: #0f766e;
  --brand-soft: #dff5f1;
  --gold: #b7791f;
  --red: #c2412d;
  --red-soft: #fff0ec;
  --green: #16803c;
  --green-soft: #e8f7ee;
  --ka: "Noto Serif Georgian", Sylfaen, serif;
  --ui: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #eef3f6;
  color: var(--text);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.48;
}

.app {
  min-height: 100vh;
}

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

.sidebar {
  background: var(--ink);
  color: #e5edf7;
  padding: 24px 18px;
}

.brand {
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.12;
  letter-spacing: 0;
}

.brand p {
  margin: 6px 0 0;
  color: rgba(229, 237, 247, 0.72);
  font-family: var(--ka);
  font-size: 15px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav button,
.side-action {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: rgba(229, 237, 247, 0.78);
  padding: 10px 12px;
  text-align: left;
}

.nav button.active,
.nav button:hover,
.side-action:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.side-action {
  margin-top: 18px;
}

.side-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 24px 0;
}

.side-stat {
  display: block;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px;
  text-align: left;
  color: inherit;
}

.side-stat:hover,
.side-stat:focus-visible {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.09);
  outline: none;
}

.side-stat--review:hover,
.side-stat--review:focus-visible {
  border-color: rgba(255, 180, 158, 0.6);
}

.side-stat b {
  display: block;
  color: #fff;
  font-size: 22px;
}

.side-stat span {
  color: rgba(229, 237, 247, 0.66);
  font-size: 12px;
}

.main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.topbar h2 {
  margin: 0 0 5px;
  font-size: 24px;
}

.topbar p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 10px;
  margin-bottom: 14px;
}

.field,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.field,
.select {
  height: 42px;
  padding: 0 12px;
}

.textarea {
  min-height: 210px;
  padding: 12px;
  resize: vertical;
  line-height: 1.5;
}

.field:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.btn,
.ghost,
.danger,
.chip,
.option {
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.btn {
  height: 42px;
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  padding: 0 14px;
  font-weight: 700;
}

.ghost {
  height: 42px;
  padding: 0 14px;
  color: var(--brand);
  font-weight: 700;
}

.danger {
  height: 36px;
  padding: 0 12px;
  color: var(--red);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.chip {
  height: 32px;
  padding: 0 11px;
  color: var(--muted);
  font-size: 13px;
}

.chip.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.chip.review.active {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}

.notice {
  border-left: 3px solid var(--brand);
  background: #fff;
  padding: 11px 13px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
}

.notice.error {
  border-color: var(--red);
  color: var(--red);
}

.word-list {
  display: grid;
  gap: 10px;
}

.card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.word-head {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 15px 16px;
  color: inherit;
  text-align: left;
}

.word-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.word-title strong {
  font-size: 20px;
  line-height: 1.2;
}

.ka {
  font-family: var(--ka);
}

.word-title span {
  color: var(--brand);
  font-family: var(--ka);
}

.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  color: var(--muted);
}

.badge.good {
  border-color: #a7dfba;
  background: var(--green-soft);
  color: var(--green);
}

.badge.bad {
  border-color: #ffc7b7;
  background: var(--red-soft);
  color: var(--red);
}

.word-body {
  border-top: 1px solid var(--line);
  padding: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 18px;
}

.label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.definition,
.note,
.phrase-list,
.exercise-list {
  margin: 0 0 16px;
}

.definition {
  line-height: 1.55;
}

.definition .ka,
.phrase .ka {
  color: var(--muted);
}

.note {
  border-left: 3px solid var(--gold);
  padding: 8px 0 8px 12px;
  color: var(--muted);
  line-height: 1.5;
}

.phrase-list {
  display: grid;
  gap: 8px;
  padding: 0;
  list-style: none;
}

.phrase {
  border-left: 1px solid var(--line);
  padding-left: 12px;
  line-height: 1.5;
}

.phrase span {
  display: block;
}

.exercise-list {
  display: grid;
  gap: 9px;
}

.exercise {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.exercise p {
  margin: 5px 0 9px;
}

.options {
  display: grid;
  gap: 8px;
}

.option {
  min-height: 42px;
  padding: 9px 11px;
  text-align: left;
}

.option span {
  display: block;
}

.option-gloss {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px dashed rgba(100, 116, 139, 0.28);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.option.correct {
  border-color: #7bd598;
  background: var(--green-soft);
  color: var(--green);
}

.option.wrong {
  border-color: #ffb49e;
  background: var(--red-soft);
  color: var(--red);
}

.panel {
  padding: 18px;
}

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

.mode {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  text-align: left;
}

.mode b {
  display: block;
  margin-bottom: 5px;
  font-size: 17px;
}

.mode span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.quiz-progress {
  height: 6px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.quiz-progress div {
  height: 100%;
  background: var(--brand);
}

.quiz-prompt {
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1.22;
}

.quiz-question {
  margin: 0 0 16px;
  color: var(--muted);
}

.import-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.preview {
  display: grid;
  gap: 10px;
}

.preview-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
}

.preview-stat b {
  display: block;
  font-size: 24px;
}

.sample {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sample th,
.sample td {
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
  text-align: left;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px 18px;
  color: var(--muted);
  text-align: center;
}

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

  .sidebar {
    position: static;
  }

  .main {
    padding: 18px;
  }

  .toolbar,
  .import-grid,
  .detail-grid,
  .modes {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .word-head {
    grid-template-columns: 1fr;
  }

  .meta {
    flex-wrap: wrap;
  }
}
