/* The museum page: a full-screen canvas with a light interface over it. */
:root { --m-cyan: #22e6ff; --m-pink: #ff3d9a; --m-bg: #05070d; --m-ink: #e8f4ff; --m-mute: #93a4bf; }
html, body.m-body { margin: 0; height: 100%; background: var(--m-bg); color: var(--m-ink); overflow: hidden; overscroll-behavior: none; }
body.m-body { font: 15px/1.5 var(--font-sans); touch-action: none; user-select: none; -webkit-user-select: none; }
#m-canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; outline: none; }
#m-canvas:active { cursor: grabbing; }
.m-start { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 1.25rem; background: #080b12; color: #f5ead8; }
.m-start[hidden] { display: none; }
.m-start:not([hidden]) ~ .m-load { display: none; }
.m-start__card { width: min(32rem, 100%); padding: clamp(1.5rem, 5vw, 3rem); border: 1px solid rgba(232, 193, 122, .38); background: rgba(25, 20, 25, .96); box-shadow: 0 1.5rem 5rem rgba(0, 0, 0, .45); }
.m-start__card h1 { margin: .4rem 0 1rem; font: 700 clamp(1.7rem, 5vw, 2.7rem)/1.05 Georgia, serif; }
.m-start__card p { color: #cbbda9; }
.m-start__button { margin-top: .75rem; padding: .8rem 1.1rem; border: 1px solid #e8c17a; background: #e8c17a; color: #211a18; font: inherit; font-weight: 700; cursor: pointer; }
.m-start__fine { margin-bottom: 0; font-size: .9rem; }
.m-site-viewer { position: fixed; inset: 0; z-index: 80; display: block; background: #10150f; }
.m-site-viewer[hidden] { display: none; }
.m-site-viewer iframe { width: 100%; height: 100%; border: 0; background: white; }
.m-site-close { position: absolute; top: 12px; right: 16px; z-index: 90; width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.5); border-radius: 8px; background: rgba(5,7,13,.85); color: #fff; font: 700 24px/1 sans-serif; cursor: pointer; pointer-events: auto; display: flex; align-items: center; justify-content: center; }
.m-site-close:hover { background: rgba(34,230,255,.9); color: #04121a; border-color: var(--m-cyan); }
.m-hud { position: fixed; inset: 0; pointer-events: none; }
.m-hud > * { pointer-events: auto; }
.m-card, .m-panel, .m-prompt, .m-toast {
  background: rgba(5, 7, 13, .78); border: 1px solid rgba(34, 230, 255, .45); border-radius: 10px; color: var(--m-ink);
  box-shadow: 0 0 22px rgba(34, 230, 255, .12); backdrop-filter: blur(6px);
}
.m-top { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; gap: 10px; align-items: flex-start; pointer-events: none; }
.m-top > * { pointer-events: auto; }
.m-card { padding: .55rem .8rem; min-width: 0; }
.m-brand { color: var(--m-cyan); font: 600 .78rem var(--font-mono); text-decoration: none; letter-spacing: .04em; }
.m-brand:hover { color: #fff; }
.m-who { margin: .15rem 0 0; font-weight: 600; }
.m-sub { margin: 0; color: var(--m-mute); font-size: .82rem; }
.m-label { margin: 0; color: var(--m-pink); font: 600 .72rem var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.m-stats { margin: .1rem 0 0; font: 500 .85rem var(--font-mono); white-space: nowrap; }
.m-ducats { margin: .1rem 0 0; font: 500 .85rem var(--font-mono); white-space: nowrap; color: #ffd54f; }
.m-compass { margin: .3rem 0 0; font: 500 .82rem var(--font-mono); color: #ffd54f; }
.m-arrow { display: inline-block; width: 1.1em; text-align: center; color: #ffd54f; }
.m-menu { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.m-btn {
  font: 600 .82rem var(--font-sans); color: var(--m-ink); background: rgba(5, 7, 13, .8); border: 1px solid rgba(34, 230, 255, .5);
  border-radius: 8px; padding: .4rem .75rem; cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.3;
}
.m-btn:hover { background: rgba(34, 230, 255, .16); color: #fff; }
.m-btn:disabled { opacity: .42; cursor: not-allowed; }
.m-btn:disabled:hover { background: rgba(5, 7, 13, .8); color: var(--m-ink); }
.m-btn.primary:disabled:hover { background: var(--m-cyan); color: #04121a; }
.m-btn.primary { background: var(--m-cyan); border-color: var(--m-cyan); color: #04121a; }
.m-btn.primary:hover { filter: brightness(1.1); background: var(--m-cyan); color: #04121a; }
.m-mini { font: 500 .72rem var(--font-mono); color: var(--m-cyan); background: none; border: 0; padding: 0 .3rem; cursor: pointer; text-decoration: underline; }
.m-swatches { display: flex; gap: 5px; margin-top: .35rem; }
.m-swatches button { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .55); padding: 0; cursor: pointer; }
.m-swatches button:hover { border-color: #fff; transform: scale(1.15); }
:focus-visible { outline: 3px solid var(--m-cyan); outline-offset: 2px; }

.m-prompt { position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); padding: .55rem 1rem; font-weight: 600; text-align: center; max-width: 90vw; pointer-events: none; border-color: rgba(255, 213, 79, .8); box-shadow: 0 0 22px rgba(255, 213, 79, .2); }
.m-toast { position: absolute; left: 50%; top: 90px; transform: translateX(-50%); padding: .55rem 1rem; max-width: min(560px, 92vw); text-align: center; pointer-events: none; }
.m-toast.show { animation: m-pop .35s ease-out; }
@keyframes m-pop { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.m-panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, 92vw); padding: 1.1rem 1.3rem 1.2rem; border-color: var(--accent, var(--m-cyan)); box-shadow: 0 0 40px rgba(0, 0, 0, .6), 0 0 26px color-mix(in srgb, var(--accent, #22e6ff) 35%, transparent); user-select: text; -webkit-user-select: text; }
.m-panel h2 { margin: .15rem 0 .5rem; font-size: 1.5rem; line-height: 1.2; color: #fff; }
.m-body-text { margin: 0 0 .7rem; white-space: pre-line; color: #c9d6ea; }
.m-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 .9rem; }
.m-tags span { font: 500 .72rem var(--font-mono); border: 1px solid var(--accent, var(--m-cyan)); border-radius: 4px; padding: 0 .4rem; color: var(--m-ink); }
.m-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.m-x { position: absolute; right: 8px; top: 4px; background: none; border: 0; color: var(--m-mute); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.m-x:hover { color: #fff; }
.m-helpbox h2 { margin-top: 0; }
.m-keys { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; margin: 0 0 .8rem; }
.m-keys dt { font: 600 .8rem var(--font-mono); color: var(--m-cyan); }
.m-keys dd { margin: 0; color: #c9d6ea; }

.m-load { position: fixed; inset: 0; z-index: 50; background: var(--m-bg); display: grid; place-content: center; justify-items: center; gap: .8rem; text-align: center; transition: opacity .6s ease; }
.m-load.done { opacity: 0; pointer-events: none; }
.m-load__brand { margin: 0; font: 700 clamp(1.6rem, 6vw, 3rem) var(--font-sans); letter-spacing: .12em; color: #fff; text-shadow: 0 0 22px var(--m-cyan); }
.m-load__track { width: min(360px, 70vw); height: 6px; border: 1px solid var(--m-cyan); border-radius: 4px; overflow: hidden; }
.m-load__bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--m-cyan), var(--m-pink)); transition: width .25s ease; }
.m-load__text { margin: 0; color: var(--m-cyan); font: 500 .85rem var(--font-mono); }
.m-load__fine { margin: 0; color: var(--m-mute); font-size: .8rem; }

.m-nowebgl { display: none; position: fixed; inset: 0; z-index: 60; overflow: auto; padding: 2rem 1.25rem; background: var(--m-bg); color: var(--m-ink); user-select: text; touch-action: auto; }
.m-nowebgl a { color: var(--m-cyan); }
.m-nowebgl ul { max-width: 62ch; line-height: 1.7; }
html.no-webgl .m-nowebgl { display: block; }
html.no-webgl body.m-body { overflow: auto; }

/* the mouse is captured: a dot where you are looking, and a hint while it is free */
.m-cross { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(255, 255, 255, .85); box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .55); pointer-events: none; }
.m-lockhint { position: absolute; left: 50%; bottom: 3.2rem; transform: translateX(-50%); margin: 0; padding: .35rem .8rem; font-size: .8rem; color: var(--m-mute); background: rgba(5, 7, 13, .6); border-radius: 8px; pointer-events: none; text-align: center; max-width: 90vw; }
.m-lockhint[hidden] { display: none; }

/* touch controls: shown on any touch screen (the script adds html.is-touch), even on a laptop that also has a mouse */
.m-touch { display: none; }
html.is-touch .m-touch { display: block; position: absolute; left: 0; right: 0; bottom: 0; height: 0; pointer-events: none; }
html.is-touch .m-stick { position: absolute; left: max(22px, env(safe-area-inset-left)); bottom: max(26px, env(safe-area-inset-bottom)); width: 128px; height: 128px; border-radius: 50%; border: 2px solid rgba(34, 230, 255, .6); background: rgba(5, 7, 13, .45); pointer-events: auto; touch-action: none; }
html.is-touch .m-knob { position: absolute; left: 36px; top: 36px; width: 56px; height: 56px; border-radius: 50%; background: rgba(34, 230, 255, .55); border: 2px solid #fff; }
html.is-touch .m-look-stick { position: absolute; right: max(22px, env(safe-area-inset-right)); bottom: max(26px, env(safe-area-inset-bottom)); width: 128px; height: 128px; border-radius: 50%; border: 2px solid rgba(255, 61, 154, .7); background: rgba(5, 7, 13, .45); pointer-events: auto; touch-action: none; }
html.is-touch .m-look-stick .m-knob { background: rgba(255, 61, 154, .55); }
html.is-touch .m-prompt { bottom: 200px; }
html.is-touch .m-lockhint, html.is-touch .m-cross { display: none; }
/* a phone held sideways has little height: keep the thumbs low and the bar small */
@media (orientation: landscape) and (max-height: 520px) {
  html.is-touch .m-stick { width: 104px; height: 104px; bottom: 14px; }
  html.is-touch .m-knob { left: 24px; top: 24px; }
  html.is-touch .m-look-stick { width: 104px; height: 104px; bottom: 14px; }
  html.is-touch .m-prompt { bottom: 90px; }
  .m-panel { max-height: 86vh; overflow: auto; }
}
@media (max-width: 700px) {
  .m-top { flex-wrap: wrap; gap: 6px; left: 8px; right: 8px; top: 8px; }
  .m-menu { margin-left: 0; gap: 4px; }
  .m-btn { padding: .28rem .5rem; font-size: .74rem; }
  .m-toast { top: 130px; }
  .m-card { padding: .3rem .55rem; }
  .m-brand, .m-label, .m-swatches { display: none; }
  .m-who { margin: 0; font-size: .85rem; }
  .m-sub { font-size: .74rem; }
  .m-stats { font-size: .74rem; }
  .m-compass { margin: .1rem 0 0; font-size: .74rem; }
}
@media (prefers-reduced-motion: reduce) { .m-toast.show, .m-load { animation: none; transition: none; } }

/* the way out of a slow load: appears after a few seconds, with no script needed */
.m-load__more { margin: .4rem 0 0; font-size: .85rem; opacity: 0; pointer-events: none; animation: m-reveal .01s 4s forwards; }
.m-load__more a { color: var(--m-cyan); }
@keyframes m-reveal { to { opacity: 1; pointer-events: auto; } }
