:root {
  --bg: #0e1116;
  --surface: #151a23;
  --text: #e8ecf3;
  --muted: #a4acb9;
  --primary: #6ee7b7;
  --primary-ink: #0b0d10;
  --border: #222937;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .25);
  --container: 1024px;
  --space: clamp(12px, 2.2vw, 22px);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f6f8fc;
  --text: #0f1422;
  --muted: #5b6372;
  --border: #e7eaf0;
  --primary: #0ea5e9;
  --primary-ink: #ffffff;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0e1116;
  --surface: #151a23;
  --text: #e8ecf3;
  --muted: #a4acb9;
  --primary: #6ee7b7;
  --primary-ink: #0b0d10;
  --border: #222937;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --surface: #f6f8fc;
    --text: #0f1422;
    --muted: #5b6372;
    --border: #e7eaf0;
    --primary: #0ea5e9;
    --primary-ink: #ffffff;
    color-scheme: light;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: var(--space);
}

.muted {
  color: var(--muted);
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 .5em;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
}

h2 {
  font-size: clamp(22px, 3vw, 30px);
}

h3 {
  font-size: clamp(18px, 2.5vw, 22px);
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(140%) blur(8px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  padding: 10px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: .2px;
}

.menu {
  list-style: none;
  display: flex;
  gap: 12px;
  margin: 0;
  padding: 0;
}

.menu a {
  padding: .55em .8em;
  border-radius: 12px;
}

.menu a:hover {
  background: var(--surface);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 .75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  line-height: 1;
  margin-left: auto;
}

.theme-toggle .theme-icon {
  font-size: 1rem;
}

#nav-toggle,
.burger {
  display: none;
}

@media (max-width:720px) {
  .menu {
    position: absolute;
    right: var(--space);
    top: 56px;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    display: none;
  }

  #nav-toggle:checked~.menu {
    display: flex;
  }

  .burger {
    display: block;
    cursor: pointer;
    padding: .4em .6em;
    border-radius: 10px;
  }

  .burger:hover {
    background: var(--surface);
  }

  .theme-toggle {
    order: 2;
  }

  .burger {
    order: 3;
  }

  .menu {
    order: 4;
  }
}

.hero {
  padding: clamp(28px, 6vw, 76px) 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(16px, 3vw, 28px);
  box-shadow: var(--shadow);
}

.hero-card {
  text-align: center;
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 10%, transparent), transparent), var(--surface);
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.section {
  padding: clamp(28px, 5vw, 48px) 0;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.btn {
  display: inline-block;
  padding: .65em 1em;
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: transform .06s ease, background .2s ease, box-shadow .2s;
  background: transparent;
  color: var(--text);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-ink);
  border-color: transparent;
  font-weight: 700;
}

.stack>* {
  margin-bottom: 10px;
}

.stack>*:last-child {
  margin-bottom: 0;
}

input[type=text],
input[type=email],
input[type=password],
textarea {
  width: 100%;
  padding: .75em .85em;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
}

#auth-status {
  min-height: 1.6em;
}

#auth-message {
  min-height: 1.6em;
}

#user-dump {
  margin-top: 12px;
  font-size: .9rem;
}

#user-dump summary {
  cursor: pointer;
  color: var(--muted);
}

#user-dump[open] summary {
  color: var(--text);
}

#user-dump pre {
  margin: 10px 0 0;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
  overflow: auto;
  max-height: 200px;
}

.footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  padding: 16px 0;
  text-align: center;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,1px,1px);
  border: 0;
}
