:root {
  --ink: #162235;
  --muted: #66758a;
  --paper: #ffffff;
  --soft: #f5f8f7;
  --line: #dbe6e9;
  --teal: #0f766e;
  --teal-2: #14a190;
  --gold: #d9972a;
  --red: #b42318;
  --dark: #0e1826;
  --shadow: 0 22px 64px rgba(22, 34, 53, 0.14);
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
  background:
    radial-gradient(circle at 8% 4%, rgba(15, 118, 110, 0.16), transparent 28%),
    radial-gradient(circle at 92% 0%, rgba(217, 151, 42, 0.15), transparent 24%),
    linear-gradient(180deg, #f8fbfb 0%, #edf5f3 100%);
}

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

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  font-size: clamp(34px, 6vw, 58px);
}

h2 {
  font-size: 20px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(380px, 1.05fr);
  gap: 16px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.controls {
  padding: 18px;
}

.output {
  padding: 18px;
  position: sticky;
  top: 16px;
}

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

.section-head span {
  border-radius: 999px;
  background: #eef7f5;
  color: #0c5f57;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.section-head.compact {
  margin: 18px 0 10px;
}

label {
  display: block;
  margin: 14px 0 6px;
  color: #314056;
  font-size: 13px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #ccd9de;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
}

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

.toggle {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-top: 16px;
  border: 1px solid #c9d9ef;
  border-radius: var(--radius);
  background: #f7fbff;
  padding: 13px;
  cursor: pointer;
}

.toggle input {
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  accent-color: var(--teal);
}

.toggle strong {
  display: block;
  color: #12352f;
  font-size: 14px;
}

.toggle small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.format-card {
  min-height: 76px;
  border: 1px solid #d8e4e7;
  border-radius: var(--radius);
  background: #fff;
  padding: 11px;
  text-align: left;
  cursor: pointer;
}

.format-card strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.format-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.format-card.selected {
  border-color: var(--teal);
  background: #f1fbf8;
  box-shadow: inset 0 0 0 1px var(--teal);
}

.button-row,
.output-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.button {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 11px 15px;
  font-weight: 950;
  cursor: pointer;
}

.button.primary {
  background: linear-gradient(135deg, var(--teal), var(--teal-2));
  color: #fff;
  box-shadow: 0 14px 30px rgba(15, 118, 110, 0.24);
}

.button.subtle {
  border-color: #cfdde2;
  background: #fff;
  color: var(--ink);
}

.button.ghost {
  border-color: #cfdde2;
  background: #f7fafb;
  color: var(--ink);
}

.button.dark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--dark);
  color: #fff;
  text-decoration: none;
}

.button.danger {
  color: var(--red);
}

.preview {
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px solid #e0e9ec;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(217, 151, 42, 0.08)),
    #f9fcfb;
  margin-bottom: 12px;
  overflow: hidden;
}

.mockup {
  position: relative;
  width: 132px;
  height: 184px;
  border-radius: 6px;
  background: linear-gradient(145deg, #0f766e, #111827 62%, #d9972a);
  box-shadow: 0 26px 44px rgba(14, 24, 38, 0.3);
  transform: rotate(-3deg);
}

.mockup::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 20px;
  border-radius: 0 6px 6px 0;
  background: rgba(0, 0, 0, 0.18);
}

.mockup .shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(110deg, rgba(255,255,255,0.22), transparent 45%);
}

.mock-title,
.mock-line {
  position: absolute;
  left: 18px;
  right: 30px;
  height: 11px;
  border-radius: 999px;
  background: rgba(255,255,255,0.86);
}

.mock-title { top: 42px; }
.mock-line { top: 72px; opacity: 0.65; }
.mock-line.short { top: 94px; right: 58px; opacity: 0.5; }

.mockup.hardback {
  width: 140px;
  height: 194px;
  border-radius: 4px;
  transform: rotate(2deg);
}

.mockup.ebook {
  width: 128px;
  height: 190px;
  transform: none;
}

.mockup.workbook {
  width: 142px;
  height: 184px;
  border-left: 10px dotted rgba(255,255,255,0.55);
}

.mockup.dvd,
.mockup.cd {
  width: 150px;
  height: 190px;
  transform: rotate(2deg);
}

.mockup.cd {
  width: 174px;
  height: 154px;
}

.mockup.cd::before,
.mockup.dvd::before,
.mockup.combo::before {
  content: "";
  position: absolute;
  right: -42px;
  bottom: 18px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 9px, #1f2937 10px 18px, #e7edf0 19px 34px, #a6b2bd 35px);
  box-shadow: 0 14px 22px rgba(14, 24, 38, 0.18);
}

.mockup.box,
.mockup.software {
  width: 150px;
  height: 184px;
  transform: perspective(460px) rotateY(-18deg);
}

.mockup.combo {
  width: 148px;
  height: 184px;
  transform: perspective(460px) rotateY(-14deg);
}

.mockup.card {
  width: 210px;
  height: 126px;
  border-radius: 10px;
  transform: rotate(-2deg);
}

.mockup.device {
  width: 212px;
  height: 136px;
  border-radius: 12px;
  background: #101827;
  border: 10px solid #1f2937;
  transform: none;
}

.mockup.device::after {
  display: none;
}

.prompt-output {
  width: 100%;
  min-height: 330px;
  border: 1px solid #cbd9de;
  border-radius: var(--radius);
  padding: 14px;
  color: #203047;
  background: #fff;
}

.pro-upgrade {
  margin-top: 16px;
  border: 1px solid #bfe1d9;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(217, 151, 42, 0.1)),
    #fff;
  padding: 18px;
}

.pro-upgrade span {
  display: inline-flex;
  border-radius: 999px;
  background: #eef7f5;
  color: #0c5f57;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 950;
}

.pro-upgrade h2 {
  margin-top: 10px;
  font-size: 24px;
}

.pro-upgrade p {
  margin: 9px 0 14px;
  color: var(--muted);
  font-weight: 650;
}

@media (max-width: 920px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .output {
    position: static;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 22px, 1180px);
  }

  .topbar,
  .two-col,
  .format-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .button,
  .button-row,
  .output-actions {
    width: 100%;
  }
}
