/* AppShotFlow — light-table dark UI.
   Tokens: ink (app bg) · panel · seam (borders) · paper (text) · dim · signal (orange) */

:root {
  --ink: #0e0f12;
  --panel: #16171c;
  --panel-2: #1c1d24;
  --seam: #272932;
  --paper: #e9eaee;
  --dim: #8a8f9a;
  --signal: #ff8a3d;
  --signal-press: #ff7a22;
  --signal-ink: #20120a;
  --radius: 10px;
  --font-ui: 'Inter', 'Segoe UI', 'Malgun Gothic', system-ui, sans-serif;
  --font-brand: 'Space Grotesk', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--paper);
  background: var(--ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

/* text fields stay selectable/editable */
input, textarea {
  -webkit-user-select: text;
  user-select: text;
}

img, canvas {
  -webkit-user-drag: none;
}

button, input, select, textarea, output {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

/* ---------- topbar ---------- */

.topbar {
  height: 58px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  border-bottom: 1px solid var(--seam);
  background: var(--panel);
}

.brand {
  flex: 0 0 auto;
  color: inherit;
  text-decoration: none;
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}

.brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--signal);
  transform: rotate(-8deg);
}

.topbar-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}

.project-name {
  flex: 0 1 150px;
  min-width: 76px;
  padding: 7px 10px;
  background: var(--ink);
  border: 1px solid var(--seam);
  border-radius: var(--radius);
  color: var(--paper);
}

.project-name::placeholder { color: var(--dim); }

.size-select {
  flex: 0 1 230px;
  width: 230px;
  min-width: 160px;
  padding: 7px 10px;
  background: var(--ink);
  border: 1px solid var(--seam);
  border-radius: var(--radius);
  color: var(--paper);
  cursor: pointer;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.autosave-state {
  max-width: 150px;
  overflow: hidden;
  color: var(--dim);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.autosave-state.is-saving { color: #e4b569; }
.autosave-state.is-saved { color: #8fcfae; }
.btn-icon { width: 34px; padding-inline: 0; }

/* ---------- buttons ---------- */

.btn {
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.btn-primary {
  background: linear-gradient(180deg, #ffa35c, var(--signal-press));
  color: var(--signal-ink);
}

.btn-primary:hover { background: var(--signal-press); }

.btn-ghost {
  background: transparent;
  border-color: var(--seam);
  color: var(--paper);
}

.btn-ghost:hover { border-color: #3a3d49; background: var(--panel-2); }

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
  border-radius: var(--radius);
}

/* ---------- workspace layout ---------- */

.workspace {
  flex: 1;
  display: flex;
  min-height: 0;
}

.panel {
  background: var(--panel);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--seam) transparent;
}

.slides-panel {
  flex: 0 0 168px;
  border-right: 1px solid var(--seam);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-slides-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 18px;
  margin-bottom: 9px;
}

.sidebar-slides-head .group-title { margin: 0; }
.sidebar-slides-head .sidebar-gallery-count {
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector {
  flex: 0 0 280px;
  border-left: 1px solid var(--seam);
  padding: 0 16px 32px;
}

/* ---------- inspector tabs ---------- */

.tab-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--panel);
  margin: 0 -16px 18px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--seam);
}

.tabs {
  display: flex;
  background: var(--ink);
  border: 1px solid var(--seam);
  border-radius: var(--radius);
  padding: 3px;
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--dim);
  font-weight: 700;
  font-size: 12px;
  padding: 7px 4px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.tab:hover { color: var(--paper); }

.tab.active {
  background: var(--panel-2);
  color: var(--paper);
  box-shadow: inset 0 0 0 1px var(--seam);
}

.group {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--seam);
  margin-bottom: 20px;
}

.inspector .group:last-of-type { border-bottom: none; margin-bottom: 0; }

/* ---------- text color row ---------- */

.tc-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tc-auto {
  height: 26px;
  padding: 0 12px;
  border-radius: 13px;
  border: 1px solid var(--seam);
  background: var(--panel-2);
  color: var(--dim);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.tc-auto.active {
  border-color: var(--signal);
  color: var(--signal);
}

.tc-swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.tc-row input[type='color'] {
  width: 28px;
  height: 22px;
}

.tc-auto {
  height: 24px;
  padding: 0 10px;
  border-radius: 12px;
}

.tc-swatch:hover { transform: scale(1.1); }

.tc-swatch.active {
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--signal);
}

.group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 12px;
}

/* ---------- stage ---------- */

.stage {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
}

#main-canvas {
  max-width: 100%;
  max-height: 100%;
  touch-action: none;
  cursor: grab;
  border-radius: 12px;
  border: 1px solid var(--seam);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.drop-hint {
  position: absolute;
  inset: 16px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--signal);
  border-radius: 16px;
  background: rgba(14, 15, 18, 0.72);
  color: var(--signal);
  font-weight: 600;
  font-size: 15px;
  pointer-events: none;
}

