:root {
  --purple: #9d5cf5;
  --orange: #f5a623;
  --green: #00e63c;
  --ink: #000000;
  --triangle: #ffffff;
  --copy-color: #00e63c;
  --page-bg: #efefef;

  --c-title: #ffffff;
  --c-badge: #000000;
  --c-label: #ffffff;
  --c-value: #ffffff;
  --c-unit: #c9c9c9;
  --c-lines: #ffffff;

  --title-font: 'Montserrat';
  --title-weight: 900;
  --text-font: 'Inter';
  --label-weight: 700;
  --value-weight: 500;
  --unit-weight: 400;

  --title-size: 56;
  --badge-size: 30;
  --label-size: 11;
  --value-size: 15;
  --unit-size: 10.5;
  --icon-size: 64;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  padding: 56px 24px 96px;
  background: var(--page-bg);
  color: #000;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.stage {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
}

/* Page background: colour on <body>, optional image / GIF / video on top of it. */
.site-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.site-bg[hidden] { display: none; }

.site-bg img,
.site-bg video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* "Без рамок": no light margins or shadow — the poster runs edge to edge. */
body.layout-full { padding: 0; }
body.layout-full .stage { min-height: 100vh; min-height: 100dvh; }
body.layout-full .poster {
  min-height: 100vh;
  min-height: 100dvh;
  background: transparent;
  box-shadow: none;
}

/* "На один экран": no frames and no scrolling — the whole poster fits the viewport.
   The picture block absorbs the leftover height; spacing shrinks on short screens. */
html.layout-fit, body.layout-fit { height: 100%; overflow: hidden; }
body.layout-fit { padding: 0; height: 100vh; height: 100dvh; }
body.layout-fit .stage { height: 100%; }
body.layout-fit .poster {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: clamp(12px, 4vh, 44px) clamp(16px, 5vw, 44px) clamp(10px, 3.5vh, 40px);
  background: transparent;
  box-shadow: none;
}
body.layout-fit .collage {
  flex: 1 1 0;
  min-height: 48px;
  aspect-ratio: auto;
}
body.layout-fit .title-row { flex: 0 0 auto; margin-top: clamp(8px, 3.2vh, 34px); }
body.layout-fit .poster-title { font-size: min(calc(var(--title-size) * 1px), calc(var(--title-size) * .15vw), calc(var(--title-size) * .1vh)); }
body.layout-fit .edit-btn { width: clamp(52px, 10vh, 92px); height: clamp(52px, 10vh, 92px); }
body.layout-fit .rule-row { flex: 0 0 auto; margin-top: clamp(6px, 2.6vh, 30px); }
body.layout-fit .meters { flex: 0 0 auto; margin-top: clamp(8px, 2.4vh, 26px); }
body.layout-fit .meter { gap: clamp(4px, 1vh, 10px); }
body.layout-fit .foot { flex: 0 0 auto; margin-top: clamp(6px, 2vh, 22px); }
body.layout-fit .copy-icon { width: min(calc(var(--icon-size) * 1px), 9vh); }
/* "На один экран, медиа сверху": same as above, but the picture touches the top edge. */
body.layout-fit-top .poster { padding-top: 0; }
/* "На один экран, без полей": same as "медиа сверху", but no side gaps — content runs to the page edges. */
body.layout-fit-edge .stage { max-width: none; }
body.layout-fit-edge .poster { padding-left: 0; padding-right: 0; }
/* The copy frame must never leave the screen where the content touches the edges. */
body.layout-fit-edge .meter::after { inset: -6px 0; }
/* Where the frame sits flush with the screen edge, keep the text a little away from it (switchable in the editor). */
body.layout-fit-edge.text-inset .meter { padding-left: 12px; padding-right: 12px; }

/* ---------------------------------------------------------------- poster */

.poster {
  position: relative;
  background: var(--ink);
  color: #fff;
  padding: 44px 44px 40px;
  box-shadow: 0 40px 70px -28px rgba(0, 0, 0, .55), 0 1px 0 rgba(0, 0, 0, .08);
  /* No faux bold/italic: the same font file renders Latin and Cyrillic identically. */
  font-synthesis: none;
  isolation: isolate;
}

