
:root {
  --bg: #090603;
  --panel: rgba(22, 16, 8, 0.82);
  --panel-2: rgba(27, 20, 10, 0.94);
  --panel-soft: rgba(255,255,255,0.05);
  --line: rgba(214, 168, 81, 0.16);
  --line-strong: rgba(214, 168, 81, 0.28);
  --text: #f4ebdd;
  --text-soft: #cabfae;
  --text-dim: #998f80;
  --gold: #d7a33d;
  --gold-soft: #8b6a25;
  --danger: #ff7a68;
  --ok: #71d18a;
  --shadow: 0 18px 60px rgba(0,0,0,0.28);
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --stage-gap: 18px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}
body {
  margin: 0;
  font-family: Inter, "Noto Sans JP", system-ui, sans-serif;
  background:
    radial-gradient(circle at top, rgba(215,163,61,0.08), transparent 32%),
    linear-gradient(180deg, #0b0703, #070503 50%, #050301 100%);
  color: var(--text);
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.5; }

.visually-hidden,
.legacy-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.ft-app {
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  padding: 10px 12px 10px;
  position: relative;
  background: #120d07;
  overflow-x: clip;
}

.app-grid {
  height: calc(100vh - 20px);
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 268px;
  gap: 12px;
}

.app-column {
  min-height: 0;
}

.app-column--left,
.app-column--right {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
}

.ft-card {
  background: linear-gradient(180deg, rgba(33, 25, 14, 0.98), rgba(19, 13, 7, 0.97));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), var(--shadow);
  overflow: hidden;
}

.ft-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 14px;
}

.ft-card__head--button {
  width: 100%;
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
}

.ft-card__icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(215, 163, 61, 0.12);
  border: 1px solid rgba(215, 163, 61, 0.2);
  color: var(--gold);
  flex: 0 0 auto;
}

.ft-card__titleBlock {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.ft-card__title { font-size: 17px; font-weight: 700; letter-spacing: 0.02em; }
.ft-card__sub { font-size: 12px; line-height: 1.4; color: var(--text-dim); }
.ft-card__chevron { margin-left: auto; color: var(--text-dim); transition: transform 0.2s ease; }
.ft-card__body { padding: 0 18px 18px; }
.stack-md > * + * { margin-top: 14px; }
.stack-sm > * + * { margin-top: 8px; }

#setupSection.is-collapsed #setupExpandable { display: none; }
#setupSection.is-collapsed #setupChevron { transform: rotate(-90deg); }

.field-group,
.field-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-label,
.field-key {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}
.field-key--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.preset-metric-legend {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
  margin-bottom: 6px;
}
.preset-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.preset-btn {
  min-height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.11);
  background: rgba(255,255,255,0.03);
  color: var(--text-soft);
  text-align: left;
  padding: 7px 10px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  white-space: nowrap;
}
.preset-btn__name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
  flex: 0 0 auto;
}
.preset-btn__meta {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
  opacity: 0.78;
  margin-left: auto;
}
.preset-btn.is-active {
  border-color: #d7a33d;
  background: #d7a33d;
  color: #201405;
}
.preset-btn.is-active .preset-btn__meta {
  opacity: 0.82;
}
.preset-state {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(215,163,61,0.14);
  border: 1px solid rgba(215,163,61,0.24);
  color: #f0be49;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.placement-card,
.field-box,
.summary-pane,
.quick-guide,
.issue-list-wrap {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-md);
}

.placement-card {
  padding: 14px;
}
.placement-card__size { font-size: 16px; font-weight: 800; letter-spacing: 0.01em; line-height: 1.2; }
.placement-card__meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
}
.muted-line { font-size: 12px; color: var(--text-soft); line-height: 1.45; }
.muted-line--soft { color: var(--text-dim); }
.helper-copy { font-size: 12px; line-height: 1.65; color: var(--text-soft); }
.helper-copy--small { font-size: 11px; color: var(--text-dim); }
.field-help {
  display: block;
  font-size: 10px;
  line-height: 1.35;
  color: var(--text-dim);
}
.field-box--compact {
  gap: 6px;
}
.range-pair {
  display: grid;
  gap: 6px;
}
.range-pair__row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: center;
}
.range-mini-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
}
.slider-value--compact {
  min-height: 22px;
  padding: 0 6px;
  font-size: 10px;
}

