/* Rubik (variable weight) — SIL Open Font License 1.1, see vendor/fonts/OFL.txt */
@font-face { font-family: "Rubik"; src: url(../vendor/fonts/Rubik-wght.ttf) format("truetype"); font-weight: 300 900; }

html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: #fff;
  font-family: "Rubik", system-ui, sans-serif; font-weight: 600; user-select: none; -webkit-user-select: none;
  /* no double-tap zoom anywhere (iOS ignores user-scalable=no); scrolling still works */
  touch-action: manipulation }
canvas { display: block }
.hidden { display: none !important }
kbd { background: #fff; color: #000; border-radius: 5px; padding: 0 6px; box-shadow: 2px 2px 0 #000; font-family: inherit }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none }
#tl { position: absolute; top: 14px; left: 18px; text-shadow: 3px 3px 0 #000 }
#score { font-size: 38px; color: #ffe14d }
#wave { font-size: 22px }
#players { font-size: 16px; margin-top: 4px; color: #ffd9a8; white-space: pre }
#tr { position: absolute; top: 16px; right: 18px; width: 260px; text-align: right; text-shadow: 2px 2px 0 #000 }
.lbl { font-size: 18px; margin-bottom: 4px }
.bar { height: 20px; border: 3px solid #000; border-radius: 12px; background: #4b2a1a; overflow: hidden; box-shadow: 3px 3px 0 #000 }
.bar > div { height: 100%; width: 100%; background: linear-gradient(#ffd977, #e8a93a); transition: width .15s }
#tr.hurt .bar { animation: shake .15s infinite }
#tr.hurt .bar > div { background: linear-gradient(#ff8a7a, #e8433a) }
#bossbox { position: absolute; top: 70px; left: 50%; transform: translateX(-50%); width: 420px; max-width: 80vw; text-align: center; text-shadow: 2px 2px 0 #000 }
.bar.boss > div { background: linear-gradient(#c56bff, #7a1fb8) }
#sprayBox { margin-top: 10px }
.bar.spray > div { background: linear-gradient(#a8f07a, #3fae3a) }
@keyframes shake { 0% { transform: translate(0, 0) } 25% { transform: translate(-3px, 1px) } 50% { transform: translate(2px, -2px) } 75% { transform: translate(-1px, 2px) } }
#cross { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -11px 0 0 -11px; border: 2px solid #fff; border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .5) }
#cross::after { content: ""; position: absolute; left: 7px; top: 7px; width: 4px; height: 4px; background: #fff; border-radius: 50% }
#hitm { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -52%); font-size: 44px; color: #ff3b3b; opacity: 0;
  text-shadow: 2px 2px 0 #000; transition: opacity .25s }
#hitm.on { opacity: 1; transition: none }
#combo { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); font-size: 46px; color: #ff5fa2;
  text-shadow: 4px 4px 0 #000; white-space: nowrap; opacity: 0 }
#combo.pop { animation: pop 1.2s ease-out }
@keyframes pop { 0% { opacity: 1; transform: translateX(-50%) scale(2) rotate(-8deg) } 20% { transform: translateX(-50%) scale(1) rotate(4deg) } 80% { opacity: 1 } 100% { opacity: 0; transform: translateX(-50%) translateY(-30px) } }
#feed { position: absolute; left: 18px; bottom: 18px; font-size: 17px; text-shadow: 2px 2px 0 #000; display: flex; flex-direction: column; gap: 4px }
#feed div { animation: feedin .2s ease-out }
@keyframes feedin { from { transform: translateX(-40px); opacity: 0 } }
#vignette { position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(200, 0, 0, .75) 100%) }

#countdown { position: fixed; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none; font-size: 160px;
  font-weight: bold; color: #ffe14d; text-shadow: 8px 8px 0 #000; line-height: 1 }
#countdown.tick { animation: tick 1s ease-out forwards }
@keyframes tick { 0% { opacity: 0; transform: scale(2.4) rotate(-10deg) } 15% { opacity: 1; transform: scale(1) rotate(3deg) }
  75% { opacity: 1; transform: scale(1) } 100% { opacity: 0; transform: scale(.7) } }

#clickToAim { position: fixed; left: 0; right: 0; top: 58%; text-align: center; pointer-events: none; font-size: 26px;
  text-shadow: 3px 3px 0 #000; display: none; animation: blink 1.2s steps(2) infinite }
#clickToAim.on { display: block }

/* ---------- banner / overlay ---------- */
#banner { position: fixed; left: 0; right: 0; top: 24%; text-align: center; pointer-events: none; opacity: 0; transition: opacity .4s }
#banner.on { opacity: 1 }
#btitle { font-size: 72px; color: #ffe14d; text-shadow: 5px 5px 0 #000; letter-spacing: 2px }
#bsub { font-size: 24px; text-shadow: 3px 3px 0 #000; margin-top: 6px; padding: 0 20px }
#overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(20, 10, 0, .55); cursor: pointer; overflow-y: auto }
#overlay.lobby { background: radial-gradient(ellipse at center, rgba(30, 15, 0, .7) 0, rgba(30, 15, 0, .35) 45%, rgba(30, 15, 0, 0) 80%), url(flies.svg), #e9c46a }
#ovc { text-align: center; max-width: 680px; padding: 20px; margin: auto }
#ovc h1 { font-size: 76px; margin: 0; color: #ffe14d; text-shadow: 6px 6px 0 #000; animation: wob 2s ease-in-out infinite; line-height: 1 }
#ovc h2 { font-size: 26px; margin: 10px 0 18px; color: #ff9ac8; text-shadow: 3px 3px 0 #000 }
#ovc p { font-size: 20px; text-shadow: 2px 2px 0 #000; margin: 8px 0 }
#ovc .stats { font-size: 22px; line-height: 1.6; margin: 14px 0 }
#ovc .winner { font-size: 28px; color: #9be33a; text-shadow: 3px 3px 0 #000 }
#ovc .go { font-size: 30px; color: #fff; margin-top: 20px; animation: blink 1s steps(2) infinite }
#ovc .who { font-size: 20px; margin: 14px 0 6px; text-shadow: 2px 2px 0 #000 }
#ovc .who label { display: block; margin-bottom: 6px }
#ovc .who input { font: inherit; font-size: 20px; width: 200px; padding: 3px 10px; border: 3px solid #000; border-radius: 10px;
  box-shadow: 3px 3px 0 #000; background: #fff; color: #000; text-align: center; user-select: text; outline: none }
#ovc .net { font-size: 17px; text-shadow: 2px 2px 0 #000; opacity: .95 }
#ovc .net .warn { color: #ffd23f }
#ovc .net a { color: #9be33a }
#ovc .invite { font: inherit; font-size: 16px; margin-left: 8px; padding: 2px 12px; cursor: pointer; color: #000; background: #ffd23f;
  border: 3px solid #000; border-radius: 10px; box-shadow: 3px 3px 0 #000 }
#ovc .invite:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000 }
#ovc .board { font-size: 20px; line-height: 1.5; margin: 10px auto; padding: 8px 18px; display: inline-block;
  background: rgba(0, 0, 0, .35); border-radius: 12px; text-shadow: 2px 2px 0 #000 }
#ovc .menu-buttons { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin: 18px 0 6px }
#ovc .menu-button { font: inherit; font-size: 26px; font-weight: bold; padding: 8px 24px; margin: 8px 0; cursor: pointer; color: #000;
  background: #ffd23f; border: 4px solid #000; border-radius: 14px; box-shadow: 5px 5px 0 #000 }
#ovc .menu-button:hover { background: #ffe14d }
#ovc .menu-button:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 #000 }
#ovc .menu-button.small { font-size: 17px; padding: 4px 16px; border-width: 3px; box-shadow: 3px 3px 0 #000; margin-top: 14px }
/* scenario cards: a thumbnail with the name under it, as chunky as the menu buttons */
#ovc .scenario-cards { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin: 10px 0 16px }
#ovc .scenario-card { font: inherit; width: min(42vw, 240px); padding: 0; cursor: pointer; color: #000; background: #ffd23f;
  border: 4px solid #000; border-radius: 14px; box-shadow: 5px 5px 0 #000; overflow: hidden; display: flex; flex-direction: column;
  transition: transform .08s }
#ovc .scenario-card img { display: block; width: 100%; height: auto; aspect-ratio: 8 / 5; border-bottom: 4px solid #000 }
#ovc .scenario-card span { padding: 6px 8px; font-size: 20px; font-weight: bold }
#ovc .scenario-card:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 #000; background: #ffe14d }
#ovc .scenario-card:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 #000 }
/* in a new room's name step the cards are a choice: the chosen one stands out, the others are pale */
#ovc #roomScenario .scenario-card { width: min(36vw, 190px) }
#ovc #roomScenario .scenario-card span { font-size: 17px }
#ovc #roomScenario .scenario-card:not(.chosen) { background: #fff3c4 }
#ovc #roomScenario .scenario-card:not(.chosen) img { opacity: .7 }
#ovc .scenario-card.chosen { outline: 4px solid #ff9ac8; outline-offset: 3px }
#ovc .choose-label { font-size: 20px; margin: 14px 0 0; text-shadow: 2px 2px 0 #000 }
#ovc .scenario-badge { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 18px; text-shadow: 2px 2px 0 #000 }
#ovc .scenario-badge img { width: 96px; height: 60px; object-fit: cover; border: 3px solid #000; border-radius: 8px }
#ovc .invite-row { margin: 14px 0 }
#ovc .invite-row .invite { margin-left: 0 }
#ovc .players { min-width: 220px }
@keyframes wob { 50% { transform: rotate(-3deg) scale(1.04) } }
@keyframes blink { 50% { opacity: .25 } }

/* ---------- settings ---------- */
.settings { display: inline-block; margin: 14px auto 0; padding: 8px 16px; background: rgba(0, 0, 0, .35); border-radius: 12px;
  font-size: 16px; text-shadow: 2px 2px 0 #000; cursor: default; text-align: left }
.settings summary { cursor: pointer; text-align: center; font-size: 18px }
.settings label { display: grid; grid-template-columns: 130px 160px 44px; align-items: center; gap: 8px; margin: 6px 0 }
.settings input[type=range] { width: 160px; accent-color: #ffd23f }
.settings.floating { position: relative }
.settings.floating .settings-panel { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  padding: 8px 16px; background: rgba(20, 10, 0, .85); border-radius: 12px; z-index: 1 }

/* ---------- opened from disk without the server ---------- */
#nofile { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  background: #2a1f17; font-size: 22px; line-height: 1.6; padding: 20px; text-shadow: 2px 2px 0 #000 }
#nofile h1 { font-size: 56px; color: #ffe14d; margin: 0 0 10px; text-shadow: 5px 5px 0 #000 }

/* ---------- touch screens (body.touch, set by js/touch.js) ---------- */
#touchControls { display: none; position: absolute; inset: 0; pointer-events: auto; touch-action: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent }
body.touch #touchControls { display: block }
body.touch canvas { touch-action: none }
#stick { display: none; position: absolute; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%;
  border: 3px solid rgba(0, 0, 0, .6); background: rgba(255, 255, 255, .12) }
#stick.on { display: block }
#stickKnob { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%;
  border: 3px solid #000; background: rgba(255, 210, 63, .85) }
.touch-button { position: absolute; display: flex; align-items: center; justify-content: center; padding: 0;
  font: inherit; color: #000; background: rgba(255, 210, 63, .8); border: 4px solid #000; border-radius: 50%;
  box-shadow: 3px 3px 0 #000; touch-action: none; -webkit-tap-highlight-color: transparent }
.touch-button.held { background: #ffe14d; transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000 }
#fireButton { width: 96px; height: 96px; font-size: 44px;
  right: calc(28px + env(safe-area-inset-right)); bottom: calc(28px + env(safe-area-inset-bottom)) }
#jumpButton { width: 64px; height: 64px; font-size: 32px;
  right: calc(140px + env(safe-area-inset-right)); bottom: calc(24px + env(safe-area-inset-bottom)) }
#pauseButton { width: 44px; height: 44px; font-size: 20px; border-width: 3px; left: 50%; margin-left: -22px;
  top: calc(10px + env(safe-area-inset-top)); background: rgba(255, 255, 255, .5) }
body.touch #tl { left: calc(18px + env(safe-area-inset-left)) }
body.touch #tr { right: calc(18px + env(safe-area-inset-right)) }
body.touch #feed { left: calc(18px + env(safe-area-inset-left)) }
#rotateHint { display: none }
@media (orientation: portrait) {
  body.touch #rotateHint { display: flex; position: fixed; inset: 0; z-index: 10; align-items: center; justify-content: center;
    padding: 20px; text-align: center; font-size: 26px; background: #2a1f17; text-shadow: 2px 2px 0 #000 }
}

/* ---------- small screens (phones on their side) ---------- */
@media (max-height: 500px) {
  #tl { top: 8px }
  #score { font-size: 26px }
  #wave { font-size: 15px }
  #players { font-size: 12px }
  #tr { top: 8px; width: 170px }
  .lbl { font-size: 13px; margin-bottom: 2px }
  .bar { height: 13px; border-width: 2px }
  #bossbox { top: 60px; width: 260px }
  #feed { font-size: 13px; bottom: 10px }
  #combo { font-size: 30px }
  #countdown { font-size: 90px }
  #btitle { font-size: 40px }
  #bsub { font-size: 17px }
  #ovc { padding: 10px }
  #ovc h1 { font-size: 44px }
  #ovc h2 { font-size: 18px; margin: 6px 0 10px }
  #ovc p, #ovc .who, #ovc .board { font-size: 16px }
  #ovc .stats { font-size: 16px; margin: 8px 0 }
  #ovc .winner { font-size: 20px }
  #ovc .go { font-size: 20px; margin-top: 10px }
  #ovc .menu-buttons { margin: 10px 0 4px }
  #ovc .menu-button { font-size: 19px; padding: 6px 18px; margin: 4px 0 }
  #ovc .scenario-cards { gap: 12px; margin: 6px 0 8px }
  #ovc .scenario-card, #ovc #roomScenario .scenario-card { width: min(30vw, 170px) }
  #ovc .scenario-card span, #ovc #roomScenario .scenario-card span { font-size: 15px; padding: 3px 6px }
  #ovc .choose-label { font-size: 16px; margin-top: 4px }
  /* the name step also holds the name field and two buttons: smaller cards, so it all fits a phone on its side */
  #ovc #roomScenario .scenario-cards { margin: 4px 0 2px }
  #ovc #roomScenario .scenario-card { width: 112px; border-width: 3px; box-shadow: 3px 3px 0 #000 }
  #ovc #roomScenario .scenario-card img { border-bottom-width: 3px }
  #ovc #roomScenario .scenario-card span { font-size: 13px; padding: 2px 4px }
  #ovc .name-warning { margin: 2px 0 }
  #ovc .who { margin: 6px 0 2px }
  #ovc .who label { margin-bottom: 2px }
  #ovc .name-warning ~ .menu-button.small { margin-top: 6px }
  #ovc .scenario-badge { font-size: 15px }
  #ovc .scenario-badge img { width: 72px; height: 45px }
}