/* Media placed behind blocks and text: the layer sits above the poster colour and under all content. */
.slot-layer {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: visible;
  pointer-events: none;
}

.slot-box {
  position: absolute;
  overflow: hidden;
  pointer-events: none;
}

.slot-box img,
.slot-box video,
.badge-media img,
.badge-media video,
.tri-media img,
.tri-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.collage {
  position: relative;
  aspect-ratio: 600 / 480;
  overflow: hidden;
  background: var(--ink);
}

.collage svg.art {
  display: block;
  width: 100%;
  height: 100%;
}

.media-layer {
  position: absolute;
  inset: 0;
}

.media-layer img,
.media-layer video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.drop-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--title-font), sans-serif;
  font-weight: var(--title-weight);
  font-size: 15px;
  letter-spacing: .12em;
  color: var(--green);
  background: rgba(0, 0, 0, .78);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}

.collage.is-drag .drop-hint { opacity: 1; }

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 34px;
}

.poster-title {
  margin: 0;
  min-width: 0;
  font-family: var(--title-font), sans-serif;
  font-weight: var(--title-weight);
  font-size: min(calc(var(--title-size) * 1px), calc(var(--title-size) * .15vw));
  line-height: .92;
  letter-spacing: -.015em;
  text-transform: uppercase;
  white-space: pre-line;
  overflow-wrap: anywhere;
  color: var(--c-title);
  outline: none;
}

.edit-btn {
  position: relative;
  flex: 0 0 auto;
  width: 92px;
  height: 92px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background: var(--green);
  color: var(--c-badge);
  font-family: var(--title-font), sans-serif;
  font-weight: var(--title-weight);
  font-size: calc(var(--badge-size) * 1px);
  letter-spacing: -.02em;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}

.badge-media { position: absolute; inset: 0; }
.badge-media[hidden] { display: none; }
.badge-text { position: relative; z-index: 1; }
.edit-btn.has-media { background: transparent; }

.edit-btn:hover { transform: scale(1.06) rotate(-4deg); }
.edit-btn:active { transform: scale(.96); }
.edit-btn:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }

.rule-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 30px;
  color: var(--c-lines);
}

.dots {
  font-size: 15px;
  letter-spacing: 7px;
  line-height: 1;
  padding-left: 2px;
}

.rule {
  flex: 1 1 auto;
  height: 1px;
  background: var(--c-lines);
}

.plus {
  font-size: 20px;
  line-height: 1;
  font-weight: 400;
  color: var(--c-lines);
}

/* ---------------------------------------------------------------- meters */

.meters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 26px;
  font-family: var(--text-font), sans-serif;
}

.meter {
  position: relative;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 2px 0 4px;
  cursor: copy;
}

.meter::after {
  content: '';
  position: absolute;
  inset: -6px -6px -6px -6px;
  border: 1px solid var(--copy-color);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}

/* Hover hint only for real pointers: on touch screens a tap leaves :hover stuck and the frame never went away. */
@media (hover: hover) and (pointer: fine) {
  .meter:hover::after { opacity: .45; }
}

/* The frame flashes, then fades out by itself — it never stays on screen and never grows past its column. */
.meter.is-copied::after {
  background: color-mix(in srgb, var(--copy-color) 14%, transparent);
  animation: copied .9s ease-out both;
}

@keyframes copied {
  0% { opacity: 0; transform: scale(.94); }
  18% { opacity: 1; transform: scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: scale(1); }
}

.meter h2 {
  margin: 0;
  min-height: 2.5em;
  font-family: inherit;
  font-size: calc(var(--label-size) * 1px);
  font-weight: var(--label-weight);
  line-height: 1.25;
  letter-spacing: .01em;
  text-transform: uppercase;
  color: var(--c-label);
  overflow-wrap: anywhere;
  outline: none;
}

.reading {
  width: 100%;
  min-width: 0;
  padding: 6px 0 7px;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--c-lines) 45%, transparent);
  border-radius: 0;
  background: transparent;
  color: var(--c-value);
  font-family: inherit;
  font-size: calc(var(--value-size) * 1px);
  font-weight: var(--value-weight);
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  cursor: copy;
  transition: border-color .15s ease;
}

