/* Carousel Safe Zone Checker UI. Reuses the docs shell and site tokens. */

.tool-section { margin-top: 48px; }
.privacy-note { margin-bottom: 28px; color: var(--muted); max-width: 68ch; }
.tool-controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.mode-picker { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.mode-button, .mini-button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  transition: background-color 160ms ease, color 160ms ease, transform 120ms var(--ease-out);
}
.mode-button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.mode-button:active, .mini-button:active { transform: scale(0.97); }
.deck-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button.secondary { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.button.secondary:hover { background: var(--ink); color: var(--bg); }

.dropzone {
  display: grid;
  gap: 8px;
  padding: 28px;
  border: 2px dashed var(--muted);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}
.dropzone.is-dragging { border-color: var(--red); background: #efe4d7; }
.dropzone strong { font-size: var(--step-lead); line-height: 1.1; }
.dropzone span { color: var(--muted); max-width: 58ch; }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.tool-status { min-height: 1.5em; margin-top: 10px; color: var(--muted); }
.tool-status.is-error { color: var(--red); }
.tool-empty { padding: 28px; background: var(--ui-ground); color: var(--ui-muted); }

.filmstrip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  margin-top: 18px;
}
.film-card {
  flex: 0 0 112px;
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--ink);
  background: var(--ui-card);
  color: var(--ui-text);
  text-align: left;
}
.film-card.is-selected { outline: 3px solid var(--red); outline-offset: -3px; }
.film-thumb { width: 100%; aspect-ratio: 9 / 16; background: #fff; overflow: hidden; }
.film-thumb img, .thumb-fallback { width: 100%; height: 100%; object-fit: cover; }
.thumb-fallback { display: grid; place-items: center; padding: 8px; color: var(--ui-muted); text-align: center; font-size: 12px; }
.film-name { font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-chip { justify-self: start; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.status-clear { background: #dff3df; color: #174d1f; }
.status-warning { background: #fff0c2; color: #6c4b00; }
.status-blocked { background: #ffd9dc; color: #8a1019; }

.stage-layout { display: grid; grid-template-columns: minmax(280px, 520px) minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 18px; }
.stage-main { min-width: 0; }
.stage-frame {
  position: relative;
  width: min(100%, 520px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: #f4efe8;
  touch-action: none;
}
.stage-frame.preset-tiktok:not(.is-empty) { aspect-ratio: 9 / 16; }
.stage-frame.preset-instagram:not(.is-empty), .stage-frame.preset-crosspost:not(.is-empty) { aspect-ratio: 4 / 5; }
.stage-frame.is-empty { min-height: 220px; display: grid; place-items: center; }
.stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.zone-overlay { position: absolute; pointer-events: none; border: 2px solid transparent; }
.zone-hard { background: rgba(220, 25, 40, 0.18); border-color: rgba(138, 16, 25, 0.85); }
.zone-soft { background: rgba(224, 169, 18, 0.16); border-color: rgba(108, 75, 0, 0.75); }
.zone-crop { background: rgba(74, 111, 132, 0.10); border: 3px dashed rgba(28, 50, 61, 0.9); }
.zone-safe-template { border: 2px dashed rgba(23, 77, 31, 0.75); background: rgba(31, 138, 76, 0.08); }
.zone-label {
  position: absolute;
  left: 6px;
  top: 6px;
  max-width: calc(100% - 12px);
  padding: 3px 6px;
  background: rgba(42, 17, 16, 0.82);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tt-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  gap: 6px;
  padding: 12px 14px 16px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: clamp(12px, 2.4vw, 16px);
  line-height: 1.25;
  pointer-events: none;
}
.tt-caption strong { display: block; }
.tt-caption span { display: -webkit-box; overflow: hidden; -webkit-box-orient: -webkit-box; -webkit-line-clamp: 4; }
.tt-caption em { color: #d8dee3; font-style: normal; font-size: 0.9em; }
.marked-region {
  position: absolute;
  border: 3px solid #1f8a4c;
  background: rgba(31, 138, 76, 0.16);
  color: #123f22;
  cursor: move;
  outline: none;
}
.marked-region:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.marked-region span {
  position: absolute;
  left: 0;
  top: 0;
  max-width: 100%;
  padding: 3px 6px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.marked-region.region-warning { border-color: #e0a912; background: rgba(224, 169, 18, 0.18); }
.marked-region.region-blocked { border-color: #dc1928; background: rgba(220, 25, 40, 0.16); }
.marked-region.region-temp { border-style: dashed; }
.safe-box { border-style: dashed; }
.region-handle {
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 16px;
  height: 16px;
  background: var(--ink);
  cursor: nwse-resize;
}
.stage-meta, .stage-hint { margin-top: 10px; color: var(--muted); font-size: var(--step-small); }
.stage-hint { max-width: 58ch; }

.stage-side { display: grid; gap: 18px; min-width: 0; }
.region-controls, .caption-panel, .grid-preview {
  background: var(--ui-card);
  color: var(--ui-text);
  padding: 16px;
}
.region-controls h3, .caption-panel h3, .grid-preview h3 { margin-bottom: 10px; font-size: var(--step-lead); }
.field { display: grid; gap: 7px; align-content: start; }
.field.compact { max-width: 260px; margin-bottom: 12px; }
.field span { font-weight: 800; }
.field small { color: var(--muted); font-weight: 500; }
.field input, .field textarea, .field select {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--ui-muted);
  background: #fff;
  color: var(--ui-text);
  font: inherit;
}
.field textarea { resize: vertical; }
.check-toggle { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; margin-bottom: 12px; }
.check-toggle input { width: 18px; height: 18px; accent-color: var(--red); }
.region-list { display: grid; gap: 8px; }
.region-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.region-row label { display: grid; gap: 4px; font-size: 12px; font-weight: 800; }
.region-row select { min-height: 38px; }
.mini-button { min-height: 38px; padding: 0 10px; font-size: var(--step-small); }
.mini-button.danger { border-color: var(--red); color: var(--red); }
.safe-summary { margin-top: 10px; font-weight: 700; }
.muted { color: var(--ui-muted); }
.caption-panel .field + .field { margin-top: 12px; }
.grid-preview p { margin: 6px 0 14px; color: var(--ui-muted); }
.grid-3x3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; background: var(--ui-ground); padding: 5px; }
.grid-tile { position: relative; aspect-ratio: 3 / 4; background: #fff; overflow: hidden; }
.grid-cover img { width: 100%; height: 100%; object-fit: cover; }
.grid-cover span { position: absolute; left: 4px; top: 4px; padding: 2px 5px; background: rgba(42, 17, 16, 0.85); color: #fff; font-size: 10px; font-weight: 800; }

.verdict {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-top: 22px;
  padding: 22px;
  border: 2px solid var(--ink);
  background: var(--surface);
}
.verdict strong { font-size: var(--step-head); line-height: 0.95; letter-spacing: -0.03em; }
.verdict p { margin-top: 6px; color: var(--muted); max-width: 62ch; }
.verdict-clear { border-color: #1f8a4c; }
.verdict-review { border-color: var(--mustard); }
.verdict-blocked { border-color: var(--red); }
.verdict-empty { border-color: var(--muted); }
.last-checked { margin-top: 12px; color: var(--muted); font-size: var(--step-small); }
.export-panel { margin-top: 22px; padding: 22px; background: var(--surface); }
.export-panel h3 { font-size: var(--step-lead); }
.export-panel > p { margin: 8px 0 18px; color: var(--muted); }
.export-actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 980px) {
  .stage-layout { grid-template-columns: 1fr; }
  .stage-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .stage-side { grid-template-columns: 1fr; }
  .region-row { grid-template-columns: 1fr; }
  .film-card { flex-basis: 92px; }
  .verdict strong { font-size: clamp(2.4rem, 14vw, 4rem); }
}
