:root {
  --ink: #1f252d;
  --muted: #687382;
  --soft: #9ba7b6;
  --line: #d7dde6;
  --line-strong: #b9c3d1;
  --paper: #ffffff;
  --panel: #f7f9fc;
  --navy: #002060;
  --blue: #0a4d93;
  --slate: #53606f;
  --green: #1d7558;
  --amber: #a16008;
  --shadow: 0 28px 80px rgba(20, 31, 45, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(0, 32, 96, 0.13), transparent 28%),
    radial-gradient(circle at 85% 18%, rgba(29, 117, 88, 0.12), transparent 25%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0 16%, transparent 16% 100%),
    linear-gradient(180deg, #eef3f8 0%, #f8fafc 52%, #e9eef4 100%);
  font-family: Aptos, "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 32, 96, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 32, 96, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 76%);
}

.app-shell {
  position: relative;
  width: min(1460px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 34px 0;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--slate);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--navy);
  font-size: clamp(40px, 5.2vw, 76px);
  line-height: 0.96;
  letter-spacing: -0.05em;
  font-weight: 820;
}

.subtitle {
  max-width: 720px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.system-card {
  display: flex;
  align-items: center;
  min-width: 178px;
  gap: 12px;
  border: 1px solid rgba(215, 221, 230, 0.92);
  background: rgba(255, 255, 255, 0.78);
  padding: 14px 16px;
  box-shadow: 0 14px 40px rgba(20, 31, 45, 0.08);
  backdrop-filter: blur(16px);
}

.system-card small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.system-card strong {
  display: block;
  margin-top: 2px;
  color: var(--green);
  font-size: 15px;
}

.pulse {
  width: 10px;
  height: 10px;
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(29, 117, 88, 0.13);
}

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

.upload-pane,
.result-pane {
  border: 1px solid rgba(215, 221, 230, 0.96);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.upload-pane {
  min-height: 724px;
  padding: 24px;
}

.brand-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
}

.brand-card img {
  width: 96px;
  height: auto;
}

.brand-card strong,
.brand-card span {
  display: block;
}

.brand-card strong {
  color: var(--navy);
  font-size: 15px;
  font-weight: 820;
}

.brand-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 252px;
  border: 1px dashed var(--line-strong);
  background:
    linear-gradient(135deg, rgba(0, 32, 96, 0.035) 0 12px, transparent 12px 100%),
    linear-gradient(180deg, #ffffff, #f4f7fb);
  cursor: pointer;
  text-align: center;
  padding: 28px;
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--navy);
  background: #fff;
  box-shadow: 0 16px 36px rgba(0, 32, 96, 0.09);
  transform: translateY(-2px);
}

.dropzone input {
  display: none;
}

.drop-glyph {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 18px;
  background: var(--navy);
  color: #fff;
  font-size: 36px;
  font-weight: 260;
  line-height: 1;
}

.dropzone strong {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.dropzone small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.control-grid {
  margin-top: 22px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  outline: none;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  outline: none;
}

textarea {
  width: 100%;
  min-height: 94px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  padding: 11px 12px;
  resize: vertical;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--soft);
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(0, 32, 96, 0.1);
}

.compact-field {
  margin-top: 10px;
}

.primary-action {
  width: 100%;
  min-height: 52px;
  margin-top: 16px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(135deg, var(--navy), #073a84);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 820;
  cursor: pointer;
  box-shadow: 0 18px 34px rgba(0, 32, 96, 0.18);
}

.primary-action:disabled {
  background: #a8b2bf;
  box-shadow: none;
  cursor: not-allowed;
}

.format-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 20px;
}

.format-strip span {
  border: 1px solid #d8e6df;
  background: #eef8f3;
  color: var(--green);
  padding: 9px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 820;
}

.flow-list {
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.flow-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.flow-list span {
  color: var(--navy);
  font-size: 12px;
  font-weight: 900;
}

.result-pane {
  min-width: 0;
  padding: 24px;
  overflow-x: hidden;
}

.result-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.result-head > div {
  min-width: 0;
}

h2 {
  color: var(--ink);
  font-size: clamp(22px, 2.4vw, 36px);
  line-height: 1.08;
  letter-spacing: -0.04em;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
  flex-shrink: 1;
}

.ghost-action {
  border: 1px solid var(--line-strong);
  color: var(--navy);
  background: rgba(255, 255, 255, 0.92);
  padding: 10px 12px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 820;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.ghost-action:not(.disabled):hover {
  border-color: var(--navy);
  background: #fff;
  transform: translateY(-1px);
}

.ghost-action.disabled {
  color: #9aa3ae;
  pointer-events: none;
}

.metrics {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.6fr) minmax(0, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.metrics div {
  min-width: 0;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfcfe, #f4f7fa);
  padding: 15px;
}

.metrics span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.metrics strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
  font-size: 15px;
  font-weight: 760;
}

.warnings {
  display: none;
  margin-bottom: 20px;
  border-left: 5px solid var(--amber);
  background: #fff8e6;
  padding: 13px 15px;
  color: #5b3d04;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.warnings.is-visible {
  display: block;
}

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

.preview-grid article {
  min-width: 0;
  border: 1px solid var(--line);
  background: #fbfcfe;
}

.preview-grid header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 820;
}

.preview-grid header small {
  color: var(--soft);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

pre {
  height: 482px;
  margin: 0;
  padding: 17px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #242a32;
  font: 13px/1.58 "SF Mono", Menlo, Consolas, monospace;
}

@media (max-width: 1050px) {
  .app-shell {
    width: min(100vw - 28px, 760px);
    padding: 22px 0;
  }

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

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

  .upload-pane {
    min-height: auto;
  }

  .result-head {
    display: grid;
  }

  .result-actions {
    justify-content: flex-start;
    min-width: 0;
  }

  pre {
    height: 310px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: calc(100vw - 18px);
    padding: 12px 0;
  }

  .upload-pane,
  .result-pane {
    padding: 16px;
  }

  .brand-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .dropzone {
    min-height: 214px;
  }

  .format-strip {
    grid-template-columns: 1fr;
  }

  .result-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}