/* Normal view: readings are display-only. Taps go to the column (copy), never into the field. */
.poster:not(.is-editing) .reading {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  caret-color: transparent;
}

.reading::placeholder { color: color-mix(in srgb, var(--c-value) 28%, transparent); }

.reading:focus { outline: none; }

.poster.is-editing .reading { cursor: text; }

.poster.is-editing .reading {
  outline: 1px dashed color-mix(in srgb, var(--green) 55%, transparent);
  outline-offset: 3px;
}

.poster.is-editing .reading:focus {
  outline: 2px solid var(--green);
  border-bottom-color: var(--green);
  background: color-mix(in srgb, var(--green) 8%, transparent);
}

.meter .unit {
  margin: 0;
  font-size: calc(var(--unit-size) * 1px);
  font-weight: var(--unit-weight);
  line-height: 1.55;
  color: var(--c-unit);
  outline: none;
}

.foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 22px;
}

.copy-hint {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--c-unit);
  font-family: var(--text-font), sans-serif;
  font-weight: var(--unit-weight);
  font-size: calc(var(--unit-size) * 1px);
  line-height: 1.4;
  text-align: left;
  cursor: copy;
  outline: none;
}

.copy-hint:hover { color: var(--c-label); }
.copy-hint.is-copied { color: var(--c-label); }

/* copy-all icon */

.copy-icon {
  flex: 0 0 auto;
  align-self: flex-end;
  display: block;
  width: calc(var(--icon-size) * 1px);
  margin: 0 -4px -6px 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: copy;
  -webkit-tap-highlight-color: transparent;
  transition: transform .18s ease;
}

.copy-icon svg { display: block; width: 100%; height: auto; overflow: visible; }
.copy-icon:hover { transform: translateY(-2px) rotate(-3deg); }
.copy-icon:active { transform: scale(.92); }
.copy-icon:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
.copy-icon.is-copied { animation: icon-pop .45s cubic-bezier(.2, 1.4, .4, 1); }

@keyframes icon-pop {
  0% { transform: scale(.86); }
  100% { transform: scale(1); }
}

/* The arrow rests low, slides up, holds, then slides back down (1.5 s loop). */
.doc-arrow {
  animation: doc-arrow 1.5s infinite;
}

@keyframes doc-arrow {
  0%, 18% { transform: translateY(36px); animation-timing-function: cubic-bezier(.45, 0, .3, 1); }
  40%, 67% { transform: translateY(0); animation-timing-function: cubic-bezier(.45, 0, .4, 1); }
  100% { transform: translateY(36px); }
}

/* inline editing */

.poster.is-editing [data-field] {
  outline: 1px dashed color-mix(in srgb, var(--green) 55%, transparent);
  outline-offset: 3px;
  cursor: text;
}

.poster.is-editing [data-field]:focus {
  outline: 2px solid var(--green);
  background: color-mix(in srgb, var(--green) 8%, transparent);
}

.poster.is-editing .meter { cursor: default; }
.poster.is-editing .meter::after { display: none; }
.poster.is-editing .meter.is-copied::after { display: block; }

/* ----------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  padding: 14px 18px;
  max-width: calc(100% - 32px);
  background: var(--green);
  color: #000;
  border: 2px solid #000;
  box-shadow: 4px 4px 0 #000;
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .02em;
  white-space: pre-line;
  transform: translate(-50%, 24px);
  opacity: 0;
  pointer-events: none;
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .22s ease;
}

.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.toast.is-error { background: #ff5a5a; }

/* ----------------------------------------------------------- login window */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 10, 10, .55);
  backdrop-filter: blur(3px);
  animation: fade-in .18s ease;
}

.login-overlay[hidden] { display: none; }

@keyframes fade-in { from { opacity: 0; } }

.win {
  --win-blue: #4343f2;
  --win-lime: #d7fca2;
  --win-orange: #ff5b1f;
  --win-ink: #1b1b2a;

  width: min(520px, 100%);
  border: 2px solid var(--win-ink);
  border-radius: 30px;
  overflow: hidden;
  background: var(--win-lime);
  box-shadow: -5px 6px 0 var(--win-ink);
  font-family: 'Montserrat', sans-serif;
  animation: pop-in .26s cubic-bezier(.2, 1.3, .4, 1);
}

