:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --text: #19202a;
  --muted: #5d6b7a;
  --line: #dbe2ea;
  --primary: #0d6efd;
  --primary-strong: #0b5ed7;
  --ok: #198754;
  --bad: #dc3545;
  --code: #0f1720;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.header-inner > a.btn:last-child {
  margin-left: auto;
}

.brand {
  font-weight: 700;
  color: var(--text);
}

.brand-btn {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 16px;
  cursor: pointer;
}

.brand-btn:hover {
  text-decoration: underline;
}

.header-search {
  position: relative;
  flex: 1 1 520px;
  max-width: 620px;
}

.search-input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.15);
}

.search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 14px 26px rgba(18, 25, 36, 0.12);
  overflow: hidden;
}

.search-results-head {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
}

.search-results-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: min(58vh, 430px);
  overflow: auto;
}

.search-result-item {
  display: block;
  padding: 10px 12px;
  border-bottom: 1px solid #edf1f6;
  color: var(--text);
  text-decoration: none;
}

.search-result-item:last-child {
  border-bottom: 0;
}

.search-result-item:hover {
  text-decoration: none;
  background: #f8fbff;
}

.search-result-title {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
}

.search-result-meta {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.search-result-empty {
  margin: 0;
  padding: 12px;
  font-size: 13px;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.breadcrumb {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
}

.title {
  margin: 0;
  font-size: 30px;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
}

.section {
  margin-top: 26px;
}

.section h2 {
  margin: 0 0 14px;
  font-size: 22px;
}

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

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.card h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.card .meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 9px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}

.btn:hover {
  border-color: #bbc7d3;
}

.btn-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.btn-saved-active {
  border-color: var(--ok);
  background: var(--ok);
  color: #fff;
}

.btn-saved-active:hover {
  border-color: #157347;
  background: #157347;
}

.btn-link {
  border: none;
  background: transparent;
  color: var(--primary);
  padding: 0;
}

.callout {
  border-left: 4px solid var(--primary);
  background: #eef5ff;
  border-radius: 6px;
  padding: 12px;
  margin: 16px 0;
  color: #223;
}

.callout h4 {
  margin: 0 0 8px;
}

.callout p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.55;
}

.callout ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.callout .code {
  margin-top: 10px;
}

.callout-info {
  border-left-color: #0d6efd;
  background: #eef5ff;
}

.callout-concept {
  border-left-color: #f59f00;
  background: #fff8e8;
}

.callout-caution {
  border-left-color: #dc3545;
  background: #fff0f2;
}

.callout-success {
  border-left-color: #198754;
  background: #ecfbf2;
}

.callout-debug {
  border-left-color: #6f42c1;
  background: #f4f0ff;
}

.article-block {
  margin-top: 14px;
}

.article-block h4 {
  margin: 0 0 8px;
}

.article-block p {
  margin: 0;
  line-height: 1.6;
}

.article-block ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
}

.article-block li {
  margin: 7px 0;
}

.romanian-article {
  max-width: 820px;
}

.romanian-paragraphs {
  display: grid;
  gap: 14px;
}

.romanian-paragraphs p {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.75;
}

.romanian-dialogue,
.romanian-analysis,
.romanian-questions {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.romanian-dialogue {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  display: grid;
  gap: 12px;
}

.romanian-dialogue h2,
.romanian-analysis h2,
.romanian-questions h2 {
  margin: 0 0 12px;
  font-size: 22px;
}

.romanian-dialogue-line {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdff;
}

.romanian-speaker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  background: #eaf2ff;
  color: #0b5ed7;
  font-weight: 700;
  font-size: 13px;
}

.romanian-dialogue-line p {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.65;
}

.romanian-analysis {
  display: grid;
  gap: 12px;
}

