:root {
  color-scheme: light;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --ink: #161616;
  --muted: #6a7078;
  --line: #d7dce2;
  --panel: #f7f8fa;
  --surface: #ffffff;
  --accent: #f45757;
  --accent-strong: #cc3939;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: #eef1f4;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(320px, 1fr) minmax(320px, 1fr);
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  overflow-y: auto;
  padding: 22px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.control-panel h1 {
  margin: 0 0 2px;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

.control-section,
.advanced-panel,
.export-section {
  display: grid;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.advanced-panel summary {
  cursor: pointer;
  font-weight: 700;
}

.advanced-panel[open] {
  gap: 14px;
}

.advanced-panel[open] summary {
  margin-bottom: 2px;
}

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

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
}

input,
select {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #c8ced6;
  border-radius: 6px;
  outline: none;
}

input[type="color"] {
  padding: 4px;
}

input[type="file"] {
  height: auto;
  padding: 8px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(244, 87, 87, 0.14);
}

button {
  min-height: 40px;
  padding: 0 14px;
  color: #ffffff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

button:active {
  transform: translateY(1px);
}

.export-section {
  margin-top: auto;
}

.status-line {
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  color: #393f46;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.4;
}

.status-line.is-error {
  color: #8b1e1e;
  border-color: #efb0b0;
  background: #fff3f3;
}

.status-line.is-ok {
  color: #205231;
  border-color: #a7d9b5;
  background: #f0fff4;
}

.preview-pane {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  height: 100vh;
  overflow: auto;
  padding: 18px;
  background: #ffffff;
  border-right: 1px solid var(--line);
}

.preview-pane:last-child {
  border-right: none;
}

.preview-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0 0 12px;
  background: #ffffff;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

canvas {
  display: block;
  justify-self: center;
  align-self: start;
  width: min(100%, 430px);
  height: auto;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(30, 35, 42, 0.18);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 300px 340px 340px;
    overflow-x: auto;
  }
}