.seg-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 4px;
}
.seg-control--guide {
  border-radius: 14px;
  padding: 4px;
}
.seg-btn,
.tab-btn {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  padding: 12px 14px;
  border-radius: 999px;
  font-weight: 700;
}
.seg-control--guide .seg-btn { border-radius: 10px; padding: 10px 12px; }
.seg-btn.active,
.tab-btn.active { background: rgba(215,163,61,0.18); color: #fff2cf; }

.btn {
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 700;
  min-height: 48px;
}
.btn:hover { border-color: rgba(215,163,61,0.42); }
.btn-wide { width: 100%; }
.btn-primary,
.btn.primary,
.btn.primary.big {
  background: linear-gradient(180deg, #e3b34d, #c58b22);
  color: #1a1104;
  border-color: #d7a33d;
}
.btn-outline,
.btn.outline,
.btn.outline.big {
  background: rgba(255,255,255,0.03);
  color: var(--text);
}
.btn.locked { opacity: 0.45; }
.action-row { display: flex; gap: 10px; }
.action-row--two > * { flex: 1 1 0; }
.action-stack > * + * { margin-top: 10px; }

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-soft);
}
.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-soft);
}
.switch-row input {
  appearance: none;
  width: 30px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.12);
  position: relative;
  cursor: pointer;
}
.switch-row input::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f4ebdd;
  transition: transform 0.15s ease;
}
.switch-row input:checked {
  background: rgba(215,163,61,0.45);
  border-color: rgba(215,163,61,0.8);
}
.switch-row input:checked::after { transform: translateX(12px); }
.check-row--boxed {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
}
.check-row input { accent-color: var(--gold); }
.check-row--compact { align-items: flex-start; }

.select-input,
.num-input {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 48px;
  outline: none;
}
.range-input {
  width: 100%;
  accent-color: #d7a33d;
}
.slider-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 8px;
  align-items: center;
}
.slider-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 6px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.11);
  background: rgba(255,255,255,0.05);
  font-size: 11px;
  color: var(--text-soft);
}
.color-inline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.color-code {
  min-height: 38px;
  padding: 8px 10px;
}
.color-swatch {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: #000;
}
.select-input:focus,
.num-input:focus { border-color: rgba(215,163,61,0.45); }

.quick-guide { padding: 14px; }
.quick-guide__title { font-size: 12px; font-weight: 700; color: var(--text-soft); }
.quick-guide__list { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.65; color: var(--text-dim); }

