/* Shared shell for every page behind the landing page: top bar + collapsible sidebar. */
:root {
  --bg: #141919; --panel: #1a2121; --raised: #222b2b; --line: #2a3535;
  --text: #ffffff; --dim: #8fa0a0; --cyan: #19d3f3; --green: #3ddc84; --red: #ff6b6b;
  --side: 248px; --top: 56px;
  --sans: Montserrat, "Avenir Next", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; padding-top: var(--top); background: var(--bg); color: var(--text);
  font: 16px/1.6 var(--sans); -webkit-text-size-adjust: 100%;
  transition: padding-left .2s ease;
}
body.no-anim, body.no-anim .side { transition: none; }

/* top bar */
.top {
  position: fixed; inset: 0 0 auto 0; height: var(--top); z-index: 30;
  display: flex; align-items: center; gap: 6px; padding: 0 8px;
  background: var(--bg); border-bottom: 1px solid var(--line); font-family: var(--sans);
}
.menu-btn {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; padding: 0;
  background: none; border: 0; border-radius: 8px; color: var(--text); cursor: pointer;
}
.menu-btn:hover { background: var(--raised); }
.menu-btn svg { width: 22px; height: 22px; }
.brand {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding-right: 8px;
  color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: .1em; font-size: 15px;
}
.brand img { width: 32px; height: 32px; border-radius: 7px; display: block; }

/* buttons + account control */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px;
  border-radius: 999px; border: 1px solid transparent; background: #fff; color: #141919; cursor: pointer;
  font: 600 14px/1.2 var(--sans); text-decoration: none; white-space: nowrap;
}
.btn[hidden] { display: none; }
.btn:hover { background: #dfe8e8; }
.btn.ghost { background: none; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--raised); }
.acct { margin-left: auto; display: flex; align-items: center; }
.acct-btn { width: 44px; height: 44px; padding: 0; display: grid; place-items: center; background: none; border: 0; border-radius: 50%; cursor: pointer; }
.face {
  position: relative; width: 34px; height: 34px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--green)); color: #141919; font: 700 15px/1 var(--sans);
}
.face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.acct-menu {
  position: fixed; top: calc(var(--top) - 2px); right: 8px; z-index: 40; width: min(260px, calc(100vw - 16px));
  display: grid; gap: 4px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45); font-family: var(--sans);
}
.acct-menu[hidden] { display: none; }
.acct-menu small { color: var(--dim); font-size: 12px; overflow-wrap: anywhere; min-width: 0; }
.acct-menu strong { overflow-wrap: anywhere; }
.acct-menu .btn { margin-top: 10px; }
.acct-menu .btn + .btn { margin-top: 6px; }
@media (max-width: 420px) {
  .top .btn { padding: 0 12px; font-size: 13px; }
  /* signed out on a narrow phone: show the icon only, leaving room for the sign-in button */
  .top:has(.acct a.btn) .brand { font-size: 0; gap: 0; padding-right: 0; min-width: 44px; justify-content: center; }
}

