/* Reels, Shorts & TikTok Safe-Zone Checker (/tools/social-safe-zone-preview/), 2026-11-30.
   Uses tokens from ft-shell-20261106.css and components from ft-tool-20261106.css.
   Reserves stage, mobile preview, stats, and 4-row zone list heights from first paint so CLS stays 0.000. */

.ft-tool .ft-fields {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr));
}

.ft-tool .ft-field,
.ft-tool fieldset,
.ft-tool .ft-panel,
.ft-tool .ft-stack,
.ft-tool .ft-inputgroup {
  min-width: 0;
  max-width: 100%;
}

.ft-tool .ft-select {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ft-tool input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]),
.ft-tool select,
.ft-tool textarea,
.ft-tool .ft-input,
.ft-tool .ft-select {
  font-size: max(16px, 1rem);
  min-height: 44px;
}

.ft-tool .ft-btn {
  min-width: 44px;
  min-height: 44px;
  height: auto;
  padding-block: 0.48rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.ft-tool .ft-drop__label {
  min-height: 7rem;
  padding: var(--ft-space-4) var(--ft-space-3);
}

.ssz-filebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ft-space-2) var(--ft-space-3);
  margin-top: calc(-1 * var(--ft-space-2));
  min-width: 0;
}

.ssz-fileinfo {
  flex: 1 1 12rem;
  min-width: 0;
  min-height: 2.5rem;
  margin: 0;
  color: var(--ft-ink-2);
  font-size: var(--ft-text-sm);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.ssz-fileinfo strong {
  color: var(--ft-ink);
  font-weight: 650;
}

.ssz-video-bar {
  padding: var(--ft-space-2) var(--ft-space-3);
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius);
  background: var(--ft-surface-2);
  min-width: 0;
}

/* Quick presets */
.ssz-presets {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ft-space-2);
  min-width: 0;
}

.ssz-presets__label {
  margin: 0;
  color: var(--ft-ink);
  font-size: var(--ft-text-sm);
  font-weight: 600;
}

.ssz-presets__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ft-space-2);
  min-width: 0;
}

.ssz-preset {
  justify-content: flex-start;
  text-align: left;
  font-size: var(--ft-text-sm);
}

.ssz-preset[aria-pressed="true"] {
  border-color: var(--ft-accent);
  background: var(--ft-accent-soft);
  color: var(--ft-ink);
}

/* Fieldset groups */
.ssz-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ft-space-3);
  min-width: 0;
  margin: 0;
  padding: var(--ft-space-4) 0 0;
  border: 0;
  border-top: 1px solid var(--ft-line);
}

.ssz-group__legend {
  float: left;
  width: 100%;
  margin: 0 0 var(--ft-space-1);
  padding: 0;
  color: var(--ft-ink);
  font-size: var(--ft-text-md);
  font-weight: 650;
}

.ssz-group__legend + * {
  clear: both;
}

/* Touch-friendly >=44px checkbox rows */
.ssz-checks {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.35rem;
  min-width: 0;
}

.ssz-check {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius);
  background: var(--ft-surface);
  color: var(--ft-ink);
  font-size: var(--ft-text-sm);
  line-height: 1.35;
  cursor: pointer;
  box-sizing: border-box;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ssz-check input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
  accent-color: var(--ft-accent);
}

.ssz-check:has(input:disabled) {
  opacity: 0.56;
  cursor: not-allowed;
}

/* Fixed-height preview stage so 9:16 <-> 4:5 <-> 16:9 never shifts page height */
.ssz-stage-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ft-space-2);
  min-width: 0;
}

.ssz-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 25rem;
  padding: var(--ft-space-3);
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius);
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ft-ink) 10%, transparent) 1px, transparent 0)
    0 0 / 16px 16px,
    var(--ft-surface-2);
  box-sizing: border-box;
  overflow: hidden;
  min-width: 0;
}

.ssz-preview-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(15, 23, 20, 0.18);
}

:root[data-theme="dark"] .ssz-preview-canvas {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}

.ssz-stagebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ft-space-2);
  min-width: 0;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius);
  background: var(--ft-surface);
}

.ssz-stage-meta {
  margin: 0;
  color: var(--ft-ink-2);
  font-size: var(--ft-text-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ssz-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.58rem;
  border-radius: 999px;
  font-size: var(--ft-text-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.ssz-badge--ok {
  background: color-mix(in srgb, #10b981 15%, var(--ft-surface));
  border-color: color-mix(in srgb, #10b981 45%, var(--ft-line));
  color: var(--ft-ink);
}

.ssz-badge--warn {
  background: color-mix(in srgb, #f59e0b 18%, var(--ft-surface));
  border-color: color-mix(in srgb, #f59e0b 48%, var(--ft-line));
  color: var(--ft-ink);
}

.ssz-badge--bad {
  background: color-mix(in srgb, #dc2626 16%, var(--ft-surface));
  border-color: color-mix(in srgb, #dc2626 48%, var(--ft-line));
  color: var(--ft-ink);
}

.ssz-stats {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.25rem), 1fr));
}

/* Mobile 168x94 Readability + Per-Zone Edge Density Inspector */
.ssz-inspect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: var(--ft-space-3);
  min-width: 0;
}

.ssz-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: var(--ft-space-2);
  padding: var(--ft-space-3);
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius);
  background: var(--ft-surface);
  box-sizing: border-box;
  min-width: 0;
}

.ssz-card__title {
  margin: 0;
  color: var(--ft-ink);
  font-size: var(--ft-text-sm);
  font-weight: 650;
}

.ssz-mobile-frame {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 98px;
  min-width: 0;
}

.ssz-mobile-canvas {
  display: block;
  width: 168px;
  height: 94px;
  max-width: 100%;
  border-radius: 6px;
  border: 1px solid var(--ft-line);
  background: #0f1714;
}

.ssz-card__note {
  margin: 0;
  color: var(--ft-ink-2);
  font-size: var(--ft-text-xs);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.ssz-zone-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.38rem;
  min-height: 8.8rem;
  min-width: 0;
}

.ssz-zone {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.2rem 0.5rem;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--ft-line);
  background: var(--ft-surface-2);
  font-size: var(--ft-text-xs);
  min-width: 0;
}

.ssz-zone--warn {
  border-color: color-mix(in srgb, #dc2626 50%, var(--ft-line));
  background: color-mix(in srgb, #dc2626 12%, var(--ft-surface));
}

.ssz-zone__name {
  color: var(--ft-ink);
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ssz-zone__val {
  color: var(--ft-ink-2);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.ssz-after-example {
  margin-top: var(--ft-space-3);
}

@media (max-width: 600px) {
  .ssz-stage {
    height: 17.5rem;
    padding: var(--ft-space-2);
  }
  .ssz-stagebar {
    padding: 0.35rem 0.45rem;
  }
  .ssz-card {
    padding: var(--ft-space-2);
  }
}