.summary-pane { padding: 14px; }
.summary-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.summary-row__label { font-size: 12px; font-weight: 700; color: var(--text-soft); }
.summary-chip {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px;
  border-radius: 999px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1);
  font-size: 12px; font-weight: 800;
}
.summary-chip.ok { background: rgba(113,209,138,0.18); color: #d9ffe3; border-color: rgba(113,209,138,0.28); }
.summary-chip.fix,
.summary-chip.risk { background: rgba(255,122,104,0.18); color: #ffe1dc; border-color: rgba(255,122,104,0.24); }
.summary-sub { font-size: 12px; line-height: 1.6; color: var(--text-soft); white-space: pre-line; }
.top3 { padding-top: 6px; }
.top3__title { font-size: 12px; font-weight: 700; color: #fff0c7; }
.top3__list { margin: 8px 0 0; padding-left: 18px; font-size: 12px; line-height: 1.65; color: var(--text-soft); }
.details-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.details-head__title { font-size: 12px; font-weight: 700; color: var(--text-soft); }
.link-btn { border: 0; background: transparent; color: var(--gold); padding: 0; font-weight: 700; }
.link-btn--advanced {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 38px;
  border-radius: 10px;
  border: 1px dashed rgba(255,255,255,0.16);
  color: var(--text-soft);
}
.link-btn--advanced:hover { color: var(--text); border-color: rgba(255,255,255,0.28); }

.issue-list-wrap { padding: 8px; min-height: 180px; max-height: 32vh; overflow: auto; }
.issue-list { display: flex; flex-direction: column; gap: 8px; }
.issue-list .item {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.035);
}
.issue-list .itemTop { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.issue-list .t { font-size: 12px; font-weight: 700; color: var(--text); line-height: 1.5; }
.issue-list .m { font-size: 11px; line-height: 1.55; color: var(--text-soft); }
.miniBtn { border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.04); color: var(--text-dim); border-radius: 999px; padding: 6px 10px; font-size: 11px; }

.app-column--stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  border-left: 1px solid rgba(255,255,255,0.06);
  border-right: 1px solid rgba(255,255,255,0.06);
  padding: 0 16px 120px;
}

.preview-wrap {
  position: relative;
  height: 100%;
  min-height: 0;
  border-radius: 20px;
  overflow: auto;
  background: rgba(0,0,0,0.22);
  scrollbar-width: thin;
}

.preview-bg {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 32%, rgba(255,170,40,0.05), rgba(0,0,0,0) 34%), #070402;
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 20px;
}
.preview-bg.white { background: #f5f1ea; }
.preview-bg.black { background: radial-gradient(circle at 50% 32%, rgba(255,170,40,0.05), rgba(0,0,0,0) 34%), #070402; }
.preview-bg.transparent {
  background: #f5f1ea;
}

#canvas,
#heatmap { display: block; width: 100%; height: 100%; }
#canvas { position: relative; z-index: 1; }
.heatmap-layer,
.pins-layer,
.upload-hint-layer {
  position: absolute;
  inset: 0;
}
.heatmap-layer { z-index: 2; pointer-events: none; }
.pins-layer { z-index: 3; }
.upload-hint-layer { z-index: 4; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.upload-hint-card {
  text-align: center;
  min-width: 280px;
  max-width: 320px;
  padding: 22px 24px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(39,30,17,0.92), rgba(24,18,9,0.92));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--shadow);
}
.upload-hint-title { font-size: 18px; font-weight: 800; }
.upload-hint-sub { margin-top: 10px; font-size: 15px; color: var(--text-soft); }
.upload-hint-meta { margin-top: 12px; font-size: 13px; color: var(--text-dim); }

.preview-wrap.dropping .upload-hint-card,
.preview-bg.dropping .upload-hint-card { border-color: rgba(215,163,61,0.35); }
.preview-wrap.panning { cursor: grabbing; }

.preview-bottom {
  position: sticky;
  bottom: 6px;
  width: min(920px, calc(100% - 16px));
  margin: -88px auto 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(11, 8, 4, 0.92);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 12px 28px rgba(0,0,0,0.34);
}
.zoom-dock {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: rgba(14, 10, 5, 0.88);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
}
.zoom-dock__icon { color: var(--gold); font-size: 12px; }
#zoom { width: min(560px, 52vw); accent-color: var(--gold); }
.zoom-label { min-width: 40px; text-align: right; font-size: 11px; font-weight: 700; }
.preview-tabs { display: inline-flex; gap: 8px; align-items: center; justify-content: center; width: 100%; }
.preview-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}
.preview-controls .zoom-dock { grid-column: 2; }
.tab-btn {
  padding: 6px 10px;
  min-width: 0;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-soft);
  border-radius: 999px;
  font-size: 11px;
}
.tab-btn.active {
  background: rgba(215,163,61,0.2);
  border-color: rgba(215,163,61,0.38);
  color: #ffe7b6;
}
.tab-btn:hover { border-color: rgba(215,163,61,0.32); }
.preview-badges { display: none; }

.bottom-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  grid-column: 3;
}

.btn-reset {
  min-width: 78px;
  min-height: 34px;
  padding: 6px 10px;
}

.btn-download {
  min-width: 176px;
  min-height: 34px;
  padding: 6px 14px;
  border-radius: 999px;
}
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.detail-head--static {
  margin-bottom: 2px;
}
.icon-btn--chevron {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1;
}
.soft-chip {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px;
  border-radius: 999px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  font-size: 12px; color: var(--text-dim);
}
.state-toast {
  position: absolute;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(17,11,5,0.94);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 12px;
}
.state-toast.is-visible { opacity: 1; }
.notice-pill {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  max-width: min(70vw, 760px);
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(30, 21, 10, 0.94);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--shadow);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.bottom-progress { padding-top: 0; }
.bottom-progress__track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(0,0,0,0.26);
  border: 1px solid rgba(255,255,255,0.18);
  overflow: hidden;
}
.bottom-progress__bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #f4c95b, #d48f18);
}

