:root {
  --bg: #f5f6fb;
  --panel: #ffffff;
  --text: #1b1e2f;
  --muted: #667085;
  --accent: #1267ff;
  --border: #d8deea;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", sans-serif;
  background: radial-gradient(circle at 20% 0%, #dde9ff, #f5f6fb 46%);
  color: var(--text);
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.topbar-main {
  flex: 1;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
}

.topbar p {
  margin: 8px 0 0;
  color: var(--muted);
}

.language-switch {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 150px;
}

.language-switch span {
  font-size: 13px;
  color: #4e5a78;
}

.language-switch select {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 14px;
  background: #fff;
  color: #1f2740;
}

.layout {
  margin-top: 20px;
  display: grid;
  grid-template-columns: minmax(260px, 300px) 1fr;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eff4ff;
  color: #1149b4;
  border: 1px dashed #a8c0f0;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
}

.file-btn input {
  display: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field span {
  font-size: 14px;
  color: #333955;
}

.field output {
  font-size: 13px;
  color: #4e5a78;
  font-variant-numeric: tabular-nums;
}

.field input[type="text"] {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 15px;
}

.field input[type="range"] {
  width: 100%;
}

.field input[type="color"] {
  width: 56px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

.download-btn {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  height: 42px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

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

.preview {
  position: relative;
  min-height: 420px;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

canvas {
  width: 100%;
  height: auto;
  max-height: 76vh;
  border-radius: 6px;
  display: none;
}

.placeholder {
  color: #5f6b85;
  font-size: 18px;
  font-weight: 500;
}

@media (max-width: 900px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .language-switch {
    align-items: flex-start;
  }

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

  .preview {
    min-height: 280px;
  }
}
