/*
  The board builder ("Utwórz planszę"): four short choices on the left, a live A4 preview on the right.
  On phones the preview moves into a small bar at the bottom with a "See the board" button.
*/
.nz-builder {
  padding-top: 56px;
  padding-bottom: 96px;
}

.nz-page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--nz-space-7);
  flex-wrap: wrap;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--nz-color-rule);
}

.nz-page-heading .nz-h2 {
  margin: var(--nz-space-4) 0 0;
}

.nz-page-heading p {
  margin: 0;
  max-width: 400px;
}

.nz-builder-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 64px;
  align-items: flex-start;
  padding-top: var(--nz-space-4);
}

.nz-builder-form {
  flex: 1 1 480px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* One numbered step: the peach number on the left, the choice on the right. */
.nz-step {
  margin: 0;
  padding: 32px 0;
  border: none;
  border-bottom: 1px solid var(--nz-color-rule);
  display: flex;
  gap: var(--nz-space-5);
  min-width: 0;
}

.nz-step > .nz-step-number {
  width: 40px;
  flex: none;
  font-size: var(--nz-text-step-number);
  line-height: 1;
}

.nz-step-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--nz-space-4);
}

.nz-step-title {
  margin: 0;
  padding: 0;
  font-family: var(--nz-font-display);
  font-weight: var(--nz-weight-display);
  font-size: var(--nz-text-h3);
  line-height: 1.2;
}

.nz-step-intro {
  margin: -8px 0 0;
  font-size: var(--nz-text-small);
  line-height: 1.5;
}

.nz-hint {
  margin: 0;
  font-size: var(--nz-text-caption);
  line-height: 1.5;
}

.nz-field-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nz-reward-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nz-reward-swatch {
  width: 22px;
  height: 12px;
  flex: none;
  border-radius: 3px;
  background: var(--nz-color-reward-step-bg);
}

.nz-reward-swatch.is-final {
  background: var(--nz-color-reward-final-bg);
}

/* Picture picker: a grid of transparent pictures, the chosen one outlined with a tick. */
.nz-pictures {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  max-height: var(--nz-picker-box);
  overflow-y: auto;
  padding: var(--nz-space-2) var(--nz-space-2) var(--nz-space-2) 0;
  scrollbar-gutter: stable;
}

.nz-picture-choice {
  position: relative;
  height: var(--nz-picker-tile);
  padding: 6px;
  border-radius: var(--nz-radius-card);
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.nz-picture-choice:hover {
  background: var(--nz-cream-deep);
}

.nz-picture-choice img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.nz-picture-choice[aria-pressed="true"] {
  border-color: var(--nz-color-text);
}

.nz-picture-tick {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--nz-color-text);
  color: var(--nz-peach);
  display: none;
  align-items: center;
  justify-content: center;
}

.nz-picture-tick svg {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}

.nz-picture-choice[aria-pressed="true"] .nz-picture-tick {
  display: flex;
}

.nz-picture-none {
  align-self: center;
  width: 100%;
  height: 100%;
  border: 1.5px dashed var(--nz-frame);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--nz-font-text);
  font-size: 11px;
  font-weight: var(--nz-weight-bold);
  line-height: 1.2;
  color: var(--nz-color-text);
}

.nz-picture-choice[aria-pressed="true"] .nz-picture-none {
  border: none;
}

/* "+ Add your own": the same dashed tile, in the accent colour. */
.nz-picture-none.is-add {
  border-color: var(--nz-color-accent);
  color: var(--nz-color-accent-pressed);
  text-align: center;
}

.nz-own-actions {
  display: flex;
  gap: var(--nz-space-2);
}

.nz-own-actions[hidden] {
  display: none;
}

.nz-hint.is-error {
  color: var(--nz-color-accent-pressed);
  font-weight: var(--nz-weight-bold);
}

.nz-picture-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--nz-space-4);
  flex-wrap: wrap;
}

.nz-link-button {
  min-height: var(--nz-target-min);
  padding: 0 4px;
  border: none;
  background: none;
  color: var(--nz-color-text);
  font-family: var(--nz-font-text);
  font-size: var(--nz-text-small);
  font-weight: var(--nz-weight-bold);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.nz-builder-action {
  padding: 32px 0 0 64px;
  display: flex;
  align-items: center;
  gap: var(--nz-space-5);
  flex-wrap: wrap;
}

.nz-builder-action p {
  margin: 0;
  max-width: 260px;
  font-size: var(--nz-text-caption);
  line-height: 1.5;
}

/* Live preview */
.nz-preview {
  flex: 0 1 var(--nz-preview-width);
  width: var(--nz-preview-width);
  max-width: 100%;
  position: sticky;
  top: calc(var(--nz-topbar-height) + 24px);
  display: flex;
  flex-direction: column;
  gap: var(--nz-space-4);
  padding-top: 32px;
}

.nz-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--nz-space-4);
  font-size: var(--nz-text-caption);
}

.nz-preview-head .nz-kicker::before {
  display: none;
}

.nz-preview-stage {
  position: relative;
}

.nz-preview-note {
  margin: 8px 0 0;
  font-size: var(--nz-text-caption);
  line-height: 1.5;
}

/* A floating label sticker: decoration on screen only. */
.nz-float-sticker {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--nz-sticker-radius);
  background: var(--nz-lilac);
  box-shadow: var(--nz-shadow-sticker);
  font-family: var(--nz-font-display);
  font-style: italic;
  font-size: 20px;
  line-height: 1.05;
  color: var(--nz-color-text);
  pointer-events: none;
}

.nz-float-sticker svg {
  width: 22px;
  height: 22px;
  flex: none;
}

.nz-preview .nz-float-sticker {
  top: 210px;
  right: -36px;
  transform: rotate(9deg);
}

/* The bottom bar only shows on phones. */
.nz-phone-bar {
  display: none;
}

@media (max-width: 1100px) {
  .nz-preview .nz-float-sticker {
    right: -8px;
  }
}

@media (max-width: 859px) {
  .nz-builder {
    padding-top: 32px;
    padding-bottom: 48px;
  }

  .nz-page-heading {
    gap: var(--nz-space-4);
    padding-bottom: 24px;
  }

  .nz-step {
    gap: var(--nz-space-4);
    padding: 24px 0;
  }

  .nz-step > .nz-step-number {
    width: 24px;
    font-size: var(--nz-text-step-number-phone);
  }

  .nz-pictures {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nz-builder-action,
  .nz-preview {
    display: none;
  }

  .nz-phone-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px var(--nz-gutter-phone);
    background: var(--nz-color-page);
    border-top: 1px solid var(--nz-color-rule);
    box-shadow: var(--nz-shadow-bar);
  }

  .nz-phone-bar .nz-sheet-frame {
    width: calc(var(--nz-page-width) * var(--nz-thumb-scale));
    flex: none;
    box-shadow: var(--nz-shadow-thumb);
  }

  .nz-phone-bar-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: var(--nz-text-caption);
    line-height: 1.4;
  }

  .nz-phone-bar-text strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nz-phone-bar .nz-button {
    flex: none;
    min-height: var(--nz-button-height-small);
    padding: 0 20px;
  }
}
