:root {
  --bg: #f8f4ee;
  --surface: #ffffff;
  --surface-2: #f1ebe2;
  --ink: #1f1b16;
  --ink-2: #5d564d;
  --ink-3: #8f877c;
  --line: #e4dccf;
  --accent: #d2603a;
  --accent-ink: #ffffff;
  --accent-soft: #fbe6dc;
  --teal: #1e6f6a;
  --teal-soft: #dcefec;
  --warn: #b7791f;
  --warn-soft: #fbf0d9;
  --bad: #b3261e;
  --bad-soft: #fbe3e1;
  --good: #2e7d32;
  --good-soft: #e3f1e3;
  --radius: 14px;
  --font: 'IBM Plex Sans Thai', 'Noto Sans Thai', 'Leelawadee UI', Tahoma, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171411; --surface: #211d19; --surface-2: #2b2621; --ink: #f3ede4; --ink-2: #c8bfb2; --ink-3: #9a9184;
    --line: #3a332c; --accent-soft: #3d2419; --teal-soft: #15302d; --warn-soft: #3a2c12; --bad-soft: #3d1715; --good-soft: #17301a;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--teal); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.6rem; font-weight: 600; }
h2 { font-size: 1.12rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 .8em; }
.muted { color: var(--ink-2); }
.small { font-size: .86rem; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.topbar { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; color: var(--ink); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 700; }
.topbar nav { margin-left: auto; display: flex; gap: 4px; }
.topbar nav a { text-decoration: none; color: var(--ink-2); padding: 6px 12px; border-radius: 999px; font-size: .92rem; }
.topbar nav a.on, .topbar nav a:hover { background: var(--surface-2); color: var(--ink); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stack > * + * { margin-top: 14px; }
.step-title { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-size: .82rem; font-weight: 600; flex: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: .9rem; cursor: pointer; }
.chip:hover { border-color: var(--ink-3); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip:disabled { opacity: .4; cursor: not-allowed; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 9px 16px; font: inherit; font-size: .94rem; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.big { padding: 13px 22px; font-size: 1.02rem; width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; }

label.field { display: block; }
label.field > span { display: block; font-size: .86rem; color: var(--ink-2); margin-bottom: 6px; }
input[type=text], input[type=url], select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
input[type=range] { width: 100%; accent-color: var(--accent); }

.drop { display: block; border: 1.5px dashed var(--ink-3); border-radius: 12px; padding: 20px; text-align: center; cursor: pointer; color: var(--ink-2); background: var(--surface-2); }
.drop:hover { border-color: var(--accent); color: var(--ink); }
.drop { position: relative; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); pointer-events: none; }
.video-holder { position: fixed; left: 0; top: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; z-index: -1; }

.cropbox { position: relative; border-radius: 10px; overflow: hidden; background: #000; touch-action: none; cursor: grab; }
.cropbox canvas { display: block; width: 100%; height: auto; }
.cropbox.dragging { cursor: grabbing; }
.cropbox .hint { position: absolute; left: 10px; bottom: 10px; background: rgba(0,0,0,.55); color: #fff; font-size: .78rem; padding: 3px 9px; border-radius: 999px; pointer-events: none; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap-ok { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.teal { background: var(--teal-soft); color: var(--teal); }

.notice { border-radius: 10px; padding: 10px 14px; font-size: .9rem; background: var(--surface-2); }
.notice.warn { background: var(--warn-soft); }
.notice.bad { background: var(--bad-soft); }
.notice.good { background: var(--good-soft); }

.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.steps-list { list-style: none; padding: 0; margin: 0; font-size: .92rem; }
.steps-list li { padding: 4px 0; color: var(--ink-3); }
.steps-list li.doing { color: var(--ink); font-weight: 600; }
.steps-list li.done { color: var(--good); }
.steps-list li.done::before { content: '✓ '; }
.steps-list li.fail { color: var(--bad); }

.hidden { display: none !important; }
.kbd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }

@media (max-width: 600px) {
  .topbar nav a { padding: 6px 8px; font-size: .85rem; }
  h1 { font-size: 1.35rem; }
}

/* DreamFrame logo: the mark (SVG) and the two-colour wordmark, as in the logo artwork */
.brand-logo { width: 34px; height: 34px; flex: none; display: block; }
.wordmark { font-family: 'Nunito', 'IBM Plex Sans Thai', system-ui, sans-serif; font-weight: 800; font-size: 1.22rem; letter-spacing: -.01em; line-height: 1; white-space: nowrap; }
.wordmark .wm-a { color: #452f26; }
.wordmark .wm-b { color: #e39b7b; }
