/* QRcode Studio — print-press preview (standalone) */
:root {
  --ink: #0a0a0a;
  --paper: #f4f1ea;
  --coal: #111111;
  --void: #070707;
  --yellow: #fff200;
  --blue: #2e3192;
  --mute: #9a9a9a;
  --line: rgba(255, 255, 255, 0.14);
  --studio-accent: #fff200;
  --studio-cols: minmax(148px, 0.38fr) minmax(0, 1.75fr) minmax(210px, 0.68fr);
  --bg: #070707;
}

* { box-sizing: border-box; }

/* custom scrollbar — identical to main site styles.css */
html {
  height: 100%;
  overflow: hidden;
  scrollbar-width: thin;
  scrollbar-color: #fff var(--bg);
}

*::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

*::-webkit-scrollbar-track {
  background: var(--bg);
}

*::-webkit-scrollbar-thumb {
  background: #fff;
  border: 2px solid var(--bg);
}

*::-webkit-scrollbar-thumb:hover {
  background: #fff;
}

*::-webkit-scrollbar-corner {
  background: var(--bg);
}

.studio-body,
.studio-rail,
.studio-controls,
.studio-stage,
.studio-format-menu,
.studio-plates {
  scrollbar-width: thin;
  scrollbar-color: #fff var(--bg);
}

.studio-body {
  margin: 0;
  font-family: "JetBrains Mono", Consolas, monospace;
  color: #fff;
  background:
    radial-gradient(ellipse 80% 50% at 15% -10%, rgba(46, 49, 146, 0.35), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(255, 242, 0, 0.08), transparent 50%),
    linear-gradient(180deg, #0c0c0c 0%, var(--void) 100%);
  overflow: hidden;
  height: 100%;
}

.studio-noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.studio-grid {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  z-index: 0;
}

.studio-top,
.studio-shell {
  position: relative;
  z-index: 1;
}

.studio-top {
  display: grid;
  grid-template-columns: var(--studio-cols);
  align-items: center;
  gap: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.studio-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  justify-self: start;
  padding: 0 12px 0 14px;
  overflow: visible;
  z-index: 2;
}

.studio-brand-mark {
  width: 1.6cm;
  height: 1.6cm;
  flex: 0 0 auto;
  display: block;
  background: none;
  box-shadow: none;
  border-radius: 0;
  object-fit: contain;
}

.studio-brand-copy {
  position: relative;
  min-width: max-content;
  flex: 0 0 auto;
  padding: 0;
  isolation: isolate;
  z-index: 1;
  overflow: visible;
}

.studio-brand-line,
.studio-brand-studio {
  position: relative;
  z-index: 1;
}

.studio-brand-line {
  margin: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.studio-brand-word {
  display: inline-block;
  font-family: "JetBrains Mono", ui-monospace, Consolas, "Cascadia Mono", monospace;
  font-weight: 800;
  font-size: 18px;
  line-height: 1.05;
  letter-spacing: 0.02em;
  color: #ffffff;
  white-space: nowrap;
}

.studio-brand-word.is-global {
  margin-left: 0.35em;
}

.studio-brand-studio {
  --studio-blue: #2e3192;
  --studio-yellow: #fff200;
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 0.01em;
  margin: 4px 0 0;
  padding-bottom: 0;
  font-family: "Syne", sans-serif;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  perspective: 420px;
  isolation: isolate;
}

.studio-letter {
  position: relative;
  display: inline-block;
  color: var(--studio-yellow);
  transform-origin: 50% 80%;
  transform-style: preserve-3d;
  animation:
    studio-letter-flip 3.6s cubic-bezier(0.45, 0.05, 0.25, 1) infinite,
    studio-letter-tint 3.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.14s);
  will-change: transform, color, filter;
}

.studio-letter::before,
.studio-letter::after {
  content: attr(data-ch);
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
}

.studio-letter::before {
  color: #4a6cff;
  animation: studio-ghost-left 3.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.14s);
}

.studio-letter::after {
  color: #ffe34a;
  animation: studio-ghost-right 3.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.14s);
}

