/* Boate Games — tema neon.
   Regra que guia este ficheiro: o brilho é barato quando é estático e caro
   quando é animado. Nada aqui anima em permanência, nada usa backdrop-filter
   numa lista, e os efeitos de hover mexem só em transform e box-shadow, que a
   GPU resolve sem repintar a página. */

:root {
  --bg: #06060c;
  --bg-2: #0b0b16;
  --panel: #10101f;
  --line: #1e1e33;
  --line-2: #2a2a45;
  --text: #e9e9f6;
  --dim: #8b8bab;
  --dim-2: #5f5f7d;
  --neon: #00e5ff;
  --neon-2: #ff2ec4;
  --neon-3: #a855f7;
  --ok: #34e07a;
  --warn: #ffb020;
  --bad: #ff4d6a;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  /* Duas manchas de cor fixas no fundo. `fixed` evita repintar no scroll. */
  background-image:
    radial-gradient(60rem 40rem at 15% -10%, rgba(0, 229, 255, 0.07), transparent 60%),
    radial-gradient(50rem 35rem at 90% 0%, rgba(255, 46, 196, 0.06), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: var(--neon); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--neon);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ login */

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 2rem 1.75rem 1.75rem;
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.06), 0 24px 60px rgba(0, 0, 0, 0.6);
}

