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

:root {
  --bg: #fff; --fg: #1a1a1a; --muted: #737373;
  --border: #e5e5e5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171717; --fg: #fafafa; --muted: #a3a3a3;
    --border: rgba(255, 255, 255, 0.1);
  }
}

html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--fg);
  display: flex; flex-direction: column;
  max-width: 56rem; margin: 0 auto;
  padding: 8px;
}

a { color: inherit; text-decoration: none; }
a:hover { opacity: 0.7; }

/* Footer */
footer { padding-top: 8px; }
footer ul {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 16px; list-style: none;
  font: 0.75rem/1.5 system-ui, -apple-system, sans-serif;
  color: var(--muted);
}
footer a:hover { color: var(--fg); opacity: 1; }

/* App: Preview */
.preview {
  flex: 1; overflow: hidden;
  border: 1px solid var(--border); border-bottom: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.preview img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
}
.preview img:not([src]), .preview img[src=""] {
  display: none;
}

/* App: Input Group */
.input-group {
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
}
.input-group textarea {
  flex: 1; border: none; background: transparent;
  color: var(--fg); padding: 12px;
  font: 0.875rem/1.5 system-ui, -apple-system, sans-serif;
  resize: none; outline: none; min-height: 72px;
}
.input-group textarea::placeholder { color: var(--muted); }
.input-actions {
  display: flex; align-items: center; gap: 8px;
  padding: 12px;
}

/* App: Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  width: 32px;
  padding: 0;
  font-size: 0.875rem;
  font-family: inherit;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
}
.btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.btn:hover:not(:disabled) { background: var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { 
  background: var(--fg); 
  color: var(--bg);
  border-color: var(--fg);
  margin-left: auto;
}
.btn-primary:hover:not(:disabled) { opacity: 0.9; background: var(--fg); }

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* App: Utilities */
.hidden { display: none !important; }

/* App: Toast */
.toast {
  position: fixed; bottom: 16px; right: 16px;
  background: #ef4444; color: white;
  padding: 12px 16px; font-size: 0.75rem;
  border-radius: 4px;
  max-width: 300px; z-index: 100;
  animation: slideUp 0.2s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); opacity: 0; } }

/* Content Pages (Privacy, Terms) */
.content {
  flex: 1; overflow-y: auto; line-height: 1.6;
}
.content h1 {
  font-size: 1.5rem; font-weight: 600;
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px; margin-bottom: 16px;
}
.content h2 {
  font-size: 1.25rem; font-weight: 600;
  margin-top: 32px; border-bottom: 1px solid var(--border);
  padding-bottom: 8px; margin-bottom: 12px;
}
.content h3 {
  font-size: 1.125rem; font-weight: 600;
  margin-top: 20px; margin-bottom: 8px;
}
.content h4 {
  font-size: 1rem; font-weight: 600;
  margin-top: 16px; margin-bottom: 8px;
}
.content p { margin-bottom: 12px; }
.content ul {
  list-style: disc; margin-left: 24px; margin-bottom: 12px;
}
.content li { margin-bottom: 8px; }
.content a { text-decoration: underline; }
.content a:hover { opacity: 0.7; }
