:root {
  --bg-color: #f8f9fa;
  --surface-color: #ffffff;
  --text-main: #212529;
  --text-muted: #6c757d;
  --border-color: #dee2e6;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --secondary-bg: #e2e8f0;
  --secondary-hover: #cbd5e1;
  --radius: 8px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header {
  background: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--primary);
}

.site-header nav a {
  margin-left: 1rem;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.hero {
  padding: 3rem 0 2rem;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.hero h1 {
  margin-top: 0;
  font-size: 2.5rem;
  letter-spacing: -0.05em;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.workspace {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 1.5rem;
  margin-bottom: 4rem;
  align-items: start;
}

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

.panel {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.panel h2 {
  margin-top: 0;
  font-size: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.help-text {
  font-size: 0.85rem;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.char-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.char-row input, .char-row select {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
}

.char-row input { flex: 1.5; }
.char-row select { flex: 1; }

.btn.remove-char {
  background: none;
  border: none;
  color: #dc3545;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0 0.5rem;
}

.action-row {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.action-row label {
  font-size: 0.9rem;
  font-weight: 600;
}

.action-row select {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-bottom: 1rem;
}

.btn {
  padding: 0.6rem 1rem;
  border-radius: 4px;
  border: 1px solid transparent;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

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

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

.btn.secondary {
  background: var(--secondary-bg);
  color: var(--text-main);
  border-color: var(--border-color);
  width: 100%;
}

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

.btn.tertiary {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-muted);
}

.btn.tertiary:hover {
  background: var(--secondary-bg);
  color: var(--text-main);
}

.btn.small {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
}

.hidden { display: none !important; }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  font-style: italic;
}

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

.matrix-header h2 {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.matrix-grid-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  border: 1px solid var(--border-color);
  padding: 0.75rem;
  vertical-align: top;
}

th {
  background: var(--bg-color);
  font-weight: 600;
  text-align: left;
  width: 20%;
}

td {
  min-width: 150px;
  background: #fff;
}

th.row-header {
  background: var(--bg-color);
}

.self-cell {
  background: #f1f5f9;
  color: #94a3b8;
  text-align: center;
  vertical-align: middle;
}

.content-guide {
  margin-bottom: 4rem;
  background: var(--surface-color);
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 1.5rem;
}

.guide-grid h3 {
  margin-top: 0;
  font-size: 1.1rem;
  color: var(--primary);
}

.guide-grid p, .guide-grid ul {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.guide-grid ul {
  padding-left: 1.2rem;
}

.site-footer {
  text-align: center;
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer nav a {
  color: var(--text-muted);
  text-decoration: none;
  margin: 0 0.5rem;
}

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

@media print {
  .site-header, .hero, .controls-panel, .content-guide, .site-footer, .matrix-actions {
    display: none !important;
  }
  .workspace {
    display: block;
  }
  .panel {
    border: none;
    box-shadow: none;
    padding: 0;
  }
  table { border: 2px solid #000; }
  th, td { border: 1px solid #000; }
}


/* 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;
}