.stage.dragging .drop-hint { display: flex; }

.stage-empty {
  position: absolute;
  z-index: 4;
  width: min(520px, calc(100% - 48px));
  padding: 38px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(28, 29, 36, 0.97), rgba(18, 19, 24, 0.97));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
  text-align: center;
}

.stage-empty[hidden] { display: none; }
.stage-empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  border-radius: 16px;
  background: rgba(255, 138, 61, 0.14);
  color: var(--signal);
  font-size: 28px;
}
.stage-empty-kicker {
  margin-bottom: 8px;
  color: var(--signal);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.stage-empty h1 {
  font-family: var(--font-brand);
  font-size: clamp(24px, 3vw, 38px);
  letter-spacing: -.035em;
}
.stage-empty > p:not(.stage-empty-kicker) {
  max-width: 420px;
  margin: 12px auto 0;
  color: var(--dim);
  line-height: 1.65;
}
.stage-empty-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}
.stage.is-empty #main-canvas { opacity: .12; filter: saturate(.4); }

/* ---------- slides list ---------- */

.slide-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.slide-item {
  position: relative;
  border: 1px solid var(--seam);
  border-radius: var(--radius);
  padding: 6px;
  display: flex;
  justify-content: center;
  cursor: pointer;
  background: var(--panel-2);
  transition: border-color 0.12s ease;
}

.slide-item:hover { border-color: #3a3d49; }

.slide-item.active {
  border-color: var(--signal);
  box-shadow: 0 0 0 1px var(--signal);
}

.slide-item canvas {
  border-radius: 6px;
  display: block;
  max-width: 100%;
  height: auto;
}

.slide-num {
  position: absolute;
  left: 10px;
  bottom: 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.45);
  padding: 2px 5px;
  border-radius: 5px;
}

.slide-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.slide-item:hover .slide-del,
.slide-del:focus-visible { opacity: 1; }

.slide-del:hover { background: rgba(217, 54, 54, 0.85); color: #fff; }

.slide-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity .12s ease;
}
.slide-item:hover .slide-actions,
.slide-item:focus-within .slide-actions { opacity: 1; }
.slide-action {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: rgba(0, 0, 0, .68);
  color: rgba(255,255,255,.84);
  cursor: pointer;
  font-size: 11px;
  line-height: 20px;
}
.slide-action:hover { color: #fff; background: rgba(255,138,61,.82); }
.slide-action.danger:hover { background: rgba(217,54,54,.9); }
.slide-item.drag-before { box-shadow: 0 -3px 0 var(--signal); }
.slide-item.drag-after { box-shadow: 0 3px 0 var(--signal); }

.privacy-note {
  margin-top: auto;
  padding-top: 12px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--dim);
}

/* ---------- project gallery entry (left rail) ---------- */

.sidebar-gallery {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--seam);
}

.sidebar-gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.sidebar-gallery-head .group-title { margin: 0; }

.sidebar-gallery-count {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--dim);
  font-size: 9px;
  font-weight: 700;
}

.gallery-open-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--seam);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--paper);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.gallery-open-btn:hover,
.gallery-open-btn:focus-visible {
  border-color: var(--signal);
  outline: none;
  transform: translateY(-1px);
}

.gallery-open-btn > span:last-child { min-width: 0; }
.gallery-open-btn strong { display: block; font-size: 11px; }
.gallery-open-btn small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--dim);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-open-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 8px;
  background: rgba(255, 138, 61, 0.14);
  color: var(--signal);
  font-size: 17px;
}

.gallery-quick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-top: 7px;
}

.gallery-quick:empty { display: none; }

.gallery-quick-tile {
  min-width: 0;
  height: 58px;
  padding: 3px;
  border: 1px solid var(--seam);
  border-radius: 7px;
  background: var(--ink);
  cursor: grab;
}

