:root {
  color-scheme: light;
  --ink: #182025;
  --muted: #667078;
  --line: #d8dee2;
  --panel: #f7f8f6;
  --paper: #ffffff;
  --accent: #166c68;
  --accent-strong: #0f4f4d;
  --warn: #9d4d19;
  --blue: #2f5f9f;
  --shadow: 0 22px 70px rgba(24, 32, 37, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(22, 108, 104, 0.10), rgba(47, 95, 159, 0.08)),
    #eef1ef;
}

button,
select,
input {
  font: inherit;
}

.shell {
  min-height: 100vh;
  padding: 28px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 56px);
}

.panel,
.stage {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(216, 222, 226, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  border-radius: 8px;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-size: 22px;
  font-weight: 800;
}

h1,
p,
figure {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.1;
}

.brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 170px;
  padding: 18px;
  border: 1.5px dashed #9aa6ad;
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.dropzone:hover,
.dropzone.dragging {
  border-color: var(--accent);
  background: #eef6f3;
}

.dropzone input {
  display: none;
}

.dropIcon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  font-size: 30px;
  line-height: 1;
}

.dropzone strong {
  font-size: 16px;
}

.dropzone small {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

input[type="password"] {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

input[type="password"]::placeholder {
  color: #9aa6ad;
}

.segments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segment {
  height: 36px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.segment.active {
  color: #fff;
  background: var(--accent);
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 46px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 750;
  cursor: pointer;
}

.primary:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.playIcon {
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid currentColor;
}

.modelTips {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 248, 246, 0.9);
}

.modelTips h2 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.3;
}

.modelTips dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.modelTips div {
  display: grid;
  gap: 2px;
}

.modelTips dt {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.modelTips dd {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 8px;
}

.previewGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 0;
}

.previewSlot {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  border-left: 1px solid var(--line);
}

.previewSlot:first-child {
  border-left: 0;
}

figcaption {
  height: 48px;
  padding: 15px 18px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.imageFrame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 420px;
  padding: 18px;
  overflow: hidden;
  background:
    linear-gradient(45deg, #edf0ee 25%, transparent 25%),
    linear-gradient(-45deg, #edf0ee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #edf0ee 75%),
    linear-gradient(-45deg, transparent 75%, #edf0ee 75%),
    #fafafa;
  background-size: 26px 26px;
  background-position: 0 0, 0 13px, 13px -13px, -13px 0;
}

.imageFrame img {
  display: none;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 36px rgba(24, 32, 37, 0.16);
}

.imageFrame.hasImage img {
  display: block;
}

.imageFrame.hasImage span {
  display: none;
}

.imageFrame span {
  color: var(--muted);
  font-weight: 650;
}

.statusBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
}

.statusBar p {
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download {
  flex: 0 0 auto;
  padding: 9px 12px;
  border-radius: 8px;
  color: #fff;
  background: var(--warn);
  text-decoration: none;
  font-weight: 750;
}

.hidden {
  display: none;
}

@media (max-width: 860px) {
  .shell {
    padding: 14px;
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .previewGrid {
    grid-template-columns: 1fr;
  }

  .previewSlot {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .previewSlot:first-child {
    border-top: 0;
  }

  .imageFrame {
    min-height: 300px;
  }
}