@keyframes studio-letter-flip {
  0%, 100% {
    transform: translateY(0) rotateX(0deg) scale(1);
    filter: drop-shadow(0 0 0 transparent);
  }
  12% {
    transform: translateY(-3px) rotateX(-28deg) scale(1.06);
    filter: drop-shadow(0 6px 10px rgba(46, 49, 146, 0.35));
  }
  24% {
    transform: translateY(1px) rotateX(12deg) scale(0.98);
  }
  36% {
    transform: translateY(0) rotateX(0deg) scale(1);
  }
  58% {
    transform: translateY(-2px) rotateZ(-2deg) scale(1.04);
  }
  72% {
    transform: translateY(0) rotateZ(1deg) scale(1);
  }
}

@keyframes studio-letter-tint {
  0%, 100% { color: var(--studio-yellow); text-shadow: 0 0 0 transparent; }
  18% { color: #ffffff; text-shadow: 0 0 12px rgba(255, 242, 0, 0.55); }
  36% { color: var(--studio-blue); text-shadow: 0 0 10px rgba(46, 49, 146, 0.55); }
  54% { color: #7ec8ff; text-shadow: 0 0 8px rgba(126, 200, 255, 0.4); }
  72% { color: var(--studio-yellow); text-shadow: 0 0 14px rgba(255, 242, 0, 0.45); }
}

@keyframes studio-ghost-left {
  0%, 100% { opacity: 0; transform: translate(0, 0); }
  14% { opacity: 0.75; transform: translate(-2px, 1px); }
  28% { opacity: 0; transform: translate(-4px, 0); }
  62% { opacity: 0.55; transform: translate(-1.5px, -1px); }
  78% { opacity: 0; transform: translate(0, 0); }
}

@keyframes studio-ghost-right {
  0%, 100% { opacity: 0; transform: translate(0, 0); }
  14% { opacity: 0.7; transform: translate(2px, -1px); }
  28% { opacity: 0; transform: translate(4px, 0); }
  62% { opacity: 0.5; transform: translate(1.5px, 1px); }
  78% { opacity: 0; transform: translate(0, 0); }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .studio-letter,
  .studio-letter::before,
  .studio-letter::after {
    animation: none !important;
  }
  .studio-letter {
    color: var(--studio-yellow);
    filter: none;
    transform: none;
  }
  .studio-letter::before,
  .studio-letter::after {
    content: none;
  }
}

.studio-top-tagline {
  margin: 0;
  justify-self: center;
  align-self: center;
  text-align: center;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 12px;
  font-family: "JetBrains Mono", ui-monospace, Consolas, "Cascadia Mono", monospace;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: #7a7a7a;
}

.studio-top-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-self: end;
  justify-content: flex-end;
  padding: 0 14px 0 12px;
}

.studio-chip {
  border: 1px solid var(--line);
  padding: 6px 10px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ddd;
}

.studio-chip.is-warn {
  border-color: rgba(255, 242, 0, 0.45);
  color: var(--yellow);
}

.studio-shell {
  display: grid;
  width: 100%;
  grid-template-columns: var(--studio-cols);
  gap: 0;
  height: calc(100vh - 78px);
  min-height: calc(100vh - 78px);
  overflow: hidden;
  align-items: stretch;
}

/* ── fx261: верхній рядок редактора ─────────────────────────────────────
   «Тип шаблону» живе в лівому рейлі (.studio-rail-kicker), а кнопка
   «? Гайд» має стояти з НЕЮ В ОДНОМУ РЯДКУ на протилежному кінці — тобто
   над правою панеллю керування. Для цього рейка розтягнута на два рядки
   сітки, а .studio-topbar займає колонки 2–3 у першому рядку.
   Сам рядок високий рівно на стільки, скільки треба кнопці. */
.studio-shell {
  grid-template-rows: auto minmax(0, 1fr);
}

.studio-topbar {
  grid-column: 2 / -1;
  grid-row: 1;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  padding: 14px 12px 0;
}

.studio-rail {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.studio-stage {
  grid-column: 2;
  grid-row: 2;
}

.studio-controls {
  grid-column: 3;
  grid-row: 2;
}

@media (min-width: 1024px) {
  /* fx262: напис «Тип шаблону» і кнопка «? Гайд» мають стояти в одному рядку
     й на одній висоті. Робимо з напису смугу такої ж висоти, як кнопка
     (34px), і центруємо текст — тоді його середина збігається із серединою
     кнопки, а не з її верхнім краєм. */
  .studio-shell .studio-rail-kicker {
    display: flex;
    align-items: center;
    min-height: 34px;
    margin: 0 0 10px;
  }

  /* Коли аркуш уже обрано (звичайний стан редактора), рейка згортається
     (.studio-rail.is-collapsed → display:none) і сітка має ЛИШЕ дві
     колонки: аркуш і панель керування. Тоді «Гайд» стоїть над панеллю. */
  .studio-shell:not(.is-picking-plate) .studio-topbar {
    grid-column: 2;
  }
  .studio-shell:not(.is-picking-plate) .studio-stage {
    grid-column: 1;
  }
  .studio-shell:not(.is-picking-plate) .studio-controls {
    grid-column: 2;
  }
}

.studio-rail,
.studio-controls {
  border-right: 1px solid var(--line);
  padding: 14px 10px 20px;
  background: rgba(0, 0, 0, 0.28);
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  align-self: stretch;
}

.studio-controls {
  border-right: 0;
  border-left: 1px solid var(--line);
  padding: 14px 12px 20px;
}

.studio-rail-kicker {
  margin: 0 0 10px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--yellow);
  line-height: 1.3;
}

.studio-plates {
  display: grid;
  gap: 6px;
  padding-bottom: 8px;
  overflow: hidden;
  width: 100%;
}

.studio-plate-btn {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  background: transparent;
  color: #cfcfcf;
  padding: 6px 7px;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.18s, background 0.18s, color 0.18s, box-shadow 0.18s, grid-template-columns 0.2s ease;
}

.studio-plate-btn:hover {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
}

.studio-plate-btn.is-on {
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 0;
  border-color: var(--blue);
  background: var(--blue);
  box-shadow: 0 0 12px rgba(46, 49, 146, 0.45);
  color: #fff;
  padding: 4px;
}

.studio-plate-btn.is-on .studio-plate-copy {
  background: var(--yellow);
  color: #0a0a0a;
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 6px 8px;
  min-width: 0;
}

.studio-plate-btn.is-on .studio-plate-copy b {
  color: #0a0a0a;
  font-weight: 700;
}

.studio-plate-btn.is-on .studio-plate-copy span {
  color: rgba(10, 10, 10, 0.7);
}

.studio-plate-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
  transform-origin: center;
  transition:
    transform 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    width 0.2s ease,
    height 0.2s ease,
    box-shadow 0.2s ease;
}

