/* The Makeo page's own pieces, in the HUD's look (src/ui/style.ts): dark glass cards with an accent
   bar, the rounded face with a drop shadow, a condensed stencil for headings, colour by meaning
   (gold = cheese and the General, cyan = sonar and the co-op partner, red = danger, green = safe). */
:root {
  --mk-gold: #ffce5c; --mk-cyan: #6edcff; --mk-red: #ff5446; --mk-green: #6ef596; --mk-kit: #ffa046;
  --mk-heart: #f0606e; --mk-partner: #82d7ff; --mk-ink: #eceae2; --mk-dim: #b2b0a6;
  --mk-glass: rgba(10, 12, 14, .9); --mk-line: rgba(255, 255, 255, .09);
  --mk-lift: 0 .2em 0 rgba(0, 0, 0, .27), 0 .5em 2em rgba(0, 0, 0, .45);
  --mk-face: ui-rounded, "SF Pro Rounded", "Avenir Next", Avenir, "Segoe UI Variable Text", "Segoe UI", Ubuntu,
    "Trebuchet MS", system-ui, sans-serif;
  --mk-cond: "DIN Condensed", "Bahnschrift SemiBold Condensed", "Avenir Next Condensed", "Roboto Condensed",
    "Arial Narrow", sans-serif;
  --mk-ease: cubic-bezier(.2, .8, .2, 1);
}
html, body { margin: 0; height: 100%; background: #05080a; overflow: hidden; touch-action: none; }
#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
[hidden] { display: none !important; }

/* ---- a panel is up: the world dims behind it, darkest under the card (as the game's own menus) ---- */
body.mk-open::before { content: ""; position: fixed; inset: 0; z-index: 39; pointer-events: none;
  background: linear-gradient(90deg, rgba(4, 6, 8, .92) 0, rgba(4, 6, 8, .74) 40%, rgba(4, 6, 8, .3));
  animation: mk-fade .3s ease-out both; }

/* ---- the card ---- */
.mk-panel { position: fixed; z-index: 40; box-sizing: border-box; display: grid; gap: .5em; align-content: start;
  left: max(16px, min(6vw, 80px), env(safe-area-inset-left)); top: 50%; translate: 0 -50%;
  width: min(27em, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain;
  padding: 1.35em 1.4em 1.25em 1.65em; border-radius: 1em; background: var(--mk-glass); color: var(--mk-ink);
  -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: var(--mk-lift), inset 0 0 0 1px var(--mk-line), inset 0 1px 0 rgba(255, 255, 255, .06);
  font: 500 clamp(14px, .5vw + 9px, 16px)/1.3 var(--mk-face); font-variant-numeric: tabular-nums;
  text-shadow: 0 .08em .1em rgba(0, 0, 0, .8); -webkit-tap-highlight-color: transparent;
  --bar: var(--mk-gold); animation: mk-card .42s var(--mk-ease) both; scrollbar-width: thin; }
.mk-panel *, .mk-panel *::before { box-sizing: border-box; }
.mk-panel::before { content: ""; position: absolute; left: 0; top: 1em; bottom: 1em; width: .25em; border-radius: .12em;
  background: var(--bar); box-shadow: 0 0 .8em color-mix(in srgb, var(--bar) 45%, transparent); }
/* each part of a card comes in a beat after the one above it (room.ts numbers them, --i) */
.mk-panel > * { animation: mk-rise .44s var(--mk-ease) both; animation-delay: calc(var(--i, 0) * 45ms + 60ms); }
.mk-panel h2 { margin: 0; font: 700 2.15em/.95 var(--mk-cond); font-stretch: condensed; letter-spacing: .03em;
  text-transform: uppercase; color: var(--mk-ink); text-shadow: 0 .04em 0 rgba(0, 0, 0, .85); }
.mk-kicker { font-size: .82em; color: var(--mk-gold); letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.mk-stripe { height: .38em; width: min(13em, 100%); border-radius: .2em; margin: .05em 0 .25em;
  background: repeating-linear-gradient(-45deg, var(--bar) 0 .45em, #151515 .45em .9em); }
.mk-sec { display: flex; align-items: center; gap: .55em; margin: .55em 0 .05em; font-size: .75em; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--mk-dim); }
.mk-sec::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--mk-line), transparent); }
.mk-sec b { color: var(--mk-gold); font-weight: 700; letter-spacing: .04em; }
.mk-panel ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .35em; }
.mk-panel ul:empty, .mk-panel div:empty:not(.mk-stripe), .mk-note:empty { display: none; }
.mk-note { margin: .1em 0 0; font-size: .84em; line-height: 1.35; color: var(--mk-dim); min-height: 0; }
.mk-ic { display: grid; place-items: center; flex: none; width: 2.1em; height: 2.1em; padding: .42em; border-radius: .55em;
  background: color-mix(in srgb, var(--c, var(--mk-cyan)) 16%, transparent); color: var(--c, var(--mk-cyan)); }
