:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #14181f;
  --muted: #6b7280;
  --line: #e4e7ec;
  --accent: #111827;
  --accent-ink: #ffffff;
  --error: #b42318;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.brand { font-weight: 650; letter-spacing: .2px; }
.muted { color: var(--muted); }
.hint  { color: var(--muted); font-size: .85rem; margin: .25rem 0 0; }
.error { color: var(--error); font-size: .9rem; margin: .25rem 0 .75rem; }

.center {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.topbar a { text-decoration: none; }
.topbar a:hover { color: var(--ink); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  margin: 2rem auto;
  max-width: 880px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.card.narrow { max-width: 380px; padding: 1.75rem; }

.banner {
  background: #fef3f2;
  border: 1px solid #fecdca;
  color: var(--error);
  padding: .7rem .9rem;
  border-radius: 8px;
  font-size: .9rem;
  margin-bottom: 1rem;
}

h1 { font-size: 1.4rem; margin: 0 0 .25rem; }
h2 { font-size: 1rem; margin: 1.75rem 0 .75rem; padding-bottom: .4rem; border-bottom: 1px solid var(--line); }
section:first-of-type h2 { margin-top: 1rem; }

.field { display: block; margin: .75rem 0; }
.field > span { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .35rem; }

input[type=text], input[type=password], input[type=number], textarea, input[type=file] {
  width: 100%;
  font: inherit;
  padding: .6rem .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(17,24,39,.08);
}
textarea { resize: vertical; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem 1rem;
}

select {
  width: 100%;
  font: inherit;
  padding: .6rem .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  margin-top: .35rem;
}

.radio { display: flex; align-items: center; gap: .5rem; font-size: .95rem; }
.radio input { width: auto; }

.dim { opacity: .5; transition: opacity .15s; }

.lbl { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .35rem; }

.preset-row {
  display: flex;
  align-items: flex-end;
  gap: .6rem;
  margin: .6rem 0;
}
.preset-row > div { flex: 1; }
.preset-row input[type=text], .preset-row select { margin-top: 0; }

.btn-sm {
  width: auto;
  margin: 0;
  padding: .55rem .9rem;
  font-size: .9rem;
  white-space: nowrap;
}

.layout { display: flex; gap: 1.75rem; align-items: flex-start; }
.settings-col { flex: 1; min-width: 0; }
.preview-col { flex: 0 0 auto; width: 320px; position: sticky; top: 1rem; }
.preview-col canvas {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(16,24,40,.12);
}

@media (max-width: 760px) {
  .layout { flex-direction: column-reverse; }
  .preview-col { width: 100%; max-width: 360px; position: static; margin: 0 auto; }
}

.checks { margin-top: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.check { display: flex; align-items: center; gap: .5rem; font-size: .92rem; }
.check input { width: auto; }

button {
  margin-top: 1.5rem;
  width: 100%;
  padding: .8rem 1rem;
  font: inherit;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
button:hover { background: #000; }

.card.narrow button { margin-top: 1rem; }

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