:root {
  --bg: #0d1117;
  --panel: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --radius: 10px;
  /* Coding-tool type pairing: Space Grotesk for UI, JetBrains Mono for code. */
  --font-sans: "Space Grotesk", "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
}

a {
  color: var(--accent);
}

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

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.header h1 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header h1 .logo {
  height: 28px;
  width: auto;
}

.header p {
  margin: 0 0 24px;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 760px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

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

.field {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* allow the field (a flex item in .row) to shrink below its input's
     intrinsic width instead of overflowing the fixed-width panel. */
  min-width: 0;
}

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

.field input,
.field select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 14px;
  width: 100%;
  min-width: 0;
}

.row {
  display: flex;
  gap: 12px;
}

.row > * {
  flex: 1 1 0;
  min-width: 0;
}

.error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(248, 81, 73, 0.12);
  border: 1px solid rgba(248, 81, 73, 0.4);
  color: #ff7b72;
  font-size: 13px;
}

.preview-head,
.snippet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.preview-head h3,
.snippet-head h3 {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.preview {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  background:
    linear-gradient(45deg, #1c2128 25%, transparent 25%),
    linear-gradient(-45deg, #1c2128 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1c2128 75%),
    linear-gradient(-45deg, transparent 75%, #1c2128 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 200px;
}

.preview img {
  max-width: 100%;
  height: auto;
}

.snippet {
  margin-top: 18px;
}

.snippet pre {
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 12px;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  word-break: break-all;
}

.snippet-disabled pre {
  opacity: 0.5;
}

button.copy {
  background: var(--accent);
  color: #0d1117;
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

button.copy:hover {
  opacity: 0.9;
}

button.copy:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.note {
  margin-top: 24px;
  font-size: 12px;
  color: var(--muted);
}
