/* LittleJS Genie: night sky + lamp gold */
:root {
  --bg: #120f24; --bg2: #1c1838; --panel: #241f45; --line: #3a3366;
  --text: #ece8ff; --muted: #a9a2cf; --gold: #ffc94d; --gold2: #ff9f1c; --good: #5ee6a8; --bad: #ff6b81;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, #2b2160 0%, transparent 60%), var(--bg); }
a { color: var(--gold); }
h1, h2, h3 { line-height: 1.2; margin: .4em 0; }
main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 16px; flex: 1; }
main.narrow { max-width: 720px; }
.muted { color: var(--muted); } .small { font-size: 14px; } .pad { padding: 24px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .row.between { justify-content: space-between; }
/* the hidden attribute always hides: without this, any class that sets "display" (.btn, .row, .share-row) shows the element anyway */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* header / footer */
.site-header { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line);
  background: rgba(18, 15, 36, .85); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.brand { color: var(--text); text-decoration: none; font-size: 20px; white-space: nowrap; }
.brand b { color: var(--gold); }
/* the site's own pictures used in a line of text (the lamp, the LittleJS train) */
.icon { height: 1.5em; width: auto; vertical-align: -0.4em; }
.site-footer .icon { height: 24px; vertical-align: -7px; margin-right: 4px; }
.site-header nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.site-header nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; }
.site-header nav a.active, .site-header nav a:hover { color: var(--text); background: var(--panel); }
.site-header nav a.nav-wish { color: var(--gold); }
.account { display: flex; align-items: center; gap: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--panel); }
.site-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px; border-top: 1px solid var(--line); }

/* buttons and inputs */
.btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 8px 14px;
  border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { border-color: var(--gold); }
.btn.primary { background: linear-gradient(180deg, var(--gold), var(--gold2)); color: #2a1600; border: none; font-weight: 700; }
.btn.big { font-size: 18px; padding: 12px 22px; } .btn.small { font-size: 14px; padding: 5px 10px; }
.btn.bad { border-color: var(--bad); color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.link { font: inherit; background: none; border: none; color: var(--gold); cursor: pointer; padding: 4px; }
textarea, input, select { font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; width: 100%; }
textarea { resize: vertical; }
label { display: block; margin: 14px 0 6px; color: var(--muted); }
.row label { display: inline-flex; gap: 6px; align-items: center; margin: 0; } .row label input { width: auto; }
#go { margin-top: 18px; width: 100%; }

/* home */
.hero { text-align: center; padding: 36px 8px 28px; }
.hero h1 { font-size: clamp(30px, 6vw, 52px); }
.hero p { color: var(--muted); max-width: 560px; margin: 0 auto 20px; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; background: var(--bg2); padding: 4px; border-radius: 10px; }
.tabs button { font: inherit; font-size: 14px; background: none; border: none; color: var(--muted); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.tabs button.active { background: var(--panel); color: var(--text); }

/* game cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-top: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  color: var(--text); text-decoration: none; transition: transform .12s, border-color .12s; }
.card:hover { transform: translateY(-2px); border-color: var(--gold); }
.thumb { aspect-ratio: 16 / 9; background: var(--bg2); position: relative; display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge { position: absolute; top: 8px; left: 8px; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: #000a; }
.badge.broken, .badge.removed, .badge.hidden, .badge.failed { color: var(--bad); }
.badge.testing, .badge.making { color: var(--gold); }
.unfinished { border: 1px solid var(--gold); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 22px; }
.unfinished h2 { margin-top: 0; }
.granted { color: var(--gold); margin: 14px 0 0; }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 0; }
.meta { padding: 10px 12px 12px; }
.meta .title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 2px; }
.by { color: var(--muted); font-size: 13px; }

/* game page */
.game-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.stage { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 75vh; background: #000; border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--line); display: grid; place-items: center; }
.stage:fullscreen { max-height: none; border-radius: 0; border: 0; }
.game-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.play-overlay { font: inherit; font-size: 28px; font-weight: 700; color: #2a1600; border: none; cursor: pointer; padding: 16px 36px;
  border-radius: 999px; background: linear-gradient(180deg, var(--gold), var(--gold2)); box-shadow: 0 0 40px #ffc94d55; }
.game-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.votes { display: flex; align-items: center; gap: 8px; }
.vote { font: inherit; background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 5px 14px; cursor: pointer; }
.vote.on { border-color: var(--gold); background: #3a2f12; }
.wish-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px 8px; }
.wish-card p#wish { white-space: pre-wrap; }
.notice { background: #2d2652; border: 1px solid var(--gold); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; }
.notice input { width: auto; min-width: 280px; padding: 4px 8px; margin-left: 6px; }

/* wish page */
.genie-busy { text-align: center; padding: 60px 0; }
.lamp-big { width: 128px; height: 128px; animation: bob 2.2s ease-in-out infinite; filter: drop-shadow(0 0 24px #ffc94d88); }
@keyframes bob { 50% { transform: translateY(-14px) rotate(-6deg); } }

/* modal, toast, moderator */
.modal-wrap { position: fixed; inset: 0; background: #0009; display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; max-width: 600px; width: 100%; padding: 20px 24px;
  max-height: 90vh; overflow: auto; }
.modal h3 { color: var(--gold); margin-top: 16px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 10px; z-index: 60; max-width: 90vw; }
.toast.bad { border-color: var(--bad); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 16px 14px; margin: 12px 0; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; } th, td { text-align: left; padding: 8px; border-top: 1px solid var(--line); vertical-align: top; }
td.actions { white-space: nowrap; }
.prose { max-width: 720px; } .prose h2 { color: var(--gold); font-size: 20px; margin-top: 28px; }

@media (max-width: 600px) {
  .site-header { gap: 8px; } .brand { font-size: 18px; }
  .hero { padding: 20px 4px; }
}
.remix-of { display: flex; gap: 12px; align-items: center; margin: 0 0 12px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg2); color: var(--text); text-decoration: none; }
.remix-of .thumb { width: 128px; flex: none; border-radius: 6px; overflow: hidden; }
.more { text-align: center; margin-top: 18px; }
/* dragging the mouse (or a long press) over the game must not select it and tint it blue */
.stage, .game-frame { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* iPhone can't put a page element full screen, so there the stage fills the page instead */
.stage.fill-page { position: fixed; inset: 0; z-index: 1000; width: 100vw; height: 100vh; height: 100dvh; max-height: none; aspect-ratio: auto; border: 0; border-radius: 0; }
.unfill { position: absolute; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); z-index: 2; width: 40px; height: 40px;
  font-size: 18px; color: #fff; background: #000a; border: 1px solid #fff5; border-radius: 999px; cursor: pointer; }
html.no-scroll, html.no-scroll body { overflow: hidden; }
/* tags: small labels on cards and the game page, and the row of tag buttons over the games list */
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag { font: inherit; font-size: 12px; line-height: 1.4; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); color: var(--muted); text-decoration: none; white-space: nowrap; }
a.tag:hover, button.tag:hover { border-color: var(--gold); color: var(--text); }
.tag-row { margin: 4px 0 12px; } .tag-row .tags { margin-top: 0; }
.tag-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.tag-bar .tag { font-size: 14px; padding: 4px 12px; cursor: pointer; }
.tag-bar .tag.on { background: var(--gold); border-color: var(--gold); color: #2a1600; font-weight: 700; }
.tag-boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 12px; margin: 12px 0; }
.tag-boxes label { display: flex; gap: 6px; align-items: center; margin: 0; color: var(--text); } .tag-boxes input { width: auto; }