@keyframes pop-in { from { transform: translateY(14px) scale(.96); opacity: 0; } }

.win.is-shake { animation: shake .4s ease; }

@keyframes shake {
  20%, 60% { transform: translateX(-9px); }
  40%, 80% { transform: translateX(9px); }
}

.win-bar {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  padding: 10px 18px;
  background: var(--win-blue);
  border-bottom: 2px solid var(--win-ink);
}

.win-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1.5px solid var(--win-ink);
  border-radius: 9px;
  background: #fff;
  color: var(--win-ink);
}

.win-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

button.win-btn { cursor: pointer; transition: transform .12s ease, background .12s ease; }
button.win-btn:hover { background: var(--win-orange); }
button.win-btn:active { transform: translateY(1px); }

.win-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 34px 44px 36px;
}

.win-title {
  margin: 0 0 14px;
  text-align: center;
  font-size: clamp(46px, 13vw, 76px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.01em;
  color: var(--win-blue);
  -webkit-text-stroke: 1.5px var(--win-ink);
  paint-order: stroke fill;
}

.pill-wrap { position: relative; }

.pill {
  display: block;
  width: 100%;
  height: 56px;
  padding: 0 64px 0 26px;
  border: 1.5px solid var(--win-ink);
  border-radius: 999px;
  background: var(--win-orange);
  color: var(--win-ink);
  font-family: 'Montserrat', sans-serif;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: .08em;
}

.pill::placeholder { color: var(--win-ink); opacity: 1; }

.pill:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--win-lime), 0 0 0 5px var(--win-ink);
}

.pill-eye {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--win-ink);
  transform: translateY(-50%);
  cursor: pointer;
}

.pill-eye svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
.pill-eye[aria-pressed="true"] { background: rgba(0, 0, 0, .12); }

.pill-submit {
  padding: 0 26px;
  background: var(--win-blue);
  color: #fff;
  font-size: 18px;
  letter-spacing: .12em;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
  box-shadow: -3px 4px 0 var(--win-ink);
}

.pill-submit:hover { transform: translate(1px, -1px); box-shadow: -4px 5px 0 var(--win-ink); }
.pill-submit:active { transform: translate(-2px, 3px); box-shadow: 0 0 0 var(--win-ink); }
.pill-submit:disabled { opacity: .7; cursor: progress; }

.win-error {
  min-height: 1.2em;
  margin: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #c4200c;
}

/* ---------------------------------------------------------------- editor */

.editor {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  width: min(400px, 100%);
  height: 100%;
  padding: 22px 22px 40px;
  background: #0a0a0a;
  color: #fff;
  border-left: 2px solid var(--green);
  overflow-y: auto;
  transform: translateX(102%);
  visibility: hidden;
  transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility .28s;
}

.editor.is-open {
  transform: translateX(0);
  visibility: visible;
}

.editor-head {
  position: sticky;
  top: -22px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -22px -22px 0;
  padding: 22px 22px 16px;
  background: #0a0a0a;
  border-bottom: 1px solid #262626;
}

.editor-head h2 {
  margin: 0;
  flex: 1 1 auto;
  font-family: 'Montserrat', sans-serif;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: .04em;
}

.save-status {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #777;
}