.pin,
.bbox {
  position: absolute;
  z-index: 5;
}
.pin {
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #0b0501;
  background: #f0be49;
  border: 1px solid rgba(255,255,255,0.4);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.pin.diff-new,
.pin.danger { background: var(--danger); color: #fff; }
.pin.diff-resolved { background: var(--ok); color: #03100a; }
.bbox {
  border: 1px solid rgba(240,190,73,0.9);
  border-radius: 8px;
  background: rgba(240,190,73,0.08);
}
.bbox.diff-new,
.bbox.danger { border-color: rgba(255,122,104,0.92); background: rgba(255,122,104,0.1); }
.bbox.diff-resolved { border-color: rgba(113,209,138,0.92); background: rgba(113,209,138,0.08); }

@media (max-width: 1280px) {
  .app-grid { grid-template-columns: 272px minmax(0, 1fr) 296px; gap: 14px; }
  .app-column--stage { padding: 0 10px; }
}

@media (max-width: 820px) {
  .app-grid {
    grid-template-columns: 1fr;
    grid-template-areas: "stage" "left" "right";
  }
  .app-column--stage { grid-area: stage; border: 0; padding: 0; }
  .app-column--left { grid-area: left; }
  .app-column--right { grid-area: right; }
  .preview-bottom { grid-template-columns: 1fr; justify-items: start; }
  .preview-badges { justify-content: flex-start; }
}


/* v5 cleanup */
.app-column--left, .app-column--right { gap: 12px; }
.ft-card--setup .ft-card__body { padding-bottom: 8px; }
.ft-card--setup .stack-md > * + * { margin-top: 8px; }
.ft-card--setup .placement-card { padding: 10px; }
.ft-card--guide .select-input { min-height: 40px; padding: 8px 12px; border-radius: 10px; }
.ft-card--guide .btn { min-height: 38px; padding: 8px 10px; border-radius: 10px; font-size: 12px; }
.ft-card--guide .check-row--boxed { padding: 8px 10px; }
.ft-card { border-radius: 22px; }
.ft-card__head { padding: 14px 14px 10px; }
.ft-card__body { padding: 0 14px 14px; }
.ft-card__icon { width: 34px; height: 34px; border-radius: 12px; }
.ft-card__title { font-size: 15px; }
#setupSub, .ft-card__sub { display:none !important; }
.field-label, .field-key, .summary-row__label, .details-head__title { font-size: 11px; }
.placement-card { padding: 12px; }
.placement-card__size { font-size: 16px; }
.helper-copy { font-size: 11px; line-height: 1.55; }
.helper-copy--compact { color: var(--text-dim); }
.muted-line { font-size: 11px; }
.btn { min-height: 44px; padding: 12px 14px; border-radius: 13px; }
.seg-btn { padding: 10px 12px; }
.check-row, .summary-sub, .top3__list, .issue-list .m { font-size: 11px; }
.quick-guide { display:none !important; }
#runMeta { display:none !important; }
.details-head { display:flex !important; }
#detailsHint { display:none !important; }
#listWrap { display:flex; }
#toggleDetails { display:inline-flex; align-items:center; }
.summary-pane { padding: 12px; }
.summary-chip { min-height: 28px; padding: 0 10px; font-size: 11px; }
.top3 { padding-top: 0; }
.issue-list-wrap { min-height: 0; max-height: none; }
.app-column--stage { padding: 0 8px 110px; }
.preview-bg { min-height: 580px; border-radius: 24px; }
.upload-hint-card { min-width: 250px; max-width: 290px; padding: 18px 20px; }
.upload-hint-title { font-size: 15px; }
.upload-hint-sub { margin-top: 8px; font-size: 13px; }
.upload-hint-meta { margin-top: 8px; font-size: 11px; }
.notice-pill { top: 18px; padding: 10px 14px; font-size: 11px; }
.preview-bottom { align-items: center; }
.zoom-dock { padding: 8px 12px; }
#zoom { width: min(560px, 52vw); }
.zoom-label { font-size: 11px; }
.preview-tabs { gap: 10px; }
.soft-chip { min-height: 30px; padding: 0 10px; font-size: 11px; }
.soft-chip--primary { color: var(--text-soft); }
#previewSourceBadge { display:none !important; }
#previewStateBadge { display:none !important; }
.bottom-progress {
  position: sticky;
  left: auto;
  width: min(920px, calc(100% - 16px));
  bottom: 64px;
  margin: 0 auto;
  transform: none;
  z-index: 42;
  padding: 0;
  display: block;
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}
.bottom-progress.is-active { opacity: 1; }
#overlayToggleWrap { padding: 10px 12px; }
.action-row--two > * { min-width: 0; }
.action-stack > * + * { margin-top: 8px; }
.check-row--compact { align-items: center; }
.preview-wrap { background: transparent; }
.action-row .btn { font-size: 13px; }
#summaryTop3Wrap[style*='display:none'] + * { margin-top: 0; }
@media (max-width: 1280px) {
  .app-grid { grid-template-columns: 224px minmax(0, 1fr) 252px; gap: 10px; }
  .preview-bottom {
    width: calc(100% - 8px);
    bottom: 4px;
    margin-top: -80px;
  }
  .bottom-progress {
    width: calc(100% - 8px);
    bottom: 58px;
  }
  .preview-controls { grid-template-columns: 1fr; }
  .preview-controls .zoom-dock,
  .bottom-actions { grid-column: auto; }
  .bottom-actions { justify-content: flex-start; }
}


/* v8 layout fix: keep guide details scrollable and keep bottom bar inside stage */
.ft-card--guide {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.ft-card--guide .ft-card__body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.issue-list-wrap {
  flex: 1 1 auto;
  min-height: 180px !important;
  max-height: min(42vh, 420px) !important;
  overflow-y: auto !important;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.issue-list-wrap::-webkit-scrollbar { width: 10px; }
.issue-list-wrap::-webkit-scrollbar-thumb {
  background: rgba(215,163,61,0.28);
  border-radius: 999px;
}
.issue-list-wrap::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.04);
}
.app-column--left,
.app-column--right {
  padding-bottom: 8px;
}
.app-column--stage {
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 0 8px 16px !important;
}
.preview-wrap {
  min-height: 0;
}
.preview-bottom {
  position: static !important;
  bottom: auto !important;
  left: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  margin: 12px 0 0 !important;
  z-index: 5;
  overflow: hidden;
}
.preview-tabs {
  flex-wrap: wrap;
}
.preview-controls {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}
.preview-controls .zoom-dock {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}
#zoom {
  width: 100% !important;
  max-width: none;
}
.bottom-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  grid-column: auto;
}
.btn-reset {
  min-width: 64px;
  min-height: 30px;
  padding: 6px 10px;
}
.btn-download {
  min-width: 124px;
  min-height: 30px;
  padding: 6px 12px;
}
.bottom-progress {
  display: none !important;
}
@media (max-width: 1280px) {
  .preview-controls {
    flex-wrap: wrap;
    align-items: stretch;
  }
  .preview-controls .zoom-dock {
    flex-basis: 100%;
  }
  .bottom-actions {
    width: 100%;
    justify-content: flex-end;
  }
}


/* v9 rollback: keep guide card visible in left column */
.app-column--left {
  overflow-y: auto;
  overflow-x: hidden;
}
.ft-card--guide {
  flex: 0 0 auto;
  min-height: 0;
}
#pfBody {
  flex: 0 0 auto;
  min-height: 0;
}
.issue-list-wrap {
  display: block !important;
  flex: 1 1 auto;
  min-height: 0 !important;
  height: 100%;
  max-height: none !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
}
.issue-list {
  min-width: 0;
}

