/* Spot the Hazard 3D. POLLE slate/sky palette; buttons use primary-700 (#0369A1) for AA contrast. */
:root { --ink: #0f172a; --muted: #475569; --primary: #0369a1; --line: #cbd5e1; --tint: #f0f9ff; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0f172a; color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
a { color: var(--primary); }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

.sheet { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100% - 32px));
  max-height: calc(100% - 32px); overflow: auto; background: #fff; border-radius: 16px; padding: 20px;
  box-shadow: 0 10px 40px rgb(15 23 42 / .35); text-align: center; }
.sheet img { width: 100%; height: auto; border-radius: 10px; }
.sheet h1 { font-size: 1.35rem; margin: .6em 0 .3em; }
.sheet h2 { font-size: 1.3rem; margin: .2em 0; }
.sheet h3 { font-size: 1rem; margin: 1em 0 .3em; }
button, .primary { font: inherit; min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; }
.primary { display: inline-block; background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; text-decoration: none; }
.hint { color: var(--muted); font-size: .95rem; }
.small { font-size: .9rem; }

#hud { position: fixed; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
#hud > * { pointer-events: auto; }
#count { background: rgb(15 23 42 / .78); color: #fff; padding: 8px 14px; border-radius: 999px; font-weight: 600; }
#cross { position: fixed; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px; border: 2px solid #fff;
  border-radius: 50%; box-shadow: 0 0 0 1px rgb(0 0 0 / .5); pointer-events: none; }
#toast { position: fixed; left: 50%; top: 68px; transform: translateX(-50%); margin: 0; max-width: calc(100% - 32px);
  background: rgb(15 23 42 / .88); color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.on { opacity: 1; }
#joy { position: fixed; left: 24px; bottom: 24px; width: 120px; height: 120px; border-radius: 50%; display: none;
  background: rgb(255 255 255 / .25); border: 2px solid rgb(255 255 255 / .6); touch-action: none; }
#joy > div { position: absolute; left: 33px; top: 33px; width: 50px; height: 50px; border-radius: 50%; background: rgb(255 255 255 / .85); pointer-events: none; }
/* Controls panel: open for 5 s after Play, then shrinks into the ? button (top right) it grew from. */
#help { position: fixed; top: 64px; right: 12px; width: min(340px, calc(100% - 24px)); max-height: calc(100% - 76px); overflow: auto;
  background: rgb(15 23 42 / .95); color: #fff; padding: 12px 16px; border-radius: 12px; cursor: pointer;
  transform-origin: top right; opacity: 0; transform: scale(.1); visibility: hidden; transition: opacity .35s, transform .35s, visibility 0s .35s; }
#help.on { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
#help h2 { font-size: 1rem; margin: 0 0 .3em; }
#help ul { margin: 0; padding-left: 1.1em; }
#help p { margin: .5em 0 0; }
#help .hint { color: #e2e8f0; font-size: .92rem; }
#help-btn { width: 44px; padding: 0; margin-left: 8px; border-radius: 50%; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { #help { transition: none; } }
@media (pointer: coarse) { #joy { display: block; } #cross, .hint.mouse { display: none; } }
@media (pointer: fine) { .hint.touch { display: none; } }

#card-num { color: var(--muted); font-weight: 600; margin: 0 0 .4em; }
#card-text { font-size: 1.1rem; }
#end-score { font-size: 2.2rem; font-weight: 700; margin: .1em 0; }
#missed { text-align: left; }
.cta { background: var(--tint); border-radius: 12px; padding: 12px; margin: 14px 0; }
.links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; align-items: center; }

.hub { max-width: 900px; margin: 0 auto; padding: 24px 16px 48px; }
.games { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.games article { background: #fff; border-radius: 14px; padding: 14px; box-shadow: 0 1px 3px rgb(15 23 42 / .12); }
.games img { width: 100%; height: auto; border-radius: 10px; }
.hub pre { white-space: pre-wrap; word-break: break-all; background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 10px; font-size: .85rem; }
