:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --panel: #ffffff;
  --text: #141820;
  --muted: #626b7a;
  --line: #d9deea;
  --accent: #1f5eff;
  --accent-dark: #1645bd;
  --soft: #eef3ff;
  --warn-bg: #fff6dc;
  --warn-line: #e7bd4b;
  --danger: #b33a3a;
  --shadow: 0 18px 45px rgba(31, 44, 71, 0.10);
}

* {
  box-sizing: border-box;
}

/* Visually hidden, but still read by screen readers and crawlers — used for SEO
   copy / headings on app pages that are otherwise JS-rendered. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #ffffff 0, var(--bg) 46%, #edf2ff 100%);
  color: var(--text);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

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

button {
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  padding: 11px 18px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(31, 94, 255, 0.22);
}

button:hover:not(:disabled) {
  background: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

button.secondary {
  background: #f2f5fb;
  color: var(--text);
  box-shadow: none;
  border: 1px solid var(--line);
}

button.secondary:hover:not(:disabled) {
  background: #e8eef9;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  padding: 11px 18px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(31, 94, 255, 0.22);
}

.link-button:hover {
  background: var(--accent-dark);
}

.link-button.secondary {
  background: #f2f5fb;
  color: var(--text);
  box-shadow: none;
  border: 1px solid var(--line);
}

.link-button.secondary:hover {
  background: #e8eef9;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(28px, 4vw, 48px);
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 6px;
  font-size: 20px;
}

.status-pill {
  white-space: nowrap;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid #d7e2ff;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.status-pill.error {
  color: var(--danger);
  background: #fff0f0;
  border-color: #ffd4d4;
}

/* ===== Full-screen generator layout ===== */
.generator-page {
  overflow: auto;
}

.generator-primary {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.generator-page > .generation-diagnostics {
  margin: 0 clamp(16px, 3vw, 32px) 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 12px clamp(16px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  z-index: 20;
}

.topbar-brand h1 {
  margin: 0;
  font-size: clamp(18px, 2vw, 24px);
  letter-spacing: -0.03em;
}

.topbar-brand .eyebrow {
  margin-bottom: 2px;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-left: 10px;
  margin-left: 2px;
  border-left: 1px solid var(--line);
}

.download-choice { position: relative; }
.download-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 100;
  min-width: 170px;
  padding: 6px;
  background: #fff;
  border: 1px solid #d5dbe3;
  border-radius: 8px;
  box-shadow: 0 6px 20px #0002;
}
.download-menu[hidden] { display: none; }
.download-menu button { display: block; width: 100%; text-align: left; }

.topbar-actions select {
  width: auto;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(217, 222, 234, 0.85);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 16px;
  min-height: 0;
  padding: 16px clamp(16px, 3vw, 32px);
}

.input-panel,
.result-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.input-panel textarea {
  flex: 1;
  min-height: 0;
}

.result-panel .diagram-scroll {
  flex: 1;
  min-height: 0;
  max-height: none;
}

html[data-ads-enabled="false"] .ad-slot,
html[data-ads-enabled="false"] .balance-reward,
html[data-ads-enabled="false"] .profile-card-adreward,
html[data-ads-enabled="false"] .ad-reward-control {
  display: none !important;
}

.generator-language-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  margin: 0 0 12px;
}
.generator-language-row label { display: flex; align-items: center; gap: 10px; }
.generator-language-row select { min-width: 150px; padding: 8px 12px; }
.generator-language-row .muted { flex: 1 1 240px; font-size: 13px; }

.panel-title-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel-title-row p {
  color: var(--muted);
  margin-bottom: 0;
}

textarea {
  width: 100%;
  min-height: 440px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  color: #10141d;
  background: #fbfcff;
  font-family: Consolas, Monaco, Menlo, monospace;
  line-height: 1.45;
  tab-size: 4;
  outline: none;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 94, 255, 0.12);
}

.action-row,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.action-row {
  margin-top: 14px;
}

.compact button {
  padding: 9px 12px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: #313846;
  font-size: 13px;
  font-weight: 700;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 11px;
  background: #fbfcff;
  color: var(--text);
  outline: none;
}

input[type="range"] {
  width: 150px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
  font-weight: 700;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0 12px;
}

.tab-button {
  border: 1px solid var(--line);
  background: #f6f8fd;
  color: var(--text);
  box-shadow: none;
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 14px;
}

.tab-button.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.diagram-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: repeating-linear-gradient(0deg, #ffffff, #ffffff 23px, #f8faff 24px), repeating-linear-gradient(90deg, #ffffff, #ffffff 23px, #f8faff 24px);
  min-height: 520px;
  max-height: 78vh;
}

.diagram-canvas {
  min-width: 100%;
  min-height: 520px;
  padding: 18px;
  transform-origin: top left;
}

.diagram-canvas svg {
  display: block;
  max-width: none;
}

.empty-state {
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .generator-primary {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .input-panel textarea {
    min-height: 320px;
  }

  .result-panel .diagram-scroll {
    min-height: 420px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }
}

/* The editor's final geometry lives in the "Full-screen overlay editor layout"
   section below — the old grid-era duplicates that this file accumulated were
   fully overridden there and have been merged away. */

.palette-item:hover {
  background: var(--soft);
}

.palette-terminator {
  border-radius: 999px;
}

/* Icons whose shape can't be the plain bordered box are drawn as self-contained
   SVG backgrounds. They use `.palette-icon.palette-*` (two classes) so they beat the
   base `.palette-icon` rule that is defined later in this file (single class, equal
   specificity → later wins), which otherwise re-imposes the rectangle border + white
   fill and made the arrow/label look identical to "Действие". `contain` keeps each
   drawing inside both the 27×19 palette box and the 24×18 type-menu box. */
.palette-io {
  transform: skewX(-18deg);
}

.palette-icon.palette-decision {
  border: none;
  background: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 20'%3E%3Cpolygon points='14,1.6 26.4,10 14,18.4 1.6,10' fill='%23fff' stroke='%23111' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.palette-icon.palette-for {
  border: none;
  background: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 20'%3E%3Cpolygon points='5,1.6 23,1.6 26.4,10 23,18.4 5,18.4 1.6,10' fill='%23fff' stroke='%23111' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.palette-icon.palette-arrow {
  border: none;
  background: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 16'%3E%3Cline x1='2' y1='8' x2='24' y2='8' stroke='%23111' stroke-width='2'/%3E%3Cpath d='M22 3 L30 8 L22 13 Z' fill='%23111'/%3E%3C/svg%3E");
}

.palette-icon.palette-label {
  border: none;
  background: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ctext x='10' y='15.5' text-anchor='middle' font-family='Arial, sans-serif' font-size='17' font-weight='700' fill='%23111'%3ET%3C/text%3E%3C/svg%3E");
}

.editor-edge-tail-handle {
  fill: #fff;
}


.editor-node {
  cursor: grab;
}

.editor-node:active {
  cursor: grabbing;
}

.editor-canvas:focus {
  box-shadow: inset 0 0 0 2px rgba(31, 94, 255, 0.10);
}

.editor-canvas.edge-drafting {
  cursor: crosshair;
}

.editor-canvas.node-drafting {
  cursor: copy;
}

.editor-canvas.node-drafting .editor-node,
.editor-canvas.node-drafting .editor-edge,
.editor-canvas.node-drafting .editor-edge-create-handle {
  pointer-events: none;
}

.editor-node-draft {
  opacity: 0.58;
  pointer-events: none;
}

.editor-node-draft .editor-node-shape {
  stroke: var(--accent);
  stroke-dasharray: 7 5;
  stroke-width: 2.2;
  fill: rgba(255, 255, 255, 0.82);
}

.editor-edge-create-handle {
  cursor: pointer;
}

.editor-edge-create-handle rect {
  fill: #ffffff;
  stroke: var(--accent);
  stroke-width: 2;
  filter: drop-shadow(0 5px 10px rgba(31, 94, 255, 0.22));
}

.editor-edge-create-handle path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.editor-edge-create-handle:hover rect {
  fill: var(--soft);
}

/* Corner resize handles on the selected block */
.editor-resize-handle rect {
  fill: #ffffff;
  stroke: var(--accent);
  stroke-width: 2;
}

.editor-resize-handle:hover rect {
  fill: var(--accent);
}

/* In-place text editing inside a block / on an edge label (fixed HTML overlay) */
.editor-text-edit {
  position: fixed;
  z-index: 1000;
  box-sizing: border-box;
  min-height: 0;
  max-height: none;
  border: 1.6px solid var(--accent);
  border-radius: 6px;
  background: #ffffff;
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.2;
  text-align: center;
  padding: 2px 4px;
  resize: none;
  outline: none;
  box-shadow: 0 4px 14px rgba(31, 94, 255, 0.22);
}

/* Left-click block type submenu (replaces the inspector type selector) */
.editor-type-menu {
  position: fixed;
  z-index: 1000;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 150px;
  max-height: 70vh;
  overflow: auto;
}

.editor-type-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  color: #1f2937;
  cursor: pointer;
  text-align: left;
  box-shadow: none;
}

