@scope (.omni-generatory-dyktando-graficzne) {

:scope {
  --bg: #ffffff;
  --bg-accent: #ffffff;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --line: #d9cdbf;
  --ink: #201a16;
  --muted: #6b625c;
  --primary: #4f883d;
  --primary-strong: #3d6a2f;
  --accent: #d9895b;
  --shadow: 0 24px 60px rgba(61, 42, 26, 0.12);
  --radius: 5px;
  --sheet-shadow: 0 22px 50px rgba(255, 255, 255, 0.01);
}

* {
  box-sizing: border-box;
}

:scope {
  margin: 0;
  min-height: 100%;
}

:scope {
  font-family: "Trebuchet MS", "Avenir Next", "Gill Sans", sans-serif;
  color: var(--ink);
  background: #ffffff;
}

:scope::before,
:scope::after {
  display: none;
}

.app-shell {
  width: 100%;
  margin: 0;
  display: grid;
  gap: 20px;
}

.sidebar,
.workspace {
  background: var(--panel);
  border: 1px solid #ffffff;
  border-radius: calc(var(--radius) + 4px);
  box-shadow: none;
}

.sidebar {
  padding: 5px;
  display: grid;
  gap: 5px;
  align-content: start;
}

.sidebar__hero h1,
.preview-card__header h3 {
  font-family: "Georgia", "Times New Roman", serif;
}

.sidebar__hero h1 {
  font-size: clamp(2rem, 2vw, 3rem);
  margin: 0.2rem 0 0.5rem;
  line-height: 1.05;
}

.muted,
.preview-card__header p {
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
}

.panel {
  background: #ffffff;
  border: 1px solid #ffffff;
  border-radius: 5px;
  padding: 16px;
  display: grid;
  gap: 14px;
}

.sidebar > .panel:first-of-type {
  padding-top: 7px;
  padding-bottom: 7px;
}

#subtitleInput {
  min-height: 80px;
  height: 80px;
}

.panel__header,
.preview-card__header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.panel__header h2,
.preview-card__header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.panel__title-inline {
  white-space: nowrap;
}

.field,
.range-field {
  display: grid;
  gap: 8px;
}

.field span,
.range-field span,
.range-field strong {
  font-size: 0.95rem;
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid #d9d9d9;
  background: var(--panel-strong);
  color: var(--ink);
  border-radius: 5px;
  padding: 14px 16px;
  font: inherit;
  resize: vertical;
  min-height: 54px;
}

.field input:focus,
.field textarea:focus,
.tool-button:focus,
.palette-button:focus,
.primary-button:focus,
.secondary-button:focus,
.ghost-button:focus {
  outline: 3px solid rgba(47, 108, 85, 0.22);
  outline-offset: 2px;
}

.range-field input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0 50%, #d9d9d9 50% 100%);
  border: 1px solid #cfcfcf;
}

.range-field input[type="range"]::-webkit-slider-runnable-track {
  height: 14px;
  border-radius: 999px;
  background: transparent;
}

.range-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #cfcfcf;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  margin-top: -8px;
}

.range-field input[type="range"]::-moz-range-track {
  height: 14px;
  border-radius: 999px;
  background: #d9d9d9;
  border: 1px solid #cfcfcf;
}

.range-field input[type="range"]::-moz-range-progress {
  height: 14px;
  border-radius: 999px;
  background: var(--primary);
}