.studio-plate-btn.is-on .studio-plate-icon {
  width: 36px;
  height: 36px;
  border-color: transparent;
  background: var(--blue);
  color: #ffffff;
  transform: scale(1.18);
}

.studio-plate-icon svg {
  width: 15px;
  height: 15px;
  display: block;
  transition: width 0.2s ease, height 0.2s ease;
}

.studio-plate-btn.is-on .studio-plate-icon svg {
  width: 20px;
  height: 20px;
}

.studio-plate-copy {
  min-width: 0;
}

.studio-plate-btn b {
  display: block;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-plate-btn span span,
.studio-plate-copy span {
  display: none;
}

.studio-stage {
  padding: 12px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.studio-stage-head {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 10px 16px;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
}

.studio-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--yellow);
}

.studio-stage-head h1 {
  margin: 0;
  font-family: "Syne", "JetBrains Mono", sans-serif;
  font-size: clamp(14px, 2vw, 22px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

.studio-lead {
  margin: 4px 0 0;
  max-width: 42ch;
  color: #c8c8c8;
  font-size: 12px;
  line-height: 1.35;
}

.studio-stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.studio-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 11px 14px;
  cursor: pointer;
}

.studio-btn.is-ghost:hover {
  border-color: #fff;
}

.studio-btn.is-yellow {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #0a0a0a;
  font-weight: 700;
}

.studio-btn.is-yellow:hover {
  filter: brightness(1.05);
}

.studio-btn.is-yellow.is-linked {
  box-shadow: 0 0 0 1px #0a0a0a inset;
}

.studio-account#studio-account-panel {
  margin-top: 2px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  animation: studio-account-in 0.28s ease both;
}

.studio-account#studio-account-panel[hidden] {
  display: none;
  animation: none;
}

@keyframes studio-account-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.studio-btn.is-place {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 14px rgba(46, 49, 146, 0.45);
}

