:root {
  color-scheme: dark;
  --bg: #07080d;
  --surface: #101117;
  --surface-2: #151720;
  --ink: #f4f2ed;
  --muted: #9b9da5;
  --line: rgba(255, 255, 255, 0.13);
  --gold: #f0a928;
  --blue: #415dff;
  --green: #38cfa2;
  --rose: #d9748d;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 72% 8%, rgba(65, 93, 255, 0.18), transparent 34rem),
    radial-gradient(circle at 12% 16%, rgba(240, 169, 40, 0.12), transparent 26rem),
    var(--bg);
  color: var(--ink);
}

body {
  font-family:
    Manrope, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(390px, 455px) minmax(0, 1fr);
  min-height: 100vh;
}

.input-pane {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(16, 17, 23, 0.95), rgba(7, 8, 13, 0.98)),
    var(--surface);
  overflow: auto;
}

.brand-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.02;
}

.brand-copy {
  max-width: 34rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.status-pill,
.keyword-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 30px;
  border: 1px solid rgba(240, 169, 40, 0.35);
  color: #ffe2a2;
  background: rgba(240, 169, 40, 0.1);
  font-size: 13px;
  font-weight: 800;
}

.status-pill {
  padding: 0 11px;
}

.generator-form,
.form-section {
  display: flex;
  flex-direction: column;
}

.generator-form {
  gap: 18px;
}