.editor-type-menu-item:hover {
  background: var(--soft);
}

.editor-type-menu-item.active {
  background: var(--soft);
  font-weight: 600;
}

.editor-type-menu-item .palette-icon {
  width: 24px;
  height: 18px;
  flex: 0 0 auto;
}

.editor-type-menu-delete {
  margin-top: 4px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  color: var(--danger);
}

.editor-type-menu-delete-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 18px;
  flex: 0 0 24px;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

.editor-type-menu .editor-type-menu-delete:hover:not(:disabled) {
  background: #fff0f0;
  color: #8f2a2a;
}

.editor-edge-draft {
  pointer-events: none;
}

.editor-edge-draft polyline {
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-dasharray: 7 5;
}

.editor-edge-draft circle {
  fill: var(--accent);
}

.editor-edge-draft-snap {
  fill: #fff !important;
  stroke: var(--accent);
  stroke-width: 2.2;
}

.editor-node-shape {
  fill: #fff;
  stroke: #111;
  stroke-width: var(--diagram-stroke-width, 1.6);
}

.editor-node.selected .editor-node-shape {
  stroke: var(--accent);
  stroke-width: 3;
  filter: drop-shadow(0 4px 8px rgba(31, 94, 255, 0.18));
}

/* Text label: invisible box normally, a dashed outline when selected. */
.editor-label-shape {
  fill: transparent;
  stroke: none;
}

.editor-node.selected .editor-label-shape {
  fill: transparent;
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-dasharray: 4 3;
  filter: none;
}

.editor-predefined-line {
  stroke: #111;
  stroke-width: var(--diagram-stroke-width, 1.6);
}

.editor-node-text {
  fill: #111;
  font-family: Arial, Helvetica, sans-serif;
  pointer-events: none;
  user-select: none;
}

.editor-edge polyline {
  stroke: #111;
  stroke-width: var(--diagram-stroke-width, 1.6);
  cursor: pointer;
}

.editor-edge-hit-body {
  stroke: transparent;
  stroke-width: 16;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  pointer-events: stroke;
  cursor: move;
}

.editor-edge-mid-handle {
  fill: var(--accent);
  stroke: #fff;
  stroke-width: 2;
  opacity: 0;
  pointer-events: all;
}

.editor-edge:hover .editor-edge-mid-handle,
.editor-edge.selected .editor-edge-mid-handle {
  opacity: 1;
}

.editor-edge-mid-handle.horizontal {
  cursor: ns-resize;
}

.editor-edge-mid-handle.vertical {
  cursor: ew-resize;
}

.editor-edge-mid-handle.free {
  cursor: move;
}

.editor-edge-head-handle {
  fill: #fff;
  stroke: var(--accent);
  stroke-width: 2;
  cursor: grab;
  opacity: 0;
  pointer-events: all;
}

.editor-edge:hover .editor-edge-head-handle,
.editor-edge.selected .editor-edge-head-handle {
  opacity: 1;
}

.editor-edge-head-handle:active {
  cursor: grabbing;
}

.editor-edge.selected polyline {
  stroke: var(--accent);
  stroke-width: 3;
}

.editor-edge-label-bg {
  fill: #fff;
  opacity: 0.9;
  pointer-events: none;
}

.editor-edge-label {
  fill: #111;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  pointer-events: none;
}

.editor-page-fallback {
  max-width: 760px;
  margin: 64px auto;
}

/* Full-screen overlay editor layout */
html,
body {
  height: 100%;
}

.standalone-editor-page {
  min-height: 100vh;
  overflow: hidden;
}

.standalone-editor-shell {
  display: block;
  width: 100vw;
  height: 100vh;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.editor-shell {
  margin-top: 12px;
}

.editor-card {
  position: relative;
  min-height: calc(100vh - 24px);
  padding: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid rgba(217, 222, 234, 0.95);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.standalone-editor-shell .editor-card {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.editor-body,
.standalone-editor-shell .editor-body {
  position: absolute;
  inset: 0;
  display: block;
  min-height: 0;
}

.editor-workspace-wrap,
.standalone-editor-shell .editor-workspace-wrap {
  position: absolute;
  inset: 0;
  z-index: 1;
  min-height: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: #ffffff;
}

.editor-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  cursor: grab;
  outline: none;
  touch-action: none;
}

.editor-canvas.is-panning {
  cursor: grabbing;
}

.editor-canvas-bg {
  pointer-events: all;
}

.editor-grid-line {
  stroke: #edf1f8;
  stroke-width: 1;
}

.editor-header {
  position: absolute;
  top: 12px;
  left: 172px;
  right: 268px;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 7px 8px;
  border: 1px solid rgba(217, 222, 234, 0.9);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(31, 44, 71, 0.12);
  backdrop-filter: blur(12px);
}

.editor-header .eyebrow,
.editor-header h2 {
  display: none;
}

.editor-header #editorSubtitle {
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer; /* click renames the diagram */
}

/* Inline rename input shown in place of the subtitle */
.editor-name-input {
  min-width: 180px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 12px;
  outline: none;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  flex: 0 0 auto;
  gap: 6px;
}

.editor-toolbar button {
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.1;
}

.editor-zoom {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #313846;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.editor-zoom input {
  width: 86px;
}

.editor-palette {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  width: 148px;
  max-height: calc(100vh - 24px);
  padding: 8px;
  overflow: auto;
  border: 1px solid rgba(217, 222, 234, 0.9);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 12px 30px rgba(31, 44, 71, 0.12);
  backdrop-filter: blur(12px);
}

.editor-palette h3 {
  margin: 0 0 6px;
  font-size: 12px;
  line-height: 1.15;
}

.editor-palette .muted {
  display: none;
}

.palette-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.palette-item {
  display: grid;
  justify-items: center;
  align-items: center;
  gap: 3px;
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 5px 3px;
  text-align: center;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: none;
}

.palette-title {
  max-width: 100%;
  color: #313846;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.palette-icon {
  display: block;
  width: 27px;
  height: 19px;
  border: 1.5px solid #111;
  background: #fff;
}

.palette-page_connector {
  border-radius: 50%;
  width: 22px;
  height: 22px;
}

.palette-icon.palette-predefined {
  border: none;
  background: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 20'%3E%3Crect x='1.5' y='2.8' width='25' height='14.4' fill='%23fff' stroke='%23111' stroke-width='1.6'/%3E%3Cline x1='5.4' y1='2.8' x2='5.4' y2='17.2' stroke='%23111' stroke-width='1'/%3E%3Cline x1='22.6' y1='2.8' x2='22.6' y2='17.2' stroke='%23111' stroke-width='1'/%3E%3C/svg%3E");
}

@media (max-width: 980px) {
  .standalone-editor-page {
    overflow: auto;
  }

  .standalone-editor-shell {
    min-width: 760px;
    min-height: 620px;
  }

  .editor-card,
  .standalone-editor-shell .editor-card {
    min-width: 760px;
  }

  .editor-header {
    left: 12px;
    right: 12px;
    top: 12px;
  }

  .editor-palette {
    top: 66px;
  }
}

.editor-canvas.is-selecting {
  cursor: crosshair;
}

.editor-selection-box-layer {
  pointer-events: none;
}

.editor-selection-box {
  fill: rgba(31, 94, 255, 0.09);
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-dasharray: 8 5;
}

.editor-edge.selected .editor-edge-label-bg {
  stroke: var(--accent);
  stroke-width: 1.4;
  opacity: 1;
}

.editor-history-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border: 1px solid rgba(217, 222, 234, 0.8);
  border-radius: 12px;
  background: rgba(248, 250, 255, 0.86);
}

