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

:root {
  --bg: #f9f9f7;
  --surface: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 0 16px;
}

header {
  text-align: center;
  padding: 48px 0 32px;
}

header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--primary);
}

.tagline {
  color: var(--muted);
  margin-top: 8px;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 80px;
}

.form-section, .output-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 24px;
}

.field {
  margin-bottom: 20px;
}

.url-loader {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.url-loader input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.url-loader button {
  padding: 10px 18px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

.url-loader button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 6px;
}

input[type="text"], textarea, select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
}

textarea { resize: vertical; }

button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

button:hover { background: var(--primary-hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.output-section h2 { font-size: 1.25rem; margin-bottom: 16px; }

#anschreiben-output {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--bg);
}

.output-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.output-actions button { width: auto; flex: 1; }

.usage-info {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 16px;
  text-align: center;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-box {
  background: var(--surface);
  border-radius: 12px;
  padding: 40px;
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.modal-box h2 { font-size: 1.25rem; margin-bottom: 12px; }
.modal-box p { color: var(--muted); margin-bottom: 24px; }
.modal-box button { margin-bottom: 8px; }

.token-unlock {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.token-unlock p { margin-bottom: 10px; font-size: 0.875rem; }
.token-unlock input { margin-bottom: 10px; }
.token-unlock button { background: #6b7280; }
.token-unlock button:hover { background: #4b5563; }

.pro-badge {
  font-size: 0.7rem;
  background: #fbbf24;
  color: #78350f;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 700;
  margin-left: 8px;
  vertical-align: middle;
}

.hidden { display: none !important; }

@media print {
  header, .form-section, .output-actions, .modal { display: none !important; }
  .output-section { border: none; padding: 0; }
  #anschreiben-output { border: none; padding: 0; font-size: 12pt; }
}