/* Browser tool pages — scoped styles loaded only on /tools/<browser-tool>/
 *
 * Variables are scoped to .tool so the design tokens never leak into
 * marketing pages, the help center, or the blog. The original standalone
 * shell's body/header/footer chrome (.tool-page-header, .tool-page-main,
 * .tool-page-footer, .tool-page-index*) is gone — the website provides
 * navbar/footer through its standard content-page pipeline.
 */

.tool {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #5e5e5e;
  --border: #e5e5e5;
  --accent: #ff5a36;
  --accent-fg: #ffffff;
  --max: 720px;
  --radius: 8px;
  --gap: 1rem;
  max-width: var(--max);
  margin: 2rem auto 0;
  color: var(--fg);
  line-height: 1.5;
}

/* The grid maker needs room for its editor + phone-preview split. */
.tool:has(.grid-gen__layout) {
  max-width: 1040px;
}

@media (max-width: 640px) {
  .tool {
    margin-top: 1.25rem;
  }
}

.tool a {
  color: var(--accent);
  text-decoration: none;
}

.tool a:hover {
  text-decoration: underline;
}

.tool-handoff {
  margin-top: 3rem;
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafafa;
}

.tool-handoff__headline {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--fg);
}

.tool-handoff__body {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

.tool-handoff__cta {
  display: inline-block;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  transition: border-color 120ms ease, color 120ms ease;
}

.tool-handoff__cta:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

.tool-handoff__fine {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
}


.tool__header {
  max-width: 640px;
  margin: 0 0 1.75rem;
}

.tool h1,
.tool__title {
  font-size: 2.25rem;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin: 0 0 0.625rem;
}

@media (min-width: 768px) {
  .tool h1,
  .tool__title {
    font-size: 2.5rem;
  }
}

.tool__lede {
  color: var(--muted);
  font-size: 1.0625rem;
  line-height: 1.55;
  margin: 0;
}

.tool__app {
  position: relative;
  margin: 0 0 2rem;
  padding: 1.75rem 1.5rem;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 14px;
}

@media (max-width: 640px) {
  .tool__app {
    padding: 1.25rem 1rem;
    border-radius: 12px;
  }
}

.tool__video {
  display: block;
  width: 100%;
  max-height: 60vh;
  background: #000;
  border-radius: var(--radius);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
}

.tool__video--empty {
  display: none;
}

.tool__inner {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.tool__btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  font: inherit;
  cursor: pointer;
}

.tool__btn:hover {
  border-color: var(--accent);
}

.tool__btn--primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.tool__btn[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}

.tool__spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: tool__spinner-rotate 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: 0.5rem;
}

@keyframes tool__spinner-rotate {
  to { transform: rotate(360deg); }
}

.tool__playback {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 0.25rem;
}

.tool__play-btn {
  appearance: none;
  border: none;
  background: var(--fg);
  color: var(--bg);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease;
}

.tool__play-btn:hover {
  background: var(--accent);
  transform: scale(1.04);
}

.tool__time-display {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.9rem;
}

.tool__time-display strong {
  color: var(--fg);
  font-weight: 600;
}

.tool__range-display {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.8125rem;
  margin-left: auto;
}

.tool__timeline {
  position: relative;
  height: 56px;
  user-select: none;
  touch-action: none;
  cursor: pointer;
}

.tool__timeline-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 14px;
  background: var(--border);
  border-radius: 7px;
  pointer-events: none;
}

.tool__timeline-fill {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 14px;
  background: var(--accent);
  opacity: 0.35;
  border-radius: 7px;
  pointer-events: none;
}

.tool__timeline-handle {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 36px;
  margin-left: -7px;
  background: var(--accent);
  border: 2px solid var(--bg);
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  cursor: ew-resize;
  transform: translateY(-50%);
  z-index: 2;
}

.tool__timeline-handle:hover,
.tool__timeline-handle:active {
  background: #ff7350;
}

.tool__timeline-playhead {
  position: absolute;
  top: 50%;
  width: 4px;
  height: 48px;
  margin-left: -2px;
  background: var(--fg);
  border-radius: 2px;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 1;
}

.tool__timeline-playhead::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  background: var(--fg);
  border-radius: 50%;
}

.tool__status {
  margin: 0;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: #f5f5f5;
}

.tool__status--error {
  background: #ffe9e3;
  color: #a23215;
}

.tool__status--done {
  background: #e6f5ea;
  color: #1f7a3a;
}