.studio-btn.is-place:hover {
  filter: brightness(1.08);
  color: var(--yellow);
}

.studio-btn.is-place.is-on {
  background: #3a3eb0;
  border-color: var(--yellow);
  color: var(--yellow);
  box-shadow: 0 0 16px rgba(255, 242, 0, 0.35);
}

.studio-press {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 30%),
    #111;
  border: 1px solid var(--line);
  overflow: visible;
}

.studio-format-bar {
  position: relative;
  z-index: 60;
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
}

.studio-format {
  position: relative;
}

.studio-format-btn {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.45);
  color: #ddd;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 14px;
  cursor: pointer;
}

.studio-format-btn strong {
  color: var(--yellow);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.studio-format-btn:hover,
.studio-format.is-open .studio-format-btn {
  border-color: var(--yellow);
  color: #fff;
}

.studio-format-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  margin: 0;
  padding: 6px;
  list-style: none;
  min-width: 220px;
  max-height: min(52vh, 360px);
  overflow: auto;
  border: 1px solid var(--line);
  background: #0d0d0d;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.studio-format-menu[hidden] {
  display: none;
}

.studio-format-menu button {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  align-items: baseline;
  text-align: left;
  border: 0;
  background: transparent;
  color: #ddd;
  font: inherit;
  font-size: 12px;
  padding: 8px 10px;
  cursor: pointer;
}

