/* ============================================================
   NOBG BY DAMIZON — dark, square, editorial
   Palette / fonts / style language aligned with damizon.uk
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --black: #070707;
  --ink: #0b0b0c;
  --white: #f1f0ec;
  --muted: #888785;
  --line: rgba(255,255,255,.14);
  --line-soft: rgba(255,255,255,.08);

  --accent: #0ab3d1;
  --accent-dim: rgba(10,179,209,.18);

  --ok: #34d399;
  --err: #f87171;
  --warn: #fbbf24;

  --mono: 'DM Mono', monospace;
  --sans: 'Inter', sans-serif;
  --pad: clamp(22px, 4vw, 72px);

  /* Widoczny wzór dla przezroczystości — nie jest częścią eksportowanego PNG. */
  --checker: conic-gradient(#e1e5ec 25%, #ffffff 0 50%, #e1e5ec 0 75%, #ffffff 0);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--black); }
body {
  margin: 0;
  background: var(--black);
  color: var(--white);
  font-family: var(--sans);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
::selection { background: var(--accent); color: #050505; }

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

/* Subtle film grain, like the main site */
.grain {
  position: fixed;
  inset: 0;
  z-index: 99;
  pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

/* ============================================================
   HEADER
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 88px;
  padding: 0 var(--pad);
  background: rgba(7,7,7,.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 18px; }
.logo {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--accent);
}
.logo svg { width: 22px; height: 22px; }

.brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.04em;
  text-transform: uppercase;
}
.brand-nobg { color: var(--white); }
.brand-nobg em {
  font-style: normal;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255,255,255,.72);
}
.ai-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  font: 700 9px var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(10,179,209,.35);
  vertical-align: middle;
}
.tagline {
  margin: 4px 0 0;
  font: 400 10px var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #777;
}

.health {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font: 400 10px var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #aaa;
  border: 1px solid var(--line);
  background: transparent;
}
.health .dot {
  width: 8px;
  height: 8px;
  background: var(--warn);
  box-shadow: 0 0 8px currentColor;
}
.health.ok { color: var(--accent); border-color: rgba(10,179,209,.35); }
.health.ok .dot { background: var(--accent); }
.health.err { color: var(--err); border-color: rgba(248,113,113,.35); }
.health.err .dot { background: var(--err); }

/* ============================================================
   LAYOUT / CARDS
   ============================================================ */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px var(--pad) 120px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--line);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.card {
  background: var(--black);
  padding: 40px;
  position: relative;
}

.card-head {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 32px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.card-head .step {
  font: 400 10px var(--mono);
  letter-spacing: .14em;
  color: var(--accent);
  text-transform: uppercase;
}
.card-head h2 {
  margin: 0;
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.02em;
  text-transform: uppercase;
}
.card-head .hint {
  font: 400 10px var(--mono);
  letter-spacing: .12em;
  color: #777;
  text-transform: uppercase;
}

/* ============================================================
   DROPZONE
   ============================================================ */
.dropzone {
  position: relative;
  border: 1px dashed rgba(255,255,255,.25);
  background: transparent;
  transition: background .2s, border-color .2s;
  cursor: pointer;
  outline: none;
}
.dropzone[hidden] { display: none !important; }
.dropzone:hover,
.dropzone:focus,
.dropzone.drag {
  border-color: var(--accent);
  background: rgba(10,179,209,.05);
}
.dz-inner { padding: 70px 20px; text-align: center; }
.dz-icon {
  width: 40px;
  height: 40px;
  color: var(--accent);
  margin: 0 auto 18px;
  opacity: .9;
}
.dz-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.dz-sub {
  margin: 0;
  font: 400 10px var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #777;
}

/* ============================================================
   PREVIEW
   ============================================================ */
.preview {
  display: flex;
  gap: 24px;
  align-items: center;
  margin-top: 0;
}
.preview[hidden] { display: none !important; }
.preview-img {
  width: 120px;
  height: 120px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  background-color: #ffffff;
  background-image: var(--checker);
  background-size: 20px 20px;
  background-position: 0 0;
}
.preview-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-meta { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.fname {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fsize {
  font: 400 10px var(--mono);
  letter-spacing: .12em;
  color: #777;
  text-transform: uppercase;
}

/* ============================================================
   OPTIONS
   ============================================================ */
.opts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: 32px;
}
.opt label {
  display: block;
  margin-bottom: 12px;
  font: 400 10px var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #777;
}
.opt select {
  width: 100%;
  padding: 14px 16px;
  background: var(--ink);
  color: var(--white);
  border: 1px solid var(--line);
  font-size: 14px;
  font-family: var(--sans);
  cursor: pointer;
  transition: border-color .2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}
.opt select:focus { outline: none; border-color: var(--accent); }
.opt select option { background: var(--ink); color: var(--white); }

/* segmented control */
.seg {
  display: flex;
  gap: 0;
  border: 1px solid var(--line);
}
.seg button {
  flex: 1;
  padding: 14px 16px;
  background: transparent;
  color: #aaa;
  border: 0;
  border-right: 1px solid var(--line);
  font: 500 11px var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .15s;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--white); }
.seg button.active {
  background: var(--accent);
  color: #050505;
}
.seg button.color-button,
.seg button.color-button:hover {
  color: #172033;
}
.seg button.color-button.active {
  color: #172033;
}
#colorPicker {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ============================================================
   TOOLS ROW — checkboxes + feather slider
   ============================================================ */
.tools-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line-soft);
}
.chk {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--white);
  cursor: pointer;
  margin: 0;
  font-weight: 500;
  white-space: nowrap;
  flex: 0 0 auto;
}
.chk input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex: 0 0 auto;
  appearance: auto;
}
.chk span { line-height: 1.4; }

