:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #fff;
  --text: #111;
  --muted: #333;
  --faint: #666;
  --fainter: #888;
  --day: #999;
  --rule: #ddd;
  --input-border: #ccc;
  --error: #8a1f1f;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111;
  --text: #eee;
  --muted: #ccc;
  --faint: #aaa;
  --fainter: #888;
  --day: #777;
  --rule: #333;
  --input-border: #555;
  --error: #e8a0a0;
}

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

body {
  font-family: Georgia, serif;
  max-width: 40rem;
  margin: 2rem auto;
  padding: 0 1rem 3rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

h1 {
  font-weight: 400;
  font-size: 1.75rem;
  margin: 0 0 0.75rem;
}

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

a.home:hover {
  text-decoration: underline;
}

.rules {
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 2.5rem;
}

.next,
.remaining {
  font-family: system-ui, sans-serif;
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.pay-btn {
  margin: 0.75rem 0 0.25rem;
}

.button {
  font-family: system-ui, sans-serif;
  display: inline-block;
  color: var(--text);
  background: var(--bg);
  text-decoration: none;
  border: 1px solid var(--text);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font-size: 1rem;
}

.button:hover,
.button:focus-visible {
  background: var(--text);
  color: var(--bg);
}

.bulk {
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.4rem 0 0.9rem;
}

.key-form {
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.6rem;
  margin: 0 0 0.5rem;
}

.key-form label {
  margin: 0;
}

.key-form input {
  font-family: Georgia, serif;
  font-size: 1rem;
  width: 9ch;
  box-sizing: content-box;
  padding: 0.35rem 0.4rem;
  border: 1px solid var(--input-border);
  color: var(--text);
  background: var(--bg);
  letter-spacing: 0.08em;
}

.key-form .button {
  margin: 0;
}

#handle,
#line {
  font-family: Georgia, serif;
  font-size: 1rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.35rem 0.4rem;
  border: 1px solid var(--input-border);
  color: var(--text);
  background: var(--bg);
}

.wall {
  margin: 1.5rem 0 0;
}

.line {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  column-gap: 0.75rem;
  margin: 0.6rem 0;
  scroll-margin-top: 1rem;
}

.num {
  color: var(--fainter);
  font-variant-numeric: tabular-nums;
  text-align: right;
  text-decoration: none;
}

.num:hover {
  color: var(--text);
}

.body {
  min-height: 1.5em;
}

.handle {
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  color: var(--faint);
  margin-left: 0.5rem;
}

.day {
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--day);
  text-align: center;
  margin: 1.5rem 0;
}

#write-form {
  font-family: system-ui, sans-serif;
  border-top: 1px solid var(--rule);
  margin-top: 2rem;
  padding-top: 1rem;
}

#write-form label {
  display: block;
  margin: 0.6rem 0 0.25rem;
}

#line {
  min-height: 4.5rem;
  resize: vertical;
}

.count {
  font-size: 0.8rem;
  color: var(--faint);
  margin: 0.2rem 0 0;
}

.error {
  color: var(--error);
  font-size: 0.9rem;
}

.share-card {
  font-family: Georgia, serif;
  border: 1px solid var(--rule);
  padding: 1rem 1.1rem;
  margin: 1.5rem 0 0;
}

.share-line {
  margin: 0.35rem 0;
}

.share-mine {
  margin: 0.5rem 0;
}

.share-empty {
  color: var(--faint);
}

.share-url {
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  color: var(--faint);
  margin: 0.9rem 0 0;
}

footer {
  font-family: system-ui, sans-serif;
  font-size: 0.75rem;
  color: var(--fainter);
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding-top: 1rem;
}

.socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 1.1rem;
  margin: 0 0 0.85rem;
}

.socials a {
  color: var(--fainter);
  text-decoration: none;
}

.socials a:hover,
.socials a:focus-visible {
  color: var(--text);
  text-decoration: underline;
}

.copy {
  text-align: center;
  margin: 0 0 0.5rem;
}

.footer-meta {
  text-align: center;
  margin: 0;
}

.footer-meta a,
.theme-toggle {
  color: var(--fainter);
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}

.footer-meta a:hover,
.theme-toggle:hover,
.footer-meta a:focus-visible,
.theme-toggle:focus-visible {
  color: var(--text);
  text-decoration: underline;
}

a {
  color: var(--text);
}