.editor-toolbar .editor-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 31px;
  padding: 0;
}

.editor-icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.editor-icon-button:disabled {
  cursor: default;
  opacity: 0.42;
}

/* ===== Editor help modal ===== */
.editor-help-card {
  width: min(680px, 100%);
  position: relative;
}

.editor-help h2 {
  margin-bottom: 4px;
  padding-right: 36px;
}

.editor-help-intro {
  color: var(--muted);
  margin: 0 0 6px;
  line-height: 1.5;
}

.editor-help-section {
  margin-top: 18px;
}

.editor-help-section h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text);
}

.editor-help-section ul {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.editor-help-section li {
  line-height: 1.5;
}

.editor-help-keys {
  list-style: none;
  padding-left: 0;
}

.editor-help kbd {
  display: inline-block;
  min-width: 12px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: 600 12px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: center;
  white-space: nowrap;
}

/* ===== About modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 24, 32, 0.45);
  backdrop-filter: blur(3px);
}

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

.modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: var(--panel);
  border-radius: 22px;
  box-shadow: 0 30px 70px rgba(20, 28, 48, 0.35);
  padding: 26px;
}

.modal-card h2 {
  margin-bottom: 12px;
  font-size: 22px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.settings-modal-card {
  width: min(680px, 100%);
}

.field-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--soft);
  border: 1px solid #c3d2f5;
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  user-select: none;
  flex: 0 0 auto;
}

.info:hover {
  background: #dbe6ff;
}

.info-tooltip {
  position: fixed;
  z-index: 200;
  max-width: 280px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(20, 28, 48, 0.96);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 0 12px 30px rgba(20, 28, 48, 0.3);
  pointer-events: none;
}

.info-tooltip[hidden] {
  display: none;
}

/* Grouped settings sections */
.settings-group {
  margin-top: 6px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.settings-group:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.settings-group > summary {
  cursor: pointer;
  list-style: none;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.settings-group > summary::-webkit-details-marker {
  display: none;
}

.settings-group > summary::before {
  content: '▸ ';
}

.settings-group[open] > summary::before {
  content: '▾ ';
}

.settings-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
}

.size-table {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 9px 10px;
  align-items: center;
}

.size-table input[type="number"] {
  width: 100%;
}

.size-col {
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.size-rowlabel {
  font-size: 13px;
  font-weight: 700;
  color: #313846;
}

/* ===== Toast notification ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 120;
  transform: translateX(-50%) translateY(12px);
  max-width: min(640px, calc(100vw - 32px));
  padding: 12px 20px;
  border-radius: 14px;
  background: rgba(20, 28, 48, 0.92);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  /* Multi-line messages (e.g. the warnings toast) keep their line breaks. */
  white-space: pre-line;
  box-shadow: 0 16px 40px rgba(20, 28, 48, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast[hidden] {
  display: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.toast-error {
  background: var(--danger);
}

/* Result panel: only switchers + the viewer, nothing else */
.result-panel .tabs {
  margin: 0 0 10px;
}

.result-panel .tabs:empty {
  display: none;
}

/* ===== Scrollable function tabs (many functions) ===== */
.tabs.scrollable {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.tabs.scrollable .tab-button {
  flex: 0 0 auto;
}

/* ===== Home button (generator topbar + editor) ===== */
.home-btn {
  font-size: 13px;
  padding: 8px 14px;
  white-space: nowrap;
}

/* ===== Balance display (generator) ===== */
.balance-display {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-dark);
  background: var(--soft);
  border: 1px solid #d7e2ff;
  border-radius: 999px;
  padding: 6px 14px;
  white-space: nowrap;
  cursor: default;
}

/* ===== Balance insufficient modal ===== */
.balance-detail-rows {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.balance-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  font-size: 15px;
  border-bottom: 1px solid var(--line);
}

.balance-detail-row:last-child {
  border-bottom: none;
}

.balance-deficit-row {
  background: #fff6dc;
}

.balance-deficit-amount {
  color: var(--danger);
  font-size: 16px;
}

/* ===== Landing page ===== */
.landing-page {
  background: #f8faff;
  color: var(--text);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  min-height: 100vh;
}

.landing-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 60px);
}

/* Nav */
.landing-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.landing-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}

.landing-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.03em;
}

.landing-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 900;
}

/* Hero */
.landing-hero {
  padding: clamp(60px, 10vw, 120px) 0 clamp(50px, 8vw, 90px);
  text-align: center;
}

.landing-h1 {
  font-size: clamp(36px, 6vw, 70px);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.08;
  margin-bottom: 20px;
}

.landing-accent {
  color: var(--accent);
}

.landing-lead {
  font-size: clamp(16px, 2.2vw, 20px);
  color: var(--muted);
  max-width: 680px;
  margin: 0 auto 36px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

.hero-cta {
  font-size: 16px;
  padding: 14px 28px;
  border-radius: 14px;
}

.hero-badges {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-badge {
  display: inline-block;
  background: var(--soft);
  border: 1px solid #d0dcff;
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
}

/* Section headings */
.landing-h2 {
  font-size: clamp(24px, 4vw, 38px);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
  text-align: center;
}

.landing-section-lead {
  text-align: center;
  color: var(--muted);
  font-size: 16px;
  max-width: 600px;
  margin: 0 auto 40px;
}

/* Try section */
.landing-try {
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: clamp(50px, 7vw, 90px) 0;
}

.try-panel {
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
}

.try-lang-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 0;
}

.try-lang-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.try-lang-select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 14px;
  background: var(--panel);
}

.try-textarea {
  width: 100%;
  min-height: 200px;
  resize: vertical;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 16px 18px;
  font-family: monospace;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}

.try-textarea:focus {
  outline: none;
  background: #fff;
}

.try-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.try-cost-label {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.try-vat {
  font-weight: 400;
  color: var(--muted);
  font-size: 13px;
}

.try-generate-btn {
  padding: 10px 24px;
  border-radius: 12px;
  font-size: 15px;
}

.try-hint {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin: 16px auto 0;
  max-width: 800px;
}

/* Comparison table */
.landing-compare {
  padding: clamp(50px, 7vw, 90px) 0;
}

.compare-table-wrap {
  overflow-x: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  font-size: 15px;
}

.compare-table th,
.compare-table td {
  padding: 14px 20px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.compare-table th {
  background: var(--bg);
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
}

.compare-table .compare-feature-col {
  text-align: left;
  font-weight: 600;
  color: var(--text);
}

.compare-table td.compare-feature-col {
  font-weight: 500;
  color: var(--text);
  text-align: left;
}

.compare-table tbody tr:last-child td {
  border-bottom: none;
}

.compare-table tbody tr:hover {
  background: var(--soft);
}

.compare-table .our-col {
  background: #f0f5ff;
  font-weight: 700;
}

.compare-table th.our-col {
  background: var(--soft);
  color: var(--accent-dark);
}

.our-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  padding: 2px 8px;
  font-weight: 700;
  margin-top: 4px;
  white-space: nowrap;
}

.compare-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  display: block;
}

.cmp-check { color: #1a8a3a; font-weight: 700; }
.cmp-cross { color: var(--danger); font-weight: 700; }
.cmp-partial { color: #a06000; font-weight: 600; font-size: 13px; }
.cmp-neutral { color: var(--muted); }
.cmp-speed-win { color: #1a8a3a; font-weight: 700; }
.cmp-speed-mid { color: #a06000; font-weight: 600; }
.cmp-speed-lose { color: var(--danger); }

/* Features */
.landing-features {
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: clamp(50px, 7vw, 90px) 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 24px;
  margin-top: 10px;
}

.feature-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 24px;
  text-align: center;
}

.feature-icon {
  font-size: 36px;
  margin-bottom: 14px;
}

.feature-card h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
}

.feature-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
}

/* Pricing */
.landing-pricing {
  padding: clamp(50px, 7vw, 90px) 0;
}

.pricing-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  max-width: 840px;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .pricing-wrap { grid-template-columns: 1fr; }
}