/* feather slider inline */
.edge-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex: 0 1 auto;
  min-width: 0;
}
.edge-name {
  font: 500 10px var(--mono);
  letter-spacing: .12em;
  color: #777;
  text-transform: uppercase;
  white-space: nowrap;
  flex: 0 0 auto;
}
.edge-label {
  font: 500 10px var(--mono);
  letter-spacing: .12em;
  color: #666;
  text-transform: uppercase;
  white-space: nowrap;
  flex: 0 0 auto;
}
.edge-value {
  font: 700 11px var(--mono);
  letter-spacing: .08em;
  color: var(--accent);
  min-width: 42px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.edge-value.soft { color: #f0b97a; }
.edge-value.hard { color: #7aa2ff; }

input[type="range"].edge-range {
  -webkit-appearance: none;
  appearance: none;
  width: 140px;
  min-width: 90px;
  height: 2px;
  background: var(--line);
  border: 0;
  outline: none;
  cursor: pointer;
  flex: 0 1 140px;
}
input[type="range"].edge-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 0;
  background: var(--white);
  border: 0;
  cursor: pointer;
  transition: background .15s, transform .12s;
}
input[type="range"].edge-range::-webkit-slider-thumb:hover {
  background: var(--accent);
  transform: scale(1.15);
}
input[type="range"].edge-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 0;
  background: var(--white);
  border: 0;
  cursor: pointer;
}
input[type="range"].edge-range::-moz-range-thumb:hover {
  background: var(--accent);
}
input[type="range"].edge-range:focus-visible {
  box-shadow: 0 0 0 2px rgba(10,179,209,.35);
}

/* ============================================================
   ACTION — button + progress
   ============================================================ */
.action-row {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 28px;
  border: 1px solid transparent;
  font: 700 12px var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn svg { flex: 0 0 auto; }
.btn.primary {
  background: var(--accent);
  color: #050505;
  border-color: var(--accent);
}
.btn.primary:hover:not(:disabled) {
  background: #0899b0;
  border-color: #0899b0;
  color: #050505;
}
.btn.primary:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.btn.ghost {
  background: transparent;
  color: var(--white);
  border-color: var(--line);
}
.btn.ghost:hover {
  border-color: var(--white);
  background: rgba(255,255,255,.05);
}
.btn.sm { padding: 10px 16px; font-size: 10px; }

.progress-wrap {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.progress-wrap[hidden] { display: none !important; }
.progress {
  height: 2px;
  background: var(--line);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width .3s ease;
}
.progress-bar.done { background: var(--ok); }
.progress-label {
  font: 400 10px var(--mono);
  letter-spacing: .14em;
  color: #777;
  text-transform: uppercase;
}
.progress-label.done { color: var(--ok); }

/* error box */
.error-box {
  margin-top: 24px;
  padding: 14px 18px;
  background: rgba(248,113,113,.08);
  border-left: 2px solid var(--err);
  color: #fca5a5;
  font-size: 13px;
}

/* ============================================================
   RESULT
   ============================================================ */
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.result-pane { margin: 0; }
.result-pane figcaption {
  font: 400 10px var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #777;
  margin: 0 0 0 0;
  padding: 10px 14px;
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}

/* checker for transparent preview */
.checker {
  width: 100%;
  height: 320px;
  min-height: 240px;
  background-color: #ffffff;
  background-image: var(--checker);
  background-size: 20px 20px;
  background-position: 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.checker img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.result-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  flex-wrap: wrap;
}

/* ============================================================
   FOOTER
   ============================================================ */
.foot {
  position: relative;
  z-index: 1;
  padding: 60px var(--pad) 40px;
  border-top: 1px solid var(--line);
  text-align: left;
}
.foot-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.foot-word {
  font-size: clamp(60px, 14vw, 220px);
  line-height: .7;
  font-weight: 900;
  letter-spacing: -.095em;
  color: transparent;
  -webkit-text-stroke: 1px #333;
}
.foot p {
  margin: 0;
  font: 400 10px var(--mono);
  letter-spacing: .14em;
  color: #777;
  text-transform: uppercase;
}
.foot a { color: var(--accent); }
.foot a:hover { text-decoration: underline; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .topbar { height: 72px; padding: 0 20px; }
  .tagline { display: none; }
  .health { padding: 6px 10px; }
  .health .label { display: none; }
  .wrap { padding: 40px 20px 80px; }
  .card { padding: 28px 22px; }
  .opts-grid { grid-template-columns: 1fr; gap: 28px; }
  .result-grid { grid-template-columns: 1fr; }
  .checker { height: 240px; min-height: 180px; }
  .tools-row { flex-wrap: wrap; gap: 16px; }
  .edge-inline { margin-left: 0; width: 100%; justify-content: space-between; }
  input[type="range"].edge-range { flex: 1 1 auto; width: auto; min-width: 0; }
}

@media (max-width: 600px) {
  :root { --pad: 16px; }
  .topbar { height: 64px; }
  .brand h1 { font-size: 14px; }
  .dz-inner { padding: 40px 16px; }
  .preview { flex-direction: column; align-items: flex-start; }
  .preview-img { width: 100%; height: 160px; }
  .card { padding: 24px 18px; }
  .card-head { gap: 12px; }
  .card-head .hint { display: none; }
  .btn { width: 100%; }
  .result-actions { flex-direction: column; }
  .foot-word { font-size: 22vw; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
