:root {
  --deep: #332D56;
  --blue: #4E6688;
  --teal: #71C0BB;
  --lime: #E3EEB2;
  --bg: #1c1a2b;
  --card: #262340;
  --border: #3c3760;
  --text: #f2f1f7;
  --muted: #a9a5c4;
  --danger: #e0776d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

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

.topbar .logo {
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--lime);
  font-size: 14px;
}

.topbar nav { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; row-gap: 8px; }
.topbar nav a { color: var(--text); text-decoration: none; font-size: 14px; white-space: nowrap; }
.topbar nav a:hover { color: var(--teal); }

.topbar .role-badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--teal);
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

h1 { font-size: 22px; margin: 0 0 18px; }
h2 { font-size: 17px; margin: 24px 0 10px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
}

.flash {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.flash.success { background: rgba(113,192,187,0.15); border: 1px solid var(--teal); }
.flash.error   { background: rgba(224,119,109,0.15); border: 1px solid var(--danger); color: #ffb3aa; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }

/* Narrow viewports scroll the table horizontally instead of squeezing
   every column unreadably thin — min-width keeps columns from collapsing
   before the scrollbar kicks in. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 560px; }
td, th { white-space: nowrap; }
td:nth-child(2) { white-space: normal; }

.btn {
  display: inline-block;
  padding: 8px 14px;
  background: var(--teal);
  color: #142322;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { opacity: 0.9; }
.btn.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.danger { background: var(--danger); color: #2a0f0c; }
.btn.small { padding: 5px 10px; font-size: 12px; }

form.inline { display: inline; }

label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%;
  padding: 9px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}
textarea { min-height: 140px; resize: vertical; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.checkbox-row input { width: auto; }

.actions { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 10px; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card { width: 340px; max-width: 100%; }

.thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; background: var(--bg); }

/* Hidden by default (empty src) — the onload/onerror handlers inline on
   the <img> in games/form.php toggle it as the cover_url field changes. */
.cover-preview {
  display: none;
  margin-top: 10px;
  max-width: 200px;
  max-height: 260px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* Sized to the table row's own line height (not an arbitrary fixed
   square) so a portrait catalog image never inflates the row. */
.row-thumb {
  height: 2.6em;
  width: 2.6em;
  object-fit: cover;
  border-radius: 5px;
  background: var(--bg);
  display: block;
}
/* .row-actions is a <div> inside the actions <td>, not the <td> itself —
   display:flex directly on a table-cell pulls it out of the table's cell
   layout in most browsers, which is what was throwing off the row's
   bottom border at that column. Never wraps to a second line — a wrapped
   actions row ends up taller than its siblings. Narrow viewports scroll
   horizontally instead (.table-scroll). */
.row-actions { display: flex; flex-wrap: nowrap; gap: 6px; align-items: center; }
.icon-btn { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-btn svg { display: block; width: 20px; height: 20px; }

.report-description { max-width: 260px; white-space: normal; word-break: break-word; }

.submission-payload {
  max-width: 320px;
  margin: 6px 0 0;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.submission-existing-list {
  max-width: 320px;
  margin: 4px 0 8px;
  padding-left: 18px;
  font-size: 12px;
}

.photo-grid { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.photo-item { width: 160px; }
.photo-item img { width: 100%; height: 100px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.photo-item .type { font-size: 11px; color: var(--muted); margin: 4px 0; word-break: break-all; }

.muted { color: var(--muted); font-size: 13px; }

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0;
}
.pager-links { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pager-dots { color: var(--muted); padding: 0 4px; }
.pager-size { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.pager-size select { width: auto; padding: 5px 8px; }
.btn.disabled { opacity: 0.35; pointer-events: none; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.filter-field label { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.filter-actions { flex-direction: row; gap: 8px; min-width: 0; }

.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: middle; margin-right: 6px; border: 1px solid rgba(255,255,255,0.2); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; border: 1px solid var(--border); color: var(--muted); }
.badge.steam { color: var(--lime); border-color: var(--lime); }
.badge.danger { color: var(--danger); border-color: var(--danger); }

.merge-status.error { color: var(--danger); }

/* Select2-like tag multiselect (progressive enhancement of a plain
   <select multiple data-multiselect>, see assets/multiselect.js) */
.ms-wrap { position: relative; }
.ms-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 7px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 42px;
}
.ms-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px 3px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text);
}
.ms-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ms-tag-remove {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
}
.ms-tag-remove:hover { color: var(--danger); }
.ms-input {
  flex: 1;
  min-width: 100px;
  border: none;
  background: none;
  padding: 4px;
  color: var(--text);
  font-size: 13px;
}
.ms-input:focus { outline: none; }
.ms-dropdown {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
}
.ms-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}
.ms-option:hover { background: var(--bg); }

@media (max-width: 640px) {
  main { padding: 16px 12px 40px; }
  h1 { font-size: 19px; }
  h2 { font-size: 15px; }
  .card { padding: 14px; }
  .topbar { padding: 12px 16px; }
  .topbar nav { gap: 10px; width: 100%; justify-content: flex-start; }

  .filter-bar { gap: 10px; }
  .filter-field { min-width: 100%; }

  .pager { flex-direction: column; align-items: stretch; text-align: center; }
  .pager-links { justify-content: center; }
  .pager-size { justify-content: center; }

  .icon-btn { width: 40px; height: 40px; }
  .icon-btn svg { width: 22px; height: 22px; }

  .login-card { width: 100%; }

  .photo-item { width: calc(50% - 7px); }
}
