/* Creator Tools: one stylesheet, system fonts, light/dark, mobile first. */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1b1b1f;
  --muted: #4a4a55;
  --surface: #f3f3f6;
  --surface-2: #e9e9ef;
  --border: #767680;
  --line: #d4d4dc;
  --accent: #0b57d0;
  --accent-hover: #0842a0;
  --accent-fg: #ffffff;
  --focus: #0b57d0;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --ok: #1e6b35;
  --warn-fg: #5c4400;
  --warn-bg: #fff4ce;
  --code-bg: #eeeef3;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121216;
    --fg: #ececf1;
    --muted: #b8b8c4;
    --surface: #1c1c22;
    --surface-2: #26262e;
    --border: #8c8c99;
    --line: #3a3a44;
    --accent: #8ab4f8;
    --accent-hover: #aecbfa;
    --accent-fg: #0b1b33;
    --focus: #8ab4f8;
    --danger: #ffb4ab;
    --danger-bg: #3b1412;
    --ok: #8fd19e;
    --warn-fg: #ffe08a;
    --warn-bg: #3a2f00;
    --code-bg: #24242c;
  }
}

*, *::before, *::after { box-sizing: border-box; }
/* the hidden attribute must win over display: flex/grid set by classes (.btn-row, .check, .video-controls) */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.6 var(--font);
  overflow-wrap: break-word;
}
img, canvas, video { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
code, kbd, pre { font-family: var(--mono); font-size: 0.92em; }
code, kbd { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
kbd { border: 1px solid var(--line); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 0.5rem; top: -4rem; z-index: 10;
  background: var(--accent); color: var(--accent-fg); padding: 0.6rem 1rem; border-radius: var(--radius);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 0.5rem; color: var(--accent-fg); }

.wrap { width: 100%; max-width: 60rem; margin: 0 auto; padding: 0 1rem; }

/* header / footer */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 1rem; padding-top: 0.5rem; padding-bottom: 0.5rem; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--fg); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; gap: 0.5rem; }
.brand:hover { color: var(--fg); }
.brand svg { flex: none; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.25rem 1rem; flex-wrap: wrap; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.25rem; }

main { display: block; padding-bottom: 2rem; }
main:focus { outline: none; }
.breadcrumb { font-size: 0.9rem; margin-top: 1rem; }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.breadcrumb li + li::before { content: "/"; margin-right: 0.25rem; color: var(--muted); }
.breadcrumb a { display: inline-block; padding: 0.15rem 0; }
h1 { font-size: 1.75rem; line-height: 1.25; margin: 1rem 0 0.5rem; }
h2 { font-size: 1.3rem; line-height: 1.3; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.1rem; line-height: 1.35; margin: 1.5rem 0 0.5rem; }
.lede { font-size: 1.1rem; color: var(--muted); margin: 0 0 1.25rem; }
.privacy-note { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.95rem; margin: 0 0 1rem; }
.privacy-note::before { content: ""; flex: none; width: 0.6rem; height: 0.6rem; margin-top: 0.5rem; border-radius: 50%; background: var(--ok); }

.prose { max-width: 46rem; }
.prose table, .table-wrap table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.prose th, .prose td, .table-wrap th, .table-wrap td { border: 1px solid var(--line); padding: 0.45rem 0.6rem; text-align: left; vertical-align: top; }
.prose th, .table-wrap th { background: var(--surface); }
.table-wrap { overflow-x: auto; max-width: 100%; }
.table-wrap td { overflow-wrap: anywhere; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 1.5rem 0 2rem; font-size: 0.95rem; }
.site-footer h2 { font-size: 1rem; margin: 0 0 0.5rem; }
.footer-cols { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li a { display: inline-flex; align-items: center; min-height: 32px; }
.site-footer p { margin: 0.5rem 0; color: var(--muted); }
@media (min-width: 40rem) { .footer-cols { grid-template-columns: 2fr 1fr; } }

/* home */
.tool-list { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: 0.75rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) { .tool-list { grid-template-columns: 1fr 1fr; } }
.tool-card { display: block; height: 100%; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--fg); }
.tool-card:hover { border-color: var(--accent); color: var(--fg); }
.tool-card strong { display: block; color: var(--accent); font-size: 1.05rem; margin-bottom: 0.25rem; }
.tool-card span { color: var(--muted); }

/* tool frame */
.tool { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 1rem; margin: 0 0 1.5rem; }
.tool h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
.tool h2:not(:first-child) { margin-top: 1.5rem; }
.tool h3 { font-size: 1rem; }
.tool-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 52rem) { .tool-grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .tool-grid.side { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); } }

