* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
:root { color-scheme: dark; }
body {
  background: #16181d; color: #eee;
  font: 13px/1.3 system-ui, sans-serif;
  overscroll-behavior: none; touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
/* no browser drag-and-drop of the game picture (a fast click-and-move could show a ghost copy of the street) */
canvas, img { -webkit-user-drag: none; user-drag: none; }
#app { display: flex; flex-direction: column; height: 100%; min-height: 300px; }

#hud {
  display: flex; align-items: center; gap: 10px;
  padding: 6px max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left));
}
.track { height: 10px; background: #0008; border-radius: 5px; overflow: hidden; }
.track i { display: block; height: 100%; width: 100%; }
.hp { flex: 1 1 0; min-width: 0; }
.hp span { font-size: 11px; opacity: .8; }
.hp.police { text-align: right; }
.hp.riot i { background: #ffa53d; }
.hp.police i { background: #2f6fed; margin-left: auto; }
#mana { flex: 1.4 1 0; display: flex; align-items: center; gap: 6px; min-width: 0; }
#mana .track { flex: 1; height: 14px; }
#mana i { background: #b56cff; }
#mana b { width: 2.2em; text-align: right; color: #d7b3ff; }
#clock { font-variant-numeric: tabular-nums; opacity: .7; }
#pause, #speed, #settings { background: #2c3038; color: #eee; border: 0; border-radius: 6px; width: 34px; height: 30px; font-weight: bold; }

#stage { position: relative; flex: 1 1 auto; min-height: 0; }
/* own compositing layer: Firefox (125 % display zoom) could leave a stale, enlarged copy of the street on screen
   after placing a spell until Alt was pressed */
#field { display: block; width: 100%; height: 100%; will-change: transform; }
#hint {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  background: #000a; padding: 4px 10px; border-radius: 12px; pointer-events: none; white-space: nowrap;
}
#overlay {
  position: fixed; z-index: 2; inset: 0; display: flex; align-items: center; justify-content: center;
  background: #000d; padding: 16px;
}
.panel { max-width: 560px; max-height: 100%; overflow-y: auto; text-align: center; }
.panel h1 { margin: 0 0 8px; font-size: 26px; }
.panel p { margin: 0 0 14px; opacity: .85; }
.panel button { background: #ffa53d; color: #111; border: 0; border-radius: 8px; padding: 10px 28px; font-size: 16px; font-weight: bold; }

#bar {
  display: flex; gap: 6px; justify-content: center;
  padding: 6px max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}
.card {
  position: relative; flex: 1 1 0; max-width: 120px; min-width: 0; height: 62px; padding: 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  background: #2c3038; color: #eee; border: 2px solid transparent; border-radius: 8px;
  font: inherit; font-size: 11px; overflow: hidden;
}
.card.spell { background: #33293d; }
.card canvas { width: 36px; height: 36px; }
.card .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; font-size: 10.5px; }
.card .cost { position: absolute; top: 2px; right: 4px; color: #d7b3ff; font-weight: bold; }
.card .cool { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: #000a; pointer-events: none; }
.card.off { opacity: .6; }
.card.armed { border-color: #ffe14d; }

#legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 4px 14px; margin-top: 14px; text-align: left; font-size: 11px; }
#legend div { display: flex; align-items: center; gap: 6px; }
#legend canvas { width: 22px; height: 22px; flex: none; }
#legend b { display: block; }
/* second-rank button on the menu, pause and game-over screens */
.panel button.quiet { background: #2c3038; color: #eee; font-weight: normal; margin-left: 8px; }
#settings-panel {
  position: fixed; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center;
  background: #000d; padding: 16px;
}
#settings-panel .panel { width: min(360px, 100%); text-align: left; }
#settings-panel h1 { text-align: center; }
#settings-panel label { display: flex; justify-content: space-between; margin-top: 12px; font-size: 14px; }
#settings-panel input[type=range], #settings-panel select { width: 100%; margin-top: 4px; accent-color: #ffa53d; }
#settings-panel select { background: #2c3038; color: #eee; border: 0; border-radius: 6px; padding: 8px; font-size: 14px; }
#settings-panel p { margin: 4px 0 0; font-size: 12px; opacity: .75; }
#settings-close { display: block; margin: 18px auto 0; }
#rotate-note { display: none; margin: 12px 0 0; color: #ffe14d; }
@media (orientation: portrait) and (max-width: 600px) { #rotate-note { display: block; } }
/* Christ Cosmique: his button waits above the screen and slides slowly down when it is time */
#christ {
  position: absolute; top: 6px; left: 50%; z-index: 1;
  width: 78px; padding: 0; border: 0; background: none; color: #fff; font: inherit; text-align: center;
  transform: translate(-50%, -160%); opacity: 0; pointer-events: none;
  transition: transform 3s ease-out, opacity 3s ease-out;
}
#christ.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
#christ .halo { /* the golden disc behind his head */
  position: absolute; left: 50%; top: -4px; width: 62px; height: 62px; margin-left: -31px; border-radius: 50%;
  background: radial-gradient(circle, #fff7c2 0 45%, #ffd400 46% 62%, #ffb30055 63% 100%);
  box-shadow: 0 0 16px 6px #ffd400aa;
  animation: christ-glow 1.6s ease-in-out infinite;
}
#christ img { position: relative; display: block; width: 58px; height: 74px; margin: 0 auto; object-fit: cover; object-position: top; border-radius: 26px 26px 10px 10px; }
#christ b { position: relative; display: block; margin-top: 2px; font-size: 11px; text-shadow: 0 0 4px #000, 0 0 4px #000; }
@keyframes christ-glow { 50% { box-shadow: 0 0 26px 12px #ffd400dd; } }
#set-side { display: block; width: 100%; margin: 16px 0 0; padding: 10px; font-size: 14px; }
/* leaderboard */
#ai-panel { position: fixed; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; background: #000d; padding: 16px; }
#ai-panel .panel { width: min(460px, 100%); }
#ai-text { text-align: left; font-size: 14px; }
#ai-text a { color: #ffa53d; }
#ov-ai { display: block; margin: 14px auto 0; font-size: 13px; padding: 6px 16px; }
#board-panel { position: fixed; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; background: #000d; padding: 16px; }
#board-panel .panel { width: min(420px, 100%); }
#board-tabs { display: flex; gap: 6px; justify-content: center; margin: 0 0 10px; }
#board-tabs button { background: #2c3038; color: #eee; font-weight: normal; font-size: 13px; padding: 6px 12px; }
#board-tabs button[aria-pressed="true"] { background: #ffa53d; color: #111; font-weight: bold; }
#board-list { list-style: none; margin: 0 0 10px; padding: 0; text-align: left; font-size: 14px; }
#board-list li { display: flex; gap: 10px; padding: 4px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; }
#board-list li:nth-child(odd) { background: #ffffff0f; }
#board-list li.me { background: #ffa53d33; outline: 1px solid #ffa53d; }
#board-list .rank { width: 2em; text-align: right; opacity: .7; }
#board-list .who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#score-form { margin: 14px auto 0; max-width: 320px; }
#score-form p { margin: 0 0 8px; }
#score-time { font-size: 18px; font-weight: bold; color: #ffe14d; opacity: 1; }
#score-name { width: 100%; padding: 9px; border: 0; border-radius: 6px; font-size: 15px; margin-bottom: 8px; background: #fff; color: #111; }
#score-msg { min-height: 1.3em; margin-top: 8px; color: #ffe14d; }
#donate-note { font-size: 11px; opacity: .7; margin: 6px 0 0; cursor: pointer; text-decoration: underline dotted; }
#donate-note:hover { opacity: 1; }
#money-panel { position: fixed; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; background: #000d; padding: 16px; }
#money-panel .panel { width: min(460px, 100%); }
#money-text { font-size: 14px; }
#money-text a { color: #ffa53d; }
#money-text figure { margin: 10px 0; }
#money-text img { max-width: 100%; border-radius: 6px; }
#money-text figcaption { font-size: 12px; opacity: .75; }

/* live "x jouent actuellement" counter, top right of the street (above the menu, below the other windows) */
#online { position: absolute; z-index: 2; top: 6px; right: 8px; display: flex; align-items: center; gap: 6px;
  background: #000a; padding: 3px 10px; border-radius: 12px; font-size: 12px; pointer-events: none; }
/* on the menu the counter moves up over the (dimmed) top bar, so it never covers the menu text */
#overlay:not([hidden]) ~ #online { position: fixed; z-index: 3; }
#online i { width: 8px; height: 8px; border-radius: 50%; background: #3ddc6a; box-shadow: 0 0 6px #3ddc6a; }

/* yellow tilted "splash" line next to the title, like the Minecraft title screen (main menu only) */
@font-face { font-family: 'Monocraft'; src: url('fonts/Monocraft.ttf') format('truetype'); font-display: swap; }
#title-wrap { position: relative; display: inline-block; margin: 14px 0 22px; }
#splash { position: absolute; left: 100%; top: 62%; white-space: nowrap; pointer-events: none;
  font-family: 'Monocraft', monospace; font-size: 12px; color: #ffff00; text-shadow: 2px 2px 0 #3f3f00;
  transform: translate(-50%, -50%) rotate(-20deg); animation: splash .55s ease-in-out infinite alternate; }
@keyframes splash {
  from { transform: translate(-50%, -50%) rotate(-20deg) scale(1); }
  to { transform: translate(-50%, -50%) rotate(-20deg) scale(1.09); }
}
@media (max-width: 600px) { #splash { left: 62%; top: 72%; } }
#ov-tip { color: #ffe14d; font-weight: bold; }
