:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef2f7;
  color: #172033;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.22), transparent 34rem),
    radial-gradient(circle at 85% 8%, rgba(15, 23, 42, 0.12), transparent 24rem),
    linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

button,
input,
select {
  font: inherit;
}

.app {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px, 300px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(18px, 4vw, 42px);
  overflow: hidden;
  margin-bottom: 18px;
  padding: 18px clamp(18px, 4vw, 38px);
  border: 1px solid rgba(14, 165, 233, 0.18);
  border-radius: 30px;
  background:
    radial-gradient(circle at 0% 0%, rgba(14, 165, 233, 0.22), transparent 22rem),
    radial-gradient(circle at 100% 100%, rgba(15, 23, 42, 0.08), transparent 24rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 255, 0.86)),
    rgba(255, 255, 255, 0.82);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(18px);
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 105px;
  margin-bottom: 0;
  border: 1px solid rgba(203, 213, 225, 0.75);
  border-radius: 18px;
  background: #ffffff;
  padding: 14px 18px;
  object-fit: contain;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.1);
}

.hero-copy {
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #0284c7;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 8px;
  font-size: clamp(2.1rem, 4.2vw, 4.2rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  color: #111827;
  text-shadow: none;
}

h2 {
  margin-bottom: 14px;
  font-size: 1.05rem;
}

.lead {
  max-width: 720px;
  margin-bottom: 0;
  color: #475569;
  font-size: 1rem;
  line-height: 1.45;
}

.workspace {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 24px;
}

.panel,
.preview-card {
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.1);
}

.panel {
  padding: 22px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: #334155;
  font-size: 0.93rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #ffffff;
  padding: 12px 13px;
  color: #0f172a;
  outline: none;
}

input:focus,
select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.13);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding: 2px 4px 2px 2px;
  scrollbar-width: thin;
}

.template-card {
  display: grid;
  gap: 8px;
  min-height: 112px;
  align-content: center;
  border: 1px solid #dbe7f3;
  border-radius: 16px;
  background: #ffffff;
  padding: 10px;
  color: #172033;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.template-card:hover,
.template-card.active {
  border-color: #2563eb;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.16);
  transform: translateY(-1px);
}

.template-card.active {
  background: linear-gradient(180deg, #eff6ff, #ffffff);
}

.template-card span {
  overflow: hidden;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  text-overflow: ellipsis;
}

.template-icon {
  width: 100%;
  height: 58px;
  overflow: visible;
}

.template-icon .cut-line {
  fill: none;
  stroke: #172033;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.description {
  margin: 14px 0 24px;
  padding: 14px;
  border-radius: 16px;
  background: #eff6ff;
  color: #1e3a8a;
  line-height: 1.45;
}

.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form .wide {
  grid-column: 1 / -1;
}

.param-symbol {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  margin-right: 7px;
  place-items: center;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 0.78rem;
  line-height: 1;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.actions .secondary:last-child {
  grid-column: 1 / -1;
}

button {
  cursor: pointer;
  border: 0;
  border-radius: 16px;
  padding: 13px 16px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.26);
}

button:hover {
  background: #1d4ed8;
}

button.secondary {
  background: #e2e8f0;
  color: #1e293b;
  box-shadow: none;
}

button.secondary:hover {
  background: #cbd5e1;
}

.preview-card {
  min-height: 640px;
  padding: 22px;
}

.preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.preview-header p {
  margin-bottom: 0;
  color: #64748b;
}

.badge {
  white-space: nowrap;
  border-radius: 999px;
  background: #ecfeff;
  padding: 8px 12px;
  color: #155e75;
  font-size: 0.86rem;
  font-weight: 800;
}

.preview {
  display: grid;
  min-height: 500px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #cbd5e1;
  border-radius: 22px;
  background:
    linear-gradient(#f8fafc 24px, transparent 25px),
    linear-gradient(90deg, #f8fafc 24px, transparent 25px),
    #ffffff;
  background-size: 25px 25px;
}

.preview svg {
  width: 100%;
  height: 100%;
  max-height: 500px;
}

.cut-line {
  fill: none;
  stroke: #0f172a;
  stroke-width: 1.8;
  vector-effect: non-scaling-stroke;
}

.preview-dimensions {
  pointer-events: none;
}

.preview-dimensions marker path {
  fill: #111827;
}

.center-line {
  stroke: #111827;
  stroke-width: 0.75;
  stroke-dasharray: 10 5 2 5;
  opacity: 0.55;
  vector-effect: non-scaling-stroke;
}

.dimension-line {
  stroke: #111827;
  stroke-width: 0.85;
  vector-effect: non-scaling-stroke;
}

.extension-line {
  stroke: #111827;
  stroke-width: 0.7;
  opacity: 0.85;
  vector-effect: non-scaling-stroke;
}

.dimension-label {
  dominant-baseline: middle;
  fill: #111827;
  font-size: 10px;
  font-style: italic;
  font-weight: 700;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 4px;
  text-anchor: middle;
  vector-effect: non-scaling-stroke;
}

.dimension-note {
  dominant-baseline: hanging;
  fill: #111827;
  font-size: 10px;
  font-style: italic;
  font-weight: 700;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 4px;
  vector-effect: non-scaling-stroke;
}

.warnings {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.warning {
  border-radius: 14px;
  background: #fff7ed;
  padding: 12px 14px;
  color: #9a3412;
  font-weight: 700;
}

@media (max-width: 900px) {
  .app {
    width: min(100% - 24px, 1220px);
    padding: 18px 0;
  }

  .hero {
    grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
    gap: 18px;
    padding: 18px;
  }

  .brand-logo {
    width: 100%;
    max-width: calc(100vw - 68px);
    max-height: 88px;
  }

  h1 {
    font-size: clamp(2rem, 7vw, 3.4rem);
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .template-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-height: none;
  }

  .preview-card {
    min-height: auto;
  }
}

@media (max-width: 520px) {
  .app {
    width: min(100% - 20px, 1220px);
    padding: 10px 0;
  }

  .hero {
    border-radius: 22px;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
  }

  .panel,
  .preview-card {
    border-radius: 20px;
    padding: 16px;
  }

  .brand-logo {
    width: 210px;
    max-width: calc(100vw - 52px);
    max-height: 74px;
    margin-bottom: 0;
    border-radius: 12px;
    padding: 8px 10px;
  }

  .eyebrow {
    font-size: 0.68rem;
    line-height: 1.35;
  }

  h1 {
    margin-bottom: 8px;
    font-size: clamp(1.9rem, 12vw, 2.8rem);
    line-height: 0.95;
  }

  .lead {
    font-size: 0.96rem;
  }

  .workspace {
    gap: 14px;
  }

  .template-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .template-card {
    min-height: 104px;
    padding: 9px;
  }

  .template-icon {
    height: 52px;
  }

  .field {
    margin-bottom: 10px;
  }

  input,
  select {
    min-height: 44px;
    padding: 10px 11px;
  }

  .form {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .preview-card {
    min-height: auto;
  }

  .preview {
    min-height: 320px;
  }

  .preview-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .badge {
    white-space: normal;
  }
}
