:root {
  --bg: #0b1020;
  --fg: #e8ecf1;
  --danger: #ff6b6b;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;

  --dur-fast: 220ms;
  --dur: 400ms;
  --dur-slow: 700ms;
  --ease: cubic-bezier(0.1, 0.7, 0.6, 0.7);
}

* {
  box-sizing: border-box;
}

.margin0 {
  margin: 0;
}

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

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  line-height: 1.2;
  background: radial-gradient(1000px 700px at 20% 10%, #e9f9f0, transparent 60%),
              radial-gradient(1200px 800px at 80% 90%, #e3f7ed, transparent 60%),
              linear-gradient(180deg, #74c877, #90ffc7);
  background-attachment: fixed;
  color: var(--fg);
}

.page {
  display: flex;
  justify-content: center;
  padding: 10px 0;
}

.card {
  width: 98%;
  max-width: 1400px;
  background: linear-gradient(180deg, #ffffff, #f7fff9);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(32, 94, 61, 0.15), 0 2px 8px rgba(32, 94, 61, 0.12);
  padding: 15px;
  border: 1px solid rgba(26, 122, 76, 0.16);
  color: #0f1a14;
}

/* Desktop screens (768px and up) */
@media (min-width: 768px) {
  .card {
    width: 80%;
  }
  .page {
    padding: 100px 0;
  }
}

h1 {
  font-size: 28px;
  margin: 0 0 4px;
  color: #0b1a13;
}

h2 {
  font-size: 22px;
  margin: 0 0 20px;
  color: #0b1a13;
}

.subtitle {
  margin: 0 0 40px 5px;
  color: #3a4a41;
}

form {
  margin-top: 8px;
}

.stepper {
  margin: 12px 0 40px;
}

.progress {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  height: 7px;
}

.progress-segment {
  position: relative;
  height: 100%;
  background: #666; /* visible on light card */
  border: 1px solid #333;
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  inset: 0 100% 0 0;
  background: #00ff0d;
  transition: inset var(--dur-slow) var(--ease);
}

.progress-segment.current .progress-fill {
  background: #fff587;
}

.stepper-labels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 2px;
  gap: 16px;
  text-align: center;
  color: var(--bg);
  font-size: 14px;
}

.stepper-labels .stepper-label {
  display: block;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all var(--dur-fast) var(--ease);
  position: relative;
}

.stepper-labels .stepper-label:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.stepper-labels .stepper-label:active {
  transform: translateY(0);
}

.stepper-labels .stepper-label:focus {
  outline: 2px solid rgba(255, 255, 255, 0.3);
  outline-offset: 2px;
}

.steps {
  display: grid;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: height var(--dur) var(--ease);
}

.step {
  margin: 0;
  padding: 18px 16px 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(26, 122, 76, 0.3);
  background: #ffffff;
  position: absolute;
  inset: 0;
  transform-origin: 20% 0%;
  transform: translateX(12px) scale(0.98);
  opacity: 0;
  filter: saturate(0.6) blur(0.5px);
  pointer-events: none;
  transition: opacity var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              filter var(--dur) var(--ease);
}

.step.no-border {
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#character-field[hidden] {
  display: none;
}

.hero-group {
  margin: 16px 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(26, 122, 76, 0.2);
  border-radius: var(--radius-xs);
}

.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(26, 122, 76, 0.1);
}

.hero-header h4 {
  margin: 0;
  font-size: 16px;
  color: #0f1a14;
}

.remove-hero-btn {
  padding: 6px 12px;
  background: #ff6b6b;
  border: 1px solid #e74c3c;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font-size: 12px;
  transition: all var(--dur-fast) var(--ease);
}

.remove-hero-btn:hover {
  background: #e74c3c;
  transform: translateY(-1px);
}

.gender-options {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.gender-btn {
  flex: 1;
  padding: 10px 12px;
  background: #e7fcff;
  border: 1px solid rgba(26, 122, 76, 0.2);
  border-radius: var(--radius-xs);
  color: #0f1a14;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  font-size: 14px;
}

.gender-btn:hover {
  background: #f6fff9;
  border-color: rgba(26, 122, 76, 0.3);
}

.gender-btn.selected {
  background: linear-gradient(180deg, #1fa567, #178e57);
  color: #ffffff;
  border-color: rgba(26, 122, 76, 0.4);
  box-shadow: 0 2px 8px rgba(23, 142, 87, 0.2);
}

.step.is-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
  filter: none;
  pointer-events: auto;
}

.step[aria-hidden="true"] {
  display: block;
}

legend {
  font-weight: 600;
  padding: 2px 10px;
  display: block;
  background-color: #f8f8f8;
  border: 1px solid rgba(26, 122, 76, 0.3);
  border-radius: 5px;
}

.field {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.field-group {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.field-group .field {
  margin-bottom: 0;
  flex: 1;
}

.field-group .field:first-child {
  flex: 2;
}

.field-group .field:last-child {
  flex: 1;
}

label {
  color: #0f1a14;
  font-size: 14px;
  margin-top: 10px;
}

input,
select,
textarea {
  width: 100%;
  color: #0f1a14;
  background: #e7fcff;
  border: 1px solid rgba(26, 112, 122, 0.2);
  border-radius: var(--radius-xs);
  padding: 12px 12px;
  margin-bottom: 2px;
  line-height: 1.5;
  outline: none;
  transition: box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

input::placeholder,
textarea::placeholder {
  color: #ad0000;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(26, 122, 76, 0.45);
  box-shadow: 0 0 0 2px rgba(26, 122, 76, 0.25);
}

input.error:focus,
select.error:focus,
textarea.error:focus {
  border-color: #ff6b6b;
  box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.25);
}

.button {
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.25);
  background: linear-gradient(180deg, #efd649, #d5bc16);
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.2);
  color: #000;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.button:hover {
  filter: saturate(1.35);
}

.button:active {
  transform: translateY(1px);
  border: 1px solid rgba(10, 241, 99, 0.3);
}

.button.primary {
  background: linear-gradient(180deg, #17be70, #129256);
  color: #fff;
}

.step-actions {
  display: flex;
  gap: 10px;
}

.step-actions .button {
  flex: 1;
}

.button.kolejny {
  background: #b380ff;
  color: #000;
  margin: 20px 0;
  width: 30%;
}

.step-actions .button:only-child {
  flex: none;
  width: 100%;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 35px;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

/* Error states */
input.error,
select.error,
textarea.error {
  border-color: #ff6b6b;
  background: #fff5f5;
  box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.25);
}

.field.error {
  border-color: #ff6b6b;
}

.error-message {
  color: #ff3c3c;
  font-size: 14px;
  font-weight: bold;
  display: block;
}

.label-with-counter {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0px;
}

.char-counter {
  font-size: 12px;
  color: #ff8800;
  white-space: nowrap;
}

.char-counter.valid {
  color: #178e57;
}

.char-counter.error {
  color: #ff6b6b;
  font-weight: 600;
}

/* Image upload styles */
.image-upload-container {
  position: relative;
}

.image-dropzone {
  position: relative;
  border: 2px dashed rgba(26, 122, 76, 0.3);
  border-radius: var(--radius-xs);
  padding: 32px 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.5);
  transition: all var(--dur-fast) var(--ease);
  cursor: pointer;
}

.image-dropzone:hover {
  border-color: rgba(26, 122, 76, 0.5);
  background: rgba(255, 255, 255, 0.7);
}

.image-dropzone.drag-active {
  border-color: #1fa567;
  background: rgba(31, 165, 103, 0.1);
  transform: scale(1.02);
}

.dropzone-content {
  pointer-events: none;
}

.upload-icon {
  color: rgba(26, 122, 76, 0.6);
  margin-bottom: 12px;
}

.dropzone-text {
  margin: 0 0 4px 0;
  color: #0f1a14;
  font-size: 14px;
}

.upload-link {
  color: #1fa567;
  text-decoration: underline;
  cursor: pointer;
}

.dropzone-hint {
  margin: 0;
  color: #51665b;
  font-size: 12px;
}

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.image-preview {
  position: relative;
  margin-top: 12px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(26, 122, 76, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
}

.image-preview img {
  width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: contain;
  display: block;
  border-radius: var(--radius-xs);
}

.image-preview-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 8px;
}

.crop-image-btn,
.remove-image-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast) var(--ease);
}

.crop-image-btn:hover,
.remove-image-btn:hover {
  background: rgba(0, 0, 0, 0.9);
}

.crop-image-btn {
  background: rgba(31, 165, 103, 0.8);
}

.crop-image-btn:hover {
  background: rgba(31, 165, 103, 1);
}

/* Image Crop Modal Styles */
.crop-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.crop-modal-content {
  background: white;
  border-radius: var(--radius);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.crop-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(26, 122, 76, 0.2);
}

.crop-modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: #0f1a14;
}

