:root {
  color-scheme: light;
  --bg: #f4f8fb;
  --ink: #17211c;
  --muted: #526879;
  --line: #a8bdd5;
  --panel: #ffffff;
  --accent: #003a70;
  --accent-strong: #022a4e;
  --warning: #9b3d27;
  --soft: #dde5ed;
  --shadow: 0 18px 50px rgba(2, 42, 78, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(0, 58, 112, 0.08), transparent 42%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

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

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
  gap: 20px;
  align-items: stretch;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

.upload-panel,
.controls-panel,
.preview-panel {
  padding: 24px;
}

.title-row,
.output-header,
.button-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 0.98;
  max-width: 440px;
}

h2 {
  font-size: 1.4rem;
}

.drop-zone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 270px;
  margin-top: 24px;
  padding: 24px;
  border: 2px dashed #7098c3;
  border-radius: 8px;
  background: #fbfdfb;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: #edf5fb;
  transform: translateY(-1px);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drop-icon {
  display: grid;
  place-items: center;
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 0;
  line-height: 0;
}

.drop-icon::before,
.drop-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 5px;
  border-radius: 1px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.drop-icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.drop-title {
  font-size: 1.15rem;
  font-weight: 800;
}

.drop-copy,
.file-summary,
.progress-log,
textarea::placeholder {
  color: var(--muted);
}

.file-summary {
  margin-top: 16px;
  min-height: 72px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--soft);
  line-height: 1.45;
}

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

.destination-summary {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--soft);
}

.destination-summary p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.destination-repo {
  margin: 8px 0 0;
  color: var(--ink);
  font-weight: 800;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

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

input,
textarea {
  width: 100%;
  border: 1px solid #b7c5bd;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

input {
  min-height: 44px;
  padding: 10px 12px;
}

textarea {
  min-height: 154px;
  margin-top: 16px;
  padding: 14px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus,
button:focus-visible,
.drop-zone:focus-within {
  outline: 3px solid rgba(0, 58, 112, 0.25);
  outline-offset: 2px;
}

.button-row {
  margin-top: 20px;
  justify-content: flex-start;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 10px 16px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: var(--accent-strong);
}

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

button.secondary {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

button.secondary:hover:not(:disabled) {
  background: var(--soft);
}

.preview-panel {
  margin-top: 20px;
}

.embed-output {
  margin-top: 20px;
}

.embed-output h2 {
  font-size: 1rem;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
}

.preview-title-group {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.preview-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.artboard-controls {
  display: grid;
  grid-template-columns: 34px minmax(120px, auto) 34px;
  gap: 8px;
  align-items: center;
}

.artboard-controls[hidden] {
  display: none;
}

#artboard-label {
  min-width: 0;
  max-width: 280px;
  overflow: hidden;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  min-width: 34px;
  min-height: 34px;
  padding: 0;
}

.preview-tab {
  min-height: 34px;
  max-width: 260px;
  padding: 7px 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.preview-frame-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  margin-top: 28px;
  margin-bottom: 20px;
  margin-right: auto;
  margin-left: auto;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow:
    0 0 0 0.5px #9e9e9e,
    0 14px 30px rgba(0, 0, 0, 0.22);
}

#preview-frame {
  display: none;
  width: 100%;
  border: 0;
  background: white;
}

#preview-frame.visible {
  display: block;
}

.preview-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.preview-empty.hidden {
  display: none;
}

.progress-log {
  max-height: 260px;
  margin-top: 14px;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.progress-log p {
  margin: 0 0 8px;
}

.progress-log .error {
  color: var(--warning);
  font-weight: 700;
}

.progress-log .success {
  color: var(--accent-strong);
  font-weight: 700;
}

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

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

  .title-row,
  .output-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .preview-header {
    flex-direction: column;
  }

  .preview-title-group {
    width: 100%;
  }

  .upload-panel,
  .controls-panel,
  .preview-panel {
    padding: 18px;
  }

  .drop-zone {
    min-height: 220px;
  }

  #preview-frame {
    height: 520px;
  }
}