.mk-ic svg, .mk-chev svg { display: block; width: 100%; height: 100%; overflow: visible; }

/* ---- buttons: quiet glass by default, gold for the one thing to do next ---- */
.mk-panel button { display: flex; align-items: center; gap: .75em; width: 100%; margin: 0; padding: .72em 1em;
  border: 0; border-radius: .6em; font: inherit; font-weight: 600; text-align: left; cursor: pointer; color: var(--mk-ink);
  background: rgba(255, 255, 255, .055); box-shadow: inset .22em 0 0 transparent, inset 0 0 0 1px rgba(255, 255, 255, .04);
  text-shadow: inherit; outline: none; touch-action: manipulation;
  transition: background .14s, box-shadow .14s, color .14s, transform .1s, filter .14s; }
.mk-panel button:hover, .mk-panel button.focus { background: rgba(110, 220, 255, .14); color: #fff;
  box-shadow: inset .22em 0 0 var(--mk-cyan), inset 0 0 0 1px rgba(110, 220, 255, .18); }
.mk-panel button:focus-visible, .mk-panel button.focus { outline: 2px solid var(--mk-cyan); outline-offset: 2px; }
.mk-panel button:active { transform: translateY(1px) scale(.985); }
.mk-panel button small { display: block; margin-top: .15em; font-size: .8em; font-weight: 500; color: var(--mk-dim); }
.mk-panel button .mk-w { display: grid; flex: 1; min-width: 0; }
.mk-chev { width: .8em; height: .8em; flex: none; margin-left: auto; color: var(--mk-dim); opacity: .6;
  transition: transform .14s, opacity .14s, color .14s; }
.mk-panel button:hover .mk-chev, .mk-panel button.focus .mk-chev, .mk-panel button:focus-visible .mk-chev {
  transform: translateX(.2em); opacity: 1; color: var(--mk-cyan); }
