:root {
  --bg: #fafafc;
  --surface: #ffffff;
  --text: #1c1c28;
  --text-muted: #6b6b80;
  --accent: #059669;
  --border: #e5e5ec;
  --flash-bg: #eeedfc;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f17;
    --surface: #1a1a26;
    --text: #e8e8f0;
    --text-muted: #9494ac;
    --accent: #34d399;
    --border: #2a2a3a;
    --flash-bg: #211e3d;
  }
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1 {
  font-size: 1.5rem;
  margin: 0;
}

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  row-gap: 0.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.nav-user {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.nav-user span {
  overflow-wrap: anywhere;
}

.content > header h1 {
  margin-bottom: 1.5rem;
}

.flash {
  background: var(--flash-bg);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.button,
button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.button:hover,
button:hover {
  opacity: 0.9;
}

.signin {
  text-align: center;
  margin-top: 3rem;
}

.block-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.block-form input[type=text] {
  flex: 1 1 200px;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
}

.blocklist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.blocklist li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.blocklist li span {
  overflow-wrap: anywhere;
}

.blocklist li form {
  margin: 0;
}

.empty {
  color: var(--text-muted);
  font-size: 0.95rem;
}

section {
  margin-bottom: 2.5rem;
}

section h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-on {
  background: var(--flash-bg);
  color: var(--accent);
}

.badge-off {
  background: var(--border);
  color: var(--text-muted);
}

.catch-all {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.forward-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.forward-form input[type=text] {
  flex: 1 1 160px;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
}

.forward-form button {
  flex: 1 1 auto;
}

.forward-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}

.forward-row span {
  overflow-wrap: anywhere;
}

.forward-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.edit-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1 1 100%;
}

.edit-form input[type=text] {
  flex: 1 1 160px;
  min-width: 0;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
}

@media (max-width: 480px) {
  .block-form,
  .forward-form,
  .edit-form {
    flex-direction: column;
  }

  .block-form input[type=text],
  .forward-form input[type=text],
  .edit-form input[type=text],
  .block-form button,
  .forward-form button,
  .edit-form button {
    flex: none;
    width: 100%;
  }

  .catch-all {
    flex-direction: column;
    align-items: stretch;
  }

  .catch-all form button {
    width: 100%;
  }
}
