:root {
  color-scheme: light;
  --ink: #1c1917;
  --muted: #57534e;
  --line: #e4ddd4;
  --paper: #f6f4ef;
  --card: #fffdfb;
  --accent: #0f3d3e;
  --accent-ink: #f4f7f5;
  --soft: #e7f0ee;
  --warn: #7f1d1d;
}

* { box-sizing: border-box; }

html { overflow-x: clip; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse 90% 42% at 50% -8%, #d7ebe4, transparent 58%),
    var(--paper);
  color: var(--ink);
  font: 1.05rem/1.55 Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
}

a { color: var(--accent); }

.wrap {
  width: min(40rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.1rem 0 4rem;
}

.wrap.home { width: min(52rem, calc(100% - 2rem)); }

.topbar {
  display: flex;
  align-items: center;
  margin-bottom: 1.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  text-decoration: none;
  font-family: system-ui, sans-serif;
  font-size: 0.92rem;
  font-weight: 650;
}

.brand img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

h1 {
  margin: 0 0 0.7rem;
  font-size: 2.15rem;
  line-height: 1.12;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.lead { margin: 0 0 1.15rem; }

h2 {
  margin: 2.3rem 0 0.7rem;
  font-size: 1.28rem;
  line-height: 1.25;
}

h3 {
  margin: 1.25rem 0 0.35rem;
  font-family: system-ui, sans-serif;
  font-size: 1.02rem;
  line-height: 1.35;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.05rem 1.05rem 1.15rem;
  box-shadow: 0 10px 30px rgba(15, 61, 62, 0.06);
}

.panel > h2 { margin-top: 0; }

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.1rem;
}

fieldset {
  border: 0;
  margin: 0 0 0.85rem;
  padding: 0;
}

legend, .field {
  display: block;
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.choices { display: grid; gap: 0.4rem; }

label.choice {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
  cursor: pointer;
  font-family: system-ui, sans-serif;
  font-size: 0.98rem;
  line-height: 1.35;
  background: #fff;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--ink);
}

label.choice input {
  margin: 0.2rem 0 0;
  accent-color: var(--accent);
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
}

label.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--soft);
}

textarea {
  width: 100%;
  min-height: 7rem;
  margin: 0 0 0.9rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: 1rem/1.45 system-ui, sans-serif;
  resize: vertical;
}

.color-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.35rem;
}

.color-row .field { margin: 0 0.15rem 0 0; }

input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.swatch {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 0;
  cursor: pointer;
}

.swatch[aria-pressed="true"] {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.warn {
  margin: 0.7rem 0 0;
  color: var(--warn);
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
}

.exact {
  margin: 0.75rem 0 0;
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
  color: var(--muted);
}

.exact code {
  display: inline;
  color: var(--ink);
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.preview-frame {
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.preview-frame canvas {
  width: min(100%, 260px);
  height: auto;
  image-rendering: pixelated;
  background: #fff;
}

.empty {
  margin: 0;
  max-width: 16rem;
  text-align: center;
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
  color: var(--muted);
}

button.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin-top: 0.75rem;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-family: system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

button.button:hover { background: #0c312f; }

button.button:disabled {
  background: #d6d3cd;
  color: #6b6560;
  cursor: not-allowed;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

ol.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}

ol.steps li {
  position: relative;
  margin: 0 0 0.85rem;
  padding: 0.15rem 0 0.15rem 2.7rem;
  counter-increment: step;
}

ol.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

ol.steps li strong { font-family: system-ui, sans-serif; }

ul.plain { padding-left: 1.15rem; }

ul.plain li { margin: 0.45rem 0; }

.note, footer {
  font-family: system-ui, sans-serif;
  font-size: 0.92rem;
  color: var(--muted);
}

.note { margin-top: 1rem; }

footer {
  margin-top: 2.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

footer nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; }

footer a[aria-current="page"] { font-weight: 700; color: var(--ink); text-decoration: none; }

footer p { margin: 0.7rem 0 0; }

#ad-top:not([hidden]) { margin: 0 0 1rem; }

@media (min-width: 800px) {
  .tool-grid { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; }
  .preview-col { position: sticky; top: 1rem; }
}

@media (max-width: 640px) {
  h1 { font-size: 1.7rem; }
  .panel { padding: 0.9rem 0.85rem 1rem; }
}
