:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --text: #151821;
  --muted: #5d6576;
  --border: #dde1e8;
  --accent: #3d5afe;
  --accent-hover: #2f49e0;
  --accent-text: #ffffff;
  --android: #15803d;
  --android-bg: #dcfce7;
  --web: #6d28d9;
  --web-bg: #ede9fe;
  --danger: #c62828;
  --danger-bg: #fdecea;
  --ok: #15803d;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 4px 12px rgb(16 24 40 / 6%);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1015;
    --surface: #171a21;
    --surface-2: #20242d;
    --text: #eceef3;
    --muted: #9aa3b4;
    --border: #2a2f3b;
    --accent: #7086ff;
    --accent-hover: #8899ff;
    --accent-text: #0e1015;
    --android: #4ade80;
    --android-bg: #14301f;
    --web: #b9a2ff;
    --web-bg: #2a2142;
    --danger: #ff8a80;
    --danger-bg: #3a1d1d;
    --ok: #4ade80;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 16px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

img {
  max-width: 100%;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h1 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
}

code {
  font: 0.9em ui-monospace, "Cascadia Code", Consolas, monospace;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
}

.main {
  padding-top: 28px;
  padding-bottom: 56px;
  min-height: 70vh;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 60px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--web));
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 8px;
  border-left: 9px solid #fff;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.nav {
  display: flex;
  gap: 4px;
}

.nav a {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-2);
}

.nav-manage {
  border: 1px dashed var(--border);
}

.search {
  margin-left: auto;
  flex: 0 1 260px;
}

