/* «Мастерская». Soft paper surfaces, one strong accent, big touch targets, and nothing technical on screen.
   Contrast stays high throughout: no light-grey text. Light and dark follow the device. */
:root {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-2: #f9f7f2;
  --ink: #16150f;
  --ink-2: #3a3830;
  --line: #e4dfd3;
  --accent: #46691a;
  --accent-2: #6e9a2b;
  --accent-ink: #ffffff;
  --accent-soft: #edf3e0;
  --warm: #a6510a;
  --warm-soft: #fcefdf;
  --ok: #1f7438;
  --ok-soft: #e2f3e6;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --focus: #2f62c9;
  --shadow: 0 1px 2px rgba(22, 21, 15, .05), 0 12px 32px -14px rgba(22, 21, 15, .18);
  --shadow-lg: 0 2px 4px rgba(22, 21, 15, .06), 0 24px 60px -20px rgba(22, 21, 15, .30);
  --r: 22px;
  --r-sm: 14px;
  --ui: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --read: "Literata", "PT Serif", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11110d;
    --surface: #1b1a15;
    --surface-2: #23221c;
    --ink: #f3f0e6;
    --ink-2: #d6d1c3;
    --line: #36342c;
    --accent: #a9cf5f;
    --accent-2: #cbe78d;
    --accent-ink: #11160a;
    --accent-soft: #252f17;
    --warm: #f2ad62;
    --warm-soft: #3a2a15;
    --ok: #83d79a;
    --ok-soft: #1c3322;
    --bad: #ff9b92;
    --bad-soft: #3d1d1a;
    --focus: #94b6ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -14px rgba(0, 0, 0, .6);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 60px -20px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 500 17px/1.55 var(--ui);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 8px; }
[hidden] { display: none !important; }
.icon { display: inline-flex; width: 1.25em; height: 1.25em; flex: none; }
.icon svg { width: 100%; height: 100%; }

/* ---------- header */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.logo {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink);
  font: 700 18px var(--read);
}
.top .spacer { flex: 1; }
.top .quiet { background: none; border: 0; padding: 8px 10px; border-radius: 10px; color: var(--ink-2); font-weight: 600; cursor: pointer; }
.top .quiet:hover { background: var(--surface); }

main { max-width: 760px; margin: 0 auto; padding: 22px 18px 120px; }
main > * { animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1 { font-size: clamp(28px, 6vw, 38px); line-height: 1.12; letter-spacing: -.02em; font-weight: 800; margin: 4px 0 6px; }
h2 { font-size: 22px; line-height: 1.25; letter-spacing: -.01em; font-weight: 800; margin: 0 0 8px; }
h3 { font-size: 18px; font-weight: 800; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.lead { font-size: 18px; color: var(--ink-2); margin-bottom: 22px; }
.small { font-size: 15px; }
.muted { color: var(--ink-2); }
.pre { white-space: pre-wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 700; margin-bottom: 14px; }

/* ---------- surfaces */
.card {
  background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 22px; margin: 0 0 16px;
}
.card.soft { background: var(--surface-2); box-shadow: none; border: 1px solid var(--line); }
.label { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.section { margin: 30px 0 12px; }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 12px 22px; border-radius: 999px; border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink);
  font-weight: 800; font-size: 17px; cursor: pointer; text-decoration: none;
  box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--accent) 80%, transparent);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn.wide { width: 100%; }
.btn.ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.btn.plain { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.textbtn { background: none; border: 0; padding: 6px 0; color: var(--accent); font-weight: 800; cursor: pointer; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  font-size: 14px; font-weight: 800; background: var(--surface-2); color: var(--ink-2);
}
.pill.wait { background: var(--warm-soft); color: var(--warm); }
.pill.run { background: var(--accent-soft); color: var(--accent); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.run .dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* ---------- shelf */
.attention {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--r-sm);
  background: var(--warm-soft); color: var(--warm); font-weight: 800; margin: 0 0 18px;
}
.book {
  display: grid; grid-template-columns: 92px 1fr; gap: 18px; align-items: start;
  text-decoration: none; color: inherit; background: var(--surface); border-radius: var(--r);
  padding: 16px; margin: 0 0 16px; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
}
.book:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.cover {
  position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden;
  display: flex; align-items: flex-end; padding: 10px; color: #fff;
  font: 600 13px/1.15 var(--read); overflow-wrap: anywhere; hyphens: auto; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), 0 8px 18px -10px rgba(0, 0, 0, .5);
}
.cover::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 7px; background: rgba(0, 0, 0, .18);
}
.cover .initial { position: absolute; top: 8px; right: 10px; font: 700 34px/1 var(--read); opacity: .35; }
.book h2 { margin: 2px 0 6px; }
.book .where { font-size: 15px; color: var(--ink-2); margin: 8px 0 12px; }
.fakebtn { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--accent); }
.newbook {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 76px;
  border: 2px dashed var(--line); border-radius: var(--r); color: var(--accent); font-weight: 800;
  text-decoration: none; background: transparent;
}
.newbook:hover { border-color: var(--accent); }

