:root {
  color-scheme: light;
  --ink: #211b16;
  --muted: #75695d;
  --line: #2a2118;
  --paper: #f7f0df;
  --paper-deep: #efe2c3;
  --panel: #fffaf0;
  --accent: #1f7a6f;
  --accent-ink: #113d38;
  --danger: #ad2f26;
  --shadow: rgba(56, 40, 20, 0.18);
  --display: "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive;
  --body: "Avenir Next", "Trebuchet MS", Verdana, sans-serif;
  font-family: var(--body);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18px 18px, rgba(33, 27, 22, 0.07) 1px, transparent 1.5px) 0 0 / 34px 34px,
    linear-gradient(90deg, rgba(31, 122, 111, 0.07) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(0deg, rgba(173, 47, 38, 0.045) 1px, transparent 1px) 0 0 / 42px 42px,
    var(--paper);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
  background:
    repeating-linear-gradient(108deg, transparent 0 9px, rgba(33, 27, 22, 0.018) 10px 11px),
    radial-gradient(circle at 12% 18%, rgba(31, 122, 111, 0.12), transparent 28%),
    radial-gradient(circle at 88% 72%, rgba(173, 47, 38, 0.10), transparent 26%);
}

a {
  color: inherit;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel,
.composer,
.library,
.reader article {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 18px 13px 20px 14px;
  box-shadow: 8px 10px 0 var(--shadow);
  position: relative;
}

.login-panel::after,
.composer::after,
.library::after,
.reader article::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px dashed rgba(33, 27, 22, 0.18);
  border-radius: 13px 10px 16px 11px;
  pointer-events: none;
}

.login-panel {
  width: min(100%, 420px);
  padding: 28px;
  transform: rotate(-0.35deg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px);
  border-bottom: 2px solid var(--line);
  background: rgba(255, 250, 240, 0.94);
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 5px 0 rgba(56, 40, 20, 0.08);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: var(--display);
  font-size: 40px;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-family: var(--display);
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 20px;
  padding: 20px clamp(16px, 4vw, 40px) 40px;
}

.composer,
.library {
  padding: 22px;
}

.composer {
  transform: rotate(0.2deg);
}

.library {
  transform: rotate(-0.15deg);
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #493d32;
  font-size: 14px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 2px solid #34281e;
  border-radius: 13px 9px 14px 10px;
  padding: 12px;
  font: inherit;
  color: var(--ink);
  background: #fffdf7;
  box-shadow: inset 3px 3px 0 rgba(56, 40, 20, 0.055);
}

input:focus,
textarea:focus {
  outline: 3px solid rgba(31, 122, 111, 0.22);
  border-color: var(--accent);
}

textarea {
  resize: vertical;
}

button {
  border: 2px solid #163a36;
  border-radius: 15px 10px 14px 11px;
  padding: 12px 14px;
  min-height: 44px;
  font: inherit;
  font-weight: 900;
  color: #fffaf0;
  background: var(--accent);
  box-shadow: 4px 5px 0 rgba(17, 61, 56, 0.22);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

button:hover {
  transform: translate(-1px, -1px) rotate(-0.25deg);
  box-shadow: 6px 7px 0 rgba(17, 61, 56, 0.22);
}

button:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 3px 0 rgba(17, 61, 56, 0.2);
}

button.ghost {
  background: #fff4d6;
  color: var(--ink);
  border-color: var(--line);
  box-shadow: 3px 4px 0 rgba(56, 40, 20, 0.14);
}

.mode-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.mode-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-row input {
  width: auto;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

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

.sketch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border: 2px solid var(--line);
  border-radius: 17px 11px 18px 12px;
  text-decoration: none;
  background: #fffdf7;
  box-shadow: 4px 4px 0 rgba(56, 40, 20, 0.10);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.sketch-row:hover {
  background: #fff7e2;
  transform: rotate(-0.25deg) translateY(-1px);
  box-shadow: 6px 7px 0 rgba(56, 40, 20, 0.12);
}

.sketch-row span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.sketch-row strong,
.sketch-row small {
  overflow-wrap: anywhere;
}

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

.sketch-row .summary {
  color: #42372c;
  font-size: 13px;
  line-height: 1.45;
  margin-top: 4px;
  max-width: 72ch;
}

.sketch-row.disabled {
  opacity: 0.65;
  pointer-events: none;
}

.status {
  border: 1px solid rgba(33, 27, 22, 0.35);
  border-radius: 999px 760px 920px 650px;
  padding: 5px 9px;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  color: #493d32;
  background: #eee1c3;
  white-space: nowrap;
}

.status.done {
  color: #0f4f45;
  background: #cdeee2;
}

.status.failed {
  color: var(--danger);
  background: #f7d3c7;
}

.status.running {
  color: #845212;
  background: #f7df99;
}

.alert {
  margin: 16px 0;
  padding: 10px 12px;
  border: 2px solid #ad2f26;
  border-radius: 14px 10px 16px 11px;
  color: var(--danger);
  background: #fff1e8;
}

.empty {
  color: var(--muted);
  padding: 16px 0;
}

.reader {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px;
}

.reader nav {
  margin-bottom: 14px;
}

.reader article {
  padding: 20px;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
  background: #fffdf7;
  border: 2px solid rgba(33, 27, 22, 0.22);
  border-radius: 14px;
  padding: 16px;
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar form,
  .topbar button {
    width: 100%;
  }

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

  .sketch-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