.mk-panel button.primary { background: linear-gradient(180deg, #ffdc84, #ffc441); color: #1d1404; text-shadow: none;
  font-weight: 750; box-shadow: 0 .18em 0 #a2701a, 0 .4em 1.4em rgba(255, 190, 60, .22); }
.mk-panel button.primary small { color: rgba(29, 20, 4, .72); }
.mk-panel button.primary .mk-ic { --c: #1d1404; background: rgba(0, 0, 0, .12); }
.mk-panel button.primary .mk-chev { color: #1d1404; opacity: .7; }
.mk-panel button.primary:hover, .mk-panel button.primary.focus { color: #1d1404; filter: brightness(1.07);
  box-shadow: 0 .18em 0 #a2701a, 0 .4em 1.8em rgba(255, 190, 60, .4); }
.mk-panel button.primary:focus-visible, .mk-panel button.primary.focus { outline-color: #fff; }
.mk-panel button.primary:active { transform: translateY(.14em); box-shadow: 0 .04em 0 #a2701a, 0 .2em .8em rgba(255, 190, 60, .3); }
.mk-panel button.primary { position: relative; overflow: hidden; }
.mk-panel button.primary.shine::after { content: ""; position: absolute; inset: 0; pointer-events: none; translate: -110% 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .5) 46%, transparent 62%);
  animation: mk-sweep 3.2s 1.2s ease-in-out infinite; }
.mk-panel button.secondary { background: transparent; color: var(--mk-dim); box-shadow: inset 0 0 0 1px var(--mk-line); }
.mk-panel button.secondary:hover, .mk-panel button.secondary.focus { color: #fff; background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }
.mk-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .4em; }
.mk-row2 button { justify-content: center; text-align: center; }

/* ---- the ways to play ---- */
.mk-way { padding: .75em .9em !important; }
.mk-way b { font-size: 1.08em; font-weight: 600; letter-spacing: .01em; }
.mk-challenge .mk-ic { --c: var(--mk-gold); }
.mk-stake { flex: none; margin-left: auto; padding: .2em .6em; border-radius: 1em; font-size: .78em; font-weight: 700; white-space: nowrap;
  color: var(--mk-gold); background: rgba(255, 206, 92, .12); box-shadow: inset 0 0 0 1px rgba(255, 206, 92, .35); }

/* a link field with its button: join a friend's room, share the invite */
.mk-join-row { display: flex; gap: .45em; }
.mk-join { flex: 1; min-width: 0; padding: .65em .8em; font: inherit; font-size: 16px; color: var(--mk-ink); border-radius: .55em;
  background: rgba(0, 0, 0, .45); border: 1.5px solid rgba(110, 220, 255, .22); outline: none; text-shadow: none;
  transition: border-color .14s, box-shadow .14s; }
.mk-join::placeholder { color: rgba(178, 176, 166, .7); }
.mk-join:focus { border-color: var(--mk-cyan); box-shadow: 0 0 0 3px rgba(110, 220, 255, .18); }
.mk-join[readonly] { color: var(--mk-cyan); font-size: .86em; text-overflow: ellipsis; }
.mk-panel .mk-join-row button { flex: none; width: auto; padding: .6em .95em; gap: .45em; }
.mk-join-row button .mk-ic { width: 1.5em; height: 1.5em; padding: .2em; background: none; }
.mk-panel .mk-join-row button.done { color: var(--mk-green); box-shadow: inset 0 0 0 1.5px var(--mk-green); }

/* ---- the lobby: one seat card per rat ---- */
#mk-lobby { --bar: var(--mk-cyan); }
.mk-seat { display: flex; align-items: center; gap: .75em; padding: .6em .75em; border-radius: .7em;
  background: rgba(255, 255, 255, .045); box-shadow: inset 0 0 0 1px var(--mk-line); --c: var(--mk-partner); }
.mk-seat.you { --c: var(--mk-gold); }
.mk-av { flex: none; display: grid; place-items: center; width: 2.4em; height: 2.4em; border-radius: 50%; font-weight: 800;
  font-size: 1em; color: #0b0d0f; text-shadow: none; background: var(--c); box-shadow: 0 0 0 .18em rgba(0, 0, 0, .4), 0 0 1em color-mix(in srgb, var(--c) 35%, transparent); }
.mk-seat .mk-w { display: grid; gap: .1em; flex: 1; min-width: 0; }
.mk-seat .mk-w b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-seat .mk-w b em { font-style: normal; color: var(--mk-dim); font-weight: 500; font-size: .85em; margin-left: .35em; }
.mk-seat .mk-w small { font-size: .78em; color: var(--mk-dim); }
.mk-chip { flex: none; display: inline-flex; align-items: center; gap: .4em; padding: .25em .65em; border-radius: 1em; font-size: .74em;
  font-weight: 700; letter-spacing: .04em; white-space: nowrap; color: var(--t, var(--mk-dim));
  background: color-mix(in srgb, var(--t, var(--mk-dim)) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t, var(--mk-dim)) 45%, transparent); }
.mk-chip::before { content: ""; width: .5em; height: .5em; border-radius: 50%; background: currentColor; }
.mk-chip.ready { --t: var(--mk-green); }
.mk-chip.wait { --t: var(--mk-gold); }
.mk-chip.wait::before { animation: mk-blink 1s ease-in-out infinite; }
.mk-chip.warn { --t: var(--mk-red); }
.mk-seat.open { background: transparent; box-shadow: none; outline: 1.5px dashed rgba(255, 255, 255, .14);
  outline-offset: -4px; --c: rgba(255, 255, 255, .12); }
.mk-seat.open .mk-av { color: var(--mk-dim); box-shadow: none; }
.mk-seat.open .mk-w b { color: var(--mk-dim); font-weight: 600; }
.mk-dots::after { content: "…"; display: inline-block; width: 1em; animation: mk-blink 1.2s steps(2) infinite; }
#mk-lobby-actions { display: grid; gap: .45em; }

/* ---- the end of a run ---- */
#mk-end { --bar: var(--mk-gold); }
#mk-end[data-tone="win"] { --bar: var(--mk-green); }
#mk-end[data-tone="lose"] { --bar: var(--mk-red); }
#mk-end[data-tone="time"] { --bar: var(--mk-kit); }
#mk-end[data-tone="left"] { --bar: var(--mk-cyan); }
.mk-stamp { justify-self: start; display: inline-block; padding: .14em .6em .1em; border: 2px solid currentColor; border-radius: .4em;
  font: 800 .85em/1.2 var(--mk-face); letter-spacing: .2em; text-transform: uppercase; color: var(--bar); rotate: -3deg;
  box-shadow: 0 0 1em color-mix(in srgb, var(--bar) 30%, transparent), inset 0 0 .6em color-mix(in srgb, var(--bar) 20%, transparent);
  animation: mk-stamp .5s cubic-bezier(.3, 1.6, .5, 1) both !important; animation-delay: .12s !important; }
#mk-end h2 { color: var(--bar); font-size: 2.4em; }
#mk-end h2:empty { display: none; }
.mk-score { display: flex; align-items: flex-end; justify-content: space-between; gap: 1em; padding: .4em 0 .55em;
  border-bottom: 1px solid var(--mk-line); }
.mk-score span { font-size: .85em; color: var(--mk-dim); padding-bottom: .55em; }
.mk-score b { font: 700 3.6em/.9 var(--mk-cond); font-stretch: condensed; color: var(--mk-gold); letter-spacing: .02em;
  text-shadow: 0 .03em 0 rgba(0, 0, 0, .85), 0 0 .35em rgba(255, 170, 40, .35); }
.mk-score b small { font-size: .32em; margin-left: .2em; color: var(--mk-dim); font-family: var(--mk-face); letter-spacing: 0; }
.mk-score b.land { animation: mk-land .35s cubic-bezier(.3, 1.6, .5, 1); }
.mk-stats { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: .45em; }
.mk-tile { display: grid; gap: .3em; align-content: start; padding: .55em .65em .6em; border-radius: .6em;
  background: rgba(255, 255, 255, .045); box-shadow: inset 0 0 0 1px var(--mk-line); min-width: 0; }
.mk-tile > span { display: flex; align-items: center; gap: .35em; font-size: .7em; letter-spacing: .1em; text-transform: uppercase;
  color: var(--mk-dim); font-weight: 700; white-space: nowrap; }
.mk-tile > span svg { width: 1.3em; height: 1.3em; flex: none; color: var(--c, var(--mk-dim)); }
.mk-tile > b { font-size: 1.5em; font-weight: 650; line-height: 1; white-space: nowrap; }
.mk-hearts { display: flex; gap: .2em; height: 1.5em; align-items: center; }
.mk-hearts svg { width: 1.15em; height: 1.15em; color: var(--mk-heart); overflow: visible; }
.mk-hearts svg path { fill: currentColor; stroke: currentColor; }
.mk-hearts svg.lost path { fill: none; stroke: var(--mk-dim); stroke-opacity: .5; }
.mk-crew { display: grid; gap: .35em; }
.mk-crew .mk-seat { padding: .45em .7em; }
.mk-crew .mk-av { width: 2em; height: 2em; font-size: .9em; }
.mk-crew .mk-hearts { height: auto; }
.mk-verdict { display: flex; gap: .65em; align-items: flex-start; margin: .1em 0 0; padding: .55em .8em; border-radius: .6em;
  background: rgba(255, 206, 92, .07); box-shadow: inset 0 0 0 1px rgba(255, 206, 92, .16); font-size: .92em; line-height: 1.35; }
.mk-verdict .mk-ic { --c: var(--mk-gold); width: 1.8em; height: 1.8em; padding: .32em; }
.mk-verdict b { display: block; color: var(--mk-gold); font-size: .78em; letter-spacing: .08em; text-transform: uppercase; }
#mk-end-lines li { font-size: .88em; color: var(--mk-ink); padding-left: .9em; position: relative; }
#mk-end-lines li::before { content: ""; position: absolute; left: 0; top: .5em; width: .4em; height: .4em; border-radius: 50%; background: var(--bar); }
.mk-actions { display: grid; gap: .4em; margin-top: .35em; }
.mk-post { display: grid; gap: .4em; }
.mk-post li { list-style: none; font-size: .88em; color: var(--mk-dim); line-height: 1.35; }

/* ---- in play: who you are, and the stub notice ---- */
#mk-hud { position: fixed; left: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 30; pointer-events: none;
  font: 600 12px/1.3 var(--mk-face); color: var(--mk-ink); opacity: .85; text-shadow: 0 1px 2px #000; }
#mk-hud span { display: block; }
#mk-hud span:empty { display: none; }
#mk-notice { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 45; margin: 0; padding: .45em .9em;
  max-width: calc(100vw - 32px); border-radius: .6em; background: rgba(40, 10, 10, .88); color: #ffd9d4;
  box-shadow: inset 0 0 0 1px rgba(255, 84, 70, .5); font: 600 13px/1.3 var(--mk-face); }

/* ---- the first run's hints: a HUD pill with key caps ---- */
#mk-hints { position: fixed; left: 50%; top: 24%; translate: -50% 0; z-index: 4; box-sizing: border-box; display: flex;
  align-items: center; gap: .8em; max-width: calc(100vw - 32px); padding: .45em .5em .45em 1em; border-radius: 1.6em;
  background: rgba(10, 12, 14, .82); color: var(--mk-ink); font: 600 clamp(13px, .4vw + 9px, 15px)/1.35 var(--mk-face);
  text-shadow: 0 .08em .1em rgba(0, 0, 0, .8); box-shadow: var(--mk-lift), inset 0 0 0 1.5px rgba(110, 220, 255, .45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
/* a menu over the run (pause, settings) or a page panel: the hint steps aside */
body.mk-open #mk-hints, body:has(.x-menu) #mk-hints { opacity: 0; pointer-events: none; }
#mk-hints .n { flex: none; font-size: .72em; font-weight: 800; letter-spacing: .1em; color: var(--mk-cyan); }
#mk-hints .t { animation: mk-rise .35s var(--mk-ease) both; }
#mk-hints kbd { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; padding: 0 .4em; margin: 0 .1em;
  border-radius: .35em; background: rgba(236, 234, 226, .92); color: #121416; font: 800 .82em/1 var(--mk-face); text-shadow: none;
  box-shadow: 0 .12em 0 rgba(0, 0, 0, .5); vertical-align: .05em; }
#mk-hints button { flex: none; padding: .45em .9em; border: 0; border-radius: 1.2em; font: inherit; font-weight: 750; cursor: pointer;
  background: var(--mk-cyan); color: #06222c; text-shadow: none; outline: none; transition: filter .14s, transform .1s; }
#mk-hints button:hover { filter: brightness(1.1); }
#mk-hints button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
#mk-hints button:active { transform: scale(.96); }

/* ---- phones ---- */
@media (max-width: 520px) {
  /* a phone: the card is a sheet at the bottom, in thumb reach, with the world above it */
  .mk-panel { left: 16px; top: auto; bottom: max(16px, env(safe-area-inset-bottom)); translate: none;
    padding: 1.15em 1.05em 1.05em 1.3em; }
  body.mk-open::before { background: linear-gradient(0deg, rgba(4, 6, 8, .94) 0, rgba(4, 6, 8, .7) 55%, rgba(4, 6, 8, .3)); }
  .mk-panel h2 { font-size: 1.9em; }
  .mk-panel { animation-name: mk-sheet; }
  #mk-end h2 { font-size: 2em; }
  .mk-score b { font-size: 3.1em; }
  .mk-tile { padding: .5em .5em .55em; }
  .mk-tile > b { font-size: 1.3em; }
  #mk-hints { top: 20%; width: calc(100vw - 32px); justify-content: space-between; }
}
@media (max-height: 560px) {
  .mk-panel { gap: .35em; padding-top: 1em; padding-bottom: .9em; }
  .mk-panel button { padding: .5em .9em; }
  .mk-score b { font-size: 2.8em; }
}

@keyframes mk-fade { from { opacity: 0; } }
@keyframes mk-card { from { opacity: 0; transform: translateX(-1.2em) scale(.985); } }
@keyframes mk-sheet { from { opacity: 0; transform: translateY(1.5em); } }
@keyframes mk-rise { from { opacity: 0; transform: translateY(.55em); } }
@keyframes mk-stamp { from { opacity: 0; scale: 1.8; rotate: -12deg; } 60% { opacity: 1; } }
@keyframes mk-land { 40% { transform: scale(1.12); } }
@keyframes mk-blink { 50% { opacity: .3; } }
@keyframes mk-sweep { 0%, 50% { translate: -110% 0; } 85%, 100% { translate: 110% 0; } }
@media (prefers-reduced-motion: reduce) {
  .mk-panel, .mk-panel *, body.mk-open::before, #mk-hints * { animation: none !important; transition: none !important; }
}
