body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
  transition: background 0.25s ease, color 0.25s ease;
}
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
h1 { font-size: 1.65rem; margin: 0.4em 0; line-height: 1.25; font-weight: 900; }
h2 { font-size: 1.3rem; margin: 0.8em 0 0.4em; line-height: 1.3; font-weight: 800; }
h3 { font-size: 1.1rem; margin: 0.6em 0 0.4em; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 1rem; }
.center-text { text-align: center; }

.screen { max-width: 780px; margin: 0 auto; padding-block: 12px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.screen.center { text-align: center; display: flex; flex-direction: column; align-items: center; }
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  border: 2px solid var(--line);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.row { display: flex; gap: 10px; justify-content: center; margin: 14px 0; }
.row.wrap { flex-wrap: wrap; justify-content: flex-start; }

/* 3D Tactile Buttons */
.btn {
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-weight: 800;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 0 var(--line-dark);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
  user-select: none;
}
.btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--line-dark);
}
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent-dark);
  box-shadow: 0 4px 0 var(--accent-dark);
}
.btn.primary:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--accent-dark);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.btn.ghost:hover {
  background: var(--accent-soft);
  border-color: var(--line);
}
.btn.ghost:active {
  transform: translateY(1px);
}
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; box-shadow: 0 4px 0 var(--bad-soft); }
.btn.small { padding: 6px 14px; min-height: 38px; font-size: 1rem; border-radius: 999px; }
.btn.wide { width: 100%; margin-top: 16px; font-size: 1.15rem; min-height: 54px; }
.link { background: none; border: none; color: var(--muted); text-decoration: underline; margin-top: 24px; padding: 10px; }

/* Topbar Enhancements */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.who {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 4px 16px 4px 4px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 3px 0 var(--line-dark);
  transition: all 0.15s ease;
}
.who:hover { border-color: var(--accent); background: var(--surface-2); }
.who:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line-dark); }
.chips { display: flex; gap: 6px; }
.chip {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 800;
  white-space: nowrap;
  font-size: 1rem;
  box-shadow: 0 2px 0 var(--line-dark);
}
.chip.streak-chip {
  background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
  border-color: #FDBA74;
  color: #C2410C;
}
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); font-size: 22px; }
.avatar.big { width: 72px; height: 72px; font-size: 44px; }

/* Auth Buttons */
.auth-btn { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 1rem; padding: 5px 12px; min-height: 36px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); cursor: pointer; transition: all 0.15s; white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.auth-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.auth-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.auth-name { font-weight: 800; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-logout { border: none; background: transparent; color: var(--muted); font-size: 1rem; padding: 2px 4px; cursor: pointer; text-decoration: underline; margin-left: 2px; }
.auth-logout:hover { color: #e53e3e; }