.gallery-quick-tile:hover,
.gallery-quick-tile:focus-visible { border-color: var(--signal); outline: none; }

.gallery-quick-tile img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 4px;
  object-fit: cover;
}

/* ---------- templates ---------- */

.tpl-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

/* landscape (feature-graphic) previews need wider cells */
.tpl-grid-wide { grid-template-columns: repeat(2, 1fr); }

.tpl {
  padding: 0;
  border: 1px solid var(--seam);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: var(--ink);
  line-height: 0;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.tpl:hover {
  border-color: var(--signal);
  transform: translateY(-2px);
}

.tpl canvas {
  width: 100%;
  height: auto;
  display: block;
}

.tpl-name {
  display: block;
  padding: 5px 3px 6px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tpl:hover .tpl-name { color: var(--paper); }

/* ---------- copy suggestions ---------- */

.suggest-panel {
  margin-top: 8px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--seam);
  border-radius: var(--radius);
}

.suggest-panel > input {
  width: 100%;
  padding: 8px 10px;
  background: var(--ink);
  border: 1px solid var(--seam);
  border-radius: 8px;
  color: var(--paper);
  margin-bottom: 8px;
}

.suggest-panel > input::placeholder { color: #565b66; }

.suggest-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--seam) transparent;
}

.suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  background: var(--ink);
  border: 1px solid var(--seam);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.12s ease;
}

.suggest-item:hover { border-color: var(--signal); }

.suggest-item b {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
}

.suggest-item span {
  display: block;
  font-size: 11px;
  color: var(--dim);
  margin-top: 2px;
}

/* ---------- Gemini autopilot ---------- */

#ai-group {
  border-color: rgba(255, 138, 61, 0.34);
  background: linear-gradient(180deg, rgba(255, 138, 61, 0.045), transparent 76%);
}

#ai-group .field { margin-bottom: 9px; }
#ai-group .btn-row .btn:first-child { flex: 1.25; }

.ai-privacy {
  margin-top: 9px;
  line-height: 1.5;
}

.ai-status {
  min-height: 15px;
  margin: 8px 0 0;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.45;
}

.ai-status.is-error { color: #ff8585; }
.ai-status.is-success { color: #8fcfae; }

.ai-result {
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(143, 207, 174, 0.24);
  border-radius: var(--radius);
  background: rgba(143, 207, 174, 0.05);
}

.ai-result strong,
.ai-result span { display: block; }
.ai-result strong { color: var(--paper); font-size: 11px; }
.ai-result span { margin-top: 3px; color: var(--dim); font-size: 10px; line-height: 1.4; }

.btn.is-loading { opacity: 0.68; cursor: wait; }

/* ---------- phone actions ---------- */

.btn-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.btn-row .btn {
  flex: 1;
  padding: 6px 6px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.hint {
  font-size: 11px;
  line-height: 1.5;
  color: var(--dim);
  margin-top: 8px;
}

/* ---------- fields ---------- */

.field {
  display: block;
  margin-bottom: 10px;
}

.field > span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--dim);
  margin-bottom: 5px;
}

.field textarea,
.field input:not([type='range']):not([type='color']):not([type='checkbox']) {
  width: 100%;
  padding: 8px 10px;
  background: var(--ink);
  border: 1px solid var(--seam);
  border-radius: var(--radius);
  color: var(--paper);
  resize: vertical;
}

.field textarea::placeholder,
.field input::placeholder { color: #565b66; }

.field select {
  width: 100%;
  padding: 8px 10px;
  background: var(--ink);
  border: 1px solid var(--seam);
  border-radius: var(--radius);
  color: var(--paper);
  cursor: pointer;
}

.img-name {
  font-size: 11px;
  color: var(--dim);
  margin: 8px 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.capture-cleaner {
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid var(--seam);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.018);
}

.capture-cleaner .btn-row { margin-bottom: 8px; }
.capture-cleaner .hint { margin-bottom: 0; }

/* ---------- segmented controls ---------- */

.seg {
  position: relative; /* keeps the hidden radios anchored inside — without this, focusing them scrolls the whole page */
  display: flex;
  background: var(--ink);
  border: 1px solid var(--seam);
  border-radius: var(--radius);
  padding: 3px;
  margin-bottom: 10px;
}

.seg label { flex: 1; }

.seg input { position: absolute; opacity: 0; pointer-events: none; }

.seg span {
  display: block;
  text-align: center;
  padding: 6px 4px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--dim);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.seg span:hover { color: var(--paper); }

.seg input:checked + span {
  background: var(--panel-2);
  color: var(--paper);
  box-shadow: inset 0 0 0 1px var(--seam);
}

.seg input:focus-visible + span {
  outline: 2px solid var(--signal);
  outline-offset: 1px;
}

/* ---------- sliders ---------- */

.slider-field {
  display: grid;
  grid-template-columns: 58px 1fr 42px;
  align-items: center;
  gap: 8px;
}

.slider-field > span { margin-bottom: 0; }

.slider-field output {
  font-size: 11px;
  color: var(--dim);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

input[type='range'] {
  width: 100%;
  accent-color: var(--signal);
  cursor: pointer;
}

input[type='checkbox'] {
  accent-color: var(--signal);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ---------- background controls ---------- */

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.swatch {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.swatch:hover { transform: scale(1.08); }

.swatch.active {
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--signal);
}

.color-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.color-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--dim);
}

input[type='color'] {
  width: 30px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--seam);
  border-radius: 7px;
  background: var(--ink);
  cursor: pointer;
}

input[type='color']:disabled { opacity: 0.35; cursor: not-allowed; }

.angle-field {
  flex: 1;
  grid-template-columns: 38px 1fr 38px;
  margin-bottom: 0;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--paper);
  cursor: pointer;
  margin-bottom: 4px;
}

