:root {
  --bg: #1b1340;
  --bg2: #2a1f5c;
  --panel: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --muted: #b9b2d9;
  --accent: #7b61ff;
  --accent2: #ffb400;
  --good: #3ddc84;
  --warn: #ffb400;
  --bad: #ff5a5f;
  --radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }
body {
  font-family: "Trebuchet MS", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 700px at 20% -10%, #3b2a8a 0%, transparent 60%),
              radial-gradient(900px 600px at 110% 110%, #5a1f6e 0%, transparent 60%),
              var(--bg);
  background-attachment: fixed;
}

h1, h2 { margin: 0 0 12px; }
h2 { font-size: 1.1rem; letter-spacing: 0.02em; }
a { color: inherit; }
code { background: var(--panel); padding: 2px 6px; border-radius: 6px; }

/* ---------- common bits ---------- */

.logo { font-weight: 900; font-size: 1.5rem; text-decoration: none; letter-spacing: -0.02em; }
.logo span { color: var(--accent2); }
.logo.big { font-size: clamp(2.4rem, 9vw, 5rem); margin-bottom: 8px; line-height: 1.1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; padding: 10px 16px;
  font: inherit; font-weight: 700; color: var(--text); text-decoration: none;
  background: rgba(255, 255, 255, 0.14); cursor: pointer;
  transition: transform .08s, background .15s, opacity .15s;
  touch-action: manipulation;
}
.btn:hover { background: rgba(255, 255, 255, 0.22); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); box-shadow: 0 6px 0 #5438d6; }
.btn.primary:hover { background: #8d77ff; }
.btn.ghost { background: transparent; border: 2px solid var(--line); }
.btn.big { padding: 16px 24px; font-size: 1.15rem; border-radius: 16px; }
.btn.small { padding: 6px 12px; font-size: 0.9rem; }

.pill { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 0.85rem; color: var(--muted); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.card.center { text-align: center; align-items: center; }

.status { padding: 8px 14px; border-radius: 999px; font-size: 0.9rem; font-weight: 700; }
.status::before { content: "●"; margin-right: 6px; }
.status.ok { background: rgba(61, 220, 132, .15); color: var(--good); }
.status.warn, .status.searching { background: rgba(255, 180, 0, .15); color: var(--warn); }
.status.bad { background: rgba(255, 90, 95, .15); color: var(--bad); }
.status.searching::before { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

input, select {
  font: inherit; font-size: 1.1rem; color: var(--text);
  background: rgba(0, 0, 0, 0.25); border: 2px solid var(--line); border-radius: 12px;
  padding: 12px 14px; outline: none; width: 100%;
}
input:focus, select:focus { border-color: var(--accent); }
select option { color: #000; }
label { font-weight: 700; color: var(--muted); font-size: 0.9rem; }

.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }

.scores, .lobby-players, .feed, .final-list { list-style: none; margin: 0; padding: 0; }
.scores li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  margin-bottom: 6px; background: rgba(255, 255, 255, 0.05);
}
.scores li.drawing { background: rgba(123, 97, 255, 0.3); }
.scores li.guessed { background: rgba(61, 220, 132, 0.2); }
.scores li.away { opacity: 0.45; }
.pname { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pscore { font-variant-numeric: tabular-nums; font-weight: 900; }
.tag { font-size: 0.9rem; }

.timer {
  min-width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.6rem; font-weight: 900; background: var(--accent2); color: #1b1340; flex: none;
}
.timer.small { min-width: 44px; height: 44px; font-size: 1.1rem; }
.timer.low { background: var(--bad); color: #fff; animation: pulse .5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); } }

.board-wrap { width: 100%; display: flex; justify-content: center; }
.board {
  background: #fff; border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0, 0, 0, .4);
  aspect-ratio: 1 / 1; display: block; touch-action: none;
}

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.gallery figure { margin: 0; background: #fff; color: #222; border-radius: 12px; overflow: hidden; }
.gallery img { width: 100%; display: block; }
.gallery figcaption { padding: 8px 10px; font-size: 0.9rem; }
.empty { color: var(--muted); }

.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 5px solid var(--line); border-top-color: var(--accent2); animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .25); cursor: pointer; padding: 0; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 3px var(--accent); }

/* ---------- top bar ---------- */

.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 20px; }
.topbar .status { margin-right: auto; }
.topbar-actions { display: flex; gap: 8px; }
.topbar.compact { padding: 10px 14px; justify-content: space-between; }
.me { display: flex; gap: 6px; align-items: center; font-weight: 700; }

/* ---------- landing ---------- */

/* The looping video behind the home page and /play, blurred and darkened so the text stays
   readable (scaled up a little so the blur has no soft edges). */
.home-bg { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; pointer-events: none; filter: blur(6px); transform: scale(1.06); }
body.landing::before, body.play::before { content: ""; position: fixed; inset: 0; z-index: -1; background: rgba(20, 12, 50, .5); pointer-events: none; }
body.play::before { background: rgba(20, 12, 50, .75); }

/* /desktop: the start screen of the Mac and Windows apps. */
.desktop-sites { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 18px 0; }
.desktop-company { max-width: 420px; margin: 0 auto 18px; text-align: start; }
.desktop-company .row { display: flex; gap: 8px; }
.desktop-company .row input { flex: 1; min-width: 0; text-transform: none; letter-spacing: normal; font-weight: 400; text-align: start; }

/* /app: the owner's all-in-one app — tabs on top, each page in its own frame. */
body.allinone { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.app-tabs { margin: 0; border-radius: 0; position: static; padding: 4px max(4px, env(safe-area-inset-right)) 4px max(4px, env(safe-area-inset-left)); align-items: center; }
.app-tabs button { min-width: 0; padding: 8px 4px; }
.app-lang { flex: 0 0 auto; padding: 8px 10px; color: var(--muted); font-weight: 700; text-decoration: none; font-size: .85rem; }
.app-frames { flex: 1; position: relative; }
.app-frames iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); }

/* The glow around the mouse (js/glow.js). */
.mouse-glow { position: fixed; left: -160px; top: -160px; width: 320px; height: 320px; border-radius: 50%; pointer-events: none; z-index: 50;
  background: radial-gradient(circle, rgba(255, 210, 120, .6) 0%, rgba(160, 120, 255, .4) 30%, rgba(123, 97, 255, .15) 55%, transparent 70%);
  mix-blend-mode: screen; opacity: 0; transition: opacity .3s; will-change: transform; }
.mouse-glow.on { opacity: 1; }
.mouse-glow::after { content: ""; position: absolute; inset: 0; border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, rgba(255, 80, 80, .9) 0%, rgba(255, 40, 60, .55) 30%, rgba(255, 40, 60, .2) 55%, transparent 70%); }
.mouse-glow.error { opacity: 1; }
.mouse-glow.error::after { animation: glow-error .9s ease-in-out; }
@keyframes glow-error { 0%, 50%, 100% { opacity: 0; } 25%, 75% { opacity: 1; } }
@media print { .mouse-glow { display: none; } }
@media (prefers-reduced-motion: reduce) { .home-bg { display: none; } }

.hero { max-width: 720px; margin: 0 auto; padding: 10vh 16px 40px; text-align: center; }
.tagline { font-size: 1.25rem; color: var(--muted); margin: 0 0 28px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 36px; }
.how { text-align: left; max-width: 520px; margin: 0 auto 24px; line-height: 1.7; color: var(--muted); }
.how b { color: var(--text); }
.fine { color: var(--muted); font-size: 0.85rem; }

/* ---------- host world ---------- */

body.world-host { height: 100vh; overflow: hidden; background: #5fb8ff; }
.world { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; cursor: grab; }
.world:active { cursor: grabbing; }

.join-corner {
  position: fixed; top: 14px; left: 14px; z-index: 2; display: flex; gap: 12px; align-items: center;
  background: rgba(27, 19, 64, 0.78); border-radius: 18px; padding: 10px 16px 10px 10px; backdrop-filter: blur(6px);
}
.corner-text { font-weight: 700; }
.corner-code { color: var(--muted); font-size: 0.95rem; }
.corner-code b { color: var(--accent2); letter-spacing: 0.15em; font-size: 1.2rem; }

.world-actions { position: fixed; top: 14px; right: 14px; z-index: 2; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.btn.light, .pill.light { background: rgba(27, 19, 64, 0.72); color: #fff; border: 0; }
.pill.light { padding: 8px 14px; font-weight: 700; }
.world-actions .status { background: rgba(27, 19, 64, 0.72); }
.world-actions { transition: opacity .25s, visibility .25s; }
/* Never run into the QR card on smaller screens (projectors are often 1280×720): wrap instead. */
.world-actions { max-width: calc(100% - 420px); }
@media (max-width: 760px) { .world-actions { max-width: calc(100% - 28px); top: auto; bottom: 14px; } }
body.buttons-hidden .world-actions { opacity: 0; visibility: hidden; pointer-events: none; }
.show-buttons { position: fixed; top: 14px; right: 14px; z-index: 3; opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
body.buttons-hidden.peek .show-buttons { opacity: .75; visibility: visible; transition: opacity .3s; }

.welcome {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -54%); z-index: 1;
  background: rgba(27, 19, 64, 0.88); border-radius: 28px; padding: 24px 36px; text-align: center;
  display: flex; flex-direction: column; align-items: center; max-width: 94vw; box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.welcome h1 { font-size: clamp(1.4rem, 3vw, 2.4rem); }
.qr { background: #fff; border-radius: 20px; padding: 10px; width: min(34vh, 300px); aspect-ratio: 1; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr.small { width: 96px; padding: 4px; border-radius: 10px; }
.or { color: var(--muted); font-size: 1.05rem; margin: 14px 0 4px; }
.or b { color: var(--text); }
.big-code { font-size: clamp(2.6rem, 6vw, 4.4rem); font-weight: 900; letter-spacing: 0.25em; color: var(--accent2); padding-left: 0.25em; }

.toasts { position: fixed; left: 14px; bottom: 14px; z-index: 3; display: flex; flex-direction: column; gap: 8px; }
.world-toast {
  background: rgba(27, 19, 64, 0.85); padding: 10px 16px; border-radius: 14px; font-weight: 700;
  animation: slidein .35s; transition: opacity .5s, transform .5s;
}
.world-toast b { color: var(--accent2); }
.world-toast.out { opacity: 0; transform: translateX(-30px); }
@keyframes slidein { from { opacity: 0; transform: translateX(-30px); } }

.gallery-dialog {
  width: min(1100px, 94vw); max-height: 88vh; border: 1px solid var(--line); border-radius: 20px;
  background: var(--bg2); color: var(--text); padding: 20px;
}
.gallery-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.dialog-head h2 small { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.dialog-head div { display: flex; gap: 8px; flex-wrap: wrap; }
.gallery figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.btn.dark { color: #222; border-color: #ddd; }

@media (max-width: 700px) {
  .join-corner .corner-text { display: none; }
  .welcome { padding: 18px; }
}

/* ---------- phone ---------- */

body.play { min-height: 100%; }
.phone { max-width: 520px; margin: 0 auto; padding: 8px 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.phone .status { align-self: center; text-align: center; border-radius: 14px; }
.row { display: flex; gap: 8px; }
.row input { text-transform: uppercase; letter-spacing: 0.3em; font-weight: 900; text-align: center; }

.prompt { flex: 1; font-size: 1.15rem; text-align: center; }
.prompt .word { color: var(--accent2); font-size: 1.4rem; }

.tools { display: flex; flex-direction: column; gap: 10px; }
.tools .swatch { width: 32px; height: 32px; }
.tool-row { display: flex; gap: 8px; align-items: center; }
.sizes { display: flex; gap: 6px; flex: 1; }
.sizes button {
  width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: rgba(255, 255, 255, .08);
  display: grid; place-items: center; cursor: pointer;
}
.sizes button.on { border-color: var(--accent2); }
.sizes i { display: block; background: #fff; border-radius: 50%; }



.overlay {
  position: fixed; inset: 0; background: rgba(27, 19, 64, .92); z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; font-weight: 700;
}
.toast {
  position: fixed; left: 50%; top: 16px; transform: translate(-50%, calc(-100% - 40px)); z-index: 20;
  width: max-content; max-width: calc(100vw - 32px); text-align: center;
  padding: 12px 20px; border-radius: 14px; font-weight: 900; background: var(--bg2); border: 1px solid var(--line);
  transition: transform .25s;
}
.toast.show { transform: translate(-50%, 0); }
.toast.good { background: var(--good); color: #0b2d18; }
.toast.warn { background: var(--warn); color: #2d1d00; }

.prompt { font-size: 1.1rem; text-align: center; }
.prompt small { color: var(--muted); }
.fine { color: var(--muted); font-size: 0.85rem; }
.center-text { text-align: center; }
.grow { flex: 1; }

.steps { display: flex; gap: 6px; justify-content: center; }
.steps span { font-size: 0.8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--panel); color: var(--muted); }
.steps span.on { background: var(--accent); color: #fff; }
.steps span.done { color: var(--good); }

.draw-phone { gap: 10px; }
.board-frame { position: relative; width: 100%; }
.draw-phone .board { width: 100%; box-shadow: 0 0 0 4px var(--accent2), 0 10px 40px rgba(0, 0, 0, .4); }
.leg-guide {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%); pointer-events: none;
  border-top: 4px dashed rgba(123, 97, 255, .7); width: 30%; text-align: center; color: #7b61ff; font-weight: 700; font-size: 0.8rem; padding-top: 2px;
}
.step-actions { display: flex; gap: 8px; }

.moves { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.move-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 8px; border-radius: 16px;
  border: 2px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
}
.move-btn.on, .move-btn:active { border-color: var(--accent2); background: rgba(255, 180, 0, .15); }
.move-emoji { font-size: 2.2rem; }

.preview { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius); display: block; }

.my-animals { display: flex; flex-direction: column; gap: 10px; }
.my-animal-head { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }
.acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.acts .btn { padding: 12px 6px; }
.acts .btn.pressed { background: var(--accent); }
.card.center h2, .card.center p { margin: 0; }

.scene-picker { display: flex; gap: 4px; background: rgba(27, 19, 64, 0.72); border-radius: 12px; padding: 3px; }
.scene-picker .btn { background: transparent; padding: 7px 10px; font-size: 1.15rem; }
.scene-picker .btn.on { background: var(--accent); }
.scene-name { margin: -4px 0 10px; color: var(--accent2); font-weight: 700; font-size: 1.2rem; }

.templates { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.template-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; border-radius: 16px;
  border: 2px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
}
.template-btn img { width: 100%; aspect-ratio: 1; border-radius: 10px; display: block; }
.template-btn:active { border-color: var(--accent2); }
.board-tpl { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; border-radius: var(--radius); }
.draw-phone .board { box-shadow: 0 0 0 4px var(--accent2), 0 10px 40px rgba(0, 0, 0, .4); }
#bucket.on { background: var(--accent2); color: #1b1340; }
.preview { aspect-ratio: 1 / 1; background: radial-gradient(circle at 50% 40%, #cfeaff, #7fb8e6); }
.local-note { background: rgba(255, 180, 0, .15); color: var(--warn); padding: 10px 16px; border-radius: 12px; font-weight: 700; margin: 8px 0 0; max-width: 560px; }
.welcome { max-height: 94vh; overflow: auto; }
@media (max-height: 800px) { .welcome .qr { width: min(26vh, 240px); } .welcome h1 { font-size: 1.5rem; margin-bottom: 4px; } .big-code { font-size: 2.6rem; } }

/* ---------- languages ---------- */

html[lang="he"] body, html[lang="he"] .btn, html[lang="he"] input, html[lang="he"] select { font-family: "Rubik", system-ui, -apple-system, "Segoe UI", Arial, sans-serif; }
.lang-corner { position: fixed; top: 14px; inset-inline-end: 14px; z-index: 5; border: 2px solid var(--line); }
.topbar.compact .logo { font-size: 1.2rem; }
.topbar.compact .me { flex-wrap: wrap; justify-content: flex-end; }
.lang-toggle { white-space: nowrap; }
[dir="rtl"] .how { text-align: right; }
[dir="rtl"] .toasts { left: auto; right: 14px; }
[dir="rtl"] .world-toast.out { transform: translateX(30px); }

/* ---------- host login ---------- */

.auth-gate {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px;
  background: rgba(27, 19, 64, 0.82); backdrop-filter: blur(8px);
}
.auth-card {
  width: min(420px, 100%); background: var(--bg2); border: 1px solid var(--line); border-radius: 22px;
  padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); display: flex; flex-direction: column; gap: 12px;
}
.auth-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.auth-card h2 { margin: 4px 0 0; font-size: 1.25rem; }
.auth-wait { color: var(--muted); margin: 8px 0; }
.auth-tabs { display: flex; gap: 6px; background: rgba(0, 0, 0, .2); border-radius: 12px; padding: 4px; }
.auth-tabs button {
  flex: 1; border: 0; border-radius: 9px; padding: 9px; font: inherit; font-weight: 700;
  background: transparent; color: var(--muted); cursor: pointer;
}
.auth-tabs button.on { background: var(--accent); color: #fff; }
.auth-form { display: flex; flex-direction: column; gap: 8px; }
.auth-form .btn { margin-top: 6px; }
.auth-error { margin: 0; color: var(--bad); font-weight: 700; }
#auth-denied { display: flex; flex-direction: column; gap: 12px; }
#auth-denied[hidden], #auth-forms[hidden] { display: none; }

/* ---------- "Made by Liam" ---------- */

.made-by {
  position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 30;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.85rem; font-weight: 700;
  color: rgba(255, 255, 255, 0.85); background: rgba(27, 19, 64, 0.55); padding: 4px 12px; border-radius: 999px;
  pointer-events: none; white-space: nowrap; letter-spacing: 0.03em;
}
html[lang="he"] .made-by { font-family: "Rubik", system-ui, sans-serif; letter-spacing: 0; }
.made-by:empty { display: none; }
.made-by-cursor { color: var(--accent2); margin-inline-start: 2px; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
body.landing, body.play { padding-bottom: 44px; }

/* ---------- loading screen (logo video) ---------- */

.intro {
  position: fixed; inset: 0; z-index: 1000; background: #fff;
  display: flex; align-items: center; justify-content: center; transition: opacity .6s ease;
}
.intro.out { opacity: 0; pointer-events: none; }
.intro-media { width: min(80vmin, 560px); height: auto; aspect-ratio: 1; object-fit: contain; }
.intro-skip {
  position: absolute; bottom: 22px; inset-inline-end: 22px; border: 0; border-radius: 999px; padding: 10px 18px;
  font: inherit; font-weight: 700; color: #fff; cursor: pointer;
  background: linear-gradient(90deg, #2448ff, #d43cf0); box-shadow: 0 6px 18px rgba(80, 60, 200, .35);
}

/* ---------- admin page ---------- */

body.admin { min-height: 100%; padding-bottom: 24px; }
body.admin .phone h2 { margin: 6px 0 0; }
.admin-row input { text-transform: none; letter-spacing: normal; font-weight: 400; text-align: start; }
.admin-tools { display: flex; gap: 8px; align-items: center; }
.admin-tools input { flex: 1; padding: 9px 12px; font-size: 1rem; }
.admin-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.admin-user {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line);
}
.admin-user.on { border-color: rgba(61, 220, 132, .45); }
.admin-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.admin-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }
.admin-who small { color: var(--muted); }

/* Scan a coloured paper sheet (play screen) */
.scan-btn { width: 100%; margin-top: 10px; }

/* Say the name instead of typing it (play screen) */
.say-row { display: flex; gap: 8px; align-items: stretch; }
.say-row input { flex: 1; min-width: 0; }
.mic-btn { font-size: 1.6rem; min-width: 58px; padding: 0 12px; }
.mic-btn.on { background: #ff5a5f; color: #fff; animation: mic-pulse 1s ease-in-out infinite; }
@keyframes mic-pulse { 50% { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(255, 90, 95, .25); } }
.mic-hint { margin: 6px 0 0; font-size: .9rem; opacity: .8; }
.voice-row { display: flex; gap: 8px; margin-top: 8px; }
.voice-row .btn { flex: 1; }

/* Remote control / keyboard focus on the host screen (js/tv-nav.js) */
.world-host :focus-visible, .auth-gate :focus-visible, .gallery-dialog :focus-visible { outline: 4px solid #ffd54f; outline-offset: 3px; }
body.buttons-hidden .show-buttons:focus { opacity: 1; visibility: visible; transition: none; }

/* Short screens (projectors and TVs at 1280×720): keep the welcome box clear of the QR card. */
@media (max-height: 820px) and (min-width: 761px) {
  .welcome { top: calc(50% + 62px); transform: translate(-50%, -50%); max-height: calc(100vh - 150px); padding: 16px 28px; }
  .welcome .qr { width: min(28vh, 260px); }
}

/* The scan button, when a sheet's QR code opened the game */
.scan-btn.pulse { border-color: #ffd54f; animation: scan-pulse 1.2s ease-in-out infinite; }
@keyframes scan-pulse { 50% { box-shadow: 0 0 0 8px rgba(255, 213, 79, .35); } }

/* Remote control: hide the QR card and the welcome box (control page "QR code: hide") */
body.qr-hidden .join-corner, body.qr-hidden #welcome { display: none !important; }

/* Remote control page (/control) */
body.control h3 { margin: 14px 0 6px; font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.ctl-status { display: flex; flex-direction: column; gap: 4px; }
.ctl-status select { margin-inline-start: 8px; padding: 4px 8px; }
.ctl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ctl-grid .btn { min-height: 64px; font-size: 1.05rem; }
.ctl-worlds .btn.on { background: #7b61ff; color: #fff; border-color: #ffd54f; }
.ctl-camera { grid-template-columns: repeat(4, 1fr); }
.ctl-camera .btn { font-size: .95rem; padding: 8px 4px; }
.ctl-wide { width: 100%; }
#ctl-wait .spinner { margin: 8px auto 12px; }
a.btn.big { display: flex; align-items: center; justify-content: center; text-decoration: none; text-align: center; }

/* Company sites (lib/brand.js): logo next to the title, and in the middle of the join QR code */
.logo .brand-logo { height: 1.5em; width: auto; max-width: 3em; vertical-align: middle; border-radius: 8px; margin-inline-end: .35em; background: #fff; object-fit: contain; }
.logo .brand-title { vertical-align: middle; }
.qr { position: relative; }
.qr .qr-logo {
  position: absolute; left: 50%; top: 50%; width: 22%; height: 22%; transform: translate(-50%, -50%);
  object-fit: contain; background: #fff; padding: 2.5%; border-radius: 14%; box-sizing: border-box;
}

/* Admin: company sites */
.brand-head { margin-top: 26px !important; }
.brand-form { display: flex; flex-direction: column; gap: 6px; }
.brand-form h3 { margin: 0 0 4px; }
.brand-form input, .brand-form select { text-transform: none; letter-spacing: normal; font-weight: 400; text-align: start; }
.brand-slug-row { display: flex; align-items: center; gap: 4px; font-weight: 700; }
.brand-slug-row input { flex: 1; min-width: 0; }
.brand-logo-row { display: flex; align-items: center; gap: 10px; }
.brand-logo-row img { width: 56px; height: 56px; object-fit: contain; background: #fff; border-radius: 10px; }
.brand-actions { display: flex; gap: 8px; margin-top: 6px; }
.brand-thumb { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 10px; flex: none; display: grid; place-items: center; font-size: 1.4rem; }
.brand-item a { color: inherit; }

/* ---------- scanning stand (/camera) ---------- */
.cam-title { margin: 6px 0 4px; }
.check-row { display: flex; gap: 10px; align-items: center; margin: 12px 0; font-weight: 400; }
.check-row input { width: 22px; height: 22px; }
#cam-setup select { width: 100%; }
#cam-run { position: fixed; inset: 0; background: #000; overflow: hidden; }
#cam-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cam-top { position: absolute; top: 10px; inset-inline: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; z-index: 3; }
.cam-top .pill { background: rgba(27, 19, 64, .8); color: #fff; padding: 6px 12px; font-weight: 700; }
.cam-top .pill.good { color: var(--good); }
.cam-top .pill.warn { color: var(--warn, #ffc400); }
.cam-top #cam-stop { margin-inline-start: auto; background: rgba(27, 19, 64, .8); }
.cam-msg {
  position: absolute; left: 50%; bottom: 6vh; transform: translateX(-50%); z-index: 3;
  width: min(92vw, 900px); padding: 18px 24px; border-radius: 22px; text-align: center; white-space: pre-line;
  background: rgba(27, 19, 64, .86); color: #fff; font-size: clamp(1.3rem, 4.2vw, 2.6rem); font-weight: 900; line-height: 1.25;
}
.cam-msg.busy { background: rgba(123, 97, 255, .9); }
.cam-msg.good { background: rgba(30, 160, 90, .92); }
.cam-msg.bad { background: rgba(200, 60, 60, .92); }
.cam-msg.warn { background: rgba(160, 110, 0, .9); }
.cam-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 2; }
.cam-flash.good { background: radial-gradient(circle, rgba(61, 220, 132, .0) 40%, rgba(61, 220, 132, .7)); }
.cam-flash.bad { background: radial-gradient(circle, rgba(255, 90, 95, .0) 40%, rgba(255, 90, 95, .7)); }
.cam-flash.on { animation: cam-flash 1.6s ease-out; }
@keyframes cam-flash { 0% { opacity: 1; } 100% { opacity: 0; } }
.cam-last { position: absolute; top: 60px; inset-inline-end: 14px; z-index: 3; width: min(30vw, 220px); border-radius: 16px; border: 4px solid #fff; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); background: #fff; }

/* ---------- page not found (404.html) ---------- */
.notfound { text-align: center; }
.notfound-art { display: block; width: clamp(150px, 42vw, 230px); height: auto; margin: 0 auto; animation: notfound-wiggle 2.4s ease-in-out infinite; }
.notfound-title { margin: 18px 0 4px; font-size: clamp(2.2rem, 8vw, 3.6rem); font-weight: 900; }
@keyframes notfound-wiggle { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { .notfound-art { animation: none; } }

/* ---------- company settings (/settings) ---------- */
.set-address { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 8px; font-weight: 700; }
.set-address a { color: var(--accent2); }

/* The welcome box (no QR code in it any more; the QR code is in the corner) is a
   slim banner at the bottom, so the guest animals walking around stay in view. */
body .welcome {
  top: auto; bottom: 52px; transform: translateX(-50%); max-height: none;
  padding: 12px 28px 14px; border-radius: 22px; width: max-content; max-width: min(94vw, 860px);
}
body .welcome h1 { font-size: clamp(1.15rem, 2.2vw, 1.7rem); margin: 0; }
body .welcome .scene-name { margin: 2px 0 0; font-size: 1rem; }
body .welcome .or { margin: 6px 0 0; font-size: .95rem; }
body .welcome .big-code { font-size: clamp(1.8rem, 3.6vw, 2.6rem); line-height: 1.1; }
body .welcome .local-note { margin-top: 6px; padding: 6px 12px; font-size: .9rem; }

/* More than one game on the WiFi: pick the code shown on your big screen. */
.game-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 10px; }
.game-choice { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; }
.game-choice b { font-size: 1.8rem; letter-spacing: .18em; color: var(--accent2); }
.game-choice small { font-size: .85rem; color: var(--muted); font-weight: 700; }

/* Admin: the free big screen (/naf) switch */
.naf-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.naf-card p { margin: 4px 0 0; }
.naf-card.on { border-color: rgba(61, 220, 132, .5); }

/* Big screen login: the form and, next to it, a QR code to log in with a phone */
.auth-gate .auth-card:has(.auth-forms:not([hidden])) { width: min(780px, 100%); }
.auth-forms:not([hidden]) { display: grid; grid-template-columns: 1fr auto; gap: 22px; align-items: center; }
.auth-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.auth-qr-box { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 220px; text-align: center; }
.auth-qr-box .qr { width: 200px; }
.auth-qr-box p { margin: 0; color: var(--muted); font-size: .95rem; line-height: 1.35; }
@media (max-width: 640px) {
  .auth-forms:not([hidden]) { grid-template-columns: 1fr; }
  .auth-qr-box { width: 100%; }
  .auth-qr-box .qr { width: 160px; }
}

/* Admin tabs and the Control tab */
.admin-tabs { display: flex; gap: 6px; background: rgba(0, 0, 0, .2); border-radius: 14px; padding: 4px; margin: 6px 0 14px; position: sticky; top: 6px; z-index: 2; backdrop-filter: blur(6px); }
.admin-tabs button { flex: 1; border: 0; border-radius: 10px; padding: 10px 6px; font: inherit; font-weight: 700; background: transparent; color: var(--muted); cursor: pointer; }
.admin-tabs button.on { background: var(--accent); color: #fff; }
.ctl-tab { margin-top: 4px; }
body.control .admin-tabs button { min-width: 0; padding: 8px 2px; font-size: .8rem; line-height: 1.2; }
.ctl-all { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.ctl-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ctl-row .btn.small { min-width: 42px; padding: 6px 8px; font-size: 1.1rem; }
.ctl-row .btn.on { background: var(--accent); color: #fff; }
.ctl-msg { display: flex; gap: 6px; }
.ctl-msg input { flex: 1; min-width: 0; }
.ctl-screens .ctl-screen { flex-direction: column; align-items: stretch; gap: 8px; }
.ctl-screen-head { display: flex; align-items: center; gap: 10px; }
.big-pill { font-size: 1.1rem; font-weight: 900; letter-spacing: .15em; color: var(--accent2); }
.ctl-where { word-break: break-all; }
.ctl-emails { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.ctl-emails .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctl-emails .btn.on { background: var(--accent); color: #fff; }
.ctl-emails .pill { margin-inline-start: 4px; font-size: .75rem; }
.brand-worlds-label { font-weight: 700; margin: 14px 0 0; }

/* /control and /settings: one page with the remote and the company settings (js/control-page.js). */
.ctl-sections { max-width: 560px; width: calc(100% - 32px); margin: 10px auto 0; }
body.sec-settings main[id^="ctl-"], body.sec-remote main[id^="set-"] { display: none !important; }
#set-logout { display: none !important; }

/* A few facts about the animal just brought to life (js/facts.js): on /play and in the museum demo. */
.fact-card { background: rgba(255, 255, 255, .08); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin: 12px 0; text-align: start; }
.fact-card h3 { margin: 0 0 8px; font-size: 1.1rem; }
.fact-card p { margin: 6px 0 0; line-height: 1.45; color: var(--muted); }
.fact-card b { color: var(--text); }
