@scope (.omni-generatory-rozsypanka-literowa) {

:scope {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --green: #4f883d;
  --green-hover: #3d6b2f;
  --focus: rgba(59, 130, 246, 0.35);
  --worksheet-font-size: 16px;
  --worksheet-title-size: 20px;
  --worksheet-watermark-size: 14px;
}

@font-face {
  font-family: "Pismo Szkolne";
  src: url("./assets/pismo-szkolne.ttf") format("truetype");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

:scope {
  margin: 0;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Helvetica,
    Arial,
    "Apple Color Emoji",
    "Segoe UI Emoji";
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

.page {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 16px;
}

.brand__title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

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

.layout {
  max-width: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

@media (min-width: 920px) {
  .layout {
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 0;
  }
}

.layout > .panel {
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  min-height: 680px;
}

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

.previewToolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

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

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

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.panel__title {
  margin: 0 0 12px 0;
  font-size: 18px;
}

.panelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.panelHeader .panel__title {
  margin: 0;
}

.field {
  margin: 12px 0;
}

.label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
}

.input,
.textarea {
  width: 100%;
  font-size: 16px;
  line-height: 1.45;
  padding: 12px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

.select {
  width: 100%;
  font-size: 16px;
  line-height: 1.45;
  padding: 12px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

.select:focus {
  box-shadow: 0 0 0 4px var(--focus);
  border-color: #93c5fd;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stepper__input {
  width: 80px;
  text-align: center;
  padding-left: 10px;
  padding-right: 10px;
}

.stepper__input::-webkit-outer-spin-button,
.stepper__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.stepper__input {
  -moz-appearance: textfield;
}

.stepper__btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.stepper__btn:hover {
  background: #f8fafc;
}

.stepper__btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.textarea {
  min-height: 200px;
  resize: vertical;
  font-family: inherit;
}

.input:focus,
.textarea:focus {
  box-shadow: 0 0 0 4px var(--focus);
  border-color: #93c5fd;
}

.hint {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
}

.button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.button--small {
  width: auto;
  /* Reduce horizontal padding for the "Tworz z AI" button. */
  padding: 8px 6px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}

.button--secondary:hover {
  background: #f8fafc;
}

.button--primary {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.button--primary:hover {
  background: var(--green-hover);
  border-color: var(--green-hover);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.preview {
  min-height: 240px;
}

.preview__paper {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 22px 18px 22px;
  box-shadow: var(--shadow);
  position: relative;
  font-family: var(--worksheet-font, inherit);
}

.preview__title {
  font-size: var(--worksheet-title-size, 20px);
  font-weight: 800;
  margin-bottom: 14px;
}

.preview__body {
  font-size: var(--worksheet-font-size, 16px);
}

.preview__sentence {
  margin: 0 0 16px 0;
}

.preview__answerline {
  height: 18px;
  margin-top: 10px;
  border-bottom: 1px solid #9ca3af;
}

.preview__watermark {
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: var(--worksheet-watermark-size, 14px);
  color: #9ca3af;
}

.status {
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.row2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 520px) {
  .row2 {
    grid-template-columns: 1fr 1fr;
  }
}

.modalBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 50;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 60;
  padding: 16px;
}

.modalCard {
  width: min(680px, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modalHeader h3 {
  margin: 0;
  font-size: 15px;
}

.iconBtn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.iconBtn:hover {
  background: #f8fafc;
}

.modalBody {
  padding: 14px 16px 16px;
  display: grid;
  gap: 14px;
}

.radioGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}

.radio {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: var(--text);
}

.radio input {
  width: 16px;
  height: 16px;
}

.modalActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
  cursor: pointer;
}

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

}
