/* Reset & base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  text-align: center;
  padding: 1.75rem 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

header .subtitle {
  margin-top: 0.25rem;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 500;
}

/* Main */
main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

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

label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  background: #fafafa;
  color: var(--text);
  transition: border-color 0.15s ease;
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

textarea[readonly] {
  background: #f8fafc;
  color: #334155;
}

.meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: -0.35rem;
}

/* Buttons */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.25rem 0;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.15s ease;
  background: var(--primary);
  color: #fff;
}

button:hover:not(:disabled) {
  background: var(--primary-hover);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.secondary {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
}

button.secondary:hover:not(:disabled) {
  background: #eff6ff;
}

/* Message */
.message {
  min-height: 1.4em;
  font-size: 0.9rem;
  color: var(--muted);
}

.message.success {
  color: #15803d;
}

.message.error {
  color: #b91c1c;
}

/* Footer */
footer {
  text-align: center;
  padding: 1.25rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted);
}

/* Responsive */
@media (max-width: 480px) {
  header h1 {
    font-size: 1.5rem;
  }

  main {
    padding: 1.25rem 0.875rem 1.75rem;
  }

  button {
    width: 100%;
  }

  .actions {
    flex-direction: column;
  }
}

@media (min-width: 768px) {
  header {
    padding: 2rem 1rem 1.5rem;
  }

  header h1 {
    font-size: 2rem;
  }

  main {
    padding: 2rem 1.5rem 2.5rem;
  }
}