.tool__mode-toggle {
  display: flex;
  width: fit-content;
  margin: 0.25rem auto;
  background: #f0f0f0;
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}

.tool__mode-toggle button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tool__mode-toggle button:hover:not(.is-active) {
  color: var(--fg);
}

.tool__mode-toggle button.is-active {
  background: #fff;
  color: var(--fg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 500;
}

.tool__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: #dbdbdb;
  padding: 1px;
  border-radius: 6px;
  max-width: 540px;
  width: 100%;
  margin: 0.25rem auto;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.tool__grid-cell {
  position: relative;
  /* Instagram's profile grid crops each 4:5 post to ~3:4, so the preview
     uses 3:4 cells with object-fit: cover — the sides of the 4:5 image
     get clipped exactly as they will on the profile. */
  aspect-ratio: 3 / 4;
  background: #f5f5f5;
  overflow: hidden;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.tool__grid-cell:hover {
  opacity: 0.85;
}

.tool__grid--empty {
  background: var(--border);
  box-shadow: none;
}

.tool__grid-cell--empty {
  background:
    repeating-linear-gradient(135deg,
      #f7f7f7 0 10px,
      #f1f1f1 10px 20px);
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool__grid-cell--empty:hover {
  opacity: 1;
}

.tool__grid-cell--empty .tool__grid-badge {
  position: static;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: #b8b8b8;
  font-size: 1.1rem;
  font-weight: 500;
  padding: 0;
  letter-spacing: 0;
}

.tool__grid-cell--empty:hover .tool__grid-badge {
  background: transparent;
}

.tool__grid-cell:hover .tool__grid-badge {
  background: var(--accent);
}

.tool__grid-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.tool__grid-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  letter-spacing: 0.02em;
  transition: background 0.15s ease;
}

.tool__hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  text-align: center;
  max-width: 540px;
  align-self: center;
}

.tool__slide-count {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.tool__slide-count .tool__btn {
  width: 2.5rem;
  padding: 0.4rem 0;
  font-size: 1.1rem;
  line-height: 1;
  text-align: center;
}

.tool__slide-count-label {
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  min-width: 5rem;
  text-align: center;
  color: var(--muted);
}

.tool__carousel {
  display: flex;
  gap: 6px;
  margin: 0.25rem auto;
  background: #dbdbdb;
  padding: 6px;
  border-radius: 6px;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
}

.tool__carousel--vertical {
  flex-direction: column;
  max-width: 280px;
  width: 100%;
}

.tool__carousel--horizontal {
  flex-direction: row;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tool__carousel-cell {
  position: relative;
  background: #f5f5f5;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.tool__carousel--vertical .tool__carousel-cell {
  width: 100%;
}

.tool__carousel--horizontal .tool__carousel-cell {
  height: 320px;
}

.tool__carousel-cell:hover {
  opacity: 0.88;
}

.tool__carousel-cell:hover .tool__grid-badge {
  background: var(--accent);
}

.tool__carousel-img {
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.tool__carousel--vertical .tool__carousel-img {
  width: 100%;
  height: auto;
}

.tool__carousel--horizontal .tool__carousel-img {
  height: 100%;
  width: auto;
}

.tool__carousel--empty {
  background: var(--border);
  box-shadow: none;
}

.tool__carousel-cell--empty {
  aspect-ratio: 4 / 5;
  background:
    repeating-linear-gradient(135deg,
      #f7f7f7 0 10px,
      #f1f1f1 10px 20px);
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool__carousel-cell--empty:hover {
  opacity: 1;
}

.tool__carousel-cell--empty .tool__grid-badge {
  position: static;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: #b8b8b8;
  font-size: 1.1rem;
  font-weight: 500;
  padding: 0;
  letter-spacing: 0;
}

.tool__carousel-cell--empty:hover .tool__grid-badge {
  background: transparent;
}

.tool__video--placeholder {
  aspect-ratio: 16 / 9;
  background: #111;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  max-height: 60vh;
}

.tool__video-placeholder-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #888;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 0.25rem;
}

.tool__video-placeholder-label {
  margin: 0;
  color: #888;
  font-size: 0.9rem;
}

.tool__timeline--empty {
  opacity: 0.55;
  cursor: default;
}

/* -------- instagram bio generator -------- */

.bio__section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bio__label {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 500;
}

.bio__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.bio__chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.bio__chip:hover {
  border-color: var(--accent);
}

.bio__chip.is-active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.bio__editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.bio__line-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bio__line-controls .tool__btn {
  width: 2rem;
  padding: 0.3rem 0;
  font-size: 1rem;
  line-height: 1;
  text-align: center;
}

.bio__line-count {
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  color: var(--muted);
  min-width: 3.5rem;
  text-align: center;
}

.bio__lines {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.bio__line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.bio__line-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: #f0f0f0;
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.bio__line-input {
  appearance: none;
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s ease;
}

.bio__line-input:focus {
  outline: none;
  border-color: var(--accent);
}

.bio__picker-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.bio__tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8125rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.bio__tab:hover:not(.is-active) {
  color: var(--fg);
}

.bio__tab.is-active {
  background: #f0f0f0;
  color: var(--fg);
  font-weight: 500;
}

.bio__picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.5rem;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.bio__picker-btn {
  appearance: none;
  border: 1px solid transparent;
  background: var(--bg);
  color: var(--fg);
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.bio__picker-btn:hover {
  border-color: var(--accent);
  transform: scale(1.08);
}

.bio__counter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.bio__counter {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  color: var(--muted);
}

.bio__counter--over {
  color: #a23215;
  font-weight: 600;
}

.bio__preview {
  max-width: 380px;
  width: 100%;
  margin: 0.25rem auto;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
}

.bio__preview-head {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 0.9rem;
}

.bio__preview-avatar {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background:
    linear-gradient(45deg,
      #feda75 0%, #fa7e1e 25%, #d62976 50%, #962fbf 75%, #4f5bd5 100%);
  flex-shrink: 0;
  box-shadow: inset 0 0 0 3px #fff, 0 0 0 1px var(--border);
}

.bio__preview-stats {
  display: flex;
  gap: 1rem;
  flex: 1;
  justify-content: space-around;
}

.bio__preview-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.bio__preview-stat strong {
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.bio__preview-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.bio__preview-username {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.bio__preview-text {
  font-size: 0.88rem;
  line-height: 1.35;
  word-break: break-word;
  margin-bottom: 0.85rem;
}

.bio__preview-text > div {
  min-height: 1em;
}

.bio__preview-buttons {
  display: flex;
  gap: 0.35rem;
}

.bio__preview-btn {
  appearance: none;
  flex: 1;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: default;
}

.bio__preview-btn:last-child {
  flex: 0 0 2.2rem;
}

.bio__preview-btn--primary {
  background: #0095f6;
  color: #fff;
  border-color: #0095f6;
}

/* -------- instagram font generator -------- */

.font-gen__section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.font-gen__label {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 500;
}

.font-gen__editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.font-gen__editor-head .tool__btn {
  padding: 0.35rem 0.85rem;
  font-size: 0.8125rem;
}

.font-gen__input {
  appearance: none;
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 1rem;
  line-height: 1.4;
  resize: vertical;
  min-height: 2.6em;
  transition: border-color 0.15s ease;
}

.font-gen__input:focus {
  outline: none;
  border-color: var(--accent);
}

.font-gen__list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.font-gen__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.font-gen__row:hover {
  border-color: #d4d4d4;
  background: #fafafa;
}

.font-gen__row-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.font-gen__row-name {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.font-gen__row-preview {
  font-size: 1.15rem;
  line-height: 1.4;
  color: var(--fg);
  word-break: break-word;
  min-height: 1.4em;
}

.font-gen__row .tool__btn {
  flex-shrink: 0;
  padding: 0.45rem 0.95rem;
  font-size: 0.85rem;
  min-width: 5rem;
}

/* -------- instagram grid maker -------- */

.grid-gen__root {
  gap: 1.25rem;
}

.grid-gen__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 880px) {
  .grid-gen__layout {
    grid-template-columns: 1fr;
  }
}

.grid-gen__col {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}

/* Preview column centers its children so the section head lines up with
   the phone mockup (which is capped at 300px and centered). */
.grid-gen__col--preview {
  align-items: center;
}

.grid-gen__col--preview .grid-gen__section-head {
  width: 100%;
  max-width: 300px;
}

.grid-gen__section-head {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.grid-gen__controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.grid-gen__controls-row .tool__btn {
  flex: 1 1 auto;
  min-width: 10rem;
}

.grid-gen__preset {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.grid-gen__preset-label {
  font-size: 0.8125rem;
  color: var(--muted);
}

.grid-gen__preset-select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.45rem 2rem 0.45rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 14px) center,
    calc(100% - 9px) center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.grid-gen__preset-select:focus {
  outline: none;
  border-color: var(--accent);
}

.grid-gen__editor-wrap {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  border-radius: var(--radius);
  transition: box-shadow 0.15s ease, outline-color 0.15s ease;
}

.grid-gen__editor-wrap.is-drop-active {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
}

.grid-gen__editor {
  position: relative;
  width: 100%;
  max-height: 62vh;
  /* The virtual-grid area is literally what the download tiles will look
     like: the canvas capture fills white first, then draws the image, so
     uncovered areas are white. Keep this background in sync with the
     capture fill so the preview reflects reality. */
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  user-select: none;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
}

.grid-gen__editor:active {
  cursor: grabbing;
}

.grid-gen__editor-wrap.is-drop-active .grid-gen__editor {
  border-color: var(--accent);
}

.grid-gen__editor-img {
  pointer-events: none;
}

.grid-gen__editor-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  pointer-events: none;
}

.grid-gen__editor-cell {
  position: relative;
  border: 1px dashed rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.grid-gen__editor-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.grid-gen__editor-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background:
    repeating-linear-gradient(135deg,
      #f4f4f4 0 10px,
      #ececec 10px 20px);
  color: #9a9a9a;
  pointer-events: none;
}

.grid-gen__editor-empty-icon {
  font-size: 2rem;
  line-height: 1;
  opacity: 0.6;
}

.grid-gen__editor-empty-label {
  font-size: 0.85rem;
}

.grid-gen__zoom {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.grid-gen__zoom-label {
  font-size: 0.8125rem;
  color: var(--muted);
  flex-shrink: 0;
}

.grid-gen__zoom-slider {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
}

.grid-gen__zoom-reset {
  flex-shrink: 0;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
}

/* ----- right column: Instagram profile phone mockup ------------------ */

.grid-gen__phone {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.7rem 0.7rem 0;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
  overflow: hidden;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  font-size: 0.88em;
}

.grid-gen__phone-head {
  padding-bottom: 0.5rem;
}

.grid-gen__phone-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
  gap: 0.5rem;
}

.grid-gen__phone-back,
.grid-gen__phone-more {
  color: var(--fg);
  display: inline-flex;
  align-items: center;
}

.grid-gen__phone-username {
  flex: 1;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.grid-gen__phone-username-caret {
  display: inline-flex;
  align-items: center;
  color: var(--fg);
  opacity: 0.85;
}

.grid-gen__phone-bio {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
}

.grid-gen__phone-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  flex-shrink: 0;
  background:
    linear-gradient(45deg,
      #feda75 0%, #fa7e1e 25%, #d62976 50%, #962fbf 75%, #4f5bd5 100%);
  box-shadow: inset 0 0 0 3px #fff, 0 0 0 1px var(--border);
}

.grid-gen__phone-stats {
  display: flex;
  flex: 1;
  justify-content: space-around;
}

.grid-gen__phone-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.grid-gen__phone-stat strong {
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.grid-gen__phone-name {
  margin-top: 0.65rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--fg);
}

.grid-gen__phone-handle-line {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.55rem;
}

.grid-gen__phone-buttons {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.8rem;
}

.grid-gen__phone-btn {
  appearance: none;
  flex: 1;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: default;
}

.grid-gen__phone-btn--icon {
  flex: 0 0 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.grid-gen__phone-btn--primary {
  background: #0095f6;
  color: #fff;
  border-color: #0095f6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.grid-gen__phone-tabs {
  display: flex;
  justify-content: space-around;
  gap: 0.5rem;
  border-top: 1px solid var(--border);
  padding-top: 0.55rem;
}

.grid-gen__phone-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bdbdbd;
  padding-bottom: 0.5rem;
}

.grid-gen__phone-tab.is-active {
  color: var(--fg);
  border-bottom: 2px solid var(--fg);
}

.grid-gen__phone-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  margin: 0 -0.7rem;
}

.grid-gen__feed-cell {
  position: relative;
  /* Instagram's profile grid crops each 4:5 post to ~3:4. Background
     matches the download canvas fill so uncovered areas show as the same
     white Instagram will end up displaying. */
  aspect-ratio: 3 / 4;
  background: #ffffff;
  overflow: hidden;
}

.grid-gen__feed-cell--ghost {
  background:
    repeating-linear-gradient(135deg,
      #f7f7f7 0 10px,
      #efefef 10px 20px);
}

.grid-gen__feed-img {
  pointer-events: none;
}

.grid-gen__feed-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.grid-gen__icon {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

.grid-gen__download-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.grid-gen__download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  max-width: 520px;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
}