/* sidebar */
.side {
  position: fixed; top: var(--top); bottom: 0; left: 0; width: min(var(--side), 84vw); z-index: 20;
  padding: 12px 10px 24px; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line);
  font-family: var(--sans); transform: translateX(-100%); visibility: hidden;
  transition: transform .2s ease, visibility .2s;
}
body.side-open .side { transform: none; visibility: visible; }
.side h2 { margin: 18px 12px 6px; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.side a {
  display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: 15px;
}
.side a:hover { background: var(--raised); }
.side a[aria-current="page"] { background: var(--raised); color: var(--green); font-weight: 600; }
.side-row { display: flex; align-items: center; gap: 2px; }
.side-row a { flex: 1; min-width: 0; }
.side-note { margin: 14px 12px 0; font-size: 12px; line-height: 1.5; color: var(--dim); }
.side-note.warn { color: #ffcf8a; }
.side-note[hidden] { display: none; }

/* owner-only visibility switch: 44px tap target around a small track */
.switch { position: relative; flex: none; width: 52px; height: 44px; padding: 0; background: none; border: 0; border-radius: 8px; cursor: pointer; }
.switch::before { content: ""; position: absolute; left: 8px; top: 12px; width: 36px; height: 20px; border-radius: 999px; background: #3a4646; transition: background .15s; }
.switch::after { content: ""; position: absolute; left: 10px; top: 14px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch[aria-checked="true"]::before { background: var(--green); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }
.switch:disabled { opacity: .6; cursor: default; }
.switch.failed::before { background: var(--red); }
.backdrop { display: none; }

/* wide screens: sidebar pushes the page; narrow screens: it slides over the page */
@media (min-width: 900px) {
  body.side-open { padding-left: var(--side); }
}
@media (max-width: 899px) {
  body.side-open .backdrop { display: block; position: fixed; inset: var(--top) 0 0 0; z-index: 10; background: rgba(0, 0, 0, .55); }
}

/* page content */
.page { max-width: 760px; margin: 0 auto; padding: 32px 20px 64px; }
.page h1 { margin: 0 0 12px; font-size: clamp(28px, 6vw, 40px); line-height: 1.15; letter-spacing: -.01em; }
.page h2 { margin: 40px 0 12px; font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.page p { margin: 0 0 14px; color: #d5dddd; overflow-wrap: anywhere; }
.grad { background: linear-gradient(90deg, var(--cyan), var(--green)); -webkit-background-clip: text; background-clip: text; color: transparent; }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { body, .side, .switch::before, .switch::after { transition: none; } }

/* footer on every public page; the server fills it in (see server/site.js) */
.site-foot { max-width: 760px; margin: 0 auto; padding: 12px 10px 40px; border-top: 1px solid var(--line); font: 14px/1.5 var(--sans); }
.site-foot nav { display: flex; flex-wrap: wrap; }
.site-foot a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; padding: 0 10px; border-radius: 8px; color: #d5dddd; text-decoration: none; }
.site-foot a:hover { background: var(--raised); color: #fff; }
.site-foot p { margin: 8px 10px 0; font-size: 13px; color: var(--dim); }

/* long-form text: game guides, About, Privacy, Terms */
.prose h2 { margin: 36px 0 10px; font-size: 22px; line-height: 1.3; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--text); scroll-margin-top: calc(var(--top) + 12px); }
.prose h3 { margin: 24px 0 6px; font-size: 17px; line-height: 1.4; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; color: #d5dddd; }
.prose li { margin: 6px 0; overflow-wrap: anywhere; }
.prose b, .prose strong { color: #fff; font-weight: 600; }
.prose .updated { font-size: 14px; color: var(--dim); }
.prose .scroll { overflow-x: auto; margin: 0 0 14px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.prose th, .prose td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.prose th:first-child, .prose td:first-child { text-align: left; padding-left: 0; }
.prose th { font-size: 12px; font-weight: 600; color: var(--dim); }
.prose caption { caption-side: bottom; padding-top: 8px; text-align: left; font-size: 13px; color: var(--dim); }
/* Links in long text sit on their own lines so each one is a full-size tap target. */
.prose ul.links { list-style: none; padding: 0; }
.prose ul.links li { margin: 0; }
.prose ul.links a, .prose a.mail { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; color: var(--cyan); overflow-wrap: anywhere; }
.guide { padding-top: 0; }
body.in-room .guide { display: none; }   /* during a game the board has the page to itself */

/* "Report a bug" on game pages (web/bug.js): a button in the top bar and a dialog */
.bug-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; height: 44px; padding: 0 10px;
  margin-left: auto; background: none; border: 0; border-radius: 8px; color: var(--dim); cursor: pointer; font: 600 13px/1 var(--sans);
}
.bug-btn:hover { background: var(--raised); color: var(--text); }
.bug-btn svg { width: 22px; height: 22px; flex: none; }
.bug-btn + .acct { margin-left: 0; }
@media (max-width: 699px) { .bug-btn span { display: none; } }
.bug-dialog {
  width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 18px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; font: 16px/1.5 var(--sans);
}
.bug-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.bug-dialog h2 { margin: 0 0 6px; font-size: 20px; line-height: 1.3; }
.bug-dialog p { margin: 0 0 12px; color: #d5dddd; font-size: 14px; overflow-wrap: anywhere; }
.bug-dialog label { display: block; margin: 12px 0 6px; font-size: 13px; font-weight: 600; color: var(--dim); }
.bug-dialog input, .bug-dialog textarea {
  display: block; width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 8px; font: 16px/1.4 var(--sans);
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
}
.bug-dialog textarea { min-height: 110px; resize: vertical; }
.bug-dialog .bug-count { margin: 4px 0 0; text-align: right; font-size: 12px; color: var(--dim); }
.bug-dialog .bug-status { min-height: 21px; margin: 10px 0 0; }
.bug-dialog .bug-status.err { color: var(--red); }
.bug-dialog .bug-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.bug-dialog .btn:disabled { opacity: .5; cursor: default; }

/* Model picker on the report admin pages (web/admin/model-picker.js). */
.picker { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin: 0 0 14px; min-width: 0; }
.picker summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 0 16px; cursor: pointer; font-weight: 600; list-style: none; }
.picker summary::-webkit-details-marker { display: none; }
.picker summary::after { content: "▾"; color: var(--dim); }
.picker[open] summary::after { content: "▴"; }
.picker summary small { margin-left: auto; color: var(--dim); font-weight: 400; font-size: 13px; text-align: right; }
.picker summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 12px; }
.picker .prows { list-style: none; margin: 0; padding: 0 16px; }
.picker .prow { padding: 10px 0; border-top: 1px solid var(--line); min-width: 0; }
.picker .prow.off .pswitch span, .picker .prow.off select { opacity: .55; }
.picker .ptop { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.picker .pswitch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; cursor: pointer; }
.picker .pswitch input { width: 22px; height: 22px; margin: 0; accent-color: var(--cyan); }
.picker .pcost { color: var(--text); font-size: 14px; white-space: nowrap; }
.picker select { display: block; width: 100%; max-width: 100%; min-height: 44px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 16px var(--sans); }
.picker select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.page .picker p { margin: 6px 0 0; font-size: 14px; }
.page .picker p.pnote { font-size: 12px; color: var(--dim); overflow-wrap: anywhere; }
.picker .psum { padding: 10px 16px 14px; border-top: 1px solid var(--line); }
.picker .pacts { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 10px; }
.page .picker .pmsg { flex: 1 1 160px; margin: 0; font-size: 13px; color: var(--dim); }
.picker .pacts .btn { font-size: 13px; padding: 0 14px; min-height: 44px; }
.picker .btn:disabled, .picker select:disabled, .picker input:disabled { opacity: .5; cursor: default; }

/* Project and game cards (home page and the arcade library) */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; padding: 0; margin: 0; list-style: none; }
.cards li { display: flex; flex-direction: column; }
.card {
  display: block; flex: 1; padding: 18px; border-radius: 12px; text-decoration: none; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--green); transform: translateY(-2px); }
.card strong { display: block; font-size: 17px; margin-bottom: 4px; }
.card span { color: var(--dim); font-size: 14px; line-height: 1.5; display: block; }
.card em { display: inline-block; margin-top: 12px; font-style: normal; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--green); }
.cards li.off .card { opacity: .55; border-style: dashed; }
.card-admin { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 18px; font-size: 13px; color: var(--dim); }
.cards .none { color: var(--dim); font-size: 15px; }
.cards .card-tag { display: inline-block; margin: 0 0 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--cyan); }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } .card:hover { transform: none; } }

/* Game logos (web/icons/games/) */
.side a .side-icon { width: 20px; height: 20px; margin-right: 10px; vertical-align: -4px; flex: none; }
.card { position: relative; }
/* The logo sits in the card's top-right corner; the text beside it leaves room for it. */
.cards .card-icon { position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; }
.cards .card-icon ~ .card-tag, .cards .card-icon ~ strong { margin-right: 56px; }
/* A game page heading: the logo centred on the title, a fixed gap between them. */
.game-title { display: flex; align-items: center; gap: .3em; }
.game-title .game-logo { flex: none; width: 1.15em; height: 1.15em; }
