:root {
  color-scheme: light;
  --background: #f4f1ea;
  --panel: #fffdf8;
  --ink: #15120d;
  --muted: #6d665e;
  --line: #d8d0c3;
  --accent: #111111;
  --shadow: 0 18px 40px rgba(42, 35, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #fffaf0 0, var(--background) 42rem);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px 32px;
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 16px;
}

.panel {
  background: color-mix(in srgb, var(--panel) 94%, white);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.intro,
.controls {
  grid-column: 1;
}

.preview-panel {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

h2 {
  margin-bottom: 12px;
  font-size: 1rem;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.note {
  padding: 12px;
  border-left: 3px solid var(--accent);
  background: #f3eadb;
  color: var(--ink);
}

form {
  display: grid;
  gap: 10px;
}

label {
  font-size: 0.82rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 0;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
}

.hint {
  margin: -4px 0 0;
  font-size: 0.85rem;
}

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

button,
.source-link {
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--ink);
}

.preview-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.preview-tools {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.segmented-control {
  display: flex;
  gap: 0;
  padding: 0;
  margin: 0;
  border: 1px solid var(--accent);
  border-radius: 999px;
  overflow: hidden;
  background: white;
}

.segmented-control label {
  position: relative;
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.85rem;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  min-height: 100%;
  cursor: pointer;
}

.segmented-control span {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  color: var(--ink);
}

.segmented-control input:checked + span {
  background: var(--accent);
  color: white;
}

.svg-preview {
  overflow: auto;
  max-height: min(78vh, 920px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #d8d0c3;
}

.svg-preview img {
  display: block;
  width: min(100%, 620px);
  height: auto;
  margin: 0 auto;
  background: white;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

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

  .intro,
  .controls,
  .preview-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .preview-heading {
    flex-direction: column;
  }

  .source-link,
  button {
    width: 100%;
    text-align: center;
  }
}
