/* Fungate's pages: the login form, the launcher, the password form and the
   "no access" page. Light and dark follow the system. No inline styles
   anywhere (the CSP forbids them); the apps' colours are in /apps.css. */

:root {
  --bg: #f6f5f8;
  --surface: #ffffff;
  --text: #1c1b22;
  --muted: #6b6878;
  --border: #e3e1ea;
  --accent: #e11d48;
  --accent-hover: #be123c;
  --accent-fg: #ffffff;
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
  --error-bg: #fef2f2;
  --error-fg: #991b1b;
  --ok-bg: #f0fdf4;
  --ok-fg: #166534;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.06);
  --radius: 14px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121117;
    --surface: #1c1b23;
    --text: #ecebf2;
    --muted: #a09cb0;
    --border: #2e2c38;
    --accent: #fb7185;
    --accent-hover: #fda4af;
    --accent-fg: #1c1b22;
    --error-bg: #3b1219;
    --error-fg: #fecdd3;
    --ok-bg: #0f2e1c;
    --ok-fg: #bbf7d0;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font:
    16px/1.5 system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    Arial,
    sans-serif;
}

body.centered {
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

a {
  color: var(--accent);
}

h1 {
  font-size: 1.35rem;
  line-height: 1.3;
  margin: 0 0 12px;
}

p {
  margin: 0 0 12px;
}

/* The brand */

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.brand img {
  display: block;
  border-radius: 11px;
}

.brand-name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.brand-link .brand {
  margin: 0;
}

.brand-link .brand img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
}

.brand-link .brand-name {
  font-size: 1.2rem;
}

/* Cards and forms */

.card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.card.narrow {
  max-width: 400px;
}

.lead {
  font-size: 1.05rem;
  color: var(--muted);
}

.muted,
.hint {
  color: var(--muted);
}

.hint {
  font-size: 0.875rem;
  margin: -4px 0 4px;
}

.form {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

input {
  font: inherit;
  font-weight: 400;
  width: 100%;
  padding: 10px 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  border-color: var(--muted);
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.button:focus-visible,
.linklike:focus-visible,
.app:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

.actions.stacked {
  flex-direction: column;
  margin-top: 16px;
}

.alert {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.95rem;
}

.alert-error {
  background: var(--error-bg);
  color: var(--error-fg);
}

.alert-ok {
  background: var(--ok-bg);
  color: var(--ok-fg);
}

/* The launcher */

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

.account {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 0.925rem;
}

.who {
  color: var(--muted);
}

.who strong {
  color: var(--text);
}

.account form {
  margin: 0;
}

.linklike {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
  border-radius: 4px;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.apps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.app {
  --app-accent: var(--accent);
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--app-accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition:
    transform 0.12s ease,
    border-color 0.12s ease;
}

.app:hover {
  transform: translateY(-2px);
  border-color: var(--app-accent);
}

.tile {
  flex: none;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--app-accent);
  color: #ffffff;
  font-size: 1.6rem;
  font-weight: 700;
}

img.tile {
  object-fit: cover;
}

.app-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.app-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.app-desc {
  color: var(--muted);
  font-size: 0.925rem;
}

.app-host {
  color: var(--muted);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty {
  padding: 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

@media (max-width: 520px) {
  .card {
    padding: 22px 18px;
  }

  .topbar {
    padding: 12px 16px;
  }

  .wrap {
    padding: 24px 16px 40px;
  }

  .apps {
    grid-template-columns: 1fr;
  }
}
