:root {
  --bg: #f4efe3;
  --surface: #ffffff;
  --text: #2b2a33;
  --muted: #6b6875;
  --line: #e2dccd;
  --accent: #2f6fd6;
  --danger: #c4372f;
  --ok: #3aa655;
  --warn: #c98a00;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18171c;
    --surface: #24232a;
    --text: #ece9f2;
    --muted: #a19ead;
    --line: #36343e;
    --accent: #6fa0ff;
    --danger: #ff6b61;
    --ok: #5fcf7a;
    --warn: #f0b429;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
[hidden] { display: none !important; }

.bar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: #2b2a33; color: #fff;
}
.bar h1 { font-size: 18px; margin: 0; }
.account { display: flex; align-items: center; gap: 10px; font-size: 13px; min-width: 0; }
.account span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }
.bar .link { color: #fff; }

main { max-width: 720px; margin: 0 auto; padding: 12px 16px; }
h2 { font-size: 16px; margin: 18px 0 8px; }
.center { text-align: center; padding: 48px 8px; color: var(--muted); }
.center p { margin: 0 0 16px; }
.view-head { display: flex; align-items: center; justify-content: space-between; }

button {
  font: inherit; border: 0; border-radius: 10px; padding: 10px 14px; cursor: pointer;
  background: var(--line); color: var(--text); min-height: 44px;
}
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); color: #fff; }
button.danger { background: var(--danger); color: #fff; }
button.link { background: none; color: var(--accent); padding: 6px 4px; min-height: 0; }

.list { display: grid; gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
  display: grid; gap: 10px;
}
.maze { grid-template-columns: 96px 1fr; align-items: start; }
.maze img, .maze .preview {
  width: 96px; height: 96px; object-fit: contain; border-radius: 8px; background: var(--bg);
  image-rendering: pixelated;
}
.maze .body { display: grid; gap: 4px; min-width: 0; }
.maze .name { font-weight: 600; overflow-wrap: anywhere; }
.meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.actions button { flex: 1 1 auto; }

.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; color: #fff; }
.pill.visible { background: var(--ok); }
.pill.hidden { background: var(--warn); }
.pill.removed { background: var(--danger); }
.pill.blocked { background: var(--danger); }

.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.empty { color: var(--muted); text-align: center; padding: 24px 8px; }

.find { display: flex; gap: 8px; margin-top: 4px; }
input, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%;
}
.find input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
label.check input { width: 20px; min-height: 20px; }

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 2;
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { flex: 1; border-radius: 0; background: none; color: var(--muted); min-height: 56px; }
.tabs button[aria-current="page"] { color: var(--accent); font-weight: 600; }

dialog {
  border: 0; border-radius: 14px; padding: 16px; max-width: min(92vw, 420px);
  background: var(--surface); color: var(--text);
}
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog .row { display: flex; justify-content: flex-end; gap: 8px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 3;
  background: #2b2a33; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px;
  max-width: calc(100vw - 32px);
}

/* Shared admin: the title goes back to the game list; each game is a card. */
.bar .title { color: #fff; padding: 0; text-align: left; }
.bar .title h1 { font-size: 18px; margin: 0; }
button.card.game { text-align: left; color: var(--text); width: 100%; display: grid; gap: 4px; }
button.card.game .name { font-weight: 600; font-size: 17px; }
