:root {
  --bg: #f5f6f8; --card: #fff; --ink: #1b1e24; --muted: #6b7280; --line: #e3e6eb;
  --accent: #ff6a1a; --accent-d: #e0560c; --yellow: #ffd84d; --warn: #b42318; --warn-bg: #fff1ef;
  --ok: #177245; --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* "input { display: block }" below would otherwise show hidden inputs */
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 "Leelawadee UI", "Segoe UI", Tahoma, sans-serif; }
header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 22px; background: #1b1e24; color: #fff; }
.brand { font-size: 19px; font-weight: 700; }
.brand small { font-weight: 400; opacity: .7; margin-left: 8px; font-size: 14px; }
.head-actions { display: flex; gap: 8px; align-items: center; }
header .ghost { color: #fff; border-color: #444b57; }
.badge { font-size: 13px; padding: 3px 10px; border-radius: 99px; background: #384050; }
.badge.ok { background: var(--ok); }
main { max-width: 1180px; margin: 18px auto 60px; padding: 0 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px 22px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
h2 { margin: 0 0 12px; font-size: 20px; display: flex; align-items: center; gap: 10px; }
h2 small { font-size: 13px; font-weight: 400; }
h3 { margin: 18px 0 8px; font-size: 16px; }
.num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 16px; }
.muted { color: var(--muted); font-weight: 400; font-size: 13px; }
.req { color: var(--accent); }
button { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px;
  padding: 8px 16px; cursor: pointer; }
button:hover { border-color: #b8bec8; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; padding: 10px 22px; }
button.primary:hover { background: var(--accent-d); }
button.ghost { background: transparent; }
button.small { padding: 3px 10px; font-size: 13px; }
button.danger { color: var(--warn); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.editor-cta { display: flex; gap: 14px; align-items: center; background: linear-gradient(90deg, #fff1f4, #f0fbff);
  border: 1px solid #f3c6d2; border-radius: 14px; padding: 12px 14px; margin: 6px 0 4px; }
button.big { font-size: 17px; padding: 12px 22px; }
.drop { display: block; border: 2px dashed #c9ced6; border-radius: var(--radius); padding: 26px; text-align: center;
  cursor: pointer; background: #fafbfc; transition: .15s; }
.drop.over { border-color: var(--accent); background: #fff6f0; }
.drop-big { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; }
.thumb { position: relative; width: 96px; height: 128px; border-radius: 10px; overflow: hidden; background: #ddd; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .tag { position: absolute; left: 4px; top: 4px; background: rgba(0,0,0,.7); color: #fff; font-size: 12px;
  padding: 0 6px; border-radius: 6px; }
.thumb .x { position: absolute; right: 3px; top: 3px; padding: 0 7px; border-radius: 50%; font-size: 13px;
  background: rgba(255,255,255,.9); border: 0; }
.tip { background: #fffbe6; border-radius: 10px; padding: 8px 12px; font-size: 14px; margin: 8px 0; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-top: 10px; }
.fields .wide { grid-column: 1 / -1; }
label { display: block; font-weight: 600; font-size: 14px; }
input, textarea, select { display: block; margin-top: 4px; font: inherit; font-weight: 400; border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; background: #fff; color: var(--ink); width: 100%; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid #ffd2b8; border-color: var(--accent); }
.progress { position: relative; margin-top: 12px; height: 30px; border-radius: 99px; background: #eceef2; overflow: hidden; }
.progress .bar { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--yellow), var(--accent));
  transition: width .4s; }
.progress .msg { position: relative; display: block; text-align: center; line-height: 30px; font-size: 13px; font-weight: 600; }
.seen { background: #eef6ff; border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.notes { background: #fff8e1; border-radius: 10px; padding: 8px 12px; font-size: 14px; margin-top: 8px; }
.notes ul, .warn ul { margin: 4px 0; padding-left: 20px; }
.warn { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 8px 12px; font-size: 14px; margin-top: 10px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; cursor: pointer; background: #fff;
  white-space: pre-line; text-align: left; font-size: 14px; max-width: 360px; }
.chip.on { border-color: var(--accent); background: #fff3ea; box-shadow: 0 0 0 2px #ffd2b8; }
.chip small { display: block; color: var(--muted); }
.scene { display: grid; grid-template-columns: 86px 1fr; gap: 12px; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; margin-bottom: 8px; }
.scene .side { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.scene .kind { font-size: 12px; font-weight: 700; text-align: center; border-radius: 6px; padding: 2px 0; background: #eceef2; }
.scene .kind.hook { background: var(--yellow); }
.scene .kind.cta { background: #ffe1cf; }
.scene .pic { width: 86px; height: 110px; border-radius: 8px; object-fit: cover; background: #ddd; }
.scene select { padding: 4px; font-size: 13px; }
.scene .body { display: grid; gap: 6px; }
.scene .body label { font-size: 12px; font-weight: 600; color: var(--muted); }
.scene .tools { display: flex; gap: 4px; justify-content: center; }
.scene .tools button { padding: 0 8px; font-size: 13px; }
.scene .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cover-row { display: grid; grid-template-columns: 1fr 180px; gap: 10px; }
.caps { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cap-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 4px; }
.toggles { display: grid; gap: 6px; }
.toggles label { display: flex; align-items: center; gap: 8px; font-weight: 400; flex-wrap: wrap; }
.toggles input { width: auto; display: inline; margin: 0; }
.scene select { margin-top: 0; }
.results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 14px; }
.results figure { margin: 0; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.results figcaption { font-weight: 700; }
.results video, .results img { width: 100%; max-width: 300px; aspect-ratio: 9 / 16; border-radius: 12px; background: #111; object-fit: contain; }
.results a { font-size: 14px; color: var(--accent-d); }
.checklists { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checklists ul { margin: 0; padding-left: 20px; font-size: 14px; }
dialog { border: 0; border-radius: var(--radius); padding: 20px 24px; width: min(560px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog form { display: grid; gap: 10px; }
dialog h2 { margin: 0; }
.history { display: grid; gap: 6px; max-height: 60vh; overflow: auto; }
.history button { text-align: left; display: flex; justify-content: space-between; gap: 10px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1b1e24; color: #fff;
  padding: 10px 18px; border-radius: 10px; z-index: 20; }
.grow { flex: 1; }
.notes, .warn, .seen, .tip { overflow-wrap: anywhere; } /* long error text and links must wrap, not widen the page */
/* this computer vs the phone (classes set by mobile.js) */
.touch-only { display: none; }
.touch .touch-only { display: inline; }
.touch .no-touch, .remote .pc-only { display: none !important; }
/* phone-only edition (web/solo/): no computer, so nothing that needs one */
.solo-only { display: none; }
.solo .solo-only:not([hidden]) { display: block; }
.solo .srv-only { display: none !important; }
.history .hrow { display: flex; gap: 6px; }
.history .hrow > button:first-child { flex: 1; min-width: 0; }
.install-tip { position: relative; padding-right: 34px; }
.install-tip .x { position: absolute; right: 6px; top: 6px; padding: 0 8px; }
.install-tip .tip-warn { color: #a33a00; font-weight: 600; }
.results .share { font-size: 14px; padding: 6px 12px; }
.ph-body p { margin: 8px 0; }
.ph-body ol { margin: 6px 0; padding-left: 22px; }
.ph-body a { color: var(--accent-d); word-break: break-all; }
.ph-qr { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.ph-qr img { width: 190px; height: 190px; border: 1px solid var(--line); border-radius: 8px; image-rendering: pixelated; }
.ph-qr > div { flex: 1; min-width: 220px; }
.ph-url { font-weight: 700; word-break: break-all; margin-bottom: 6px; }
.ph-awake { display: flex; gap: 8px; align-items: center; font-weight: 400; margin-top: 12px; flex-wrap: wrap; }
.ph-awake input { width: auto; margin: 0; }
pre.out { background: #f3f4f6; border-radius: 8px; padding: 8px; font-size: 12px; white-space: pre-wrap; max-height: 160px; overflow: auto; }
@media (max-width: 860px) {
  .fields, .caps, .results, .checklists, .cover-row { grid-template-columns: 1fr; }
}
/* phone screens */
@media (max-width: 600px) {
  header { padding: 8px 12px; flex-wrap: wrap; gap: 6px; }
  .brand { font-size: 17px; }
  .brand small { display: none; }
  .head-actions { gap: 4px; width: 100%; }
  .head-actions button { padding: 5px 9px; white-space: nowrap; font-size: 14px; }
  .head-actions .badge { margin-right: auto; }
  .badge { font-size: 11px; padding: 2px 8px; }
  main { margin: 10px auto 40px; padding: 0 8px; gap: 10px; }
  .card { padding: 14px 12px 16px; }
  h2 { font-size: 18px; }
  .drop { padding: 18px 12px; }
  .thumb { width: 78px; height: 104px; }
  input, textarea, select { font-size: 16px; } /* smaller text makes iPhones zoom in while typing */
  .scene { grid-template-columns: 70px 1fr; gap: 8px; padding: 8px; }
  .scene .pic { width: 70px; height: 92px; }
  .scene .tools { gap: 2px; }
  .scene .tools button { padding: 0 5px; }
  .scene .two { grid-template-columns: 1fr; }
  .chip { max-width: 100%; }
  .editor-cta { flex-direction: column; align-items: stretch; text-align: left; }
  button.big { width: 100%; }
  .results video, .results img { max-width: 260px; }
  .results figure { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .toast { bottom: 14px; max-width: 92vw; }
  dialog { padding: 16px; }
}
