:root {
  color-scheme: light;
  --ink: #211f1c;
  --muted: #6a6259;
  --line: #ddd6cc;
  --paper: #f8f5ef;
  --panel: #fffdf8;
  --field: #f0ece4;
  --accent: #2f6f68;
  --accent-strong: #184c47;
  --terracotta: #a9583f;
  --gold: #c6903d;
  --shadow: 0 18px 40px rgba(38, 33, 26, 0.12);
  font-family: Inter, "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(47, 111, 104, 0.08), transparent 35%),
    linear-gradient(230deg, rgba(169, 88, 63, 0.08), transparent 42%),
    var(--paper);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.app-shell {
  width: min(1540px, 100%);
  margin: 0 auto;
  padding: 22px;
}

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

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
}

.status-pill {
  min-width: 112px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.78);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(286px, 360px) minmax(420px, 1fr) minmax(260px, 320px);
  gap: 16px;
  align-items: start;
}

.panel,
.stage-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.controls-panel,
.saved-panel {
  position: sticky;
  top: 16px;
}

.panel-heading,
.stage-toolbar,
.prompt-header,
.button-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quick-box {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(47, 111, 104, 0.22);
  border-radius: 9px;
  background:
    linear-gradient(135deg, rgba(47, 111, 104, 0.08), rgba(198, 144, 61, 0.08)),
    #fffdf8;
}

.quick-field {
  margin-top: 0 !important;
}

.quick-help {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 13px;
}

.field span,
.prompt-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--field);
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 104, 0.13);
}

.prompt-box {
  margin-top: 14px;
}

.prompt-header {
  margin-bottom: 7px;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 38px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 8px 12px;
  font-weight: 800;
}

.primary-button {
  flex: 1;
  background: var(--accent);
  color: white;
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-strong);
}

.secondary-button {
  background: #fff;
  border-color: var(--line);
  color: var(--accent-strong);
}

.ghost-button {
  min-height: 32px;
  background: transparent;
  color: var(--muted);
}

.ghost-button:hover,
.secondary-button:hover {
  border-color: var(--accent);
}

.button-row {
  margin-top: 14px;
}

.usage-note {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.stage-panel {
  overflow: hidden;
}

.stage-toolbar {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.stage-toolbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.canvas-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: min(64vh, 760px);
  padding: 16px;
  background:
    linear-gradient(45deg, rgba(33, 31, 28, 0.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(33, 31, 28, 0.04) 25%, transparent 25%),
    #ebe6dc;
  background-size: 28px 28px;
}

canvas {
  width: min(100%, 760px);
  max-height: 72vh;
  aspect-ratio: 1 / 1;
  border-radius: 7px;
  background: #d9d0c2;
  box-shadow: 0 22px 48px rgba(28, 24, 19, 0.18);
}

.empty-state {
  position: absolute;
  inset: 16px;
  display: grid;
  place-content: center;
  gap: 8px;
  border: 1px dashed rgba(33, 31, 28, 0.25);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}

.empty-state strong {
  color: var(--ink);
  font-size: 18px;
}

.saved-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.saved-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.recipe-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.recipe-load {
  width: 100%;
  min-height: 88px;
  border: 0;
  background: transparent;
  padding: 13px 38px 13px 13px;
  color: var(--ink);
  text-align: left;
}

.recipe-title {
  display: block;
  font-weight: 900;
  margin-bottom: 6px;
}

.recipe-meta {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.recipe-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
}

.site-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
}

.site-footer a,
.legal-page a,
.legal-back {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover,
.legal-page a:hover,
.legal-back:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.legal-shell {
  width: min(900px, 100%);
}

.legal-page {
  display: grid;
  gap: 22px;
  line-height: 1.8;
}

.legal-page section {
  display: grid;
  gap: 8px;
}

.legal-page h2 {
  color: var(--accent-strong);
}

.legal-page p {
  color: var(--ink);
}

.legal-updated {
  color: var(--muted) !important;
  font-size: 12px;
  text-align: right;
}

.is-busy {
  opacity: 0.62;
  pointer-events: none;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: minmax(300px, 390px) minmax(420px, 1fr);
  }

  .saved-panel {
    grid-column: 1 / -1;
    position: static;
  }

  .saved-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 14px;
  }

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

  .workspace,
  .saved-list {
    grid-template-columns: 1fr;
  }

  .controls-panel {
    position: static;
  }

  .canvas-wrap {
    min-height: 420px;
  }
}