:root {
  --bg: #fafafa;
  --fg: #1a1a1a;
  --border: #ddd;
  --accent: #2563eb;
  --error: #b91c1c;
  --ok: #15803d;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111;
    --fg: #eee;
    --border: #333;
    --accent: #60a5fa;
    --error: #f87171;
    --ok: #4ade80;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

main { max-width: 720px; margin: 0 auto; padding: 2rem 1rem; }
header { display: flex; justify-content: space-between; align-items: center; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
a { color: var(--accent); }

form { display: flex; flex-direction: column; gap: 0.75rem; }
#shorten-form { flex-direction: row; }
#shorten-form input { flex: 1; }
label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; }

input {
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
}

button {
  padding: 0.6rem 1rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button.link { background: none; color: var(--accent); padding: 0; text-decoration: underline; }

.row { display: flex; gap: 0.5rem; }
.list-header { display: flex; justify-content: space-between; align-items: center; }
#result { margin-top: 1rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; table-layout: fixed; }
th, td {
  text-align: left;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
th:last-child, td:last-child { width: 4.5rem; text-align: right; }

#message { padding: 0.6rem 0.8rem; border: 1px solid var(--ok); border-radius: 6px; color: var(--ok); }
#message.error { border-color: var(--error); color: var(--error); }

[hidden] { display: none !important; }