.romanian-note {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.romanian-note-index {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.romanian-note-body h3 {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.45;
}

.romanian-note-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.romanian-note-fields div {
  padding: 10px;
  border-radius: 8px;
  background: #f5f8fc;
}

.romanian-note-fields dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.romanian-note-fields dd {
  margin: 0;
  line-height: 1.5;
}

.romanian-note-block {
  margin-top: 10px;
}

.romanian-note-block h4 {
  margin: 0 0 7px;
  font-size: 15px;
}

.romanian-note-block ul {
  margin: 0;
  padding-left: 18px;
}

.romanian-note-block li {
  margin: 6px 0;
  line-height: 1.5;
}

.romanian-note-block li span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.romanian-questions ol {
  margin: 0;
  padding-left: 22px;
}

.romanian-questions li {
  margin: 9px 0;
  line-height: 1.55;
}

pre.code {
  margin: 0;
  background: var(--code);
  color: #d7e0ea;
  border-radius: 10px;
  padding: 12px;
  overflow: auto;
}

.code-with-copy {
  position: relative;
}

.code-with-copy .code {
  margin: 0;
  padding-right: 52px;
}

.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 1px solid #4d5d70;
  background: #1a2633;
  color: #d7e0ea;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.code-copy-btn:hover {
  background: #233243;
  border-color: #5f738a;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.question-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-top: 16px;
}

.progress {
  color: var(--muted);
  font-size: 14px;
}

.question-title {
  margin: 8px 0 0;
  font-size: 23px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.answer-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #b7e3cc;
  background: #eaf9f1;
  color: #0d6a3f;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.question-text {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
}

.question-row {
  margin-top: 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.question-row .question-text {
  flex: 1 1 auto;
  min-width: 0;
}

.star-bookmark-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 2px solid #e2b216;
  border-radius: 999px;
  background: #fff;
  color: #e2b216;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
}

.star-bookmark-btn::before {
  content: '☆';
  font-size: 22px;
}

.star-bookmark-btn:hover {
  background: #fff9df;
}

.star-bookmark-btn.is-saved {
  background: #fff3bc;
}

.star-bookmark-btn.is-saved::before {
  content: '★';
  color: #e2b216;
}

.choice-list {
  margin-top: 16px;
  display: grid;
  gap: 9px;
}

.choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.choice input {
  margin-top: 3px;
}

.choice label {
  cursor: pointer;
}

.answer-box {
  margin-top: 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fafcff;
}

.answer-highlight {
  margin-bottom: 12px;
}

.answer-options {
  display: grid;
  gap: 10px;
}

.answer-option {
  margin: 0;
}

.answer-rich {
  color: var(--text);
}

.answer-rich p {
  margin: 8px 0;
  line-height: 1.6;
  color: var(--text);
}

.answer-rich .answer-heading {
  margin: 12px 0 6px;
  color: #17212b;
}

.answer-rich .answer-list {
  margin: 8px 0;
  padding-left: 20px;
}

.answer-rich .answer-list li {
  margin: 6px 0;
  line-height: 1.5;
}

.direct-question-rich {
  margin-bottom: 14px;
}

.answer-note {
  margin: 10px 0;
}

.inline-code {
  font-family: Consolas, "Courier New", monospace;
  background: #ecf2f8;
  border: 1px solid #d5e0ea;
  border-radius: 6px;
  padding: 1px 6px;
  color: #223447;
}

.answer-table-wrap {
  overflow-x: auto;
  margin: 10px 0;
}

.answer-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.answer-table th,
.answer-table td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
  line-height: 1.45;
}

.answer-table th {
  background: #eef3f8;
  font-weight: 700;
}

.status-ok {
  color: var(--ok);
  font-weight: 700;
}

.status-bad {
  color: var(--bad);
  font-weight: 700;
}

textarea.code-input {
  width: 100%;
  min-height: 200px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
}

.footer-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

.saved-list-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.saved-list-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 32, 0.5);
}

.saved-list-panel {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.saved-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.saved-list-header h2 {
  margin: 0;
  font-size: 20px;
}

.saved-list-content {
  padding: 12px 16px;
  overflow: auto;
}

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

.saved-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  cursor: pointer;
}

.saved-item:hover {
  border-color: #b6c5d3;
  background: #f8fbff;
}

.saved-item-title {
  color: var(--text);
  font-weight: 600;
  line-height: 1.45;
}

.saved-item-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.saved-group-count {
  color: #6c7a88;
  font-weight: 700;
}

.saved-subheader {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.saved-subtitle {
  color: var(--text);
  font-weight: 700;
}

.saved-back-btn {
  min-width: 76px;
}

.saved-empty {
  margin: 4px 0;
  color: var(--muted);
}

.saved-list-footer {
  margin-top: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

body.no-scroll {
  overflow: hidden;
}

.hidden {
  display: none;
}

@media (max-width: 760px) {
  .header-inner {
    flex-wrap: wrap;
  }

  .header-search {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
  }

  .header-inner > a.btn:last-child {
    margin-left: 0;
  }

  .title {
    font-size: 24px;
  }

  .question-title {
    font-size: 20px;
  }

  .romanian-dialogue-line,
  .romanian-note,
  .romanian-note-fields {
    grid-template-columns: 1fr;
  }

  .question-row {
    gap: 10px;
  }

  .star-bookmark-btn {
    width: 36px;
    height: 36px;
  }
}