/* ---------- languages (Pro) ---------- */

.pro-tag,
.owner-tag,
.free-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--signal);
  border: 1px solid rgba(255, 138, 61, 0.5);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: 1px;
}

.owner-tag { color: #77c6ff; border-color: rgba(119,198,255,.48); }
.free-tag { color: #8fcfae; border-color: rgba(143,207,174,.45); }

.lang-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.lang-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--seam);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: var(--panel-2);
  color: var(--dim);
}

.lang-chip.active {
  border-color: var(--signal);
  color: var(--signal);
}

.lang-chip::before {
  content: '';
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border-radius: 50%;
  background: #4dc98b;
}

.lang-chip.incomplete::before { background: #f0ad4e; }

.lang-chip .chip-x {
  border: none;
  background: none;
  color: var(--dim);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  line-height: 1;
}

.lang-chip .chip-x:hover { color: #ff6b6b; }

.lang-add-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.lang-add-row input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  background: var(--ink);
  border: 1px solid var(--seam);
  border-radius: var(--radius);
  color: var(--paper);
}

.locale-source-field { margin-bottom: 8px; }
.locale-preset-btn { margin-bottom: 9px; }

.locale-status {
  margin: 9px 0 0;
  color: #8fcfae;
  font-size: 10px;
  line-height: 1.45;
}

.locale-status.is-warning { color: #e4b569; }

.bulk-input {
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--ink);
  border: 1px solid var(--seam);
  border-radius: var(--radius);
  color: var(--paper);
  font-size: 11px;
  resize: vertical;
}

/* ---------- reusable image gallery ---------- */

.gallery-empty {
  margin: 10px 0 2px;
  padding: 12px 8px;
  border: 1px dashed var(--seam);
  border-radius: var(--radius);
  color: var(--dim);
  font-size: 11px;
  text-align: center;
}

.asset-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 280px;
  overflow-y: auto;
}

.asset-tile {
  position: relative;
  min-width: 0;
  padding: 5px;
  border: 1px solid var(--seam);
  border-radius: 9px;
  background: var(--ink);
  cursor: grab;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.asset-tile:hover,
.asset-tile:focus-visible {
  border-color: var(--signal);
  outline: none;
  transform: translateY(-1px);
}

.asset-tile:active { cursor: grabbing; }

.asset-tile img {
  display: block;
  width: 100%;
  height: 86px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--panel-2);
}

.asset-tile > span {
  display: block;
  padding: 5px 2px 1px;
  overflow: hidden;
  color: var(--dim);
  font-size: 9px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(14, 15, 18, 0.78);
  color: #fff;
  cursor: pointer;
  line-height: 17px;
}

.drop-overlay[hidden],
.app-toast[hidden] { display: none; }