.pricing-card,
.pricing-calc-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 30px 26px;
  box-shadow: var(--shadow);
}

.pricing-card {
  text-align: center;
  border: 2px solid var(--accent);
}

.pricing-amount {
  margin-bottom: 8px;
}

.pricing-num {
  font-size: 64px;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--accent);
}

.pricing-rub {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
}

.pricing-per {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 4px;
}

.pricing-vat-note {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  margin: 4px 0 20px;
}

.pricing-includes {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  text-align: left;
}

.pricing-includes li {
  padding: 6px 0;
  font-size: 14px;
  color: #1a8a3a;
  font-weight: 600;
}

.pricing-cta {
  display: block;
  text-align: center;
  font-size: 15px;
  padding: 12px 20px;
}

.pricing-calc-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
}

.pricing-calc-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.pricing-calc-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.calc-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 15px;
  background: var(--bg);
}

.pricing-calc-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--soft);
  border: 1px solid #d0dcff;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
  font-size: 15px;
}

.pricing-calc-result strong {
  font-size: 22px;
  color: var(--accent);
}

.pricing-calc-hint {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin: 12px 0 0;
}

/* Auth modal */
.auth-modal-card {
  position: relative;
}

.modal-close-x {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  padding: 0;
}

.modal-close-x:hover {
  background: #e8eef9;
  color: var(--text);
}

.auth-cost-preview {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-dark);
  margin: 0 0 4px;
}

.auth-modal-actions {
  justify-content: flex-start;
  gap: 12px;
}

#trialGuestBtn[hidden] { display: none; }

/* Footer */
.landing-footer {
  background: #1a2035;
  color: #c8d0e0;
  padding: clamp(50px, 7vw, 80px) 0 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 2fr;
  gap: 40px;
  padding-bottom: 50px;
}

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

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

.footer-logo {
  color: #fff;
  margin-bottom: 14px;
  display: inline-flex;
}

.footer-tagline {
  font-size: 14px;
  color: #8897b3;
  line-height: 1.55;
  margin-bottom: 18px;
}

.footer-col-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8897b3;
  margin: 0 0 14px;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 10px;
}

.footer-links a {
  color: #c8d0e0;
  text-decoration: none;
  font-size: 14px;
}

.footer-links a:hover {
  color: #fff;
}

/* Contact form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-input,
.contact-textarea {
  border: 1px solid #2e3a52;
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 14px;
  background: #232d42;
  color: #e0e8f8;
  font-family: inherit;
  transition: border-color 0.15s;
}

.contact-input::placeholder,
.contact-textarea::placeholder {
  color: #5a6a82;
}

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

.contact-textarea {
  resize: vertical;
  min-height: 90px;
}

.contact-submit {
  align-self: flex-start;
  padding: 9px 22px;
  font-size: 14px;
  border-radius: 10px;
}

.contact-sent {
  color: #4cd97b;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.contact-error {
  color: #ff5c5c;
  font-size: 13px;
  margin: 0;
}

.footer-contacts-note {
  color: #8897b3;
  font-size: 14px;
  line-height: 1.6;
  margin: 4px 0 0;
}

/* ---- Legal pages (privacy / offer) ---- */
.legal-page {
  background: #f4f6fb;
  color: #1a2233;
}

.legal-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 44px 20px 88px;
}

.legal-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.legal-meta {
  color: #8897b3;
  font-size: 14px;
  margin: 0 0 30px;
}

.legal-back {
  display: inline-block;
  margin-bottom: 22px;
  color: #1f5eff;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.legal-back:hover {
  text-decoration: underline;
}

.legal-toc {
  background: #fff;
  border: 1px solid #e3e8f2;
  border-radius: 12px;
  padding: 16px 24px;
  margin: 0 0 34px;
}

.legal-toc ol {
  margin: 0;
  padding-left: 20px;
  color: #56627d;
  font-size: 14px;
  line-height: 1.9;
}

.legal-wrap h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 34px 0 12px;
  color: #141c2e;
}

.legal-wrap p,
.legal-wrap li {
  line-height: 1.7;
  color: #38435c;
  font-size: 15px;
}

.legal-wrap ul,
.legal-wrap ol {
  padding-left: 22px;
  margin: 10px 0;
}

.legal-wrap li {
  margin-bottom: 6px;
}

.legal-wrap a {
  color: #1f5eff;
}

.legal-fill {
  background: #fff3cd;
  border: 1px dashed #e0b800;
  border-radius: 4px;
  padding: 0 6px;
  font-weight: 600;
  color: #7a5b00;
  white-space: nowrap;
}

/* ---- Registration consent checkbox ---- */
.auth-consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 4px 0 16px;
  font-size: 13px;
  line-height: 1.5;
  color: #56627d;
  cursor: pointer;
}

.auth-consent input[type="checkbox"] {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  cursor: pointer;
  accent-color: #1f5eff;
}

.auth-consent a {
  color: #1f5eff;
}

/* ---- Cookie consent banner ---- */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  background: #1b2335;
  color: #e7ecf6;
  border: 1px solid #2e3a52;
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 12px 44px rgba(10, 16, 30, 0.4);
  font-size: 14px;
  line-height: 1.5;
  animation: cookie-rise 0.35s ease;
}

