/* qr-clean — no network fonts, no external assets. Calm utility styling. */

:root {
  --ink: #16181d;
  --muted: #5c6472;
  --line: #d9dde5;
  --bg: #f6f7f9;
  --card: #ffffff;
  --accent: #1d4ed8;
  --warn-bg: #fff6e0;
  --warn-ink: #6b4b00;
  --warn-line: #e3b341;
  --err-bg: #fdeaea;
  --err-ink: #8a1c1c;
  --err-line: #e0a0a0;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* Thai-capable system stack; no webfont is ever fetched. */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai",
               "Sukhumvit Set", "Leelawadee UI", "Tahoma", sans-serif;
  /* Thai needs headroom so tone marks and upper/lower vowels are not clipped. */
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

h1 {
  font-size: 1.6rem;
  line-height: 1.45;
  margin: 0 0 6px;
  font-weight: 700;
}

.lede {
  margin: 0 0 22px;
  color: var(--muted);
}

.cols {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  flex: 1 1 380px;
  min-width: 0;
}

.preview-panel {
  flex: 0 1 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.field {
  display: block;
  margin: 0 0 16px;
  border: 0;
  padding: 0;
  min-width: 0;
}

.label-text {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 6px;
  padding: 0;
}

textarea, select, input[type="color"] {
  width: 100%;
  font: inherit;
  line-height: 1.6;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

textarea { resize: vertical; min-height: 96px; }

input[type="color"] {
  height: 44px;
  padding: 4px;
  cursor: pointer;
}

.radios { display: flex; flex-direction: column; gap: 8px; }

.radio {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.radio input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--accent); }

.grid3 {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 14px;
}

.hint {
  margin: 0 0 12px;
  font-size: 0.86rem;
  line-height: 1.7;
  color: var(--muted);
}

.warn, .err {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.7;
}

.warn { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.err  { background: var(--err-bg);  color: var(--err-ink);  border: 1px solid var(--err-line); }

.preview {
  width: 100%;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fbfbfc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}

canvas {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

button {
  font: inherit;
  font-weight: 600;
  line-height: 1.5;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 11px 16px;
  cursor: pointer;
  min-height: 44px;
}

button:hover:not(:disabled) { background: #1740b8; }

button:disabled {
  background: #e7e9ee;
  border-color: var(--line);
  color: #99a0ad;
  cursor: not-allowed;
}

#dl-svg, #copy {
  color: var(--accent);
  background: #fff;
}

#dl-svg:hover:not(:disabled), #copy:hover:not(:disabled) { background: #eef2ff; }

#dl-svg:disabled, #copy:disabled { color: #99a0ad; background: #f4f5f8; }

:focus-visible {
  outline: 3px solid #0b57d0;
  outline-offset: 2px;
}

footer {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.8;
}

@media (max-width: 720px) {
  .wrap { padding: 20px 16px 32px; }
  h1 { font-size: 1.35rem; }
  .panel { padding: 15px; flex-basis: 100%; }
  .preview-panel { flex-basis: 100%; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .grid3 .field:first-child { grid-column: 1 / -1; }
  .actions { width: 100%; }
  .actions button { flex: 1 1 auto; }
}
