:root {
  color-scheme: light;
  --ink: #151515;
  --muted: #6d6a64;
  --paper: #f7f4ef;
  --panel: #fffdf9;
  --line: #d9d1c5;
  --press: #ed3f3f;
  --cyan: #00a3ff;
  --gold: #f4c22b;
  --shadow: 0 22px 70px rgb(42 34 24 / 0.16);
  font-family: "Avenir Next", "Hiragino Sans", "Yu Gothic", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgb(21 21 21 / 0.035) 1px, transparent 1px) 0 0 / 26px 26px,
    radial-gradient(circle at 20% 10%, rgb(244 194 43 / 0.24), transparent 28%),
    linear-gradient(135deg, #fbf8f2, #efe8db 62%, #f8efe1);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

.shell {
  width: min(1480px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 34px;
}

.masthead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 8px 0 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--press);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(42px, 7vw, 92px);
  line-height: 0.9;
  font-weight: 900;
}

h2 {
  font-size: 26px;
  line-height: 1.1;
}

.status-pill {
  min-width: 92px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--gold);
  box-shadow: 5px 5px 0 var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 450px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.tool-panel,
.preview-stage {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(255 253 249 / 0.88);
  box-shadow: var(--shadow);
}

.tool-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
  position: sticky;
  top: 18px;
}

.drop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.drop-zone {
  display: grid;
  min-height: 118px;
  align-content: space-between;
  border: 2px dashed var(--ink);
  border-radius: 8px;
  padding: 14px;
  background: #fff7e2;
  cursor: pointer;
}

.drop-zone.secondary {
  background: #eef8ff;
}

.drop-zone span,
.control-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.drop-zone strong {
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.25;
}

.drop-zone input {
  display: none;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.control-grid label {
  display: grid;
  gap: 7px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
  color: var(--ink);
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgb(0 163 255 / 0.32);
  outline-offset: 2px;
}

.option-row {
  display: grid;
  gap: 8px;
}

.check-option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.check-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--press);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.action-row button,
.segmented button,
.page-strip button {
  min-height: 42px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 900;
  cursor: pointer;
}

.action-row button:nth-child(1) {
  background: var(--press);
}

.action-row button:nth-child(2) {
  background: #0d7fbd;
}

.action-row button:disabled,
.segmented button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.readout {
  display: grid;
  gap: 8px;
  margin: 0;
}

.readout div {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.readout dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.readout dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 800;
}

.preview-stage {
  min-height: calc(100vh - 120px);
  padding: 18px;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 4px;
  background: white;
}

.segmented button {
  min-width: 58px;
  min-height: 34px;
  background: transparent;
  color: var(--ink);
}

.segmented button.active {
  background: var(--ink);
  color: white;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  min-height: 590px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f4ef;
}

#previewCanvas {
  display: block;
  width: 100%;
  height: min(70vh, 690px);
  min-height: 520px;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
}

.empty-state strong {
  font-size: 28px;
}

.empty-state span {
  color: var(--muted);
  font-weight: 800;
}

.empty-state[hidden] {
  display: none;
}

.page-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.page-strip button {
  min-height: 34px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

@media (max-width: 980px) {
  .shell {
    width: min(100% - 24px, 760px);
  }

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

  .tool-panel {
    position: static;
  }

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

@media (max-width: 560px) {
  .drop-grid,
  .control-grid,
  .action-row {
    grid-template-columns: 1fr;
  }

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

  #previewCanvas {
    min-height: 390px;
    height: 58vh;
  }
}