@keyframes cookie-rise {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.cookie-banner-text {
  flex: 1;
}

.cookie-banner-text a {
  color: #6f9bff;
}

.cookie-banner-btn {
  flex-shrink: 0;
  background: #1f5eff;
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 10px 22px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.cookie-banner-btn:hover {
  background: #1a4fd6;
}

.cookie-banner-hide {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

@media (max-width: 560px) {
  .cookie-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
}

/* ---- Ad slots (Yandex RTB / РСЯ) ---- */
.ad-slot {
  margin: 28px auto;
  display: flex;
  justify-content: center;
  width: 100%;
  overflow: hidden;
}
.ad-slot > div {
  width: 100%;
}
.ad-slot-feed {
  margin-top: 36px;
}

/* Floor Ad floats fixed at the bottom of the viewport over the editor; give the
   editor shell bottom room (added only once an ad actually renders) so the bar
   never hides the canvas or its controls. */
.standalone-editor-page.has-floor-ad .standalone-editor-shell {
  padding-bottom: 100px;
}

/* ---- Rewarded "+5 ₽ за рекламу" (balance modal) ---- */
.balance-reward {
  margin: 16px 0 4px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: #f6f9ff;
  text-align: center;
}
.balance-reward-hint {
  margin: 0 0 10px;
  font-size: 13px;
  color: #51607a;
}
.balance-reward-btn {
  width: 100%;
  cursor: pointer;
}

/* ---- Free editor promo (landing) ---- */
.landing-nav-link {
  color: #38435c;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 6px;
  white-space: nowrap;
}

.landing-nav-link:hover {
  color: #1f5eff;
}

.landing-editor {
  padding: 72px 0;
  background: #ffffff;
}

.editor-promo {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 48px;
  align-items: center;
}

.editor-promo-badge {
  display: inline-block;
  background: #eaf7ee;
  color: #1a8a3a;
  font-weight: 700;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.editor-promo-list {
  list-style: none;
  padding: 0;
  margin: 20px 0 28px;
  display: grid;
  gap: 10px;
}

.editor-promo-list li {
  position: relative;
  padding-left: 28px;
  color: #38435c;
  font-size: 15px;
  line-height: 1.5;
}

.editor-promo-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: #1a8a3a;
  font-weight: 700;
}

.editor-promo-visual {
  display: flex;
  justify-content: center;
}

/* Promo "preview card" framing a REAL generator SVG (see landing.html). The faux
   editor bar + faint grid behind the white blocks read as genuine generator output. */
.promo-diagram {
  margin: 0;
  width: 100%;
  max-width: 340px;
  background: #fff;
  border: 1px solid #e4e9f3;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(31, 94, 255, 0.14);
}

.promo-diagram-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: #f5f7fc;
  border-bottom: 1px solid #e9edf6;
}

.promo-diagram-dots {
  display: inline-flex;
  gap: 5px;
}

.promo-diagram-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d4dcec;
}

.promo-diagram-fn {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: #28324a;
}

.promo-diagram-lang {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: #1f5eff;
  background: #eaf0ff;
  padding: 2px 9px;
  border-radius: 999px;
}

.promo-diagram-canvas {
  padding: 16px 14px 18px;
  background:
    linear-gradient(#eef2fb 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(90deg, #eef2fb 1px, transparent 1px) 0 0 / 22px 22px,
    #fff;
}

.promo-diagram-canvas svg {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 760px) {
  .editor-promo {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .editor-promo-visual {
    order: -1;
  }
}

/* ---- FAQ (landing) ---- */
.landing-faq {
  padding: 72px 0;
  background: #f4f6fb;
}

.faq-list {
  max-width: 820px;
  margin: 28px auto 0;
  display: grid;
  gap: 12px;
}

.faq-item {
  background: #ffffff;
  border: 1px solid #e3e8f2;
  border-radius: 12px;
  padding: 4px 22px;
}

.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 18px 28px 18px 0;
  font-weight: 600;
  font-size: 17px;
  color: #141c2e;
  position: relative;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  font-weight: 400;
  color: #1f5eff;
  line-height: 1;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item p {
  margin: 0 0 18px;
  color: #38435c;
  line-height: 1.7;
  font-size: 15px;
}

.footer-bottom {
  border-top: 1px solid #2e3a52;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-copy {
  font-size: 13px;
  color: #5a6a82;
  margin: 0;
}

/* ===== Editor toolbar home button (injected via editor-page.js) ===== */
.editor-home-toolbar-btn {
  margin-right: 4px;
}

/* ===== Profile page ===== */
.profile-page {
  background: #f8faff;
  min-height: 100vh;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
}

.profile-main {
  padding-top: 40px;
  padding-bottom: 60px;
  max-width: 860px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 36px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-name {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 4px;
}

.profile-since {
  margin: 0;
  font-size: 14px;
}

/* Stat cards */
.profile-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 40px;
}

@media (max-width: 640px) {
  .profile-cards { grid-template-columns: 1fr; }
}

.profile-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 20px;
  box-shadow: 0 4px 18px rgba(31,44,71,0.07);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-card-balance {
  border: 2px solid var(--accent);
}

.pc-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.pc-value {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.pc-bonus {
  color: #1a8a3a;
}

.pc-action {
  font-size: 13px;
  padding: 8px 14px;
  margin-top: 4px;
  align-self: flex-start;
}

.pc-status {
  font-size: 13px;
  color: var(--muted);
}

.pc-sub {
  font-size: 13px;
  color: var(--muted);
}

/* Sections */
.profile-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 18px rgba(31,44,71,0.06);
}

.profile-section-title {
  font-size: 17px;
  font-weight: 800;
  margin: 0 0 18px;
  letter-spacing: -0.02em;
}

/* Referral */
.referral-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.referral-desc {
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 14px;
  line-height: 1.55;
}

.referral-link-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.referral-link-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
}

.referral-link-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 14px;
  background: var(--bg);
  color: var(--accent-dark);
  font-weight: 600;
}

.ref-copy-btn {
  white-space: nowrap;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 14px;
}

.referral-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 14px;
}

.ref-stat strong {
  color: var(--text);
  font-weight: 700;
}

.ref-stat-sep {
  color: var(--muted);
}

/* Profile tables */
.payments-wrap,
.referral-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.profile-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.profile-table th,
.profile-table td {
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.profile-table th {
  background: var(--bg);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.profile-table tbody tr:last-child td {
  border-bottom: none;
}

.profile-table tbody tr:hover {
  background: var(--soft);
}

.amount-positive {
  color: #1a8a3a;
  font-weight: 700;
}

.amount-negative {
  color: var(--danger);
  font-weight: 700;
}

.payment-date {
  white-space: nowrap;
  color: var(--muted);
}

.table-empty {
  text-align: center;
  color: var(--muted);
  padding: 28px !important;
  font-style: italic;
}

.receipt-link {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.receipt-link:hover {
  text-decoration: underline;
}

/* Danger zone */
.danger-zone {
  border-color: #ffd4d4;
}

.danger-title {
  color: var(--danger);
}

.danger-panel {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.danger-desc {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  max-width: 500px;
  line-height: 1.55;
}

.danger-btn {
  background: var(--danger);
  box-shadow: none;
  font-size: 14px;
  padding: 10px 20px;
  white-space: nowrap;
}

.danger-btn:hover:not(:disabled) {
  background: #8f2a2a;
}

/* Delete confirm input */
.delete-confirm-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 15px;
  background: var(--bg);
  margin: 8px 0 0;
}

/* Top-up modal: preset-amount buttons */
.topup-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 4px;
}
.topup-preset {
  flex: 1 1 0;
  min-width: 64px;
  padding: 11px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  /* Override the global button rule (accent bg + white text), which made these
     near-invisible: white text on the light --bg. These are neutral chips. */
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  box-shadow: none;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.topup-preset:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--soft);
}
.topup-preset.selected {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--accent-dark);
}
.topup-amount-label {
  display: block;
  margin: 14px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

/* The toast component is defined once (see "Toast notification" above): this
   second, conflicting .toast definition left the profile page's toast at the
   shared opacity:0 base state — i.e. invisible — because it never added .show. */

/* ===== Auth pages (login, register, verify) ===== */
.auth-page {
  background: #f8faff;
  min-height: 100vh;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
}

.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 65px);
  padding: 40px 20px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 36px 32px;
  box-shadow: 0 8px 40px rgba(31,44,71,0.10);
}

.auth-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
}

.auth-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 24px;
  line-height: 1.55;
}

.auth-field {
  margin-bottom: 16px;
}

.auth-field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.auth-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s;
}

.auth-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31,94,255,0.12);
  outline: none;
}

.auth-optional {
  font-weight: 400;
  color: var(--muted);
}

.auth-submit {
  width: 100%;
  padding: 13px;
  font-size: 15px;
  border-radius: 12px;
  margin-top: 8px;
}

.auth-error {
  background: #fff0f0;
  border: 1px solid #ffd4d4;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--danger);
  margin-bottom: 12px;
  /* A 422 can carry several validation messages joined with line breaks. */
  white-space: pre-line;
}

.auth-switch {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  margin: 16px 0 0;
}

.auth-switch a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

/* Password rules */
.pw-rules {
  list-style: none;
  padding: 8px 0 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pw-rules li {
  font-size: 12px;
  color: var(--muted);
  padding-left: 18px;
  position: relative;
}

.pw-rules li::before {
  content: "○";
  position: absolute;
  left: 0;
  font-size: 10px;
}

.pw-rules li.pw-ok {
  color: #1a8a3a;
}

.pw-rules li.pw-ok::before {
  content: "✓";
}

.pw-rules li.pw-fail {
  color: var(--danger);
}

.pw-rules li.pw-fail::before {
  content: "✗";
}

/* Yandex button */
.yandex-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: none;
  cursor: pointer;
  margin-bottom: 6px;
  transition: background 0.15s;
}

.yandex-btn:hover {
  background: #f4f4f4;
}

.oauth-consent {
  margin: 0 0 6px;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  color: var(--muted);
}