.field { margin: 0 0 1rem; }
.field > label, .field-label, legend { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.hint { font-size: 0.9rem; color: var(--muted); margin: 0.3rem 0 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem 0.5rem; margin: 0 0 1rem; min-width: 0; }
legend { padding: 0 0.25rem; }

input[type="text"], input[type="number"], select, textarea {
  font: inherit; font-size: 1rem; color: var(--fg); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 0.55rem 0.7rem; min-height: 44px; width: 100%; max-width: 100%;
}
textarea { min-height: 8rem; font-family: var(--mono); font-size: 0.9rem; resize: vertical; }
select { padding-right: 2rem; }
input[type="number"] { max-width: 10rem; }
input[type="file"] { font: inherit; max-width: 100%; min-height: 44px; color: var(--fg); }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; min-height: 44px; padding: 0.5rem 1rem; margin-right: 0.75rem;
  border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: var(--accent-fg); cursor: pointer;
}
input[type="file"]:hover::file-selector-button { background: var(--accent-hover); }
input[type="checkbox"], input[type="radio"] { width: 1.5rem; height: 1.5rem; margin: 0; flex: none; accent-color: var(--accent); }
input[type="range"] { width: 100%; min-height: 44px; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; }
.check label { cursor: pointer; }
.inline-fields { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: flex-end; }
.inline-fields .field { flex: 1 1 10rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: inherit; font-weight: 600; min-height: 44px; padding: 0.5rem 1rem; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--bg); color: var(--accent); text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-fg); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.75rem 0; }

.drop-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 1rem; background: var(--bg); }
.drop-zone.is-over { border-color: var(--accent); background: var(--surface-2); }

.status { min-height: 1.6em; margin: 0.5rem 0; }
.error { color: var(--danger); background: var(--danger-bg); border-radius: 8px; padding: 0.6rem 0.8rem; margin: 0.5rem 0; font-weight: 600; }
.error:empty { padding: 0; margin: 0; }
.warn { color: var(--warn-fg); background: var(--warn-bg); border-radius: 8px; padding: 0.6rem 0.8rem; margin: 0.5rem 0; }
.warn:empty { padding: 0; margin: 0; }
.note { font-size: 0.92rem; color: var(--muted); border-left: 4px solid var(--line); padding: 0.25rem 0 0.25rem 0.75rem; margin: 0.75rem 0; }

.result-big { font-size: 2rem; font-weight: 700; line-height: 1.2; margin: 0.25rem 0; }
.result-grid { display: grid; gap: 0.75rem; grid-template-columns: 1fr; margin: 0 0 1rem; }
@media (min-width: 36rem) { .result-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.result-card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem; }
.result-card h3 { margin: 0; font-size: 0.95rem; color: var(--muted); font-weight: 600; }
.result-card p { margin: 0.25rem 0 0; }

.file-result { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem; margin: 0 0 1rem; }
.file-result h3 { margin: 0 0 0.25rem; overflow-wrap: anywhere; }
.report { margin: 0.25rem 0 0.5rem; padding-left: 1.25rem; font-size: 0.95rem; }
.report li { margin: 0.15rem 0; }
details > summary { cursor: pointer; font-weight: 600; min-height: 32px; display: list-item; padding: 0.2rem 0; }
pre.preview { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem; max-height: 16rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0.5rem 0; font-size: 0.85rem; }

.cue-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: var(--bg); }
.cue-table th, .cue-table td { border: 1px solid var(--line); padding: 0.35rem 0.5rem; text-align: left; vertical-align: top; }
.cue-table td.t { font-family: var(--mono); white-space: nowrap; font-size: 0.85rem; }