.crop-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #51665b;
  border-radius: 4px;
  transition: background var(--dur-fast) var(--ease);
}

.crop-modal-close:hover {
  background: rgba(26, 122, 76, 0.1);
}

.crop-container {
  position: relative;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  max-height: 400px;
  overflow: hidden;
}

#crop-canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.crop-overlay {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  bottom: 20px;
  pointer-events: none;
}

.crop-selection {
  position: absolute;
  border: 2px solid #1fa567;
  background: rgba(31, 165, 103, 0.1);
  cursor: move;
  pointer-events: all;
}

.crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #1fa567;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s ease;
  z-index: 10;
}

.crop-handle:hover {
  transform: scale(1.2);
  background: #178e57;
}

.crop-handle-nw { top: -7px; left: -7px; cursor: nw-resize; }
.crop-handle-ne { top: -7px; right: -7px; cursor: ne-resize; }
.crop-handle-sw { bottom: -7px; left: -7px; cursor: sw-resize; }
.crop-handle-se { bottom: -7px; right: -7px; cursor: se-resize; }
.crop-handle-n { top: -7px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.crop-handle-s { bottom: -7px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.crop-handle-w { top: 50%; left: -7px; transform: translateY(-50%); cursor: w-resize; }
.crop-handle-e { top: 50%; right: -7px; transform: translateY(-50%); cursor: e-resize; }

.crop-modal-actions {
  display: flex;
  gap: 12px;
  padding: 16px 24px 20px;
  border-top: 1px solid rgba(26, 122, 76, 0.2);
  justify-content: flex-end;
}

/* Review section styles */
.review-section {
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(26, 122, 76, 0.2);
  border-radius: var(--radius-xs);
}

.review-section h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: #0f1a14;
  border-bottom: 1px solid rgba(26, 122, 76, 0.2);
  padding-bottom: 8px;
}

.review-field {
  display: flex;
  margin-bottom: 8px;
  gap: 12px;
}

.review-label {
  min-width: 120px;
  font-weight: 500;
  color: #3a4a41;
}

.review-value {
  flex: 1;
  color: #0f1a14;
  word-wrap: break-word;
}

.review-image-preview {
  display: flex;
  align-items: center;
}

.error {
  color: var(--danger);
  font-size: 13px;
  margin-top: -4px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  opacity: 0;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
  pointer-events: none;
}

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

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .step {
    transition: none;
  }
  .toast {
    transition: none;
  }
}