.meter { display: flex; gap: 4px; }
.meter span { flex: 1; height: 6px; border-radius: 4px; background: var(--line); }
.meter .approved { background: var(--ok); }
.meter .review, .meter .working { background: var(--warm); }

/* money */
.money { font-weight: 800; color: var(--ink); white-space: nowrap; }
.spend { margin-top: 22px; }
.spend .totals { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 14px; }
.spend .big { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.costs { list-style: none; padding: 0; margin: 0; font-size: 15.5px; }
.costs li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.costs li b { white-space: nowrap; }

/* ---------- book */
.hero {
  position: relative; border-radius: var(--r); overflow: hidden; padding: 26px 22px 22px; color: #fff; margin: 0 0 18px;
  box-shadow: var(--shadow-lg);
}
.hero h1 { color: #fff; margin: 0 0 6px; font-family: var(--read); font-weight: 600; letter-spacing: -.01em; }
.hero .sub { font-weight: 700; opacity: .92; }
.hero .initial { position: absolute; right: 18px; top: 6px; font: 700 110px/1 var(--read); opacity: .14; }

.journey { display: flex; gap: 0; overflow-x: auto; padding: 6px 2px 4px; margin: 0 0 18px; scrollbar-width: none; }
.journey::-webkit-scrollbar { display: none; }
.step { flex: 1 0 92px; display: grid; justify-items: center; align-content: start; gap: 6px; text-align: center; position: relative; font-size: 12.5px; line-height: 1.25; font-weight: 700; color: var(--ink-2); padding: 0 4px; }
.step::before { content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.step:first-child::before { display: none; }
.step.approved::before, .step.review::before, .step.working::before { background: var(--ok); }
.step .bead {
  position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); box-shadow: inset 0 0 0 2px var(--line); font-weight: 800; color: var(--ink-2);
}
.step.approved .bead { background: var(--ok); box-shadow: none; color: #fff; }
.step.review .bead, .step.working .bead { background: var(--warm); box-shadow: 0 0 0 5px var(--warm-soft); color: #fff; }
.step.review, .step.working { color: var(--ink); }

.now { border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-lg); padding: 24px; margin: 0 0 18px; }
.now .eyebrow { margin-bottom: 10px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }

.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 12px 0 0; }
.doc-tile {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  padding: 14px 16px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-2);
  cursor: pointer; font-weight: 700; color: var(--ink); transition: border-color .15s, transform .15s;
}
.doc-tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.doc-tile .icon { color: var(--accent); }
.group-title { font-size: 14px; font-weight: 800; color: var(--ink-2); margin: 18px 0 0; }

/* Claude at work */
.atwork { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.orb {
  width: 54px; height: 54px; border-radius: 50%; flex: none;
  background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--warm), var(--accent));
  filter: blur(.3px); animation: spin 2.8s linear infinite;
  -webkit-mask: radial-gradient(circle, transparent 42%, #000 44%); mask: radial-gradient(circle, transparent 42%, #000 44%);
}
@keyframes spin { to { transform: rotate(360deg); } }
.phases { list-style: none; padding: 0; margin: 4px 0 14px; display: grid; gap: 10px; }
.phases li { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--ink-2); }
.phases .mark { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 2px var(--line); flex: none; }
.phases li.done { color: var(--ink); }
.phases li.done .mark { background: var(--ok); box-shadow: none; color: #fff; }
.phases li.current { color: var(--ink); }
.phases li.current .mark { box-shadow: inset 0 0 0 3px var(--warm); animation: pulse 1.4s ease-in-out infinite; }
.activity { font-size: 15px; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.activity div { padding: 3px 0; }

/* Claude's message */
.bubble-wrap { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 18px; }
.avatar {
  width: 40px; height: 40px; border-radius: 14px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, #d97757, #e8a07f); color: #fff; font-weight: 800;
}
.bubble { background: var(--surface); border-radius: 6px var(--r) var(--r) var(--r); padding: 16px 18px; box-shadow: var(--shadow); flex: 1; min-width: 0; }
.bubble.bad { background: var(--bad-soft); }
.bubble .meta { font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }

/* composer */
.composer { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.composer .field-row { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { flex: 1; min-height: 52px; max-height: 240px; border: 0; background: var(--surface-2); border-radius: 16px; padding: 14px 16px; resize: none; }
.send {
  width: 52px; height: 52px; border-radius: 50%; border: 0; flex: none; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); display: grid; place-items: center;
}
.send:disabled { opacity: .4; cursor: not-allowed; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.chip {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 8px 14px;
  font-size: 15px; font-weight: 700; cursor: pointer; color: var(--ink);
}
.chip:hover, .chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

details.fold { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); margin: 0 0 14px; }
details.fold > summary {
  list-style: none; cursor: pointer; padding: 18px 22px; font-weight: 800; display: flex; align-items: center; gap: 12px;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "+"; margin-left: auto; font-size: 22px; color: var(--ink-2); }
details.fold[open] > summary::after { content: "–"; }
details.fold > .inner { padding: 0 22px 20px; }
.history { list-style: none; padding: 0; margin: 0; font-size: 15px; }
.history li { padding: 8px 0; border-top: 1px solid var(--line); }

/* ---------- full-screen sheets: the answer flow and the reader */
.sheet {
  position: fixed; inset: 0; z-index: 30; background: var(--bg); overflow-y: auto;
  animation: sheet-in .28s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.sheet-top {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.sheet-top .title { flex: 1; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow);
  display: grid; place-items: center; cursor: pointer; color: var(--ink); flex: none;
}
.progress { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; margin: 0 16px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 6px; transition: width .3s ease; }
.sheet-body { max-width: 640px; margin: 0 auto; padding: 22px 18px 140px; }
.sheet-body > * { animation: rise .3s ease both; }
.sheet-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.sheet-foot .row { max-width: 640px; margin: 0 auto; flex-wrap: nowrap; }
.sheet-foot .btn { flex: 1; }
.counter { font-size: 14px; font-weight: 800; color: var(--ink-2); letter-spacing: .04em; text-transform: uppercase; }

.qtext { font-size: 22px; line-height: 1.35; font-weight: 700; letter-spacing: -.01em; margin: 10px 0 16px; }
.hint {
  display: flex; gap: 10px; padding: 14px 16px; border-radius: var(--r-sm); background: var(--accent-soft);
  color: var(--ink); font-size: 15.5px; margin: 0 0 16px;
}
.hint .icon { color: var(--accent); margin-top: 2px; }
.choices { display: grid; gap: 10px; }
.choice {
  display: flex; gap: 14px; align-items: flex-start; text-align: left; width: 100%;
  padding: 16px 18px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface);
  cursor: pointer; font-weight: 600; line-height: 1.45; color: var(--ink); transition: border-color .15s, background .15s, transform .15s;
}
.choice:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.choice:active { transform: scale(.99); }
.choice .key {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--line); font-weight: 800;
}
.choice.on { border-color: var(--accent); background: var(--accent-soft); }
.choice.on .key { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.choice .tag { display: block; margin-top: 6px; font-size: 13px; font-weight: 800; color: var(--accent); }
.choice b { display: block; font-size: 17.5px; }
textarea.big, input.big {
  width: 100%; border: 2px solid var(--line); border-radius: 18px; padding: 14px 16px; background: var(--surface);
  margin-top: 12px; min-height: 110px; resize: vertical; font-weight: 500;
}
input.big { min-height: 0; }
textarea.big:focus, input.big:focus { border-color: var(--accent); outline: none; }
.verdict { margin: 0 0 12px; }
.review { display: grid; gap: 10px; }
.review button {
  display: grid; gap: 4px; text-align: left; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; color: var(--ink);
}
.review .q { font-size: 14.5px; color: var(--ink-2); font-weight: 600; }
.review .a { font-weight: 800; }
.review .a.bad { color: var(--bad); }

/* reader */
.doc { max-width: 700px; margin: 0 auto; padding: 18px 20px 100px; font: 400 calc(19px * var(--zoom, 1))/1.7 var(--read); }
.doc h1, .doc h2, .doc h3 { font-family: var(--ui); }
.doc h1 { font-size: 1.6em; }
.doc pre { white-space: pre-wrap; background: var(--surface); border-radius: 14px; padding: 14px; font-size: .85em; }
.doc code { font-family: var(--ui); font-size: .9em; }
.doc table { border-collapse: collapse; display: block; overflow-x: auto; font: 500 15px/1.45 var(--ui); }
.doc th, .doc td { border: 1px solid var(--line); padding: 8px 10px; vertical-align: top; }
.doc blockquote { margin: 0; padding-left: 16px; border-left: 4px solid var(--line); }
.zoom { display: flex; gap: 6px; }

/* feedback */
.error { background: var(--bad-soft); color: var(--bad); border-radius: var(--r-sm); padding: 12px 16px; margin: 10px 0; font-weight: 700; }
.skeleton { border-radius: var(--r); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; margin: 0 0 16px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--bg); padding: 14px 20px; border-radius: 999px; font-weight: 800;
  box-shadow: var(--shadow-lg); animation: rise .25s ease both; max-width: calc(100% - 32px);
}

/* login */
.login { max-width: 420px; margin: 10vh auto 0; padding: 0 18px; }
.login .logo { width: 56px; height: 56px; border-radius: 18px; font-size: 30px; margin-bottom: 18px; }
.login input { width: 100%; border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px; background: var(--surface); margin: 8px 0 16px; }
.login input:focus { border-color: var(--accent); outline: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