.drop-overlay {
  position: fixed;
  inset: 12px;
  z-index: 120;
  display: grid;
  place-items: center;
  border: 2px dashed var(--signal);
  border-radius: 18px;
  background: rgba(14, 15, 18, 0.9);
  color: var(--paper);
  font-size: clamp(18px, 3vw, 32px);
  font-weight: 700;
  pointer-events: none;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 140;
  max-width: min(520px, calc(100vw - 32px));
  padding: 11px 16px;
  border: 1px solid rgba(77, 201, 139, 0.45);
  border-radius: 999px;
  background: rgba(20, 25, 23, 0.96);
  color: #dff8e9;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
  font-size: 12px;
  text-align: center;
  transform: translateX(-50%);
}

.app-toast.error {
  border-color: rgba(255, 138, 61, 0.55);
  background: rgba(43, 25, 19, 0.97);
  color: #ffe1cd;
}

/* ---------- store preview modal ---------- */

.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  padding: 24px;
}

/* ---------- large project gallery modal ---------- */

.gallery-card {
  position: relative;
  width: min(1180px, 100%);
  height: min(820px, 92vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  color: var(--paper);
  border: 1px solid var(--seam);
  border-radius: 20px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58);
}

.gallery-shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}

.gallery-app-sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  overflow-y: auto;
  border-right: 1px solid var(--seam);
  background: rgba(12,13,16,.42);
}

.gallery-sidebar-title-row,
.gallery-selection-bar,
.gallery-footer,
.ai-review-head,
.ai-review-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gallery-sidebar-title-row { justify-content: space-between; }
.gallery-mini-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--seam);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--paper);
  cursor: pointer;
}
.gallery-mini-btn:hover { border-color: var(--signal); color: var(--signal); }
.gallery-app-create { display: grid; gap: 6px; }
.gallery-app-create[hidden] { display: none; }
.gallery-app-create input,
.gallery-search-field input,
.gallery-toolbar select,
.gallery-selection-bar select,
.campaign-bar select,
.gallery-app-select {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--seam);
  border-radius: 9px;
  background: var(--ink);
  color: var(--paper);
}
.gallery-app-select { display: none; }
.gallery-app-list { display: grid; gap: 6px; }
.gallery-app-item {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--dim);
  text-align: left;
  cursor: pointer;
}
.gallery-app-item strong { overflow: hidden; color: inherit; text-overflow: ellipsis; }
.gallery-app-item span { font-size: 10px; }
.gallery-app-item:hover { background: var(--panel-2); color: var(--paper); }
.gallery-app-item.active { border-color: rgba(255,138,61,.5); background: rgba(255,138,61,.1); color: var(--signal); }
.gallery-app-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.gallery-app-actions .btn { min-width: 0; padding-inline: 7px; font-size: 10px; }
.btn.danger { color: #e99898; }
.btn.danger:hover { border-color: rgba(217,54,54,.65); background: rgba(217,54,54,.1); }

.folder-card {
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--seam);
  border-radius: 12px;
  background: var(--panel-2);
}
.folder-card strong { font-size: 11px; }
.folder-card p { margin: 5px 0 10px; color: var(--dim); font-size: 10px; line-height: 1.4; }
.folder-card .btn + .btn { margin-top: 6px; }
.storage-meter { color: var(--dim); font-size: 9px; }
.storage-meter > div { display: flex; justify-content: space-between; gap: 8px; }
.storage-meter > span { display: block; height: 4px; margin-top: 6px; overflow: hidden; border-radius: 999px; background: var(--seam); }
.storage-meter i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--signal); transition: width .2s ease; }

