:root {
  --ink: #171411;
  --muted: #6a6258;
  --paper: #fbf7ef;
  --panel: #fffdf8;
  --line: #d9cdb9;
  --accent: #a9570a;
  --accent-dark: #713700;
  --good: #28664a;
  --bad: #9b2c2c;
  --shadow: 0 22px 70px rgba(34, 26, 16, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(169, 87, 10, 0.12), transparent 28%),
    linear-gradient(135deg, #f4e6d2 0%, #fbf7ef 48%, #eadcc8 100%);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1320px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 30px 0 44px;
}

.page-card,
.task-reader,
.side-card {
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid rgba(122, 95, 58, 0.18);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.page-card {
  max-width: 980px;
  margin: 0 auto;
  padding: 30px;
}

.page-card.narrow {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.03em;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.98;
}

h2 {
  margin: 0 0 12px;
  font-size: 28px;
}

h3 {
  margin: 0;
  font-size: 20px;
}

p,
li {
  line-height: 1.7;
}

.muted {
  color: var(--muted);
}

.doc-section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 18px;
}

.doc-section h3 {
  margin-bottom: 8px;
}

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

.btn {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 11px 16px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(31, 24, 16, 0.16);
}

.btn.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn.accent {
  background: var(--accent);
}

.btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.field label,
.checkbox-row {
  color: var(--ink);
  font-weight: 650;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 64px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: rgba(169, 87, 10, 0.7);
  box-shadow: 0 0 0 3px rgba(169, 87, 10, 0.13);
}

.checkbox-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.checkbox-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(217, 205, 185, 0.85);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.48);
}

.checkbox-row input {
  width: auto;
  margin-top: 4px;
}

.task-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: start;
}

.task-reader,
.side-card {
  padding: 22px;
}

.side {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.7);
  font-size: 13px;
}

.progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(217, 205, 185, 0.8);
  margin-bottom: 16px;
}

.progress > div {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #d99a3e);
}

.text-block {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid rgba(217, 205, 185, 0.82);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
}

.text-block.segment {
  border-left: 5px solid var(--accent);
  background: rgba(255, 253, 248, 0.78);
}

.text-block strong {
  display: block;
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.text-content {
  white-space: pre-wrap;
  line-height: 1.76;
  font-size: 15px;
}

.segment-content {
  font-size: 16px;
  max-width: 92ch;
}

.inline-concepts {
  display: block;
  margin-top: 12px;
  color: var(--accent-dark);
  font-weight: 700;
}

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

.rating-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(217, 205, 185, 0.8);
  border-radius: 18px;
  padding: 11px;
  background: rgba(255, 255, 255, 0.48);
}

.metric b {
  display: block;
  margin-bottom: 3px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.score-buttons {
  display: flex;
  gap: 7px;
}

.score {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fffaf2;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.score.selected {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(169, 87, 10, 0.24);
}

.notice {
  min-height: 22px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

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

.notice.ok {
  color: var(--good);
}

@media (max-width: 980px) {
  .task-layout {
    grid-template-columns: 1fr;
  }

  .side {
    position: static;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100vw - 20px, 1320px);
    padding-top: 16px;
  }

  .rating-row {
    grid-template-columns: 1fr;
  }

  .score {
    flex: 1;
  }
}
