:root {
  color-scheme: light;
  --ink: #202b3c;
  --muted: #7b8594;
  --line: #e5e9ee;
  --blue: #3d68d7;
  --blue-dark: #3158bd;
  --green: #26825e;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: #f5f7fa;
  background-image:
    linear-gradient(rgba(133, 146, 164, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(133, 146, 164, 0.045) 1px, transparent 1px),
    radial-gradient(ellipse at 50% -10%, #ffffff 0, rgba(255, 255, 255, 0) 65%);
  background-size: 34px 34px, 34px 34px, 100% 100%;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(100% - 48px, 1000px);
  margin: 0 auto;
  padding: 34px 0 30px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  margin-bottom: 54px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #3b4656;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #dfe7f3;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 3px 9px rgba(34, 49, 75, 0.04);
}

.brand-mark svg {
  width: 19px;
  stroke: #496dc7;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.header-note {
  color: #929aa7;
  font-size: 12px;
  font-weight: 500;
}

.builder-card {
  width: min(100%, 600px);
  margin: 0 auto;
  padding: 42px 46px 36px;
  border: 1px solid rgba(222, 227, 234, 0.9);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 60px rgba(39, 52, 73, 0.075), 0 2px 8px rgba(39, 52, 73, 0.025);
}

.intro {
  margin-bottom: 31px;
}

.eyebrow {
  color: #70809c;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

h1 {
  margin: 9px 0 7px;
  color: #202b3c;
  font-size: clamp(26px, 4vw, 31px);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 1.16;
}

.intro p {
  margin: 0;
  color: #7e8897;
  font-size: 14px;
  line-height: 1.6;
}

.field-block {
  margin-bottom: 24px;
}

.field-label {
  display: block;
  margin-bottom: 10px;
  color: #394557;
  font-size: 12px;
  font-weight: 700;
}

.upload-zone {
  position: relative;
  display: flex;
  min-height: 91px;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px dashed #c9d3e1;
  border-radius: 12px;
  background: #fbfcfe;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.upload-zone:hover,
.upload-zone.is-dragging {
  border-color: #7392df;
  background: #f7f9ff;
}

.upload-zone:focus-within {
  outline: 3px solid rgba(80, 119, 220, 0.2);
  outline-offset: 2px;
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.upload-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #e6ebf2;
  border-radius: 12px;
  background: #fff;
  color: #5a75b4;
}

.upload-icon svg {
  width: 21px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.upload-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.upload-copy strong {
  overflow: hidden;
  color: #465367;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-copy span {
  color: #9099a7;
  font-size: 11px;
}

.browse-button {
  margin-left: auto;
  padding: 8px 11px;
  border: 1px solid #e1e6ed;
  border-radius: 8px;
  background: white;
  color: #5a6678;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.selected-file {
  overflow: hidden;
  min-height: 16px;
  margin: 7px 2px 0;
  color: #8b94a1;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-field {
  margin-top: 24px;
  margin-bottom: 26px;
}

.select-wrap {
  position: relative;
}

.select-wrap select {
  width: 100%;
  height: 47px;
  padding: 0 42px 0 14px;
  appearance: none;
  border: 1px solid #dfe4eb;
  border-radius: 9px;
  outline: none;
  background: #fff;
  color: #3d4858;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.select-wrap select:focus {
  border-color: #8ca6e6;
  box-shadow: 0 0 0 3px rgba(80, 119, 220, 0.12);
}

.select-chevron {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 16px;
  transform: translateY(-50%);
  pointer-events: none;
  stroke: #7b8797;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.field-hint {
  margin: 7px 2px 0;
  color: #939ba7;
  font-size: 11px;
}

.create-button {
  display: flex;
  width: 100%;
  min-height: 49px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(61, 104, 215, 0.19);
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.create-button:not(:disabled):hover {
  transform: translateY(-1px);
  background: var(--blue-dark);
  box-shadow: 0 8px 18px rgba(61, 104, 215, 0.24);
}

.create-button:focus-visible,
.download-link:focus-visible,
.result-filename:focus-visible {
  outline: 3px solid rgba(80, 119, 220, 0.26);
  outline-offset: 3px;
}

.create-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.create-button svg {
  width: 17px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.privacy-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 15px 0 0;
  color: #8c96a4;
  font-size: 10px;
}

.privacy-note svg {
  width: 13px;
  flex: 0 0 auto;
  stroke: #8c96a4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.25;
}

.status-message {
  margin-top: 19px;
  padding: 11px 13px;
  border: 1px solid #f0d9bd;
  border-radius: 9px;
  background: #fff9f2;
  color: #875c2b;
  font-size: 12px;
  line-height: 1.5;
}

.status-message[data-kind="error"] {
  border-color: #f2d2d2;
  background: #fff7f7;
  color: #9a4444;
}

.status-message[data-kind="success"] {
  border-color: #d5e9df;
  background: #f4fbf7;
  color: #397354;
}

.result-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  padding: 15px;
  border: 1px solid #dbe9e1;
  border-radius: 12px;
  background: #f8fcf9;
}

.result-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 11px;
  background: #e8f4ed;
  color: var(--green);
}

.result-icon svg {
  width: 21px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.result-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.result-caption {
  color: #718579;
  font-size: 10px;
  font-weight: 600;
}

.result-filename {
  overflow: hidden;
  color: #315f49;
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: #b1cfbd;
  text-underline-offset: 3px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 10px;
  border: 1px solid #d8e7de;
  border-radius: 8px;
  background: #fff;
  color: #426951;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.download-link:hover {
  background: #f1f8f4;
}

.download-link svg {
  width: 15px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.result-hint {
  grid-column: 2 / -1;
  margin: -4px 0 0;
  color: #849289;
  font-size: 10px;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
  color: #929ba7;
  font-size: 10px;
  text-align: center;
}

.footer-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #aab2bd;
}

[hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 30px, 500px);
    padding-top: 21px;
  }

  .app-header {
    margin-bottom: 32px;
  }

  .header-note {
    max-width: 120px;
    text-align: right;
  }

  .builder-card {
    padding: 30px 23px 25px;
    border-radius: 16px;
  }

  .upload-zone {
    gap: 11px;
    padding: 14px 12px;
  }

  .upload-icon {
    width: 37px;
    height: 37px;
  }

  .browse-button {
    padding: 7px 8px;
  }

  .app-footer {
    flex-wrap: wrap;
    row-gap: 5px;
  }
}

@media (max-width: 390px) {
  .result-card {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .result-icon {
    width: 36px;
    height: 36px;
  }

  .download-link {
    grid-column: 2;
    justify-self: start;
  }

  .result-hint {
    grid-column: 1 / -1;
    margin-top: 0;
  }
}