.gallery-main { min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.gallery-main .gallery-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px auto;
  gap: 9px;
  align-items: end;
  padding: 14px 18px 10px;
}
.gallery-main .field { margin: 0; }
.campaign-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 18px 10px;
}
.campaign-bar > div { display: flex; align-items: center; gap: 7px; color: var(--dim); font-size: 10px; }
.campaign-bar select { width: 180px; padding-block: 7px; }
.campaign-bar .gallery-modal-hint { flex: 1; margin: 0 0 0 6px; padding: 0; }
.gallery-selection-bar {
  min-height: 42px;
  padding: 8px 18px;
  border-block: 1px solid var(--seam);
  background: rgba(255,255,255,.018);
  font-size: 10px;
}
.gallery-selection-bar label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.gallery-selection-bar strong { color: var(--signal); }
.gallery-selection-bar select { width: 150px; padding-block: 6px; }
.gallery-selection-bar .btn { padding: 6px 10px; font-size: 10px; }
.gallery-spacer { flex: 1; }
.gallery-main .gallery-storage-note { margin: 10px 18px; }
.gallery-main .gallery-modal-empty { margin-inline: 18px; }
.gallery-main .gallery-modal-grid {
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  align-content: start;
  flex: 1;
  padding: 0 18px 14px;
}
.gallery-modal-grid .asset-tile { min-height: 212px; }
.asset-tile.selected { border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal); }
.asset-select-check {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 7px;
  background: rgba(14,15,18,.82);
  color: transparent;
  font-weight: 800;
}
.asset-tile.selected .asset-select-check { border-color: var(--signal); background: var(--signal); color: var(--signal-ink); }
.asset-meta { display: flex !important; justify-content: space-between; gap: 4px; }
.asset-meta small { color: #666b76; }
.asset-warning { color: #e4b569 !important; }

.gallery-footer {
  justify-content: space-between;
  min-height: 58px;
  padding: 10px 18px;
  border-top: 1px solid var(--seam);
  background: rgba(12,13,16,.55);
  color: var(--dim);
  font-size: 10px;
}
.gallery-footer > div { display: flex; gap: 7px; }
.ai-campaign-review {
  position: absolute;
  z-index: 8;
  inset: 72px 24px 20px 254px;
  overflow-y: auto;
  padding: 20px;
  border: 1px solid rgba(119,198,255,.35);
  border-radius: 16px;
  background: rgba(19,21,27,.985);
  box-shadow: 0 24px 80px rgba(0,0,0,.65);
}
.ai-campaign-review[hidden] { display: none; }
.ai-review-head { justify-content: space-between; }
.ai-review-head h3 { margin-top: 3px; font-size: 20px; }
.ai-campaign-summary { margin: 15px 0; padding: 12px; border-radius: 10px; background: rgba(119,198,255,.07); color: #bdddf4; line-height: 1.5; }
.ai-campaign-list { display: grid; gap: 8px; padding: 0; list-style: none; counter-reset: campaign; }
.ai-campaign-list li { counter-increment: campaign; display: grid; grid-template-columns: 32px 90px 1fr auto; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--seam); border-radius: 10px; }
.ai-campaign-list li::before { content: counter(campaign, decimal-leading-zero); color: var(--signal); font-weight: 800; }
.ai-campaign-list img { width: 90px; height: 74px; border-radius: 7px; object-fit: contain; background: var(--ink); }
.ai-campaign-list strong { display: block; }
.ai-campaign-list p { margin-top: 3px; color: var(--dim); font-size: 10px; }
.ai-evidence { color: #8fcfae; font-size: 10px; }
.ai-review-actions { justify-content: flex-end; margin-top: 18px; }

.desktop-notice { display: none; }

.gallery-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--seam);
}

.gallery-modal-head h2 { margin: 2px 0 0; font-size: 22px; }

.gallery-kicker {
  margin: 0;
  color: var(--signal);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gallery-close {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  border: 1px solid var(--seam);
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--paper);
  font-size: 20px;
  cursor: pointer;
}

.gallery-close:hover { border-color: var(--signal); color: var(--signal); }

.gallery-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.4fr) auto;
  align-items: end;
  gap: 10px;
  padding: 16px 24px 10px;
}

.gallery-app-field { margin: 0; }

.gallery-app-create {
  display: flex;
  gap: 7px;
}

.gallery-app-create input {
  min-width: 0;
  flex: 1;
  padding: 9px 11px;
  background: var(--ink);
  border: 1px solid var(--seam);
  border-radius: var(--radius);
  color: var(--paper);
}

.gallery-modal-hint {
  margin: 0;
  padding: 0 24px 12px;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.5;
}

.gallery-storage-note {
  margin: 0 24px 14px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 138, 61, 0.25);
  border-radius: 9px;
  background: rgba(255, 138, 61, 0.07);
  color: #e2b08d;
  font-size: 10px;
  line-height: 1.45;
}

.gallery-modal-empty {
  margin: 16px 24px 24px;
  padding: 48px 16px;
}

.gallery-modal-grid {
  flex: 1;
  min-height: 0;
  max-height: none;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 12px;
  overflow-y: auto;
  padding: 0 24px 24px;
}

.gallery-modal-grid .asset-tile { padding: 7px; }
.gallery-modal-grid .asset-tile img {
  height: 180px;
  object-fit: contain;
}
.gallery-modal-grid .asset-tile > span { font-size: 10px; }

