/* superpfeif components — built on the tokens in tokens.css. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-body);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom));
}

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

/* ---- Top bar ---------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  color: var(--nav-text);
  padding: 0.75rem 1rem;
  padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.topbar .brand {
  font-weight: 800;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.topbar .online-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); display: inline-block;
  box-shadow: 0 0 0 3px rgba(88, 204, 2, 0.25);
}

/* ---- Layout ----------------------------------------------------------- */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}
.page-title {
  font-weight: 800;
  font-size: 1.6rem;
  margin: 0.25rem 0 1.25rem;
}

/* ---- Cards ------------------------------------------------------------ */
.card {
  background: var(--bg-card);
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: 1.25rem;
}

/* ---- Site tiles ------------------------------------------------------- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: 1.5rem 1rem;
  min-height: 130px;
  color: var(--text);
  font-weight: 700;
  transition: transform var(--bounce-duration) var(--bounce-easing),
    box-shadow 0.15s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-soft); }
.tile:active { transform: translateY(0); }
.tile .icon { font-size: 2.4rem; line-height: 1; }
.tile .label { font-size: 1rem; }

/* ---- Buttons (chunky 3D, Duolingo press-in) --------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-min);
  padding: 0.65rem 1.25rem;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  background: var(--green);
  border: none;
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-raised);
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.1s ease;
  width: 100%;
}
.btn:hover { filter: brightness(1.03); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--green-edge); }
.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
  box-shadow: 0 4px 0 var(--border-soft);
}
.btn-danger { background: var(--red); box-shadow: 0 4px 0 var(--red-edge); }
.btn-ghost {
  background: transparent; color: var(--nav-text);
  box-shadow: none; width: auto; min-height: auto; padding: 0.4rem 0.6rem;
}

/* ---- Forms ------------------------------------------------------------ */
.field { margin-bottom: 1rem; }
.field label {
  display: block; font-weight: 700; margin-bottom: 0.35rem; font-size: 0.95rem;
}
.field input {
  width: 100%;
  min-height: var(--touch-min);
  font-size: 16px;            /* prevents iOS zoom on focus */
  padding: 0.6rem 0.8rem;
  background: var(--bg-input);
  color: var(--text);
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-control);
}
.field input:focus { outline: none; border-color: var(--blue); }

/* ---- Auth screens ----------------------------------------------------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.auth-card { width: 100%; max-width: 380px; }
.auth-logo {
  text-align: center; font-size: 2.5rem; margin-bottom: 0.5rem;
}
.auth-title { text-align: center; font-weight: 800; margin: 0 0 1.25rem; }
.auth-alt { text-align: center; margin-top: 1rem; font-size: 0.9rem; }

/* ---- Flash messages --------------------------------------------------- */
.flashes { margin-bottom: 1rem; }
.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-control);
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.flash-success { background: rgba(88, 204, 2, 0.15); color: var(--green); }
.flash-danger { background: rgba(255, 75, 75, 0.15); color: var(--red); }
.flash-warning { background: rgba(255, 200, 0, 0.18); color: var(--gold); }

/* ---- Bottom navigation (mobile) -------------------------------------- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--bottom-nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-card);
  border-top: 2px solid var(--border-soft);
  display: flex;
  z-index: 90;
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}
.bottom-nav a.active { color: var(--green); }
.bottom-nav .ico { font-size: 1.4rem; }

@media (min-width: 992px) {
  .bottom-nav { display: none; }
  body { padding-bottom: 2rem; }
}

/* ---- Theme toggle ----------------------------------------------------- */
.theme-toggle {
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: var(--nav-text);
  border-radius: 999px;
  width: 40px; height: 40px;
  font-size: 1.1rem;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
