:root {
  --bg: #f6f5f1;
  --fg: #1b1b1a;
  --muted: #6b6a65;
  --line: #d9d7cf;
  --accent: #1b1b1a;
  --accent-fg: #f6f5f1;
  --error: #b3261e;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --fg: #ecebe6;
    --muted: #9a9993;
    --line: #34332f;
    --accent: #ecebe6;
    --accent-fg: #161615;
    --error: #f2857d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

main {
  flex: 1;
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  padding: 3rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

section { display: flex; flex-direction: column; gap: 1rem; }
section[hidden] { display: none; }

h1 { margin: 0; font-size: 1.75rem; letter-spacing: -0.02em; }
.lede { margin: 0; color: var(--muted); }
.hint { margin: 0; color: var(--muted); font-size: 0.875rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.button[hidden] { display: none; }
.button:hover { border-color: var(--fg); }
.button:focus-within, .button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.button input { position: absolute; width: 1px; height: 1px; opacity: 0; }

#pastebox { cursor: text; caret-color: transparent; }
#pastebox:empty::before { content: attr(data-placeholder); color: var(--muted); }

#error { margin: 0; color: var(--error); }

.toggle { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.toggle input { width: 1.125rem; height: 1.125rem; margin: 0; accent-color: var(--accent); }

#code {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 0.75rem;
  overflow: hidden;
}
#code svg { display: block; width: 100%; height: 100%; }

#contents {
  color: inherit;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

footer {
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8125rem;
}