.oauth-consent a {
  color: var(--muted);
  text-decoration: underline;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Verify email page */
.verify-icon {
  font-size: 48px;
  text-align: center;
  margin-bottom: 16px;
}

.verify-email-display {
  font-weight: 700;
  color: var(--accent-dark);
  text-align: center;
  font-size: 15px;
  margin: 0 0 12px;
}

.verify-hint {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin: 0 0 20px;
}

/* ============================================================================
   SEO content pages (language landings, examples gallery, blog/reference)
   ========================================================================= */
.content-page {
  background: var(--bg);
}

.content-main {
  padding: 32px 24px 64px;
}

.breadcrumbs {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0 22px;
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.bc-sep {
  margin: 0 8px;
  color: var(--line);
}

.content-page h1 {
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.15;
  margin: 0 0 16px;
  color: var(--text);
}

.content-lead,
.article-lead {
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 760px;
  margin: 0 0 24px;
}

.content-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 36px;
}

/* Article CTA — centered + enlarged so it stands out above the ad block that now
   follows it (otherwise the buttons got lost next to the colourful РСЯ banner). */
.article-cta {
  justify-content: center;
  gap: 16px;
  margin: 28px 0 24px;
}
.article-cta .link-button {
  padding: 15px 32px;
  font-size: 16px;
}

.content-list {
  line-height: 1.7;
  color: var(--text);
  max-width: 820px;
  padding-left: 22px;
}

.content-list li {
  margin-bottom: 8px;
}

.content-page section {
  margin: 36px 0;
}

.content-page h2 {
  font-size: clamp(20px, 2.6vw, 26px);
  margin: 0 0 16px;
  color: var(--text);
}

/* --- language landing --- */
.lang-example-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.lang-code pre,
.example-code pre {
  margin: 0;
  background: #0f1729;
  color: #e6edff;
  border-radius: 12px;
  padding: 18px;
  overflow-x: auto;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 14px;
  line-height: 1.55;
}

.lang-diagram {
  margin: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow);
}

.lang-diagram svg {
  max-width: 100%;
  height: auto;
}

.lang-diagram figcaption {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.lang-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.lang-chip {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border: 1px solid transparent;
}

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

/* --- examples gallery --- */
.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}

.example-card {
  margin: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.example-title {
  font-size: 17px !important;
  margin: 0 0 12px !important;
}

.example-canvas {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.example-img {
  max-width: 100%;
  max-height: 320px;
  height: auto;
}

.example-caption {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  margin: 14px 0 12px;
  flex-grow: 1;
}

.example-code summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
}

.example-code pre {
  margin-top: 12px;
  font-size: 13px;
}

/* Clickable example card (opens the modal) */
.example-card[data-example] {
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.example-card[data-example]:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.example-card[data-example]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.example-open {
  margin-top: 12px;
  font-weight: 600;
  color: var(--accent);
  font-size: 14px;
}

/* Examples modal (enlarged diagram + language-switchable code) */
.ex-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.ex-modal[hidden] {
  display: none;
}

.ex-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 41, 0.55);
}

.ex-modal-card {
  position: relative;
  background: var(--panel);
  border-radius: 16px;
  max-width: 1040px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px;
  box-shadow: var(--shadow);
}

.ex-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  border: none;
  background: none;
  font-size: 30px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.ex-modal-close:hover {
  color: var(--text);
}

.ex-modal-title {
  margin: 0 0 6px;
  font-size: 24px;
}

.ex-modal-caption {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 15px;
  max-width: 70ch;
}

.ex-modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
  min-width: 0;
}

.ex-modal-diagram {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.ex-modal-diagram img {
  display: block;
  width: auto;
  min-width: 0;
  max-width: 100%;
  max-height: 60vh;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.ex-modal-code {
  min-width: 0;
  max-width: 100%;
}

.ex-lang-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.ex-lang-tab {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.ex-lang-tab:hover {
  border-color: var(--accent);
}

.ex-lang-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.ex-modal-code pre {
  width: 100%;
  max-width: 100%;
  margin: 0;
  background: #0f1729;
  color: #e6edff;
  border-radius: 12px;
  padding: 18px;
  overflow-x: auto;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 14px;
  line-height: 1.55;
}

.ex-modal-cta {
  margin-top: 16px;
}

@media (max-width: 760px) {
  .ex-modal-body {
    grid-template-columns: 1fr;
  }
}

/* --- blog index --- */
.blog-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.blog-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.15s;
}

.blog-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.blog-card-title {
  font-size: 19px;
  margin: 0 0 10px;
  color: var(--text);
}

.blog-card-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 12px;
}

.blog-card-more {
  font-weight: 600;
  color: var(--accent);
  font-size: 14px;
}

/* --- article --- */
.article {
  max-width: 800px;
}

.article-body {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
}

.article-body h2 {
  margin: 34px 0 14px;
}

.article-body p,
.article-body li {
  margin-bottom: 12px;
}

.article-body ul,
.article-body ol {
  padding-left: 24px;
}

.article-body a {
  color: var(--accent);
}

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.article-nav-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 48%;
  text-decoration: none;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  transition: border-color 0.15s;
}

.article-nav-link:hover {
  border-color: var(--accent);
}

.article-nav-link.next {
  text-align: right;
  margin-left: auto;
}

.article-nav-dir {
  font-size: 13px;
  color: var(--muted);
}

.article-nav-title {
  font-weight: 600;
  color: var(--text);
  font-size: 15px;
}

.ref-table-scroll {
  width: 100%;
  max-width: 100%;
  margin: 18px 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.ref-table-scroll:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.ref-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  margin: 0;
  font-size: 15px;
}

.ref-table th,
.ref-table td {
  border: 1px solid var(--line);
  padding: 10px 14px;
  text-align: left;
  vertical-align: middle;
}

.ref-table th {
  background: var(--soft);
}

.ref-table td:first-child {
  text-align: center;
}

.ref-table svg {
  display: block;
  margin: 0 auto;
}

/* --- content footer --- */
.content-footer {
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 40px 24px;
  margin-top: 48px;
}

.content-footer-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 28px;
}

.content-footer-title {
  font-size: 14px !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 12px !important;
}

.content-footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.content-footer-col li {
  margin-bottom: 8px;
}

.content-footer-col a {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}

.content-footer-col a:hover {
  color: var(--accent);
}

/* All 9 language links wrap inline so the column stays compact. */
.content-footer-langs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.content-footer-langs li {
  margin-bottom: 4px;
}

.content-footer-langs a {
  font-size: 13px;
}

.content-footer-copy {
  margin: 28px 0 0;
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .lang-example-grid {
    grid-template-columns: 1fr;
  }
}

/* Languages section on the landing page (links to the per-language landings). */
.landing-languages {
  padding: 56px 0;
  text-align: center;
}

.landing-lang-grid {
  justify-content: center;
  margin-top: 24px;
}

.landing-usecases {
  padding: 56px 0;
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.landing-usecase-list {
  margin-top: 24px;
}

/* ============================================================================
   Responsive navigation and mobile layout
   ========================================================================= */
.landing-nav-inner {
  position: relative;
}

.landing-nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.mobile-nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  box-shadow: none;
}

.mobile-nav-toggle:hover:not(:disabled) {
  background: var(--soft);
}

.mobile-nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.mobile-nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mobile-nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.mobile-nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (hover: none) and (pointer: coarse) {
  button,
  .link-button,
  input:not([type="range"]):not([type="checkbox"]),
  select {
    min-height: 44px;
  }
}