.search input {
  width: 100%;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

@media (max-width: 640px) {
  .header-inner {
    gap: 8px 12px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .search {
    flex: 1 1 100%;
    margin-left: 0;
  }
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0 32px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---- catalogue */

.page-head {
  margin-bottom: 20px;
}

.page-head p {
  margin: 0;
}

.page-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgb(16 24 40 / 14%);
}

.card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.card-art {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--surface-2);
}

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

.card-art-letter {
  font-size: 3.5rem;
  font-weight: 800;
  color: rgb(255 255 255 / 92%);
}

.card-body {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 16px 0;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  flex: none;
  object-fit: cover;
}

.card-text {
  min-width: 0;
}

.card-title {
  font-size: 1.05rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-dev {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.card-tagline {
  margin: 10px 16px 0;
  color: var(--muted);
  font-size: 0.925rem;
}

.card .chips {
  padding: 12px 16px 16px;
  margin-top: auto;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
}

.chip-android {
  background: var(--android-bg);
  color: var(--android);
}

.chip-web {
  background: var(--web-bg);
  color: var(--web);
}

.chip-tag {
  font-weight: 500;
}

.empty {
  padding: 48px 0;
  text-align: center;
  color: var(--muted);
}

/* placeholder artwork for games without images */
.ph-0 { background: linear-gradient(135deg, #3d5afe, #8e24aa); }
.ph-1 { background: linear-gradient(135deg, #00897b, #43a047); }
.ph-2 { background: linear-gradient(135deg, #f4511e, #fb8c00); }
.ph-3 { background: linear-gradient(135deg, #5e35b1, #d81b60); }
.ph-4 { background: linear-gradient(135deg, #0277bd, #26c6da); }
.ph-5 { background: linear-gradient(135deg, #455a64, #78909c); }

.icon-fallback {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
}

/* ---- game page */

.notice {
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 0 0 20px;
}

.hero {
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 6;
  margin-bottom: 24px;
  background: var(--surface-2);
}

.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-head {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.game-icon {
  width: 112px;
  height: 112px;
  border-radius: 24px;
  flex: none;
  object-fit: cover;
  box-shadow: var(--shadow);
  font-size: 2.6rem;
}

.game-heading {
  flex: 1;
  min-width: 0;
}

.game-heading h1 {
  margin-bottom: 4px;
}

.game-dev {
  margin: 0 0 6px;
  font-weight: 500;
}

.lede {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 1.05rem;
}

@media (max-width: 560px) {
  .game-head {
    flex-wrap: wrap;
  }
  .game-icon {
    width: 84px;
    height: 84px;
    border-radius: 18px;
  }
  .hero {
    aspect-ratio: 16 / 9;
  }
}

.get {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: stretch;
  margin-bottom: 32px;
}

.get-option {
  flex: 1 1 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.get-option h2 {
  font-size: 1.1rem;
  margin-bottom: 2px;
}

.get-option p {
  margin: 0 0 14px;
}

.get-qr {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  font-size: 0.85rem;
}

.get-qr p {
  margin: 0;
  max-width: 140px;
}

.qr {
  width: 132px;
  height: 132px;
  background: #fff;
  border-radius: 8px;
  padding: 4px;
}

.qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Phones download directly, so the QR code only helps on bigger screens. */
@media (pointer: coarse) and (max-width: 820px) {
  .get-qr {
    display: none;
  }
}

.install-help {
  margin-top: 14px;
  font-size: 0.925rem;
}

.install-help summary {
  cursor: pointer;
  color: var(--accent);
}

.install-help ol {
  margin: 10px 0 0;
  padding-left: 1.25em;
}

.install-help li + li {
  margin-top: 6px;
}

section {
  margin-bottom: 32px;
}

.section-title {
  font-size: 1.2rem;
}

.shots {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}

.shot {
  flex: none;
  scroll-snap-align: start;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.shot img {
  display: block;
  height: 340px;
  width: auto;
  max-width: none;
}

@media (max-width: 560px) {
  .shot img {
    height: 260px;
  }
}

.prose {
  max-width: 72ch;
}

.prose p {
  margin: 0 0 1em;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 0;
}

.facts div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  min-width: 0;
}

.facts dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.facts dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

/* ---- buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.button:disabled {
  opacity: 0.6;
  cursor: progress;
}

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

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

.button-quiet {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.button-quiet:hover {
  background: var(--surface-2);
}

.button-danger {
  background: var(--danger);
  color: #fff;
}

.button-danger-quiet {
  background: transparent;
  border-color: var(--border);
  color: var(--danger);
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--danger);
  cursor: pointer;
  text-decoration: underline;
}

.game-edit {
  flex: none;
}

/* ---- player */

body.bare {
  background: #000;
  overflow: hidden;
}

.player {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.player-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: #111318;
  color: #eceef3;
}

.player-bar .button-quiet {
  background: #20242d;
  border-color: #2f3440;
  color: #eceef3;
  padding: 6px 12px;
  margin-left: auto;
}

.player-back {
  color: #eceef3;
  text-decoration: none;
  font-size: 1.3rem;
  padding: 0 6px;
}

.player-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  object-fit: cover;
  font-size: 0.9rem;
}

.player-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #000;
}

/* ---- error page */

.error-page {
  text-align: center;
  padding: 64px 0;
}

.error-code {
  font-size: 4rem;
  font-weight: 800;
  margin: 0;
  color: var(--muted);
}

/* ---- management */

.crumbs {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
  vertical-align: middle;
}

.badge-live {
  background: var(--android-bg);
  color: var(--android);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

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

.table th,
.table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface-2);
}

.table tr:last-child td {
  border-bottom: 0;
}

.table-game {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.table-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  flex: none;
}

.table-actions {
  white-space: nowrap;
  text-align: right;
}

.table-actions a + a {
  margin-left: 10px;
}

.game-head-compact {
  display: flex;
  align-items: center;
  gap: 12px;
}

.game-head-compact h1 {
  margin: 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.panel > h2 {
  font-size: 1.25rem;
}

.panel h3 {
  font-size: 1rem;
  margin-top: 8px;
}

.panel-danger {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}

.form {
  display: grid;
  gap: 16px;
  max-width: 860px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field label,
.fieldset legend {
  font-weight: 600;
  font-size: 0.925rem;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px 16px;
  margin: 0;
}

input:not([type="checkbox"], [type="file"], [type="hidden"]),
textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

input:focus-visible,
textarea:focus-visible,
.button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

textarea {
  resize: vertical;
}

input[type="file"] {
  font: inherit;
  max-width: 100%;
}

.help {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.check input {
  width: 18px;
  height: 18px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.form-status {
  margin: 0;
  font-size: 0.9rem;
}

.form-status[data-kind="error"] {
  color: var(--danger);
}

.form-status[data-kind="ok"] {
  color: var(--ok);
}

.form-status[data-kind="busy"] {
  color: var(--muted);
}

.upload {
  display: grid;
  gap: 10px;
  margin-bottom: 8px;
}

progress {
  width: 100%;
  height: 8px;
  accent-color: var(--accent);
}

.image-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.image-preview {
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 8px;
}

.image-slot-icon .image-preview {
  width: 128px;
  height: 128px;
}

.image-slot-cover .image-preview {
  aspect-ratio: 16 / 9;
  max-width: 360px;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shot-admin {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.shot-admin figure {
  margin: 0;
  width: 150px;
  font-size: 0.85rem;
}

.shot-admin img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.shot-admin figcaption {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.build-forms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 20px;
}

.build-upload {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--bg);
}

.copy-block {
  position: relative;
  margin-bottom: 28px;
}

.copy-block pre {
  margin: 0;
  padding: 16px 18px;
  padding-right: 130px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 0.875rem/1.55 ui-monospace, "Cascadia Code", Consolas, monospace;
}

.copy-block .guide {
  max-height: 70vh;
  overflow: auto;
}

.copy-block .button {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 12px;
}

@media (max-width: 560px) {
  .copy-block pre {
    padding-right: 18px;
    padding-top: 52px;
  }
}