.form-section {
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(16, 17, 23, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.section-heading,
.form-actions,
.workspace-header,
.toolbar,
.tabs {
  display: flex;
  align-items: center;
}

.section-heading {
  gap: 12px;
}

.section-heading h2 {
  margin-bottom: 3px;
  font-size: 17px;
}

.section-heading p,
.empty-state p,
.image-preview p {
  margin-bottom: 0;
  color: var(--muted);
}

.section-heading p {
  font-size: 13px;
  line-height: 1.45;
}

.step-badge {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(240, 169, 40, 0.45);
  color: var(--gold);
  background: rgba(240, 169, 40, 0.08);
  font-size: 13px;
  font-weight: 900;
}

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #d7d5cf;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0;
  outline: none;
  color: var(--ink);
  background: rgba(7, 8, 13, 0.82);
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

input,
select {
  min-height: 43px;
  padding: 0 12px;
}

select option {
  background: #101117;
  color: var(--ink);
}

textarea {
  min-height: 112px;
  padding: 12px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(240, 169, 40, 0.14);
}

input::placeholder,
textarea::placeholder {
  color: #727681;
}

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

.upload-field {
  gap: 8px;
}

.upload-control {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(7, 8, 13, 0.82);
  cursor: pointer;
}

.upload-control input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-button,
.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  cursor: pointer;
  font-weight: 900;
}

.upload-button,
.primary-action {
  color: #0b0c10;
  background: linear-gradient(135deg, #f7c75b, var(--gold));
}

.upload-button {
  padding: 0 12px;
  font-size: 13px;
}

.upload-file-name {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-preview {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(7, 8, 13, 0.72);
}

.image-preview img {
  width: 74px;
  height: 74px;
  object-fit: cover;
  background: #0c0d13;
}

.image-preview strong {
  display: block;
  overflow: hidden;
  margin-bottom: 4px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-actions {
  justify-content: space-between;
  gap: 12px;
}

.primary-action,
.secondary-action {
  min-height: 46px;
  padding: 0 18px;
}

.primary-action {
  box-shadow: 0 18px 42px rgba(240, 169, 40, 0.16);
}

.secondary-action {
  border: 1px solid rgba(65, 93, 255, 0.45);
  color: #c9d1ff;
  background: rgba(65, 93, 255, 0.12);
}

.workspace {
  min-width: 0;
  padding: 28px 34px 34px;
  overflow: auto;
}

.workspace-header {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.workspace-header h2 {
  max-width: 52rem;
  margin-bottom: 0;
  font-size: clamp(25px, 3vw, 42px);
  line-height: 1.08;
}

.toolbar {
  gap: 8px;
}

.icon-button,
.export-action {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(16, 17, 23, 0.82);
  cursor: pointer;
}

.icon-button {
  width: 42px;
}

.export-action {
  grid-template-columns: auto auto;
  gap: 8px;
  padding: 0 13px;
  font-weight: 900;
}

.export-action span {
  white-space: nowrap;
}

.icon-button:hover:not(:disabled),
.export-action:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold);
}

.icon-button:disabled,
.export-action:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.icon-button svg,
.export-action svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.cover-strip {
  position: relative;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: rgba(16, 17, 23, 0.66);
  overflow: hidden;
}

.cover-strip img {
  width: 100%;
  height: 100%;
  min-height: 150px;
  object-fit: cover;
}

.cover-strip div {
  padding: 18px 20px;
  align-self: center;
}

.cover-strip span {
  display: block;
  margin-bottom: 10px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.cover-strip p {
  max-width: 58rem;
  margin-bottom: 0;
  color: #d6d4ce;
  font-size: 16px;
  line-height: 1.7;
}

.score-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.score-card {
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(16, 17, 23, 0.74);
}

.score-card span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.score-card strong {
  color: var(--ink);
  font-size: 36px;
  line-height: 1;
}

.score-card:nth-child(2) strong {
  color: #87a0ff;
}

.score-card:nth-child(3) strong {
  color: var(--gold);
}

.score-card:nth-child(4) strong {
  color: var(--rose);
}

.tabs {
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  background: rgba(16, 17, 23, 0.74);
}

.tab-button {
  min-height: 38px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

.tab-button.active {
  color: #0b0c10;
  background: var(--gold);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 430px;
  margin-top: 16px;
  padding: 34px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(16, 17, 23, 0.45);
  text-align: center;
}

.empty-state h2 {
  max-width: 680px;
  margin: 18px auto 10px;
  font-size: 27px;
  line-height: 1.22;
}

.empty-state p {
  max-width: 620px;
  font-size: 16px;
  line-height: 1.75;
}

.empty-mark {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border: 1px solid rgba(240, 169, 40, 0.45);
  color: var(--gold);
  background: rgba(240, 169, 40, 0.08);
  font-size: 23px;
  font-weight: 950;
}

.result-area {
  margin-top: 16px;
}

.output-panel {
  display: none;
  padding: 28px;
  border: 1px solid var(--line);
  background: #f6f2e8;
  color: #151720;
  box-shadow: var(--shadow);
}

.output-panel.active {
  display: block;
}

.output-panel h1,
.output-panel h2,
.output-panel h3 {
  color: #0e1118;
  line-height: 1.24;
}

.output-panel h1 {
  margin-bottom: 18px;
  font-size: clamp(28px, 3vw, 38px);
}

.output-panel h2 {
  margin: 30px 0 11px;
  padding-top: 4px;
  font-size: 24px;
}

.output-panel h3 {
  margin: 20px 0 8px;
  font-size: 18px;
}

.output-panel p,
.output-panel li,
.output-panel td,
.output-panel th {
  color: #30333b;
  font-size: 16px;
  line-height: 1.78;
}

.output-panel p {
  margin-bottom: 13px;
}

.output-panel ul,
.output-panel ol {
  margin: 8px 0 16px;
  padding-left: 22px;
}

.output-panel table {
  display: block;
  width: 100%;
  margin: 16px 0 20px;
  overflow-x: auto;
  border-collapse: collapse;
}

.output-panel th,
.output-panel td {
  padding: 12px;
  border-bottom: 1px solid rgba(15, 18, 25, 0.16);
  text-align: left;
  vertical-align: top;
}

.output-panel th {
  color: #0e1118;
  background: rgba(240, 169, 40, 0.14);
  font-weight: 900;
}

.meta-box,
.answer-box,
.warning-box {
  margin: 16px 0;
  padding: 16px;
  border: 1px solid rgba(15, 18, 25, 0.16);
  background: rgba(255, 255, 255, 0.52);
}

.answer-box {
  border-left: 4px solid var(--gold);
}

.label-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.keyword-chip {
  padding: 0 10px;
  color: #22201a;
  background: rgba(240, 169, 40, 0.2);
}

.code-panel pre,
.schema-block {
  overflow: auto;
  margin: 0;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e7e2d7;
  background: #090a0f;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: 360px;
  padding: 12px 14px;
  border: 1px solid rgba(240, 169, 40, 0.34);
  color: var(--ink);
  background: rgba(16, 17, 23, 0.96);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: no-preference) {
  .cover-strip img {
    animation: coverDrift 16s ease-in-out infinite alternate;
  }
}

@keyframes coverDrift {
  from {
    transform: scale(1.02) translateX(-1%);
  }
  to {
    transform: scale(1.07) translateX(1%);
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .input-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }

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

@media (max-width: 760px) {
  .input-pane,
  .workspace {
    padding: 20px 16px;
  }

  .field-grid,
  .score-row,
  .cover-strip {
    grid-template-columns: 1fr;
  }

  .cover-strip img {
    min-height: 190px;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab-button {
    flex: 0 0 auto;
  }

  .output-panel {
    padding: 20px;
  }

  .toast {
    right: 16px;
    left: 16px;
    max-width: none;
  }
}