.preview-bottom {
  align-self: center;
  width: calc(100% - 24px) !important;
  max-width: 820px !important;
  min-width: 0;
  margin: 10px auto 0 !important;
  padding: 8px 10px !important;
  border-radius: 14px;
}
.preview-tabs,
.preview-controls,
.zoom-dock {
  min-width: 0;
}
.preview-controls {
  gap: 8px !important;
}
.zoom-dock {
  padding: 6px 10px !important;
}
.bottom-actions {
  flex: 0 0 auto;
  max-width: 100%;
}
.btn-reset {
  min-width: 58px;
  min-height: 30px;
  padding: 6px 10px;
}
.btn-download {
  min-width: 110px;
  min-height: 30px;
  padding: 6px 12px;
}

@media (max-width: 1280px) {
  .preview-bottom {
    width: calc(100% - 16px) !important;
    max-width: 720px !important;
  }
}

/* v10: narrow-browser resilient layout (desktop windows, not only phones) */
@media (max-width: 1280px) {
  .app-grid {
    grid-template-columns: 210px minmax(0, 1fr) 236px !important;
    gap: 8px !important;
  }
  .app-column--stage {
    padding: 0 6px 14px !important;
  }
  .preview-bottom {
    max-width: 760px !important;
  }
}

@media (max-width: 1024px) {
  .app-grid {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "stage"
      "right"
      "left" !important;
    height: auto !important;
    min-height: calc(100vh - 12px) !important;
  }
  .app-column--stage {
    grid-area: stage !important;
    border: 0 !important;
    padding: 0 4px 14px !important;
  }
  .app-column--right {
    grid-area: right !important;
  }
  .app-column--left {
    grid-area: left !important;
    overflow: visible !important;
  }
  .ft-card--guide {
    min-height: 260px !important;
  }
  .issue-list-wrap {
    max-height: min(36vh, 320px) !important;
  }
  .preview-bottom {
    width: calc(100% - 8px) !important;
    max-width: 100% !important;
    margin-top: 8px !important;
  }
  .preview-controls {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .preview-controls .zoom-dock {
    flex-basis: 100% !important;
    width: 100% !important;
  }
  #zoom {
    width: 100% !important;
  }
  .bottom-actions {
    width: 100%;
    justify-content: flex-end !important;
  }
}

