:root {
  color-scheme: dark;
  --bg: #120b0d;
  --panel: #1d1114;
  --panel-2: #28161a;
  --line: #44252b;
  --line-strong: #74404a;
  --text: #f2f5f7;
  --muted: #c9aeb4;
  --accent: #e63f4f;
  --accent-2: #ffb35c;
  --danger: #ff6573;
  --ok: #64d98b;
  --button-text: #fff7f8;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(230, 63, 79, 0.24), transparent 34%),
    radial-gradient(circle at 92% 18%, rgba(255, 98, 83, 0.15), transparent 32%),
    linear-gradient(180deg, #1a0e12 0%, #120b0d 58%, #0c0809 100%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid rgba(230, 63, 79, 0.7);
  border-radius: 7px;
  background: linear-gradient(180deg, #ff5967 0%, #d52e3e 100%);
  color: var(--button-text);
  font-weight: 760;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button.secondary {
  background: #241418;
  color: var(--text);
  border-color: var(--line-strong);
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: clamp(14px, 2.4vw, 28px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.brand-area {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 16px 34px rgba(166, 30, 46, 0.28);
}

.top-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.language-field {
  display: grid;
  gap: 5px;
  min-width: 150px;
}

.language-field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.language-field select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(29, 17, 20, 0.88);
  color: var(--text);
  padding: 0 10px;
}

.topbar h1,
.preview-copy h2,
.output-card h2,
.diagnostics h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(2rem, 4.4vw, 3.35rem);
  line-height: 1.05;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(29, 17, 20, 0.88);
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}

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

.control-panel,
.output-card,
.diagnostics {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(29, 17, 20, 0.94);
  box-shadow: var(--shadow);
}

.control-panel {
  align-self: start;
  padding: 16px;
}

.panel-section {
  padding: 0 0 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-section:last-of-type {
  margin-bottom: 14px;
}

.panel-section h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.drop-zone {
  position: relative;
  display: grid;
  gap: 4px;
  min-height: 92px;
  margin-bottom: 10px;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--panel-2);
  cursor: pointer;
}

.drop-zone.dragging {
  border-color: var(--accent);
  background: rgba(230, 63, 79, 0.14);
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-kind {
  width: max-content;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(230, 63, 79, 0.16);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.drop-zone strong,
.drop-zone small {
  display: block;
  overflow-wrap: anywhere;
}

.drop-zone small,
.field span,
.check-row,
#previewMeta {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 11px;
}

.field input,
.field select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #130b0e;
  color: var(--text);
  outline: none;
}

.field input,
.field select {
  min-height: 40px;
  padding: 0 11px;
}

.field input:focus,
.field select:focus,
textarea:focus {
  border-color: var(--accent);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 10px 0;
}

.check-row input {
  margin-top: 4px;
  accent-color: var(--accent);
}

textarea {
  min-height: 145px;
  resize: vertical;
  padding: 11px;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 0.82rem;
}

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

.result-area {
  display: grid;
  gap: 18px;
}

.preview-band {
  display: grid;
  grid-template-columns: minmax(220px, 330px) minmax(0, 1fr);
  gap: 18px;
  min-height: 270px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(230, 63, 79, 0.2), transparent 58%),
    #180e11;
  box-shadow: var(--shadow);
}

.preview-copy {
  align-self: center;
}

.preview-copy h2 {
  margin-bottom: 9px;
  font-size: clamp(1.25rem, 2vw, 2rem);
}

.preview-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.preview-controls button {
  min-width: 118px;
  padding: 0 12px;
}

#modelPreview {
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0e080a;
  cursor: grab;
  touch-action: none;
}

#modelPreview:active {
  cursor: grabbing;
}

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

.output-card,
.diagnostics {
  min-width: 0;
  padding: 16px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card-head button {
  min-width: 92px;
  padding: 0 13px;
}

.output-card h2,
.diagnostics h2 {
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

pre {
  min-height: 210px;
  max-height: 360px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #10090b;
  color: #eadde0;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 0.82rem;
  line-height: 1.48;
  white-space: pre-wrap;
}

.diagnostics-list {
  display: grid;
  gap: 10px;
}

.diagnostic-item {
  border-left: 4px solid var(--line-strong);
  padding: 11px 12px;
  border-radius: 7px;
  background: var(--panel-2);
}

.diagnostic-item.error {
  border-left-color: var(--danger);
}

.diagnostic-item.warning {
  border-left-color: var(--accent-2);
}

.diagnostic-item.ok {
  border-left-color: var(--ok);
}

.diagnostic-item strong {
  display: block;
  margin-bottom: 4px;
}

.diagnostic-item p {
  margin: 0;
  color: var(--muted);
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.faq-section {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(29, 17, 20, 0.94);
  box-shadow: var(--shadow);
}

.faq-head {
  margin-bottom: 12px;
}

.faq-head h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2.4vw, 1.65rem);
}

.faq-list {
  display: grid;
  gap: 10px;
}

.faq-list details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  overflow: hidden;
}

.faq-list summary {
  min-height: 48px;
  padding: 13px 15px;
  color: var(--text);
  font-weight: 780;
  cursor: pointer;
}

.faq-list details[open] summary {
  border-bottom: 1px solid var(--line);
}

.faq-list p {
  margin: 0;
  padding: 13px 15px 15px;
  color: var(--muted);
  line-height: 1.55;
}

.site-footer {
  margin-top: 28px;
  padding: 28px 16px 10px;
  color: rgba(242, 245, 247, 0.68);
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-size: clamp(0.92rem, 2.5vw, 1.05rem);
  font-weight: 520;
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
  }

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

  .control-panel {
    position: static;
  }

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

  #modelPreview {
    min-height: 360px;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 12px;
  }

  .topbar,
  .top-actions,
  .card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-area {
    align-items: flex-start;
    gap: 10px;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
    font-size: 1.35rem;
  }

  .topbar h1 {
    font-size: clamp(1.8rem, 11vw, 2.5rem);
  }

  .language-field {
    min-width: 0;
  }

  .status-pill,
  .language-field,
  .language-field select,
  .card-head button {
    width: 100%;
  }

  .action-row {
    grid-template-columns: 1fr;
  }

  .preview-band,
  .control-panel,
  .output-card,
  .diagnostics {
    padding: 12px;
  }

  .preview-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .preview-controls button {
    min-width: 0;
  }

  #modelPreview {
    min-height: 260px;
  }
}

@media (max-width: 420px) {
  .brand-area {
    flex-direction: column;
  }

  .preview-controls {
    grid-template-columns: 1fr;
  }

  pre {
    max-height: 300px;
  }
}
