:root {
  color-scheme: dark;
  --ink: #f4efe3;
  --muted: #b8ad9a;
  --dim: #756d60;
  --field: rgba(244, 239, 227, 0.08);
  --line: rgba(244, 239, 227, 0.16);
  --accent: #d6b35a;
  --bg: #0d0c0a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(circle at 20% 20%, rgba(214, 179, 90, 0.16), transparent 28rem),
    linear-gradient(135deg, #12100d 0%, var(--bg) 52%, #060605 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 40px));
  min-height: 100svh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
  padding: 56px 0;
}

.spell-stage {
  max-width: 680px;
}

.domain,
.pane-label {
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(72px, 14vw, 168px);
  line-height: 0.82;
  letter-spacing: 0;
}

.origin {
  margin: 24px 0 0;
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: clamp(22px, 3vw, 38px);
}

.definition {
  width: min(560px, 100%);
  margin: 24px 0 42px;
  color: var(--muted);
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.45;
}

.spell-form label {
  display: block;
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.spell-row {
  display: flex;
  min-height: 58px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
}

.spell-row input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  padding: 0 18px;
}

.spell-row input::placeholder {
  color: var(--dim);
}

.spell-row button,
.approval button {
  border: 0;
  color: #15110a;
  background: var(--accent);
  font-weight: 800;
  padding: 0 22px;
  cursor: pointer;
}

.spell-row button:hover,
.approval button:not(:disabled):hover {
  filter: brightness(1.08);
}

.workbench {
  border-left: 1px solid var(--line);
  padding-left: clamp(24px, 4vw, 52px);
}

.pane {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.pane:first-child {
  border-top: 1px solid var(--line);
}

.result,
.approval p,
.log-pane li,
.memory-state {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.draft-field {
  display: grid;
  grid-template-columns: minmax(130px, 0.42fr) minmax(0, 1fr);
  gap: 14px;
  padding: 6px 0;
}

.draft-field strong,
.result strong {
  color: var(--ink);
}

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

.approval button,
.log-heading button {
  min-height: 44px;
  padding: 0 18px;
}

.approval button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.log-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.log-heading .pane-label {
  margin-bottom: 0;
}

.log-heading button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}

.memory-state {
  margin: 16px 0;
  color: var(--dim);
}

ol {
  margin: 0;
  padding-left: 20px;
}

li + li {
  margin-top: 10px;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    width: min(100% - 28px, 680px);
    align-items: start;
    padding: 36px 0;
  }

  .workbench {
    border-left: 0;
    padding-left: 0;
  }

  .spell-row {
    flex-direction: column;
  }

  .spell-row input,
  .spell-row button {
    min-height: 56px;
  }

  .draft-field {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .log-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
