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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  color: #1e293b;
  background: #f8fafc;
}

.header {
  background: #1e293b;
  color: #fff;
  padding: 12px 24px;
  flex-shrink: 0;
}

.header h1 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.header-tagline {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

.footer {
  background: #1e293b;
  color: #94a3b8;
  padding: 10px 24px;
  font-size: 12px;
  text-align: center;
  flex-shrink: 0;
}

.footer a {
  color: #fff;
  text-decoration: none;
}

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

.panels {
  display: flex;
  flex: 1;
  min-height: 0;
}

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.panel-input {
  background: #f8fafc;
  border-right: 2px solid #e2e8f0;
}

.panel-output {
  background: #f0fdf4;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.panel-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.editor {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.7;
  outline: none;
}

.editor:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  font-style: italic;
  pointer-events: none;
}

.editor.output {
  cursor: default;
}

.placeholder-text {
  color: #94a3b8;
  font-style: italic;
}

/* Clean output typography */
.editor.output h2 { font-size: 1.5em; margin: 0.8em 0 0.4em; font-weight: 700; }
.editor.output h3 { font-size: 1.25em; margin: 0.7em 0 0.35em; font-weight: 600; }
.editor.output h4 { font-size: 1.1em; margin: 0.6em 0 0.3em; font-weight: 600; }
.editor.output p { margin: 0.5em 0; }
.editor.output ul, .editor.output ol { margin: 0.5em 0; padding-left: 1.5em; }
.editor.output li { margin: 0.2em 0; }
.editor.output blockquote {
  border-left: 3px solid #94a3b8;
  padding-left: 16px;
  margin: 0.6em 0;
  color: #475569;
}
.editor.output table {
  border-collapse: collapse;
  margin: 0.6em 0;
  width: 100%;
}
.editor.output th, .editor.output td {
  border: 1px solid #cbd5e1;
  padding: 8px 12px;
  text-align: left;
}
.editor.output th {
  background: #f1f5f9;
  font-weight: 600;
}
.editor.output a {
  color: #2563eb;
  text-decoration: underline;
}

.panel-header-actions {
  display: flex;
  gap: 8px;
}

/* Debug panel */
.debug-area {
  flex: 1;
  padding: 16px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.5;
  font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
  background: #1e293b;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

/* Buttons */
.btn {
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}

.btn-clear {
  background: #fff;
  color: #64748b;
}
.btn-clear:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.btn-copy {
  background: #1e293b;
  color: #fff;
  border-color: #1e293b;
}
.btn-copy:hover {
  background: #334155;
}
.btn-copy.copied {
  background: #16a34a;
  border-color: #16a34a;
}

/* Responsive */
@media (max-width: 768px) {
  .panels {
    flex-direction: column;
  }
  .panel-input {
    border-right: none;
    border-bottom: 2px solid #e2e8f0;
  }
  .panel {
    min-height: 40vh;
  }
}
