:root {
  --bg: #f6f5f1;
  --bg-dot: #e4e1d8;
  --card: #ffffff;
  --text: #1c1b18;
  --muted: #6b675e;
  --border: #e6e3da;
  --accent: #c2410c;
  --gh-bg: #1f2328;
  --gh-text: #ffffff;
  --gh-hover: #32383f;
  --alert-bg: #fdf0ec;
  --alert-text: #9a3412;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.06);
  --radius: 16px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --bg-dot: #262522;
    --card: #1b1a18;
    --text: #f2f0eb;
    --muted: #a19c91;
    --border: #2e2c28;
    --accent: #fb923c;
    --gh-bg: #f2f0eb;
    --gh-text: #1f2328;
    --gh-hover: #ffffff;
    --alert-bg: #2a1a12;
    --alert-text: #fdba74;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dot) 1px, transparent 1px);
  background-size: 20px 20px;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 26px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 600; }

.muted { color: var(--muted); margin: 0; }

.logo { width: 24px; height: 24px; fill: var(--accent); flex: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  letter-spacing: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Login and thanks */

.center {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login {
  width: 100%;
  max-width: 380px;
  padding: 36px 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login .brand { margin-bottom: 20px; }
.login .btn { margin-top: 16px; }

.alert {
  margin: 4px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--alert-bg);
  color: var(--alert-text);
  font-size: 14px;
}

.fine {
  margin: 4px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.05s;
}

.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }

.btn-github { background: var(--gh-bg); color: var(--gh-text); }
.btn-github:hover { background: var(--gh-hover); }

.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); }

.btn-small { height: 32px; padding: 0 12px; font-size: 14px; }

/* Admin page */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.who { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.who form { margin: 0 0 0 4px; }

.avatar { border-radius: 50%; border: 1px solid var(--border); }

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.empty {
  padding: 56px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.empty .logo { width: 40px; height: 40px; margin-bottom: 8px; opacity: 0.85; }

.setting {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.setting h2 { margin-bottom: 4px; }
.setting form { margin: 0; flex-shrink: 0; }

code {
  margin-top: 8px;
  font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
}

/* Sites */

.list { padding: 4px 0; }

.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.site:first-child { border-top: 0; }

.site-info { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.site-path { color: var(--text); font-weight: 600; text-decoration: none; }
.site-path:hover { color: var(--accent); }
.small { font-size: 13px; }

.badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}

.badge-public { color: var(--accent); border-color: var(--accent); }

.site-actions { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 6px; }
.site-actions form { margin: 0; }

.delete summary, .inline-form summary { list-style: none; }
.delete summary::-webkit-details-marker, .inline-form summary::-webkit-details-marker { display: none; }
.delete[open] summary, .inline-form[open] summary { background: var(--bg); }

.delete form, .inline-form form {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.delete input, .inline-form input {
  display: block;
  margin-top: 4px;
  height: 32px;
  padding: 0 10px;
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.btn-danger { background: var(--alert-text); color: #fff; }
.btn-danger:hover { opacity: 0.9; }

/* CLI approval */

.cli form { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.cli .btn { width: 100%; }
.cli form .btn { margin-top: 8px; }

.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }

.code-input {
  height: 52px;
  padding: 0 14px;
  font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 22px;
  letter-spacing: 0.15em;
  text-align: center;
  text-transform: uppercase;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.text-input {
  height: 40px;
  padding: 0 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.text-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.code-input::placeholder { color: var(--muted); opacity: 0.5; }
.code-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.code-show {
  font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-align: center;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.cli .choice .btn { margin-top: 0; }

.done-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--accent);
}