.sp-card {
  position: relative;
  width: min(420px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: #ffffff;
  color: #1b1c21;
  border-radius: 22px;
  padding: 22px 20px 26px;
  font-family: var(--font-ui);
}

.sp-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: #eef0f4;
  color: #555;
  font-size: 18px;
  cursor: pointer;
}

/* feature graphic shows as a full-width banner, like the real listing */
.sp-banner { margin: 10px 0 16px; }

.sp-banner canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid #e5e7ec;
}

.sp-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 6px 0 12px;
}

.sp-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ff8a3d, #d93636);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 24px;
  overflow: hidden;
  flex: 0 0 auto;
}

.sp-icon canvas { width: 100%; height: 100%; display: block; }

.sp-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.sp-title strong {
  font-size: 17px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-dev { font-size: 12px; color: #0b7a4b; }

.sp-install {
  background: #0b7a4b;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 22px;
  border-radius: 999px;
}

.sp-meta {
  font-size: 12px;
  color: #666;
  margin-bottom: 14px;
}

.sp-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.sp-strip canvas {
  height: 240px;
  width: auto;
  border-radius: 12px;
  border: 1px solid #e5e7ec;
  flex: 0 0 auto;
}

.sp-desc {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sp-desc span {
  height: 10px;
  border-radius: 5px;
  background: #eceef2;
}

.sp-desc .short { width: 55%; }

/* ---------- responsive ---------- */

@media (max-width: 1450px) {
  .topbar { gap: 10px; padding-inline: 10px; }
  .topbar-actions { gap: 5px; }
  .topbar-actions .btn { padding-inline: 12px; }
  .autosave-state { display: none; }
  .size-select { width: 190px; min-width: 150px; }
}

@media (max-width: 1180px) {
  #btn-export { display: none; }
  .project-name { flex-basis: 120px; }
  .size-select { width: 165px; min-width: 135px; }
}

@media (max-width: 920px) {
  body { overflow: auto; }
  .workspace { flex-direction: column; }
  .stage { min-height: 420px; }
  .slides-panel {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--seam);
    overflow-x: auto;
  }
  .slide-list { flex-direction: row; }
  .sidebar-gallery {
    min-width: 170px;
    margin: 0;
    padding: 0 0 0 12px;
    border-top: none;
    border-left: 1px solid var(--seam);
  }
  .gallery-quick { display: none; }
  .privacy-note { display: none; }
  .inspector {
    flex: 0 0 auto;
    border-left: none;
    border-top: 1px solid var(--seam);
  }
  .topbar-center { justify-content: flex-start; }
  .gallery-main .gallery-toolbar { grid-template-columns: 1fr; align-items: stretch; }
  .gallery-card { height: min(820px, 94vh); }
  .gallery-shell { grid-template-columns: 180px minmax(0,1fr); }
  .campaign-bar { align-items: flex-start; flex-wrap: wrap; }
  .campaign-bar .gallery-modal-hint { flex-basis: 100%; margin-left: 0; }
  .gallery-selection-bar select,
  .gallery-selection-bar #btn-gallery-move { display: none; }
  .ai-campaign-review { left: 196px; }
  .gallery-modal-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .gallery-modal-grid .asset-tile img { height: 150px; }
}

@media (max-width: 760px) {
  .desktop-notice:not([hidden]) {
    position: fixed;
    z-index: 200;
    right: 12px;
    bottom: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 13px 16px;
    border: 1px solid rgba(255,138,61,.45);
    border-radius: 12px;
    background: rgba(24,19,16,.97);
    box-shadow: 0 16px 42px rgba(0,0,0,.45);
    color: var(--paper);
  }
  .desktop-notice span { color: var(--dim); font-size: 11px; }
  .topbar-center { display: none; }
  .autosave-state,
  #btn-undo,
  #btn-redo { display: none; }
  .gallery-shell { grid-template-columns: 1fr; overflow-y: auto; }
  .gallery-app-sidebar { border-right: 0; border-bottom: 1px solid var(--seam); }
  .gallery-app-list { grid-template-columns: repeat(auto-fit,minmax(130px,1fr)); }
  .folder-card { margin-top: 0; }
  .gallery-main { overflow: visible; }
  .ai-campaign-review { inset: 64px 12px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