/* safe zone checker */
.stage-wrap { display: flex; justify-content: center; }
.stage {
  position: relative; width: min(100%, 22rem); aspect-ratio: 9 / 16; overflow: hidden; border-radius: 8px;
  background-color: #2b2b31;
  background-image: linear-gradient(45deg, #34343b 25%, transparent 25%, transparent 75%, #34343b 75%), linear-gradient(45deg, #34343b 25%, transparent 25%, transparent 75%, #34343b 75%);
  background-size: 24px 24px; background-position: 0 0, 12px 12px;
}
.stage.has-media { background: #000; }
.stage video, .stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stage.fit-cover video, .stage.fit-cover img { object-fit: cover; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.legend { list-style: none; padding: 0; margin: 0.5rem 0; font-size: 0.92rem; }
.legend li { display: flex; align-items: center; gap: 0.5rem; margin: 0.2rem 0; }
.swatch { flex: none; width: 2.25rem; height: 0; border-top: 4px solid; }
.swatch.tiktok { border-color: #c79100; border-top-style: solid; }
.swatch.reels { border-color: #0277bd; border-top-style: dashed; }
.swatch.shorts { border-color: #558b2f; border-top-style: dotted; }
.swatch.combined { border-color: var(--fg); border-top-width: 6px; }
.swatch.shade { height: 1rem; border: 1px solid var(--border); background: rgba(0, 0, 0, 0.45); }
@media (prefers-color-scheme: dark) {
  .swatch.tiktok { border-color: #ffd54f; } .swatch.reels { border-color: #4fc3f7; } .swatch.shorts { border-color: #aed581; }
}
.video-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.5rem 0; }

/* LUT previewer */
.lut-grid { list-style: none; padding: 0; margin: 0.75rem 0; display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); }
.lut-grid li { min-width: 0; }
.tile { display: flex; flex-direction: column; width: 100%; padding: 0.35rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer; }
.tile:hover, .tile[aria-pressed="true"] { border-color: var(--accent); }
.tile[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); }
.tile canvas { width: 100%; height: auto; display: block; border-radius: 4px; background: var(--surface-2); }
.tile .name { display: block; margin-top: 0.3rem; font-weight: 600; overflow-wrap: anywhere; line-height: 1.3; }
.tile.bad { cursor: default; border-color: var(--danger); }
.tile.bad .name { color: var(--danger); }
.tile .msg { display: block; font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.compare { position: relative; }
.compare canvas { width: 100%; height: auto; display: block; border-radius: 8px; background: var(--surface-2); }
.compare-labels { display: flex; justify-content: space-between; font-size: 0.9rem; font-weight: 600; margin-top: 0.25rem; }
.frame-preview { width: 100%; max-height: 50vh; object-fit: contain; background: #000; border-radius: 8px; display: block; }

/* FAQ / related */
.faq details { border-bottom: 1px solid var(--line); padding: 0.5rem 0; }
.faq summary { font-weight: 600; }
.faq .answer { padding: 0.25rem 0 0.25rem; }
.related ul { padding-left: 1.25rem; }
.related li { margin: 0.25rem 0; }
.related a { display: inline-block; padding: 0.2rem 0; }
.updated { font-size: 0.9rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
@media (min-width: 48rem) { h1 { font-size: 2.1rem; } .tool { padding: 1.25rem 1.5rem; } }

/* local-build banners (never shown in a release build) */
.draft-banner { margin: 1rem 0 0; padding: 0.6rem 0.8rem; border: 2px solid var(--warn-fg); border-radius: 8px; background: var(--warn-bg); color: var(--warn-fg); }
.draft-banner strong { margin-right: 0.4rem; letter-spacing: 0.04em; }

/* safe-zone sources table */
.sz-table { min-width: 44rem; }
.sz-table .pct { color: var(--muted); white-space: nowrap; }
.sz-table td a { display: inline-block; padding: 0.1rem 0; }

/* links inside warnings (T1 -> T9) */
.warn-link { display: inline-block; padding: 0.1rem 0; color: var(--accent); font-weight: 600; }

/* caption style previewer (T8) */
.cs-stage-wrap { display: flex; justify-content: center; }
.cs-stage {
  position: relative; width: min(100%, 22rem); aspect-ratio: 9 / 16; overflow: hidden; border-radius: 8px;
  background-color: #2b2b31;
  background-image: linear-gradient(45deg, #34343b 25%, transparent 25%, transparent 75%, #34343b 75%), linear-gradient(45deg, #34343b 25%, transparent 25%, transparent 75%, #34343b 75%);
  background-size: 24px 24px; background-position: 0 0, 12px 12px;
}
.cs-stage.has-media { background: #000; }
.cs-stage video, .cs-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.cs-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cs-seek-field { flex: 1 1 12rem; margin: 0; }
input[type="color"] { width: 4.5rem; min-height: 44px; padding: 0.2rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); cursor: pointer; }
.inline-fields .field:has(> input[type="color"]) { flex: 0 1 8rem; }
.cs-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); grid-template-areas: "in" "prev" "style"; }
.cs-inputs { grid-area: in; min-width: 0; } .cs-preview-col { grid-area: prev; min-width: 0; } .cs-style { grid-area: style; min-width: 0; }
@media (min-width: 52rem) {
  .cs-grid { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); grid-template-areas: "in prev" "style prev"; grid-template-rows: auto 1fr; }
  .cs-preview-col { position: sticky; top: 0.5rem; align-self: start; }
}
input:disabled { opacity: 0.6; cursor: not-allowed; }

/* vertical reframe guide (T9) */
.rf-src-wrap, .rf-out-wrap { display: flex; justify-content: center; }
.rf-src, .rf-out { display: block; max-width: 100%; border-radius: 8px; background: #000; }
.rf-src { cursor: grab; touch-action: pan-y; }
.rf-src:active { cursor: grabbing; }
.rf-table { min-width: 44rem; }
.rf-table code { overflow-wrap: anywhere; }
.rf-table td.rf-val { min-width: 15rem; }
.badge-unverified { display: inline-block; margin-left: 0.35rem; padding: 0 0.4rem; border: 1px solid var(--warn-fg); border-radius: 999px; background: var(--warn-bg); color: var(--warn-fg); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }

/* color palette from video (T10) */
.cp-canvas { display: block; max-width: 100%; border-radius: 8px; background: var(--surface-2); }
.link-target { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.cp-lut-link { margin: 0.25rem 0 0; }
.swatches { list-style: none; padding: 0; margin: 0.75rem 0; display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); }
.swatch-item { display: flex; gap: 0.6rem; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem; min-width: 0; }
.swatch-chip { flex: none; width: 3rem; height: 3rem; border-radius: 6px; border: 1px solid var(--border); }
.swatch-text { display: flex; flex-direction: column; font-size: 0.9rem; line-height: 1.35; min-width: 0; }
.swatch-hex { font-family: var(--mono); font-size: 1rem; }