.save-status.is-ok { color: var(--green); }
.save-status.is-error { color: #ff5a5a; }

.close-btn {
  width: 34px;
  height: 34px;
  border: 1px solid #333;
  background: transparent;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.close-btn:hover { background: var(--green); color: #000; border-color: var(--green); }

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 0;
  border-bottom: 1px solid #1c1c1c;
}

.group-title {
  margin: 0 0 4px;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fff;
}

.field-group label,
.size-row label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #9a9a9a;
}

.field-group input[type="text"],
.field-group textarea,
.field-group select {
  width: 100%;
  padding: 10px 12px;
  background: #000;
  border: 1px solid #2e2e2e;
  border-radius: 0;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  resize: vertical;
}

.field-group select { cursor: pointer; }

.field-group input:focus,
.field-group textarea:focus,
.field-group select:focus {
  outline: none;
  border-color: var(--green);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

.segmented label {
  position: relative;
  cursor: pointer;
}

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

.segmented span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid #333;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fff;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.segmented small {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .02em;
  text-transform: none;
  color: #8a8a8a;
}

.segmented label:hover span { border-color: #fff; }
.segmented input:checked + span { background: var(--green); border-color: var(--green); color: #000; }
.segmented input:checked + span small { color: #0b3d17; }
.segmented input:focus-visible + span { outline: 2px solid #fff; outline-offset: 2px; }

.meter-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 4px 0 6px;
}

.meter-fields > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meter-fields input + input { color: #b5b5b5 !important; }
.meter-fields input.reading-field { color: #fff !important; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.meter-fields input.reading-field::placeholder { color: #555; }

.size-row {
  display: grid;
  grid-template-columns: 92px 1fr 44px;
  align-items: center;
  gap: 10px;
}

.size-row input[type="range"] { width: 100%; accent-color: var(--green); }

.size-row output {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: #fff;
}

.hex-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hex-row {
  display: grid;
  grid-template-columns: 40px 96px 1fr;
  align-items: center;
  gap: 10px;
}

.hex-row input[type="color"] {
  width: 40px;
  height: 36px;
  padding: 0;
  border: 1px solid #2e2e2e;
  background: transparent;
  cursor: pointer;
}

.hex-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.hex-row input[type="color"]::-webkit-color-swatch { border: 0; }

.field-group .hex-row input[type="text"] {
  padding: 8px 10px;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: 13px;
  text-transform: uppercase;
}

.field-group .hex-row input.is-invalid { border-color: #ff5a5a; }

.hex-row span {
  font-size: 11px;
  color: #bdbdbd;
}

.font-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.font-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #262626;
}

.font-list .font-sample {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 15px;
}

.font-list .font-sample small {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: #8a8a8a;
}

.font-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 3px 5px;
  border: 1px solid currentColor;
  color: var(--green);
}

.font-badge.is-missing { color: var(--orange); }

.font-del {
  width: 26px;
  height: 26px;
  border: 1px solid #333;
  background: none;
  color: #fff;
  cursor: pointer;
}

.font-del:hover { border-color: #ff5a5a; color: #ff5a5a; }

.file-btn,
.ghost-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 14px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  border: 0;
  transition: transform .12s ease, background .15s ease, color .15s ease;
}

.field-group .file-btn {
  background: var(--green);
  color: #000;
  font-size: 11px;
  letter-spacing: .08em;
}

.file-btn:hover { transform: translateY(-1px); }
.file-btn.is-busy { opacity: .6; pointer-events: none; }

.ghost-btn {
  background: transparent;
  color: #fff;
  border: 1px solid #333;
}

.ghost-btn:hover { border-color: #fff; }

.danger-btn {
  margin-top: 22px;
  background: transparent;
  color: #ff5a5a;
  border: 1px solid #ff5a5a;
}

.danger-btn:hover { background: #ff5a5a; color: #000; }

.logout-btn { margin: 10px 0 14px; }

.hint {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  color: #777;
}

.hint.warn { color: var(--orange); }

/* ---------------------------------------------------------------- mobile */

@media (max-width: 560px) {
  body { padding: 24px 12px 64px; }
  .poster { padding: 24px 22px 26px; }
  .edit-btn { width: 68px; height: 68px; font-size: calc(var(--badge-size) * .74px); }
  .meters { grid-template-columns: 1fr 1fr; gap: 22px 18px; }
  body.layout-fit { padding: 0; }
  body.layout-fit .meters { gap: clamp(8px, 2vh, 22px) 18px; }
  body.layout-fit .meter h2 { min-height: 0; }
  .copy-icon { width: calc(var(--icon-size) * .9px); }
  .win-body { padding: 26px 22px 28px; }
  .win-bar { gap: 10px; }
  .win-btn { width: 32px; height: 32px; }
  .pill { font-size: 18px; height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .doc-arrow { transform: translateY(18px); }
  .meter.is-copied::after { opacity: 1; }
}


/* ------------------------------------------------- board (one-screen layouts) */

.board {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--ink);
}

.board[hidden] { display: none; }

.board-back,
.board-front,
.board-tiles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.board-back,
.board-front { display: block; pointer-events: none; overflow: hidden; }

.board-tiles { pointer-events: none; }

/* Triangle / board media sit on top of the drawn shapes. */
.tri-media {
  position: absolute;
  top: var(--tri-t, 0px);
  right: var(--tri-r, 0px);
  width: var(--tri-w, 25%);
  height: var(--tri-h, 31.25%);
  clip-path: polygon(100% 0, 100% 100%, 0 0);
  pointer-events: none;
}

.tri-media[hidden] { display: none; }

.tile {
  position: absolute;
  left: 0;
  top: 0;
  background: var(--purple);
  will-change: transform;
  transition: transform .2s cubic-bezier(.2, .8, .25, 1);
  touch-action: none;
}

.tile.is-dragging { transition: none; z-index: 2; }

/* Interactive preset: the top block is a play field. */
body.layout-fit-play .collage { touch-action: none; -webkit-user-select: none; user-select: none; }
body.layout-fit-play .collage .board { cursor: grab; }
body.layout-fit-play .tile { pointer-events: auto; cursor: grab; }
body.layout-fit-play .tile.is-dragging { cursor: grabbing; }


/* Circled figures slide in from the screen edge; the flower and the diamond spin. */
.fig-slide { will-change: transform; }
.fig-spin { transform-box: fill-box; transform-origin: center; }

.board.is-intro .fig-slide-left { animation: fig-from-left 1.15s cubic-bezier(.2, .9, .25, 1) both; }
.board.is-intro .fig-slide-right { animation: fig-from-right 1.15s cubic-bezier(.2, .9, .25, 1) .12s both; }
.board.is-intro .fig-spin { animation: fig-spin 1.7s cubic-bezier(.15, .75, .2, 1) both; }
.board.is-intro .fig-spin-rev { animation-name: fig-spin-rev; }
.board.spin-always .fig-spin { animation: fig-spin-loop 7s linear infinite; }
.board.spin-always .fig-spin-rev { animation-name: fig-spin-loop-rev; }
.board.is-intro.spin-always .fig-spin { animation: fig-spin 1.7s cubic-bezier(.15, .75, .2, 1) both, fig-spin-loop 7s linear 1.7s infinite; }
.board.is-intro.spin-always .fig-spin-rev { animation: fig-spin-rev 1.7s cubic-bezier(.15, .75, .2, 1) both, fig-spin-loop-rev 7s linear 1.7s infinite; }

@keyframes fig-from-left { from { transform: translateX(var(--from-left, -120%)); } }
@keyframes fig-from-right { from { transform: translateX(var(--from-right, 120%)); } }
@keyframes fig-spin { from { transform: rotate(-540deg); } to { transform: rotate(0deg); } }
@keyframes fig-spin-rev { from { transform: rotate(540deg); } to { transform: rotate(0deg); } }
@keyframes fig-spin-loop { to { transform: rotate(360deg); } }
@keyframes fig-spin-loop-rev { to { transform: rotate(-360deg); } }

/* Editor list of media placed in blocks / text */
.slot-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slot-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid #262626;
  font-size: 11px;
  color: #d0d0d0;
}

.slot-list li span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-list li img,
.slot-list li video { width: 34px; height: 34px; object-fit: cover; background: #111; flex: 0 0 auto; }
.slot-list:empty { display: none; }


/* ------------------------------------------------ objects: selection, free blocks */

/* The file icon keeps its place on the right even when the hint text next to it is deleted. */
.copy-icon { margin-left: auto; }

/* Selected object (editor open) */
.poster .is-selected:not(svg *):not(.item) {
  outline: 2px solid var(--green) !important;
  outline-offset: 3px;
}
.poster svg .is-selected,
.board .is-selected {
  filter: drop-shadow(0 0 3px var(--green)) drop-shadow(0 0 2px var(--green));
}
.poster.is-editing .edit-btn,
.poster.is-editing .copy-icon,
.poster.is-editing .collage,
.poster.is-editing .meter,
.poster.is-editing .foot,
.poster.is-editing .title-row,
.poster.is-editing .rule-row { cursor: pointer; }
.poster.is-editing .edit-btn:hover { transform: none; }

/* Floating bar over the selected object */
.obj-bar {
  position: fixed;
  z-index: 70;
  display: flex;
  align-items: stretch;
  max-width: calc(100vw - 12px);
  background: #0a0a0a;
  color: #fff;
  border: 2px solid var(--green);
  box-shadow: 3px 3px 0 #000;
  font-family: 'Montserrat', sans-serif;
}
.obj-bar[hidden] { display: none; }
.obj-bar-name {
  padding: 6px 10px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1.6;
}
.obj-bar-btn {
  padding: 0 12px;
  border: 0;
  border-left: 2px solid var(--green);
  background: #ff5a5a;
  color: #000;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
}
.obj-bar-btn:hover { background: #fff; }

/* Free blocks */
.items-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  container-type: size;
}
.item {
  position: absolute;
  pointer-events: auto;
  color: #fff;
}
.item-body {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.item-text .item-body {
  --fs: 28;
  font-size: calc(var(--fs) * 1px);
  font-size: calc(var(--fs) * 100cqw / 640);
  line-height: 1.18;
  padding: .25em .4em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  outline: none;
}
.item-media .item-body img,
.item-media .item-body video { display: block; width: 100%; height: 100%; }
.item-media .item-body audio { display: block; width: 100%; margin-top: 4px; }
.item-frame { display: block; width: 100%; height: 100%; border: 0; background: transparent; }
.item-js-root { width: 100%; height: 100%; overflow: auto; }
.item-js-root.is-error { color: #ff8a8a; font: 12px monospace; padding: 8px; }

.item-empty { display: none; }
.poster.is-editing .item-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 4px;
  padding: 8px;
  text-align: center;
  font: 800 12px 'Montserrat', sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--green);
  background: rgba(0, 230, 60, .08);
}
.item-empty small { font: 500 10px 'Inter', sans-serif; letter-spacing: 0; text-transform: none; color: #9a9a9a; }

.item-h { display: none; }

.poster.is-editing .item {
  outline: 1px dashed color-mix(in srgb, var(--green) 65%, transparent);
  outline-offset: 0;
  cursor: move;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.poster.is-editing .item.is-selected { outline: 2px solid var(--green); }
.poster.is-editing .item .item-body iframe,
.poster.is-editing .item .item-body video,
.poster.is-editing .item .item-body audio,
.poster.is-editing .item .item-body img,
.poster.is-editing .item .item-js-root { pointer-events: none; }
.poster.is-editing .item.is-typing { cursor: text; touch-action: auto; -webkit-user-select: text; user-select: text; }
.poster.is-editing .item.is-typing .item-body { pointer-events: auto; }

.poster.is-editing .item.is-selected .item-h {
  display: block;
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--green);
  border: 2px solid #000;
  z-index: 2;
}
.poster.is-editing .item.is-selected .item-h::after { content: ''; position: absolute; inset: -9px; }
.item-h[data-h="nw"] { left: -7px; top: -7px; cursor: nwse-resize; }
.item-h[data-h="n"] { left: calc(50% - 6px); top: -7px; cursor: ns-resize; }
.item-h[data-h="ne"] { right: -7px; top: -7px; cursor: nesw-resize; }
.item-h[data-h="e"] { right: -7px; top: calc(50% - 6px); cursor: ew-resize; }
.item-h[data-h="se"] { right: -7px; bottom: -7px; cursor: nwse-resize; }
.item-h[data-h="s"] { left: calc(50% - 6px); bottom: -7px; cursor: ns-resize; }
.item-h[data-h="sw"] { left: -7px; bottom: -7px; cursor: nesw-resize; }
.item-h[data-h="w"] { left: -7px; top: calc(50% - 6px); cursor: ew-resize; }
.poster.is-editing .item.is-typing .item-h { display: none; }

/* ------------------------------------------------ editor: objects, trash, block settings */

.add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.add-grid .ghost-btn { border-color: var(--green); color: var(--green); }
.add-grid .ghost-btn:hover { background: var(--green); color: #000; }

.item-props { display: flex; flex-direction: column; gap: 10px; }
.ip-field { display: flex; flex-direction: column; gap: 6px; }
.ip-sub {
  margin: 8px 0 0;
  font: 900 10px 'Montserrat', sans-serif;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #9a9a9a;
}
.ip-range { display: grid; grid-template-columns: 1fr 40px; align-items: center; gap: 10px; }
.ip-range input { width: 100%; accent-color: var(--green); }
.ip-out { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; color: #fff; }
.ip-color { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; }
.ip-color input[type="color"] { width: 40px; height: 36px; padding: 0; border: 1px solid #2e2e2e; background: transparent; cursor: pointer; }
.field-group .ip-color input[type="text"] { font-family: ui-monospace, Menlo, monospace; text-transform: uppercase; }
.field-group .ip-color input.is-invalid { border-color: #ff5a5a; }
.ip-mini { height: 36px; padding: 0 12px; border: 1px solid #333; background: none; color: #fff; font: 800 10px 'Montserrat', sans-serif; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.ip-mini:hover { border-color: #fff; }
.field-group textarea.ip-code { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 12px; line-height: 1.5; white-space: pre; overflow: auto; tab-size: 2; }
.ip-geo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ip-geo-cell { display: flex; flex-direction: column; gap: 4px; }
.field-group .ip-geo-cell input { width: 100%; padding: 8px 10px; background: #000; border: 1px solid #2e2e2e; color: #fff; font-size: 13px; }
.field-group .ip-geo-cell input:focus { outline: none; border-color: var(--green); }
.ip-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.ip-actions .ghost-btn { padding: 10px 6px; }
.ip-actions .ip-danger { color: #ff5a5a; border-color: #ff5a5a; }
.ip-actions .ip-danger:hover { background: #ff5a5a; color: #000; }

.obj-tree { display: flex; flex-direction: column; gap: 6px; }
.obj-tree details { border: 1px solid #1f1f1f; }
.obj-tree summary {
  padding: 9px 10px;
  cursor: pointer;
  font: 900 10px 'Montserrat', sans-serif;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff;
}
.obj-row { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 10px; }
.obj-row.is-current { background: color-mix(in srgb, var(--green) 14%, transparent); }
.obj-row.is-dim .obj-name { color: #666; text-decoration: line-through; }
.obj-name {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 0;
  border: 0;
  background: none;
  color: #d0d0d0;
  font: 500 12px 'Inter', sans-serif;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.obj-name:hover { color: var(--green); }

.count {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  margin-left: 6px;
  background: #ff5a5a;
  color: #000;
  font-size: 10px;
  text-align: center;
  letter-spacing: 0;
}
.trash-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.trash-list:empty { display: none; }
.trash-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid #262626; font-size: 12px; color: #d0d0d0; }
.trash-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-name small { display: block; font-size: 10px; color: #777; }
.trash-restore { padding: 7px 10px; border: 1px solid var(--green); background: none; color: var(--green); font: 900 10px 'Montserrat', sans-serif; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.trash-restore:hover { background: var(--green); color: #000; }

.file-btn-like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px;
  border: 0;
  background: var(--green);
  color: #000;
  font: 900 11px 'Montserrat', sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}
.file-btn-like:hover { transform: translateY(-1px); }
.file-btn-like:disabled { opacity: .6; cursor: progress; }
[hidden] { display: none !important; }

/* Video: no native play button / loading spinner; the first frame shows instead. */
video.vid { background: transparent; transition: opacity .25s ease; }
video.vid.vid-pending { opacity: 0; }
video.vid.vid-ready { opacity: 1; }
video.vid::-webkit-media-controls,
video.vid::-webkit-media-controls-panel,
video.vid::-webkit-media-controls-enclosure,
video.vid::-webkit-media-controls-overlay-play-button,
video.vid::-webkit-media-controls-start-playback-button,
video.vid::-webkit-media-controls-overlay-enclosure {
  display: none !important;
  -webkit-appearance: none;
  opacity: 0;
  pointer-events: none;
}

/* Custom copy icon (picture / GIF / video) replaces the drawn file icon */
.copy-icon-media[hidden] { display: none; }
.copy-icon-media { display: block; width: 100%; pointer-events: none; }
.copy-icon-media img,
.copy-icon-media video { display: block; width: 100%; height: auto; max-height: 24vh; object-fit: contain; }
.copy-icon.has-custom .doc-icon { display: none; }