.neon-title {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
  background: linear-gradient(92deg, var(--neon), var(--neon-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 28px rgba(0, 229, 255, 0.28);
}

.login-sub {
  margin: 0.35rem 0 1.5rem;
  text-align: center;
  color: var(--dim);
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-card label {
  display: block;
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  color: var(--dim);
  letter-spacing: 0.04em;
}

.login-card input {
  width: 100%;
  margin-bottom: 1.1rem;
  padding: 0.7rem 0.85rem;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-card input:focus {
  outline: none;
  border-color: var(--neon);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.14);
}

.login-card button {
  width: 100%;
  padding: 0.75rem;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(92deg, var(--neon), var(--neon-3));
  color: #04040a;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: filter 0.15s, box-shadow 0.15s;
}

.login-card button:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.3);
}

.login-error {
  margin: 0 0 1rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  background: rgba(255, 77, 106, 0.12);
  border: 1px solid rgba(255, 77, 106, 0.35);
  color: #ffb3c0;
  font-size: 0.85rem;
}

/* ----------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 1.1rem;
  background: rgba(6, 6, 12, 0.92);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  background: linear-gradient(92deg, var(--neon), var(--neon-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}

.search {
  flex: 1;
  min-width: 90px;
  max-width: 420px;
  padding: 0.5rem 0.8rem;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search:focus {
  outline: none;
  border-color: var(--neon);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.12);
}

.sort {
  padding: 0.5rem 0.6rem;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  cursor: pointer;
}

.topbar .spacer { flex: 1; }

.btn {
  padding: 0.45rem 0.85rem;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.btn:hover { border-color: var(--neon); color: var(--neon); }

.btn-primary {
  border: 0;
  background: linear-gradient(92deg, var(--neon), var(--neon-3));
  color: #04040a;
  font-weight: 700;
}

.btn-primary:hover { filter: brightness(1.1); color: #04040a; }

.btn-danger { border-color: rgba(255, 77, 106, 0.4); color: #ff9aab; }
.btn-danger:hover { border-color: var(--bad); color: var(--bad); }

.btn-sm { padding: 0.28rem 0.55rem; font-size: 0.8rem; }

.count {
  color: var(--dim);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ grelha */

main { padding: 1.1rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 1.1rem 0.95rem;
  max-width: 1900px;
  margin: 0 auto;
}

.card {
  /* Fora do ecrã o browser pode saltar o layout deste cartão por completo.
     Com centenas de jogos é a diferença entre scroll fluido e scroll aos saltos. */
  content-visibility: auto;
  contain-intrinsic-size: auto 290px;
  cursor: pointer;
  border: 0;
  padding: 0;
  background: none;
  text-align: left;
  color: inherit;
  font: inherit;
}

.card-art {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  will-change: transform;
}

.card:hover .card-art,
.card:focus-visible .card-art {
  transform: translateY(-4px);
  border-color: rgba(0, 229, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.25), 0 10px 34px rgba(0, 229, 255, 0.16);
}

.card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-art .noart {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--dim-2);
  font-size: 0.75rem;
  padding: 0.5rem;
  text-align: center;
  background: linear-gradient(160deg, #14142a, #0b0b16);
}

.badge-size {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 0.15rem 0.42rem;
  border-radius: 6px;
  background: rgba(4, 4, 10, 0.82);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: var(--neon);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.badge-hidden {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 0.15rem 0.42rem;
  border-radius: 6px;
  background: rgba(4, 4, 10, 0.82);
  border: 1px solid rgba(255, 176, 32, 0.45);
  color: var(--warn);
  font-size: 0.7rem;
}

.card-title {
  margin: 0.45rem 0 0.1rem;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  color: var(--dim);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty {
  grid-column: 1 / -1;
  padding: 4rem 1rem;
  text-align: center;
  color: var(--dim);
}

.empty code {
  font-family: var(--mono);
  color: var(--neon);
  background: var(--panel);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}

/* ------------------------------------------------------------------ modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: rgba(3, 3, 8, 0.78);
}

.modal {
  width: 100%;
  max-width: 820px;
  max-height: 88vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.08), 0 30px 80px rgba(0, 0, 0, 0.7);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.2rem 1.3rem 0.9rem;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.35rem;
  line-height: 1.2;
}

.modal-sub { color: var(--dim); font-size: 0.85rem; }

.modal-close {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--dim);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.4rem;
}

.modal-close:hover { color: var(--neon); }

.modal-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.3rem;
  padding: 1.2rem 1.3rem 1.5rem;
}

@media (max-width: 620px) {
  .modal-body { grid-template-columns: 1fr; }
}

.modal-cover {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  display: block;
}

.desc {
  white-space: pre-wrap;
  color: #cfcfe4;
  margin: 0 0 1.1rem;
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.8rem;
  margin: 0 0 1.1rem;
  font-size: 0.87rem;
}

.kv dt { color: var(--dim); }
.kv dd { margin: 0; }

.dl-list { display: grid; gap: 0.5rem; }

.dl-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.dl-row .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.87rem;
}

.dl-row .size {
  color: var(--dim);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.shots {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  overflow-x: auto;
  padding-bottom: 0.3rem;
}

.shots img {
  height: 110px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  cursor: zoom-in;
}

/* ------------------------------------------------------------------ admin */

.admin-wrap { max-width: 1300px; margin: 0 auto; padding: 1.2rem 1.1rem 4rem; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.3rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.6rem;
}

.tab {
  padding: 0.45rem 0.9rem;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--dim);
  cursor: pointer;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--neon);
  border-color: rgba(0, 229, 255, 0.4);
  background: rgba(0, 229, 255, 0.07);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.2rem;
  margin-bottom: 1.2rem;
}

.panel h2 {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.panel .hint {
  margin: 0 0 1.1rem;
  color: var(--dim);
  font-size: 0.85rem;
}

.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

th, td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--dim);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

td.num { font-variant-numeric: tabular-nums; text-align: right; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
  align-items: end;
}

.field label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
  color: var(--dim);
  letter-spacing: 0.03em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--neon);
}

.field .sub { color: var(--dim-2); font-size: 0.73rem; margin-top: 0.25rem; }

.checks { display: flex; flex-wrap: wrap; gap: 1rem; margin: 0.8rem 0; }

.checks label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.87rem;
  cursor: pointer;
}

.pill {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  border: 1px solid var(--line-2);
  color: var(--dim);
}

.pill.on { color: var(--ok); border-color: rgba(52, 224, 122, 0.4); }
.pill.off { color: var(--dim-2); }
.pill.admin { color: var(--neon-2); border-color: rgba(255, 46, 196, 0.4); }

.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  min-width: 70px;
}

.bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(92deg, var(--neon), var(--neon-3));
}

.bar.hot > i { background: linear-gradient(92deg, var(--warn), var(--bad)); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 100;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--neon);
  box-shadow: 0 0 28px rgba(0, 229, 255, 0.2);
  font-size: 0.87rem;
}

.toast.bad { border-color: var(--bad); box-shadow: 0 0 28px rgba(255, 77, 106, 0.2); }

.hidden { display: none !important; }

.progress-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Quem prefere menos movimento não leva com transições nenhumas. */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