@media (max-width: 980px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .topbar-brand,
  .topbar-controls {
    width: 100%;
    min-width: 0;
  }

  .topbar-controls {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    padding-bottom: 3px;
  }

  .topbar-controls > *,
  .topbar-actions > * {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .topbar-actions {
    flex-wrap: nowrap;
  }

  .workspace {
    width: 100%;
    min-width: 0;
  }

  .standalone-editor-shell,
  .editor-card,
  .standalone-editor-shell .editor-card {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 720px) {
  body:not(.standalone-editor-page) {
    overflow-x: clip;
  }

  h1,
  h2,
  h3,
  .landing-logo,
  .landing-h1,
  .landing-h2,
  .profile-name,
  .pc-value,
  .pricing-num {
    letter-spacing: 0;
  }

  .landing-container {
    padding-left: 16px;
    padding-right: 16px;
  }

  /* Shared site navigation. With JavaScript disabled the links remain visible
     as a wrapped second row; enhancement turns them into a compact menu. */
  .landing-nav-inner {
    min-height: 64px;
    padding-top: 10px;
    padding-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .landing-logo {
    gap: 9px;
    font-size: 19px;
    min-width: 0;
  }

  .landing-logo-mark {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
  }

  .landing-nav-actions {
    flex: 1 0 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .landing-nav-actions > * {
    width: 100%;
    min-height: 46px;
    margin: 0;
  }

  .landing-nav-actions .landing-nav-link {
    display: flex;
    align-items: center;
    padding: 11px 14px;
    border-radius: 10px;
    background: var(--bg);
  }

  .landing-nav.mobile-nav-enhanced .landing-nav-inner {
    flex-wrap: nowrap;
  }

  .landing-nav.mobile-nav-enhanced .mobile-nav-toggle {
    display: inline-flex;
    flex: 0 0 44px;
    margin-left: auto;
  }

  .landing-nav.mobile-nav-enhanced .landing-nav-actions {
    position: absolute;
    top: calc(100% + 1px);
    left: 16px;
    right: 16px;
    z-index: 60;
    display: none;
    width: auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 16px 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 36px rgba(31, 44, 71, 0.18);
  }

  .landing-nav.mobile-nav-enhanced .landing-nav-actions.is-open {
    display: grid;
  }

  .auth-page .landing-nav-inner,
  .legal-page .landing-nav-inner {
    flex-wrap: nowrap;
  }

  /* Landing page */
  .landing-hero {
    padding: 44px 0 48px;
  }

  .landing-h1 {
    margin-bottom: 18px;
    font-size: 34px;
    line-height: 1.12;
  }

  .landing-lead {
    margin-bottom: 28px;
    font-size: 16px;
    line-height: 1.6;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 28px;
  }

  .hero-actions .link-button,
  .editor-promo-text > .link-button,
  .pricing-cta {
    width: 100%;
    min-height: 50px;
    padding: 13px 16px;
    text-align: center;
  }

  .hero-badges {
    gap: 8px;
  }

  .hero-badge {
    padding: 7px 10px;
    font-size: 12px;
  }

  .landing-h2 {
    font-size: 28px;
    line-height: 1.2;
  }

  .landing-section-lead {
    margin-bottom: 28px;
    font-size: 15px;
    line-height: 1.6;
  }

  .landing-try,
  .landing-compare,
  .landing-features,
  .landing-pricing,
  .landing-editor,
  .landing-faq,
  .landing-languages,
  .landing-usecases {
    padding-top: 48px;
    padding-bottom: 48px;
  }

  .try-panel {
    border-radius: 16px;
  }

  .try-lang-row {
    padding: 14px 14px 0;
  }

  .try-lang-select {
    min-height: 44px;
    padding: 8px 10px;
  }

  .try-textarea {
    min-height: 240px;
    padding: 14px;
    font-size: 16px;
  }

  .try-footer,
  .try-cost-label {
    align-items: stretch;
    flex-direction: column;
  }

  .try-footer {
    padding: 14px;
  }

  .try-cost-label {
    gap: 3px;
  }

  .try-generate-btn {
    width: 100%;
    min-height: 50px;
  }

  .compare-table {
    min-width: 700px;
  }

  .compare-table th,
  .compare-table td {
    padding: 12px 14px;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .feature-card,
  .pricing-card,
  .pricing-calc-card,
  .blog-card,
  .example-card,
  .profile-card {
    border-radius: 12px;
  }

  .feature-card {
    padding: 22px 18px;
  }

  .pricing-wrap {
    gap: 16px;
  }

  .pricing-card,
  .pricing-calc-card {
    padding: 24px 18px;
  }

  .pricing-num {
    font-size: 52px;
  }

  .editor-promo {
    gap: 24px;
  }

  .promo-diagram {
    max-width: 300px;
  }

  .faq-item {
    padding: 2px 16px;
  }

  .faq-item summary {
    min-height: 52px;
    padding: 14px 28px 14px 0;
  }

  .footer-grid {
    gap: 28px;
    padding-bottom: 36px;
  }

  /* Generator */
  .generator-page {
    min-height: 100dvh;
  }

  .topbar {
    padding: 12px max(12px, env(safe-area-inset-left)) 11px max(12px, env(safe-area-inset-right));
    background: rgba(255, 255, 255, 0.96);
  }

  .topbar-brand .eyebrow {
    font-size: 11px;
  }

  .topbar-brand h1 {
    font-size: 20px;
    line-height: 1.2;
  }

  .topbar-controls {
    gap: 8px;
    margin: 0 -12px;
    width: calc(100% + 24px);
    padding: 1px 12px 5px;
    scrollbar-width: none;
  }

  .topbar-controls::-webkit-scrollbar,
  .editor-toolbar::-webkit-scrollbar,
  .palette-list::-webkit-scrollbar {
    display: none;
  }

  .topbar-controls .link-button,
  .topbar-controls button,
  .topbar-controls .status-pill {
    min-height: 44px;
    padding: 10px 14px;
  }

  .topbar-actions {
    gap: 8px;
    padding-left: 8px;
    margin-left: 0;
  }

  .workspace {
    gap: 12px;
    padding: 12px 12px 20px;
  }

  .panel {
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(31, 44, 71, 0.08);
  }

  .panel-title-row {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .panel-title-row .button-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .panel-title-row .button-row button {
    width: 100%;
    min-height: 44px;
  }

  .input-panel textarea {
    min-height: 360px;
    padding: 14px;
    border-radius: 12px;
    font-size: 16px;
  }

  .action-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .action-row #generateBtn {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 50px;
  }

  .action-row #generationInfo {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .result-panel .diagram-scroll,
  .diagram-canvas {
    min-height: 360px;
  }

  .diagram-scroll {
    border-radius: 12px;
  }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  /* Full-screen editor: controls stay usable while the canvas remains full width. */
  .standalone-editor-page {
    width: 100%;
    min-height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  .standalone-editor-shell,
  .standalone-editor-shell .editor-card {
    width: 100vw;
    height: 100dvh;
    min-width: 0;
    min-height: 0;
  }

  .editor-header {
    top: max(8px, env(safe-area-inset-top));
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    display: block;
    padding: 6px;
    border-radius: 14px;
  }

  .editor-header > div:first-child {
    display: none;
  }

  .editor-toolbar {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .editor-toolbar > *,
  .editor-toolbar button {
    flex: 0 0 auto;
  }

  .editor-toolbar button {
    min-height: 42px;
    padding: 9px 12px;
    font-size: 13px;
  }

  .editor-toolbar .editor-icon-button {
    width: 42px;
    height: 42px;
  }

  .editor-history-controls {
    padding: 2px;
  }

  .editor-zoom {
    min-height: 42px;
    padding: 0 6px;
  }

  .editor-zoom input {
    width: 72px;
  }

  .editor-palette {
    top: calc(max(8px, env(safe-area-inset-top)) + 58px);
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    width: auto;
    max-height: 100px;
    padding: 8px;
    overflow: hidden;
    border-radius: 14px;
  }

  .editor-palette h3 {
    display: none;
  }

  .palette-list {
    display: flex;
    grid-template-columns: none;
    gap: 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    min-height: 82px;
    padding: 2px 2px 8px;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  .palette-item {
    flex: 0 0 76px;
    min-height: 74px;
    padding: 7px 4px;
    touch-action: pan-x;
    scroll-snap-align: start;
  }

  .palette-title {
    font-size: 10px;
    letter-spacing: 0;
  }

  .editor-type-menu {
    min-width: 180px;
    max-height: calc(100dvh - 16px);
    padding: 8px;
    gap: 3px;
  }

  .editor-type-menu-item {
    min-height: 44px;
    padding: 9px 10px;
    font-size: 14px;
  }

  /* Dialogs become thumb-friendly bottom sheets. */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: min(90vh, 90dvh);
    padding: 22px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
  }

  .modal-card h2 {
    padding-right: 34px;
    font-size: 21px;
  }

  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-actions button,
  .modal-actions .link-button {
    width: 100%;
    min-height: 48px;
  }

  .settings-modal-card {
    padding-left: 14px;
    padding-right: 14px;
  }

  .size-table {
    grid-template-columns: minmax(106px, 1.35fr) repeat(2, minmax(70px, 1fr));
    gap: 8px;
  }

  .size-rowlabel,
  .size-col {
    font-size: 11px;
    letter-spacing: 0;
  }

  .info-tooltip {
    max-width: calc(100vw - 24px);
  }

  .toast {
    bottom: calc(12px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 24px);
    padding: 12px 14px;
  }

  /* Profile and account pages */
  .profile-main {
    padding-top: 24px;
    padding-bottom: 44px;
  }

  .profile-header {
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 24px;
  }

  .profile-header > div:last-child {
    min-width: 0;
  }

  .profile-avatar {
    width: 52px;
    height: 52px;
    font-size: 22px;
  }

  .profile-name {
    font-size: 19px;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .profile-cards {
    gap: 12px;
    margin-bottom: 24px;
  }

  .profile-card {
    padding: 19px 17px;
  }

  .pc-action {
    align-self: stretch;
    min-height: 46px;
  }

  .profile-section {
    padding: 20px 16px;
    margin-bottom: 16px;
    border-radius: 14px;
  }

  .referral-link-wrap {
    align-items: stretch;
    flex-direction: column;
  }

  .referral-link-input {
    min-width: 0;
    font-size: 16px;
  }

  .ref-copy-btn,
  .danger-btn {
    width: 100%;
    min-height: 46px;
  }

  .referral-stats {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .ref-stat-sep {
    display: none;
  }

  .profile-table {
    min-width: 560px;
  }

  .profile-table th,
  .profile-table td {
    padding: 11px 12px;
  }

  .danger-panel {
    flex-direction: column;
  }

  .topup-presets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Authentication and legal documents */
  .auth-container {
    align-items: flex-start;
    min-height: calc(100dvh - 64px);
    padding: 24px 16px 40px;
  }

  .auth-card {
    max-width: 460px;
    padding: 26px 20px;
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(31, 44, 71, 0.09);
  }

  .auth-title {
    font-size: 24px;
  }

  .auth-field input,
  .yandex-btn,
  .auth-submit {
    min-height: 48px;
    font-size: 16px;
  }

  .legal-wrap {
    padding: 28px 16px 56px;
  }

  .legal-title {
    font-size: 27px;
    line-height: 1.2;
    letter-spacing: 0;
  }

  .legal-meta {
    margin-bottom: 24px;
    line-height: 1.5;
  }

  .legal-toc {
    padding: 14px 16px;
    margin-bottom: 28px;
  }

  .legal-fill {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* SEO/content pages */
  .content-main {
    padding: 24px 16px 48px;
  }

  .breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 0;
    line-height: 1.5;
    margin-bottom: 18px;
  }

  .content-page h1 {
    font-size: 30px;
    line-height: 1.18;
  }

  .content-lead,
  .article-lead {
    font-size: 17px;
    line-height: 1.6;
  }

  .content-cta,
  .article-cta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .content-cta .link-button,
  .article-cta .link-button {
    width: 100%;
    min-height: 50px;
    padding: 13px 16px;
    text-align: center;
  }

  .content-page section {
    margin: 30px 0;
  }

  .lang-example-grid,
  .examples-grid,
  .blog-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .examples-grid,
  .blog-list {
    gap: 14px;
  }

  .example-card,
  .blog-card {
    padding: 18px;
  }

  .article-body {
    font-size: 16px;
    line-height: 1.65;
  }

  .article-body ul,
  .article-body ol {
    padding-left: 20px;
  }

  .article-nav {
    align-items: stretch;
    flex-direction: column;
  }

  .article-nav-link,
  .article-nav-link.next {
    width: 100%;
    max-width: none;
    min-height: 48px;
    margin-left: 0;
    text-align: left;
  }

  .ex-modal {
    align-items: flex-end;
    padding: 0;
  }

  .ex-modal-card {
    max-height: 92dvh;
    padding: 22px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
  }

  .ex-modal-close {
    top: 7px;
    right: 8px;
    width: 44px;
    height: 44px;
    padding: 0;
    box-shadow: none;
  }

  .ex-modal-title {
    padding-right: 40px;
    font-size: 22px;
  }

  .ex-modal-body {
    gap: 18px;
  }

  .ex-modal-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 48dvh;
    padding: 12px;
  }

  .ex-modal-diagram img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 44dvh;
  }

  .ex-lang-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .ex-lang-tab {
    flex: 0 0 auto;
    min-height: 42px;
  }

  .content-footer {
    padding: 34px 16px;
    margin-top: 32px;
  }

  .content-footer-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px 18px;
  }

  /* Consent banner */
  .cookie-banner {
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    gap: 12px;
    padding: 16px;
    border-radius: 14px;
    text-align: left;
  }

  .cookie-banner-btn {
    width: 100%;
    min-height: 48px;
  }
}

@media (max-width: 420px) {
  .landing-hero {
    padding-top: 36px;
  }

  .landing-h1 {
    font-size: 31px;
  }

  .landing-lead {
    margin-bottom: 22px;
  }

  .landing-h2 {
    font-size: 26px;
  }

  .landing-container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .landing-nav-inner {
    padding-left: 14px;
    padding-right: 14px;
  }

  .landing-nav.mobile-nav-enhanced .landing-nav-actions {
    left: 10px;
    right: 10px;
  }

  .landing-nav-inner > .link-button {
    padding-left: 12px;
    padding-right: 12px;
  }

  .content-footer-cols {
    grid-template-columns: 1fr;
  }

  .size-table {
    grid-template-columns: minmax(96px, 1.25fr) repeat(2, minmax(64px, 1fr));
    gap: 7px;
  }

  .cookie-banner {
    gap: 8px;
    padding: 12px;
    font-size: 12.5px;
    line-height: 1.45;
  }

  .cookie-banner-btn {
    min-height: 44px;
    padding-top: 9px;
    padding-bottom: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
/* Guest checkout is intentionally usable without leaving the generator. */
dialog.guest-checkout {
  width: min(540px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  box-sizing: border-box; overflow: auto; border: 1px solid #dbe2f1;
  border-radius: 18px; padding: 24px; color: #172238; background: #fff;
  box-shadow: 0 18px 70px #13244b40;
}
dialog.guest-checkout::backdrop { background: #10203c88; }
.guest-checkout input[type=email], .guest-checkout textarea {
  width: 100%; box-sizing: border-box; font: inherit; padding: 12px;
  border: 1px solid #aab8d0; border-radius: 8px; margin: 8px 0;
}
.guest-checkout textarea { min-height: 90px; }
.guest-checkout p { line-height: 1.5; overflow-wrap: anywhere; }
.guest-checkout button { margin: 5px 4px 5px 0; }
.guest-checkout #guest-pay { background: #265dff; color: white; padding: 12px 20px; border-radius: 10px; }
.guest-checkout #guest-notice { padding: 10px; background: #eef3ff; border-radius: 8px; }
.guest-checkout .guest-consent { display: flex; align-items: flex-start; gap: 10px; line-height: 1.5; }
.guest-checkout .guest-consent input { flex: 0 0 18px; width: 18px; height: 18px; margin: 3px 0 0; }
.guest-checkout #guest-key, .guest-checkout #guest-refresh { background: #eef3ff; color: #173ea0; box-shadow: none; }
/* Optional connector advice and explicit payment-check progress. */
.connector-advice { width: min(620px, calc(100vw - 32px)); max-height: 88vh; overflow: auto; box-sizing: border-box; padding: 24px; border: 1px solid #dbe2f3; border-radius: 18px; color: #172033; background: #fff; }
.connector-advice::backdrop { background: #14213d80; }
.connector-advice label { display: block; font-weight: 600; margin-top: 16px; }
.connector-advice [hidden] { display: none; }
.connector-advice figure { margin: 16px 0; }
.connector-advice svg { width: 100%; height: auto; }
.connector-advice figcaption { font-size: 13px; color: #59677d; }
.advice-actions { display: flex; flex-wrap: wrap; gap: 10px; }
#guest-refresh[aria-busy="true"]::before { content: ''; display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; margin-right: 8px; animation: guest-spin .8s linear infinite; }
@keyframes guest-spin { to { transform: rotate(360deg); } }
.generation-diagnostics { padding: 12px 16px; margin: 0 0 12px; border: 1px solid #b6c6de; border-radius: 8px; background: #f5f8fd; color: #24364b; white-space: pre-line; overflow-wrap: anywhere; text-align: left; }
.generation-diagnostics.has-errors { border-color: #bd6870; background: #fff5f5; color: #752b33; }
.generation-diagnostics[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { #guest-refresh[aria-busy="true"]::before { animation: none; } }