/* v11 rollback: keep layout natural, allow page-level scroll */
.app-grid {
  height: auto !important;
  min-height: calc(100vh - 20px) !important;
  align-items: start;
}
.app-column--left,
.app-column--right {
  min-height: 0;
  max-height: none !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* v12: keep center column at maximum viewport height */
@media (min-width: 1025px) {
  .ft-app {
    height: 100vh;
    overflow: hidden;
  }
  .app-grid {
    height: calc(100vh - 20px) !important;
    min-height: calc(100vh - 20px) !important;
  }
  .app-column--left,
  .app-column--right {
    height: calc(100vh - 20px) !important;
    max-height: calc(100vh - 20px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: thin;
  }
  .app-column--left {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    gap: 12px;
    overflow: hidden !important;
  }
  .app-column--right {
    overflow: hidden !important;
  }
  .ft-card--halftone {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
  }
  .ft-card--halftone .ft-card__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
  }
  /* Reduce visual noise: show scrollbars only on hover */
  .preview-wrap,
  #pfBody,
  .ft-card--halftone .ft-card__body {
    scrollbar-width: none;
  }
  .preview-wrap::-webkit-scrollbar,
  #pfBody::-webkit-scrollbar,
  .ft-card--halftone .ft-card__body::-webkit-scrollbar {
    width: 0;
    height: 0;
  }
  #pfBody:hover,
  .ft-card--halftone .ft-card__body:hover {
    scrollbar-width: thin;
  }
  #pfBody:hover::-webkit-scrollbar,
  .ft-card--halftone .ft-card__body:hover::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  #pfBody:hover::-webkit-scrollbar-thumb,
  .ft-card--halftone .ft-card__body:hover::-webkit-scrollbar-thumb {
    background: rgba(215,163,61,0.30);
    border-radius: 999px;
  }
  #pfBody:hover::-webkit-scrollbar-track,
  .ft-card--halftone .ft-card__body:hover::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.04);
  }
  .ft-card--setup {
    flex: 0 0 auto;
  }
  .ft-card--guide {
    display: flex;
    flex-direction: column;
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow: hidden;
  }
  #pfBody {
    display: block !important;
    min-height: 0 !important;
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
  }
  .issue-list-wrap {
    flex: 0 0 auto;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .app-column--stage {
    height: calc(100vh - 20px) !important;
    min-height: calc(100vh - 20px) !important;
    padding-bottom: 110px !important;
    overflow: hidden;
  }
  .preview-wrap {
    height: 100% !important;
    min-height: 0 !important;
    overflow: auto !important;
  }
  .preview-bottom {
    position: fixed !important;
    left: 276px !important;
    right: 308px !important;
    bottom: 8px !important;
    transform: none !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    z-index: 60 !important;
  }
}

@media (min-width: 1025px) and (max-width: 1280px) {
  .preview-bottom {
    left: 252px !important;
    right: 280px !important;
  }
}
