*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-text: #1e293b;
  --color-text-secondary: #475569;
  --color-primary: #0f766e;
  --color-primary-hover: #0d6b63;
  --color-secondary: #e2e8f0;
  --color-border: #cbd5e1;
  --color-accent: #f59e0b;
  --color-danger: #dc2626;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --max-width: 1280px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 700;
  font-size: 1.125rem;
}

.logo svg { flex-shrink: 0; }

.nav-list {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

.nav-list a {
  text-decoration: none;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-list a:hover { color: var(--color-primary); }

/* Main app shell */
.app-shell {
  max-width: var(--max-width);
  margin: 1.5rem auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  flex: 1;
  align-items: start;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
}

/* Panels */
.builder-panel, .output-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.panel-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.subtitle {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* Controls */
.control-group {
  margin-bottom: 1rem;
}

.control-group label, .field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 0.25rem;
}

select, input[type="text"], textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color 0.2s;
}

select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.15);
}

textarea { resize: vertical; font-family: var(--font-mono); font-size: 0.8125rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover { background: var(--color-primary-hover); }

.btn-secondary {
  background: var(--color-secondary);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover { background: #cbd5e1; }

.btn-sm { padding: 0.25rem 0.75rem; font-size: 0.8125rem; }

.btn-danger {
  background: transparent;
  color: var(--color-danger);
  border-color: var(--color-danger);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
}

.btn-danger:hover { background: #fef2f2; }

/* Import section */
.import-section {
  margin-bottom: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: var(--color-bg);
}

.import-section summary {
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--color-primary);
}

.import-body {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Schema meta */
.schema-meta {
  border: none;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.schema-meta legend {
  font-weight: 700;
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
}

/* Properties */
.props-section { margin-top: 0.5rem; }

.props-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.props-header h2 { font-size: 1.0625rem; font-weight: 700; }

.props-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.prop-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  position: relative;
}

@media (max-width: 500px) {
  .prop-card { grid-template-columns: 1fr; }
}

.prop-card .field { display: flex; flex-direction: column; }

.prop-card .field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 0.15rem;
}

.prop-card input, .prop-card select {
  padding: 0.35rem 0.5rem;
  font-size: 0.8125rem;
}

.prop-card .prop-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.prop-actions label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;
  cursor: pointer;
}

/* Output */
.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.output-header h2 { font-size: 1.0625rem; font-weight: 700; }

.output-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.schema-output {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid #334155;
}

.hint {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-top: 0.5rem;
}

/* Support content */
.support-content {
  max-width: var(--max-width);
  margin: 2rem auto;
  padding: 0 1.25rem 2rem;
}

.support-inner {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.support-inner h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--color-primary);
}

.support-inner h3 {
  font-size: 1.0625rem;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.support-inner p, .support-inner li {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.5rem;
}

.support-inner ul {
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
}

.support-inner code {
  background: var(--color-secondary);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.ecosystem-note {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.ecosystem-note a { color: var(--color-primary); font-weight: 500; }

/* Footer */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 1rem 1.25rem;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

.footer-inner a { color: var(--color-primary); text-decoration: none; }

.footer-inner a:hover { text-decoration: underline; }

/* Print */
@media print {
  .site-header, .builder-panel, .support-content, .site-footer, .output-actions, .import-section, #add-prop-btn {
    display: none !important;
  }
  .app-shell { display: block; padding: 0; }
  .output-panel { border: none; box-shadow: none; padding: 0; }
  .schema-output { background: #fff; color: #000; border: 1px solid #ccc; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
