:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111318;
  background: #f6f7f9;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: radial-gradient(circle at 50% -10%, #ffffff 0, #f7f8fa 42%, #f2f3f5 100%);
}

button, input { font: inherit; }
button { cursor: pointer; }

.shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hero {
  flex: 1;
  padding: 48px 0 56px;
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.logo-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #111318;
  color: white;
  font-size: 15px;
  font-weight: 800;
}

h1 {
  margin: 58px 0 10px;
  max-width: 680px;
  font-size: clamp(42px, 7vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.055em;
  font-weight: 760;
}

.subtitle {
  margin: 0 0 34px;
  color: #6b707c;
  font-size: 18px;
  line-height: 1.5;
}

.card {
  padding: 12px;
  border: 1px solid #e2e4e8;
  background: rgba(255,255,255,.92);
  border-radius: 20px;
  box-shadow: 0 22px 70px rgba(17, 19, 24, .07);
}

.url-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.url-row input {
  width: 100%;
  height: 54px;
  border: 1px solid #dedfe3;
  border-radius: 14px;
  padding: 0 16px;
  outline: 0;
  background: #fbfbfc;
  color: #111318;
  transition: border-color .15s, box-shadow .15s;
}

.url-row input:focus, .number-wrap input:focus {
  border-color: #9ca2ad;
  box-shadow: 0 0 0 4px rgba(17,19,24,.06);
}

.url-row button, .secondary-btn {
  border: 0;
  border-radius: 14px;
  min-width: 116px;
  padding: 0 20px;
  background: #111318;
  color: #fff;
  font-weight: 650;
  transition: transform .15s, opacity .15s;
}

.url-row button:hover, .secondary-btn:hover { transform: translateY(-1px); }
.url-row button:disabled { opacity: .45; cursor: wait; transform: none; }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 18px;
  padding: 16px 4px 3px;
}

.control-group { display: grid; gap: 7px; }
.control-label {
  display: block;
  color: #777c86;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #f1f2f4;
  border-radius: 12px;
}

.preset {
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #767b85;
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 650;
}

.preset.active {
  background: #fff;
  color: #111318;
  box-shadow: 0 1px 3px rgba(17,19,24,.09);
}

.number-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 39px;
  padding-right: 11px;
  border: 1px solid #dedfe3;
  border-radius: 10px;
  background: #fff;
}

.number-wrap input {
  width: 94px;
  height: 37px;
  border: 0;
  outline: 0;
  padding: 0 9px;
  background: transparent;
}
.number-wrap span { color: #858a94; font-size: 13px; }

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
  height: 39px;
  color: #4f545f;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.check-row input { position: absolute; opacity: 0; pointer-events: none; }
.check-box {
  width: 18px;
  height: 18px;
  border: 1px solid #c7cad0;
  border-radius: 6px;
  background: #fff;
  position: relative;
}
.check-row input:checked + .check-box { background: #111318; border-color: #111318; }
.check-row input:checked + .check-box::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
  left: 4px;
  top: 5px;
}

.message {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 13px;
  font-size: 14px;
  line-height: 1.45;
}
.message.error { color: #8c2323; background: #fff1f1; border: 1px solid #f4d6d6; }

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  padding: 28px 0;
  color: #6e737d;
  font-size: 14px;
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #d6d8dc;
  border-top-color: #111318;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result {
  margin-top: 28px;
  padding: 14px;
  border: 1px solid #e2e4e8;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(17, 19, 24, .06);
}
.result-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 4px 14px;
}
.result-title { font-size: 14px; font-weight: 700; }
.result-meta { margin-top: 4px; color: #838893; font-size: 12px; }
.secondary-btn { min-width: auto; height: 40px; padding: 0 15px; font-size: 13px; }
.preview-frame {
  overflow: auto;
  display: flex;
  justify-content: center;
  padding: 12px;
  background: #f4f5f7;
  border-radius: 12px;
  max-height: 78vh;
}
.preview-frame img {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  box-shadow: 0 10px 34px rgba(17,19,24,.12);
  background: white;
}

footer {
  padding: 0 0 30px;
  color: #969aa3;
  text-align: center;
  font-size: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 680px) {
  .hero { padding-top: 28px; }
  h1 { margin-top: 44px; }
  .url-row { grid-template-columns: 1fr; }
  .url-row button { height: 52px; }
  .controls { align-items: stretch; }
  .custom-group, .check-row { margin-left: 0; }
  .check-row { height: 36px; }
  .result-topline { align-items: flex-start; flex-direction: column; }
  .secondary-btn { width: 100%; }
}
