:root {
  color: #181716;
  background: #e7e0d4;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  --ink: #181716;
  --paper: #f8f3e9;
  --paper-deep: #ede5d7;
  --muted: #686157;
  --line: #c9beae;
  --red: #921f1f;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: #e7e0d4;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

.demo-warning {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  gap: 18px;
  justify-content: center;
  padding: 9px 18px;
  border-bottom: 1px solid var(--ink);
  background: var(--red);
  color: #fff;
  font-size: 0.76rem;
}

.demo-warning span {
  opacity: 0.85;
}

.app-shell {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  border-right: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
  background: var(--paper);
}

.app-header {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
  padding: clamp(22px, 4vw, 42px);
  border-bottom: 1px solid var(--ink);
}

.archive-code,
.drawer-heading span,
.recipe-heading > div > span,
.recipe-sheet > div > span,
.request-panel header span,
.ticket-panel > span,
.history-panel header span {
  color: var(--red);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin: 10px 0 10px;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(2.2rem, 5vw, 4.6rem);
  font-weight: 500;
  line-height: 0.95;
}

.app-header p {
  max-width: 58ch;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.text-button {
  padding: 7px 4px;
  border: 0;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(210px, 0.3fr) minmax(0, 1fr);
}

.recipe-drawer {
  padding: 28px 22px;
  border-right: 1px solid var(--ink);
  background: var(--paper-deep);
}

.drawer-heading h2 {
  margin: 8px 0 24px;
  font-family: Georgia, "Songti SC", serif;
  font-size: 1.35rem;
  font-weight: 500;
}

.recipe-drawer nav {
  display: grid;
}

.recipe-button {
  padding: 14px 3px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.recipe-button:last-child {
  border-bottom: 1px solid var(--line);
}

.recipe-button[aria-current="true"] {
  color: var(--red);
}

.recipe-drawer > p {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.55;
}

.workbench {
  min-width: 0;
  padding: clamp(24px, 4vw, 42px);
}

.recipe-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 24px;
  align-items: end;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--ink);
}

.recipe-heading h2 {
  margin: 8px 0 10px;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(1.8rem, 3.8vw, 3rem);
  font-weight: 500;
}

.recipe-heading p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.scale-control {
  padding-left: 16px;
  border-left: 3px solid var(--red);
}

.scale-control label,
.scale-control small {
  display: block;
}

.scale-control label {
  margin-bottom: 7px;
  font-size: 0.74rem;
  font-weight: 700;
}

.scale-control input {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: #fff;
}

.scale-control small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.66rem;
}

.recipe-sheet {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 24px 0 30px;
  border: 1px solid var(--line);
}

.recipe-sheet > div {
  min-width: 0;
  padding: 20px;
}

.recipe-sheet > div + div {
  border-left: 1px solid var(--line);
}

.recipe-sheet h3 {
  margin: 8px 0 14px;
  font-size: 1rem;
}

.recipe-sheet dl {
  margin: 0;
}

.recipe-sheet dl > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.recipe-sheet dt,
.recipe-sheet dd {
  font-size: 0.8rem;
}

.recipe-sheet dd {
  margin: 0;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.recipe-sheet ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 1.25em;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.request-panel {
  padding: 24px;
  border: 1px solid var(--ink);
  background: #fff;
}

.request-panel header h3 {
  margin: 7px 0 5px;
  font-family: Georgia, "Songti SC", serif;
  font-size: 1.35rem;
  font-weight: 500;
}

.request-panel header p {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.78rem;
}

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

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field-wide {
  grid-column: 1 / -1;
}

.field > span {
  font-size: 0.75rem;
  font-weight: 700;
}

.field textarea,
.field select,
.field input {
  width: 100%;
  min-height: 42px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
}

.field textarea {
  resize: vertical;
}

.field small {
  color: var(--muted);
  font-size: 0.66rem;
}

.image-preview {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.image-preview[hidden] {
  display: none;
}

.image-preview img {
  width: 120px;
  height: 90px;
  border: 1px solid var(--ink);
  object-fit: cover;
}

.image-preview p {
  margin: 5px 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.request-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 20px;
}

.primary-button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
}

#error-message {
  margin: 0;
  color: var(--red);
  font-size: 0.76rem;
}

.ticket-panel {
  margin-top: 26px;
  padding: 24px;
  border-top: 4px solid var(--red);
  background: var(--paper-deep);
}

.ticket-panel > p {
  margin: 10px 0 0;
  color: var(--muted);
}

.ticket-title {
  margin: 8px 0 4px;
  font-family: Georgia, "Songti SC", serif;
  font-size: 1.35rem;
  font-weight: 500;
}

.ticket-meta {
  margin-bottom: 18px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.7rem;
}

.ticket-block {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.ticket-block strong {
  display: block;
  margin-bottom: 7px;
  font-size: 0.76rem;
}

.ticket-block p,
.ticket-block li {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.ticket-block p,
.ticket-block ul {
  margin-top: 0;
  margin-bottom: 0;
}

.ticket-block ul {
  padding-left: 1.15em;
}

.history-panel {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--ink);
}

.history-panel header {
  display: flex;
  align-items: end;
  justify-content: space-between;
}

.history-panel h3 {
  margin: 7px 0 0;
  font-size: 1rem;
}

.history-panel ol {
  margin: 14px 0 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.history-panel li {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  font-size: 0.74rem;
}

.history-panel time,
.history-panel small {
  color: var(--muted);
}

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

@media (max-width: 760px) {
  .text-button,
  .recipe-button,
  .primary-button,
  .scale-control input,
  input,
  select {
    min-height: 44px;
  }

  .demo-warning {
    display: block;
  }

  .demo-warning span {
    display: block;
    margin-top: 3px;
  }

  .app-shell {
    border: 0;
  }

  .app-header {
    align-items: flex-start;
  }

  .workspace,
  .recipe-heading,
  .recipe-sheet,
  .request-grid {
    grid-template-columns: 1fr;
  }

  .recipe-drawer {
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }

  .recipe-drawer nav {
    grid-template-columns: 1fr;
  }

  .recipe-sheet > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .field-wide {
    grid-column: auto;
  }

  .request-actions {
    display: block;
  }

  #error-message {
    margin-top: 10px;
  }

  .history-panel li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
