:root {
  --ink: #1c1916;
  --muted: #5c564e;
  --paper: #f7f3ec;
  --card: #fffcf7;
  --line: #e3d8c8;
  --accent: #9a3b24;
  --accent-ink: #fffaf6;
  --accent-soft: #f3e3dc;
  --ok: #1f6b45;
  --warn: #8a4b00;
  --warn-bg: #fff3d9;
  --slot-bg: #efe8dd;
  --max: 68rem;
  --sans: "Source Sans 3", "Noto Sans", "Noto Sans Thai", "Sarabun", "Leelawadee UI", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  min-height: 100vh;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
.wrap { width: min(var(--max), calc(100% - 2rem)); margin-inline: auto; }
.site-header {
  background: #231e1a;
  color: #f6efe6;
  border-bottom: 4px solid var(--accent);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0.85rem 0;
}
.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 1.15rem;
}
.brand span { font-weight: 500; color: #e8cbbd; font-size: 0.85rem; margin-left: 0.4rem; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; margin-left: auto; }
.site-header nav a { color: #f6efe6; text-decoration: none; }
.site-header nav a:hover { text-decoration: underline; }
.lang-switch { display: flex; gap: 0.35rem; }
.lang-switch a, .lang-switch span {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-decoration: none;
  color: #f6efe6;
  border: 1px solid transparent;
  font-size: 0.85rem;
}
.lang-switch a:hover { border-color: #c9b8a6; }
.lang-switch [aria-current="page"] { background: var(--accent); }
main.wrap { padding: 1.5rem 0 3rem; }
h1 { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.25; margin: 0 0 0.6rem; }
h2 { font-size: 1.25rem; margin: 1.8rem 0 0.6rem; }
h3 { font-size: 1.05rem; margin: 1.1rem 0 0.4rem; }
.lede { font-size: 1.05rem; color: var(--muted); max-width: 42rem; }
.note, .disclaimer, .convention, .privacy-callout {
  background: var(--warn-bg);
  border-left: 4px solid #c4841a;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}
.privacy-callout { background: #e7f3ec; border-left-color: var(--ok); }
.official {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1rem 1.1rem;
  margin: 1.2rem 0;
}
.official p { margin: 0.4rem 0; }
.small, .fine { font-size: 0.88rem; color: var(--muted); }
.tool {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1rem 1.2rem;
  margin: 1.2rem 0;
  display: grid;
  gap: 0.85rem;
}
.tool-controls, .tool-actions, .tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.75rem;
  align-items: center;
}
label.doc-label, label.zoom-label, .bg-toggle {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  font-weight: 600;
}
select, input[type="file"], button, .btn {
  font: inherit;
  font-weight: 600;
}
select {
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  max-width: 100%;
}
button, .btn {
  appearance: none;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
}
button.secondary, .btn.secondary {
  background: #fff;
  color: var(--accent);
}
button:disabled, .btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  background: #8a7d74;
  border-color: #8a7d74;
  color: #fff;
}
.stage-wrap { display: grid; gap: 0.5rem; }
.stage {
  position: relative;
  width: min(100%, 22rem);
  aspect-ratio: var(--photo-aspect, 1);
  background: #d8d2c8;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  margin: 0;
}
.stage:active { cursor: grabbing; }
.stage canvas { display: block; width: 100%; height: 100%; }
.stage .frame {
  pointer-events: none;
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 2px #9a3b24;
}
.video-wrap video {
  width: min(100%, 22rem);
  background: #111;
  border-radius: 6px;
}
.status { min-height: 1.3em; color: var(--muted); font-size: 0.95rem; }
.status.error { color: var(--accent); }
.head-meter { font-variant-numeric: tabular-nums; }
.ad-slot {
  background: var(--slot-bg);
  border: 1px dashed #c9bba8;
  color: #7a7166;
  text-align: center;
  padding: 1.4rem 0.75rem;
  font-size: 0.85rem;
  margin: 1.2rem 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.card-grid, .type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.75rem;
  padding: 0;
  list-style: none;
}
.type-grid a, .related a {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: inherit;
}
.type-grid a:hover, .related a:hover { border-color: var(--accent); }
.type-grid strong { color: var(--accent); display: block; margin-bottom: 0.25rem; }
.related { display: grid; gap: 0.5rem; padding: 0; list-style: none; }
details.faq { border-bottom: 1px solid var(--line); padding: 0.55rem 0; }
details.faq summary { cursor: pointer; font-weight: 650; }
.howto ol { padding-left: 1.2rem; }
.lang-chooser { max-width: 36rem; margin: 2rem auto; text-align: center; }
.lang-chooser ul { list-style: none; padding: 0; display: grid; gap: 0.6rem; }
.lang-chooser a {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 650;
}
.prose { max-width: 42rem; }
.prose .big-link { font-size: 1.15rem; }
.site-footer {
  background: #231e1a;
  color: #efe7dc;
  padding: 2rem 0 2.4rem;
  margin-top: auto;
}
.site-footer a { color: #f3c7b6; }
.foot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1.25rem 2rem;
}
.site-footer h2 { font-size: 0.95rem; margin: 0 0 0.5rem; color: #fff; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 0.25rem 0; }
.site-footer .fine { color: #c9bfb3; margin-top: 1.4rem; }
@media (max-width: 640px) {
  .site-header nav { margin-left: 0; }
  .stage { width: 100%; }
}

ul.checklist, ul.rejections { padding-left: 1.2rem; max-width: 42rem; }
ul.checklist li, ul.rejections li { margin: 0.35rem 0; }
.guide h3 { margin-top: 1.15rem; }