.range-field input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #cfcfcf;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.range-field__title,
.chip-row,
.action-row,
.stack-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.grid-summary {
  display: flex;
  gap: 14px;
  flex-wrap: nowrap;
  white-space: nowrap;
  color: var(--primary-strong);
  font-size: 0.95rem;
  font-weight: 700;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #ffffff;
  color: var(--primary-strong);
  font-size: 0.9rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.tool-button,
.secondary-button,
.ghost-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.tool-button,
.secondary-button,
.ghost-button {
  border: 1px solid #d9d9d9;
  border-radius: 5px;
  padding: 12px 14px;
  background: #ffffff;
  color: var(--ink);
}

.tool-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.primary-button:hover,
.palette-button:hover {
  transform: translateY(-1px);
}

.tool-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled,
.primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.tool-button.is-active {
  background: var(--primary-strong);
  color: white;
  border-color: transparent;
}

.secondary-button {
  flex: 1 1 0;
}

.ghost-button {
  width: 100%;
  background: #ffffff;
}

.primary-button {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  border-color: transparent;
}

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

.palette-button {
  aspect-ratio: 1;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: inset 0 0 0 1px rgba(40, 35, 31, 0.12);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.palette-button.is-active {
  box-shadow:
    inset 0 0 0 1px rgba(40, 35, 31, 0.16),
    0 0 0 3px rgba(47, 108, 85, 0.28);
}

.status-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.14);
}

.workspace {
  padding: 0;
  display: grid;
  gap: 18px;
}

.preview-stack {
  display: grid;
  gap: 18px;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px 0;
}

.preview-toolbar p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.preview-toolbar h2 { margin: 0; font-size: 18px; }

.preview-toolbar .primary-button { width: auto; }

.preview-card {
  background: #ffffff;
  border: 1px solid #ffffff;
  border-radius: 24px;
  padding: 0px;
  display: grid;
  gap: 16px;
}

.preview-frame {
  position: relative;
  display: grid;
  min-height: 440px;
}

.sheet-sheet {
  display: none;
}

.sheet-sheet--visible {
  display: block;
}

.sheet {
  width: min(100%, 980px);
  margin: 0 auto;
  background: white;
  border-radius: 5px;
  box-shadow: none;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.sheet::before {
  display: none;
}

.sheet__header,
.sheet__content {
  position: relative;
  z-index: 1;
}

.sheet__header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 24px;
}

.sheet__title {
  margin: 0;
  font: 700 clamp(1.7rem, 3vw, 2.45rem) / 1.05 "Georgia", "Times New Roman", serif;
}

.sheet__subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 38rem;
}

.sheet__content {
  display: grid;
  gap: 24px;
}

.sheet__grid-wrap {
  display: flex;
  justify-content: center;
  overflow: auto;
  padding-bottom: 6px;
}

.grid-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  touch-action: none;
}

.grid-svg.is-interactive rect[data-row][data-col] {
  cursor: crosshair;
}

.legend-list,
.sheet__legend {
  display: grid;
  gap: 12px;
}

.legend-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid #ffffff;
}

.legend-item__swatch {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.legend-item__title {
  font-weight: 700;
}

.legend-item__coords {
  color: var(--muted);
  line-height: 1.45;
  word-break: break-word;
}

.empty-state {
  padding: 18px;
  border-radius: 18px;
  background: #ffffff;
  color: var(--muted);
  border: 1px dashed #ffffff;
}

.print-root {
  display: none;
}

.print-page {
  page-break-after: always;
}

.print-page:last-child {
  page-break-after: auto;
}

@media (min-width: 800px) {
  .app-shell {
    width: 100%;
    grid-template-columns: 300px minmax(0, 1fr);
    align-items: start;
  }

  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 799px) {
  .app-shell {
    width: min(100% - 20px, 1000px);
    margin: 10px auto 18px;
  }

  .sidebar,
  .workspace {
    border-radius: 24px;
  }

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

  .palette {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .sheet {
    padding: 24px 18px;
    border-radius: 22px;
  }

  .sheet__header {
    flex-direction: column;
  }
}

@media print {
  body {
    background: white;
  }

  body::before,
  body::after,
  .app-shell {
    display: none !important;
  }

  .print-root {
    display: block;
  }

  .print-page {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    padding: 10mm 0;
  }

  .sheet {
    width: 190mm;
    min-height: 277mm;
    box-shadow: none;
    border-radius: 0;
    padding: 14mm;
  }

  .grid-svg {
    max-height: none;
  }
}

}
