/* Темний монохром за системою shadcn: волосні бордери, пігулки 18px, картки 24px. */
:root {
  --canvas: #09090b;
  --paper: #131316;
  --surface-alt: #1c1c21;
  --ink: #fafafa;
  --mid-gray: #a1a1aa;
  --hairline: #26262c;
  --hairline-soft: #3f3f46;
  --ember: #f87171;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 14px/1.43 var(--font);
}
button, input { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, .drop:focus-visible {
  outline: 2px solid var(--hairline-soft);
  outline-offset: 2px;
}
.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 12px 0;
}
.top { margin: 4px 2px 0; }
.top h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.top p { margin: 2px 0 0; font-size: 12px; color: var(--mid-gray); }
.card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 24px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 1px 3px rgba(0, 0, 0, 0.4);
  padding: 16px;
  margin-top: 12px;
}
.file-pick { position: relative; }
.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  border: 1px dashed var(--hairline-soft);
  border-radius: 18px;
  padding: 10px;
  cursor: pointer;
  text-align: center;
  background: transparent;
}
.drop.small { margin-top: 8px; }
.drop.has-file { padding-right: 44px; border-style: solid; }
.drop.over { border-color: var(--ink); border-style: solid; background: var(--surface-alt); }
.drop-title { font-weight: 500; font-size: 14px; }
.drop svg { width: 22px; height: 22px; color: var(--mid-gray); }
.drop-sub, .hint { color: var(--mid-gray); font-size: 12px; line-height: 1.33; }
.hint { margin: 6px 0 0; }
.field { margin-top: 12px; }
.field:first-child { margin-top: 0; }
.field-label, .field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--mid-gray);
}
.field-label output, .field label output { font-weight: 400; letter-spacing: normal; text-transform: none; }
#text {
  width: 100%;
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: 18px;
  background: var(--surface-alt);
  color: var(--ink);
}
#text::placeholder { color: var(--mid-gray); }
#text:focus { outline: none; border: 1px solid var(--hairline-soft); padding: 7px 13px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.seg.wrap { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg button {
  min-width: 0;
  min-height: 40px;
  padding: 8px 6px;
  border: 0;
  border-radius: 18px;
  background: var(--surface-alt);
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.seg button.on { background: var(--ink); color: #0a0a0a; font-weight: 500; }
.seg button:active, .btn:active, .drop:active { opacity: 0.78; }
.remove-file {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--ember);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.remove-file svg { width: 18px; height: 18px; }
input[type="range"] { width: 100%; min-height: 32px; margin: 0; accent-color: var(--ink); }
.range { position: relative; padding-top: 26px; }
.bubble {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  background: var(--ink);
  color: #0a0a0a;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 18px;
  pointer-events: none;
  white-space: nowrap;
}
.preview {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--hairline);
  background: #000;
}
.preview canvas { display: block; max-width: 100%; max-height: 320px; touch-action: none; cursor: grab; }
.preview canvas:active { cursor: grabbing; }
.actions {
  position: sticky;
  bottom: 0;
  padding: 12px 0 max(12px, env(safe-area-inset-bottom));
  background: var(--canvas);
}
.btn {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--ink); color: #0a0a0a; }
.btn:disabled { opacity: 0.55; cursor: progress; }
.toast {
  position: fixed;
  z-index: 10;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  width: min(480px, calc(100% - 24px));
  transform: translateX(-50%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 1px 3px rgba(0, 0, 0, 0.5);
  padding: 10px 14px;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
}
@media (max-width: 360px) {
  .wrap { padding-left: 8px; padding-right: 8px; }
  .card { padding: 14px; }
  #typeSeg { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #typeSeg button:first-child { grid-column: 1 / -1; }
}
