:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #15171a;
  --muted: #626a73;
  --line: #d9dde3;
  --line-strong: #b8c0ca;
  --accent: #101214;
  --accent-soft: #e9f3ee;
  --success: #137a4b;
  --danger: #a92635;
  --shadow: 0 16px 40px rgba(18, 24, 31, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  color: #99a1aa;
  cursor: not-allowed;
  background: #eef0f3;
}

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

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--success);
  font-size: 13px;
  font-weight: 800;
}

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

h1 {
  font-size: 32px;
  line-height: 1.12;
}

h2 {
  font-size: 22px;
  margin-bottom: 18px;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(18, 24, 31, 0.06);
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

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

.preview-pane {
  padding: 16px;
  display: grid;
  gap: 14px;
  position: sticky;
  top: 16px;
}

.drop-zone {
  min-height: 230px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 2px dashed var(--line-strong);
  border-radius: 8px;
  background: #fafbfc;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.drop-zone.is-dragging {
  border-color: var(--success);
  background: var(--accent-soft);
}

.drop-zone input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.drop-zone strong {
  color: var(--text);
  font-size: 19px;
}

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

.preview-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.preview-card img {
  display: block;
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  background: #111;
}

.preview-card figcaption {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.preview-card span,
.notice p,
.hint,
small {
  color: var(--muted);
}

.notice {
  border: 1px solid #b7dfcc;
  border-radius: 8px;
  background: var(--accent-soft);
  padding: 14px;
}

.notice p {
  margin: 6px 0 0;
  line-height: 1.55;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.tab {
  min-height: 48px;
}

.tab.is-active,
.primary-action {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.panel-stack {
  padding: 18px;
}

.panel {
  display: none;
}

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

.switch-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.switch-row input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.switch-row span {
  display: grid;
  gap: 4px;
}

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

label {
  color: #343940;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 13px;
}

input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
}

.quick-row,
.export-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.hint {
  margin: 14px 0 0;
}

.result-box {
  margin-top: 16px;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #b7dfcc;
  border-radius: 8px;
  background: var(--accent-soft);
}

.result-box a {
  min-height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}

#resetButton {
  color: var(--danger);
}

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

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

  h1 {
    font-size: 27px;
  }

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

  .preview-pane {
    position: static;
  }

  .tabs {
    grid-template-columns: repeat(3, 1fr);
  }

  .field-grid,
  .quick-row,
  .export-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .tabs {
    grid-template-columns: repeat(2, 1fr);
  }

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