.studio-format-menu button b {
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.studio-format-menu button span {
  grid-column: 2;
  font-size: 10px;
  color: var(--mute);
  letter-spacing: 0.02em;
}

.studio-format-menu button:hover,
.studio-format-menu button.is-on {
  background: rgba(255, 242, 0, 0.12);
  color: #fff;
}

.studio-format-menu button.is-on b {
  color: var(--yellow);
}

.studio-press-sheet {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
  overflow: hidden;
  container-type: size;
}

.studio-crop {
  position: absolute;
  inset: 8px;
  pointer-events: none;
  z-index: 1;
}

.studio-crop i {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 0 solid rgba(255, 242, 0, 0.55);
}

.studio-crop i:nth-child(1) { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.studio-crop i:nth-child(2) { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.studio-crop i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.studio-crop i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

.studio-board {
  position: relative;
  z-index: 2;
  /* Fit chosen paper format fully in the press sheet */
  --pw: 210;
  --ph: 297;
  width: min(100cqw, calc(100cqh * var(--pw) / var(--ph)));
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--pw) / var(--ph);
  height: auto;
  transform-origin: center;
  animation: studio-in 0.45s ease both;
  transition: aspect-ratio 0.25s ease, width 0.25s ease;
}

.studio-board.is-swap {
  animation: studio-swap 0.4s ease both;
}

@keyframes studio-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes studio-swap {
  0% { opacity: 0; transform: translateY(12px) rotate(-0.4deg); }
  100% { opacity: 1; transform: none; }
}

/* —— Printable plate (A4) —— */
.plate {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  background: var(--paper, #fff);
  color: var(--ink, #0a0a0a);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.plate-bar {
  height: 8px;
  background: var(--accent, var(--yellow));
}

.plate.is-free .plate-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
}

.plate-layer {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  max-width: min(70%, calc(100% - 28px));
  box-sizing: border-box;
}

.plate.is-free .plate-copy {
  width: max-content;
  max-width: min(52%, calc(100% - 36px));
  text-align: left;
  pointer-events: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.plate.is-free .plate-qr-wrap {
  width: var(--qr-size, 22%);
  max-width: 48%;
  padding: 6px;
  pointer-events: none;
}

.plate.is-free .plate-qr-wrap canvas {
  width: 100% !important;
  height: auto !important;
}

.plate.is-free .plate-emblem {
  width: var(--emblem-size, 16%);
  max-width: 140px;
  height: auto;
  object-fit: contain;
  display: block;
  pointer-events: none;
  z-index: 3;
}

.plate.is-picking {
  cursor: crosshair;
}

.plate.is-picking .plate-layer {
  opacity: 0.55;
}

.plate.is-picking-text .plate-copy,
.plate.is-picking-qr .plate-qr-wrap,
.plate.is-picking-emblem .plate-emblem {
  opacity: 1;
  outline: 1px dashed rgba(46, 49, 146, 0.7);
  outline-offset: 4px;
}

.studio-point-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  pointer-events: none;
  background:
    radial-gradient(circle at center, transparent 0 38%, rgba(255, 255, 255, 0.08) 39%),
    rgba(255, 255, 255, 0.18);
}

.studio-point-overlay span {
  padding: 8px 12px;
  background: rgba(10, 10, 10, 0.82);
  color: #fff;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  max-width: 80%;
  text-align: center;
}

.plate-inner {
  height: calc(100% - 8px);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
}

.plate-copy {
  display: grid;
  gap: calc(8px * var(--text-scale, 1) * var(--part-scale, 1));
}

.plate-eyebrow {
  margin: 0;
  font-size: calc(10px * var(--text-scale, 1) * var(--part-scale, 1));
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent, #2e3192);
  font-weight: 700;
}

.plate-name {
  margin: 0;
  font-family: "Syne", sans-serif;
  font-size: calc(22px * var(--text-scale, 1) * var(--part-scale, 1));
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-weight: 800;
  color: var(--ink, #0a0a0a);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.plate-sub,
.plate-meta {
  margin: 0;
  font-size: calc(12px * var(--text-scale, 1) * var(--part-scale, 1));
  line-height: 1.4;
  color: var(--ink, #0a0a0a);
  opacity: 0.78;
  max-width: 34ch;
}

.plate-qr-wrap {
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.12);
  width: fit-content;
  max-width: 100%;
}

.plate-qr-wrap canvas {
  width: 120px !important;
  height: auto !important;
  display: block;
}

.plate-emblem {
  --emblem-size: 16%;
  width: var(--emblem-size);
  max-width: 140px;
  height: auto;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.plate-qr-wrap.has-emblem {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* Controls */
.studio-form {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.studio-form label {
  display: grid;
  gap: 5px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  white-space: normal;
  overflow-wrap: anywhere;
}

.studio-form input,
.studio-form textarea,
.studio-layout select {
  width: 100%;
  border: 1px solid var(--line);
  background: #0a0a0a;
  color: #fff;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  padding: 10px 11px;
}

.studio-form textarea {
  min-height: 64px;
  resize: vertical;
}

.studio-form input:focus,
.studio-form textarea:focus,
.studio-layout select:focus {
  outline: 1px solid var(--yellow);
  border-color: var(--yellow);
}

.studio-inks,
.studio-layout,
.studio-emblem,
.studio-qr-style,
.studio-account {
  display: grid;
  gap: 10px;
  margin-bottom: 0;
}

.studio-qr-style {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.studio-qr-style .studio-check,
.studio-qr-style label:has(#studio-frame-text),
.studio-qr-style label:has(#studio-margin) {
  grid-column: auto;
}

.studio-inks-qr {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.studio-fold {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 10px;
}

.studio-fold[open] {
  border-color: rgba(255, 242, 0, 0.35);
  background: rgba(255, 242, 0, 0.03);
}

.studio-fold-sum {
  list-style: none;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: start;
  cursor: pointer;
  padding: 12px 12px;
  user-select: none;
}

.studio-fold-sum::-webkit-details-marker {
  display: none;
}

.studio-fold-sum::before {
  content: "+";
  grid-row: 1 / span 2;
  align-self: center;
  flex: 0 0 auto;
  width: 1.1em;
  color: var(--yellow);
  font-weight: 800;
  font-family: "JetBrains Mono", monospace;
}

.studio-fold[open] > .studio-fold-sum::before {
  content: "–";
}

.studio-fold-sum span {
  min-width: 0;
  font-family: "JetBrains Mono", ui-monospace, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.studio-fold-sum em {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.studio-fold-body {
  padding: 0 12px 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.studio-inks label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: #ccc;
  white-space: normal;
  overflow-wrap: anywhere;
}

.studio-inks input[type="color"] {
  width: 42px;
  height: 32px;
  border: 1px solid var(--line);
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.studio-layout label,
.studio-emblem label,
.studio-qr-style label,
.studio-account label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  white-space: normal;
  overflow-wrap: anywhere;
}

.studio-layout label em,
.studio-emblem label em,
.studio-qr-style label em {
  font-style: normal;
  color: var(--yellow);
  letter-spacing: 0.08em;
}

.studio-layout input[type="range"],
.studio-emblem input[type="range"],
.studio-qr-style input[type="range"] {
  width: 100%;
  accent-color: var(--yellow);
}

.studio-emblem select,
.studio-qr-style select,
.studio-qr-style input[type="text"],
.studio-account select {
  width: 100%;
  border: 1px solid var(--line);
  background: #0a0a0a;
  color: #fff;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  padding: 10px 11px;
}

.studio-emblem select:focus,
.studio-qr-style select:focus,
.studio-qr-style input[type="text"]:focus,
.studio-account select:focus {
  outline: 1px solid var(--yellow);
  border-color: var(--yellow);
}

.studio-check {
  display: flex !important;
  align-items: center;
  gap: 10px;
  grid-template-columns: none !important;
  text-transform: none !important;
  letter-spacing: 0.02em !important;
  font-size: 12px !important;
  color: #ddd !important;
  cursor: pointer;
}

.studio-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--yellow);
}

.studio-account-status {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: #ccc;
}

.studio-account-status.is-ok { color: #b8f5c4; }
.studio-account-status.is-warn { color: var(--yellow); }
.studio-account-status.is-err { color: #ff9b9b; }

.studio-account-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.studio-account-hint {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--mute);
}

.studio-account-hint a {
  color: var(--yellow);
}

.studio-file input[type="file"] {
  width: 100%;
  margin-top: 4px;
  font-size: 11px;
  color: #ccc;
  text-transform: none;
  letter-spacing: 0;
}

.studio-btn.is-block {
  width: 100%;
  justify-content: center;
}

.studio-text-tools {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.studio-text-tools label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
}

.studio-text-tools label em {
  font-style: normal;
  color: var(--yellow);
  letter-spacing: 0.08em;
  text-align: center;
}

.studio-text-tools input[type="range"] {
  width: 100%;
  accent-color: var(--yellow);
}

.studio-place-now {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--mute);
}

.studio-btn.is-on {
  border-color: var(--yellow);
  color: var(--yellow);
}

.studio-layout {
  display: grid;
  gap: 8px;
}

.studio-place-block {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.studio-place-block label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
}

.studio-place-block label em {
  font-style: normal;
  color: var(--yellow);
}

.studio-place-block input[type="range"] {
  width: 100%;
  accent-color: var(--yellow);
}

.studio-btn.is-dim {
  opacity: 0.45;
}

.studio-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--mute);
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

@media (max-width: 1023px) {
  html,
  .studio-body {
    height: auto;
    overflow: auto;
    overflow-x: hidden;
  }
  .studio-shell {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  /* fx262: на телефоні та планшеті редактор — одна колонка, тому «Гайд»
     НЕ може стояти окремим рядком над смугою шаблонів: він висить над
     правим краєм рейки, рівно в рядку з написом «Тип шаблону» — тобто в
     тому самому рядку й на тому самому місці, що й на компі. */
  .studio-topbar,
  .studio-rail,
  .studio-controls,
  .studio-stage {
    grid-column: 1;
    grid-row: auto;
  }
  .studio-topbar {
    position: absolute;
    top: 9px;
    right: 10px;
    left: auto;
    padding: 0;
    justify-content: flex-end;
  }
  .studio-rail,
  .studio-controls,
  .studio-stage {
    border: 0;
    border-bottom: 1px solid var(--line);
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .studio-press {
    flex: none;
    min-height: 560px;
    height: 75vh;
  }
  .studio-press-sheet {
    flex: 1 1 0;
    min-height: 0;
    container-type: size;
  }
  .studio-plates {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .studio-plate-btn.is-on {
    transform: none;
  }
  .studio-top {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 10px;
  }
  .studio-brand {
    justify-self: center;
  }
  .studio-top-meta {
    justify-self: center;
    width: 100%;
    justify-content: center;
  }
  .studio-top-tagline {
    order: 3;
    max-width: 28ch;
    white-space: normal;
  }
  .studio-brand-copy {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .studio-plates {
    grid-template-columns: 1fr;
  }
  .studio-stage {
    padding: 16px;
  }
  .studio-brand-mark {
    width: 1.6cm;
    height: 1.6cm;
  }
  .studio-brand-word {
    font-size: 18px;
  }
}
