/*
 * hydrushbad on the desk (hyd-hydrushbad.js, hyd-hydrushbad-access.js): the small unlock window over the game
 * (#hyd-hydrushbad-access), the desk icon while the game loads, and the boot window that stands where the game’s
 * window will while it loads (#hyd-hydrushbad-boot, at the end). The unlock window is the email window’s own design
 * (hyd-personal-details.css, recoloured by hyd-theme.css): its title bar, close button and body classes are reused,
 * and only what that file scopes to #email-manad is repeated here, with the same theme tokens.
 */

#hyd-hydrushbad-access {
  position: fixed;
  inset: 0;
  margin: auto;
  width: 380px;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  overflow: hidden;
  padding: 3px;
  border: 1px solid var(--desktop-rim, #765584);
  border-color: var(--metal-top, #e3cde9) var(--paper-edge, #765584) var(--paper-edge, #765584) var(--metal-top, #e3cde9);
  border-radius: 3px;
  background: var(--paper-surface, #291c33);
  box-shadow: 3px 5px #0008;
  color: var(--paper-text, #f2dfee);
  font-family: var(--desktop-font, Tahoma, sans-serif);
}

#hyd-hydrushbad-access[open],
#hyd-hydrushbad-access > form {
  display: flex;
  flex-direction: column;
}

#hyd-hydrushbad-access > form {
  flex: 1;
  min-height: 0;
}

#hyd-hydrushbad-access .personal-email-body h2 {
  font-size: 17px;
}

#hyd-hydrushbad-access .personal-email-body p {
  margin: 0 0 12px;
}

#hyd-hydrushbad-access .personal-email-body p:empty,
#hyd-hydrushbad-access .personal-email-body [hidden] {
  display: none;
}

#hyd-hydrushbad-access .hydrushbad-access-status {
  min-height: 1.5em;
  overflow-wrap: anywhere;
}

#hyd-hydrushbad-access :is(.hydrushbad-access-actions, .hydrushbad-access-ways) {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

/* Every button in the body looks like the email window’s one button (.personal-email-body > button). */
#hyd-hydrushbad-access .personal-email-body button {
  border: 1px solid;
  border-color: var(--metal-top, #f6e9fa) var(--paper-edge, #735a83) var(--paper-edge, #735a83) var(--metal-top, #f6e9fa);
  border-radius: 4px;
  background: linear-gradient(var(--metal-top, #efe3f6), var(--metal-mid, #b396c6));
  color: var(--metal-ink, #2e1c3c);
  padding: 7px 12px;
  font: 12px var(--desktop-font, Tahoma, sans-serif);
  text-shadow: 0 1px #fff8;
  cursor: pointer;
}

#hyd-hydrushbad-access .personal-email-body button[type='submit'] {
  font-weight: 700;
}

#hyd-hydrushbad-access .personal-email-body button:disabled {
  opacity: 0.5;
  cursor: default;
}

#hyd-hydrushbad-access .personal-email-body .hydrushbad-access-how {
  margin: 0 0 12px;
}

#hyd-hydrushbad-access .hydrushbad-access-help {
  padding-top: 10px;
  border-top: 1px solid var(--paper-edge, #765584);
}

#hyd-hydrushbad-access :focus-visible {
  outline: 2px solid var(--paper-accent, #efb7dd);
  outline-offset: 2px;
}

/* The desk icon while the game’s code comes down on its first press. */
#world [data-hydrushbad][aria-busy='true'] {
  cursor: progress;
}

/* Touch and phones: 44px controls, and a 16px field so iOS Safari does not zoom in on it. */
@media (max-width: 620px), (any-pointer: coarse) {
  #hyd-hydrushbad-access .personal-titlebar .personal-close {
    flex: none;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
  }

  #hyd-hydrushbad-access .personal-email-body button {
    min-height: 44px;
  }

  #hyd-hydrushbad-access .personal-email-body input {
    font-size: 16px;
  }
}

/*
 * The boot window (owner, 17 Nov 2026: "can we make screen show up directly first instead of icon text changing to
 * loading, we can make a windows boot up kind loading screen for the same"). It opens on the icon’s first press and
 * stands exactly where the game’s first window (its rider screen) will, with that window’s frame and blue title bar
 * (hydrushbad/hyd-rash.css), so the game’s window takes its place without a jump. Below the bar, a startup screen of
 * the site’s own: black, the helmet, the name, and a small rounded track with three blocks sliding along it.
 * Sizes measured 17 Nov 2026 in this copy: the game’s window on its rider screen at the moment it opens, while its own
 * art line reads loading (it shrinks by that line, 22.4 px at 1440x900, about 200 ms later, as it always has):
 * 1440x900, 910 x 764.8 px, centred (742.4 once settled); 1024x768, 566 x 535.8 (509); 800x600 and 800x950, 760 wide
 * and as tall as the screen less 16 px; 390x844 (a phone), 374 x 804.2 at 8 px from the sides (783.4). Its widths
 * follow the game’s rider-screen choice (hyd-rash.js rosterLayout and rosterSize): wide at 900 x 600 and up, the big
 * roster at 960 x 780 and up, short under 500 tall.
 */
#hyd-hydrushbad-boot {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: min(760px, calc(100vw - 16px));
  height: calc(100dvh - 16px);
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #0841c6;
  border-radius: 8px 8px 2px 2px;
  background: #000;
  color: #fff;
  box-shadow: 0 0 0 3px #0b5de6, 0 0 0 4px #0a2a8c, 3px 6px 16px rgba(0, 0, 0, .35);
  font: 12px/1.4 Tahoma, 'Trebuchet MS', Verdana, sans-serif;
}

#hyd-hydrushbad-boot[open] {
  display: flex;
  flex-direction: column;
}

/* The game’s own backdrop, so nothing behind changes when its window takes this one’s place. */
#hyd-hydrushbad-boot::backdrop {
  background: #201c2b66;
}

#hyd-hydrushbad-boot [hidden] {
  display: none;
}

/* The title bar: the game’s Luna blue caption, its title on the left in white, the red close box on the right. */
#hyd-hydrushbad-boot .hydrushbad-boot-bar {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-sizing: border-box;
  min-height: 30px;
  padding: 3px 5px 3px 9px;
  border-radius: 7px 7px 0 0;
  background: linear-gradient(#3a93ff 0%, #0058ee 18%, #0a5ff0 50%, #0058ee 80%, #0040c8 100%);
  box-shadow: inset 0 1px rgba(255, 255, 255, .35);
}

#hyd-hydrushbad-boot .hydrushbad-boot-bar h2 {
  margin: 0;
  padding: 0;
  overflow: hidden;
  color: #fff;
  font: bold 13px/1.2 'Trebuchet MS', Tahoma, sans-serif;
  text-overflow: ellipsis;
  text-shadow: 1px 1px #0a1f60;
  white-space: nowrap;
}

#hyd-hydrushbad-boot .hydrushbad-boot-close {
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  flex: none;
  width: 21px;
  min-width: 21px;
  height: 21px;
  min-height: 21px;
  margin: 0;
  padding: 0;
  border: 1px solid #fff;
  border-radius: 3px;
  background: linear-gradient(#e8805a, #d65a2c 45%, #c43a12 55%, #d24a1c);
  box-shadow: inset 0 1px rgba(255, 255, 255, .45);
  color: #fff;
  /* !important: the site gives every button its desktop face (hyd-platform.css); this glyph is the game’s Arial one */
  font: bold 16px/1 Arial, sans-serif !important;
  text-shadow: 0 1px rgba(0, 0, 0, .3);
  cursor: pointer;
}

@media (hover: hover) {
  #hyd-hydrushbad-boot .hydrushbad-boot-close:hover {
    background: linear-gradient(#f29a75, #e06a3a 45%, #d24a1c 55%, #e05a28);
  }
}

#hyd-hydrushbad-boot .hydrushbad-boot-close:active {
  background: linear-gradient(#b23410, #d65a2c);
}

/* The startup screen: black, everything in a column in the middle. */
#hyd-hydrushbad-boot .hydrushbad-boot-field {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 24px 16px 40px;
  background: #000;
  text-align: center;
}

#hyd-hydrushbad-boot .hydrushbad-boot-helmet {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 0 10px;
}

#hyd-hydrushbad-boot .hydrushbad-boot-word {
  margin: 0 0 30px;
  color: #fff;
  font: bold 30px/1.1 'Trebuchet MS', Tahoma, sans-serif;
  letter-spacing: .02em;
}

/* The track: a small rounded silver frame on the black, its three blue blocks coming in at the left and going out at
   the right, again and again. */
#hyd-hydrushbad-boot .hydrushbad-boot-track {
  position: relative;
  box-sizing: border-box;
  width: 150px;
  height: 16px;
  overflow: hidden;
  border: 2px solid #b3b3b3;
  border-radius: 5px;
  background: #000;
}

#hyd-hydrushbad-boot .hydrushbad-boot-blocks {
  position: absolute;
  top: 2px;
  left: 0;
  display: flex;
  gap: 2px;
  animation: hydrushbad-boot-slide 2.4s linear infinite;
}

#hyd-hydrushbad-boot .hydrushbad-boot-blocks i {
  display: block;
  width: 9px;
  height: 8px;
  border-radius: 1px;
  background: linear-gradient(#a9cfff, #3a93ff 35%, #0058ee 65%, #0040c8);
}

/* the parts loaded of the parts expected (hyd-hydrushbad.js sets the share), shown in place of the blocks */
#hyd-hydrushbad-boot .hydrushbad-boot-fill {
  position: absolute;
  inset: 2px;
  display: none;
  border-radius: 1px;
  background: linear-gradient(#a9cfff, #3a93ff 35%, #0058ee 65%, #0040c8);
  transform-origin: left center;
}

@keyframes hydrushbad-boot-slide {
  from {
    transform: translateX(-35px);
  }

  to {
    transform: translateX(146px);
  }
}

/* (owner, 17 Nov 2026, on staging: "why is loading window taking forever, game doesnt load only now", then "it loads but
   after a min why, before it was faster, max loading screen shud be there for like 5-10 secs") The boot screen never sits
   silent: how far along it is in small words under the track, and after 10 s a line saying so, with what it waits for
   and the buttons below. */
#hyd-hydrushbad-boot .hydrushbad-boot-count {
  margin: 10px 0 0;
  color: #9a9a9a;
  font: 11px/1.3 Tahoma, Verdana, sans-serif;
}

#hyd-hydrushbad-boot .hydrushbad-boot-slow {
  margin: 18px 0 6px;
  color: #d8d8d8;
  font: 13px/1.4 Tahoma, Verdana, sans-serif;
}

#hyd-hydrushbad-boot .hydrushbad-boot-waiting {
  max-width: 100%;
  margin: 0 0 14px;
  overflow-wrap: anywhere;
  color: #9a9a9a;
  font: 11px/1.3 Tahoma, Verdana, sans-serif;
}

/* A failed load: the same window, a plain message and the game’s blue push buttons. */
#hyd-hydrushbad-boot .hydrushbad-boot-message {
  margin: 0 0 14px;
  color: #d8d8d8;
  font: 13px/1.4 Tahoma, Verdana, sans-serif;
}

#hyd-hydrushbad-boot .hydrushbad-boot-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

#hyd-hydrushbad-boot .hydrushbad-boot-actions button {
  min-width: 75px;
  min-height: 24px;
  margin: 0;
  padding: 3px 12px;
  border: 1px solid #0b3a9e;
  border-radius: 3px;
  background: linear-gradient(#6aa6ff, #2f6fe3 48%, #1a52c4 52%, #2865da);
  box-shadow: inset 0 1px rgba(255, 255, 255, .45);
  color: #fff;
  font: bold 12px/1.15 Tahoma, Verdana, sans-serif;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .35);
  cursor: pointer;
}

@media (hover: hover) {
  #hyd-hydrushbad-boot .hydrushbad-boot-actions button:hover {
    background: linear-gradient(#86b8ff, #3d7ef0 48%, #2560d6 52%, #3574e6);
    box-shadow: inset 0 0 0 2px #f8b330;
  }
}

#hyd-hydrushbad-boot :focus-visible {
  outline: 2px solid #f8b330;
  outline-offset: 2px;
}

/* The game’s wide rider screen (900 x 600 and up), its big one (960 x 780 and up), and its short one (under 500 tall). */
@media (min-width: 900px) and (min-height: 600px) {
  #hyd-hydrushbad-boot {
    width: 566px;
    height: min(535.8px, calc(100dvh - 16px));
  }
}

@media (min-width: 960px) and (min-height: 780px) {
  #hyd-hydrushbad-boot {
    width: 910px;
    height: min(764.8px, calc(100dvh - 16px));
  }
}

@media (max-height: 499px) {
  #hyd-hydrushbad-boot {
    width: min(860px, calc(100vw - 16px));
    height: calc(100dvh - 16px);
  }

  #hyd-hydrushbad-boot .hydrushbad-boot-field {
    padding: 12px 16px;
  }

  #hyd-hydrushbad-boot .hydrushbad-boot-helmet {
    width: 64px;
    height: 64px;
  }

  #hyd-hydrushbad-boot .hydrushbad-boot-word {
    margin-bottom: 18px;
    font-size: 24px;
  }
}

/* A phone: the game’s window keeps 8 px from the sides and may take the whole height (its own 620 px rule). */
@media (max-width: 620px) {
  #hyd-hydrushbad-boot {
    width: calc(100vw - 16px);
    height: min(804.2px, 100dvh);
    max-height: 100dvh;
  }

  #hyd-hydrushbad-boot .hydrushbad-boot-helmet {
    width: 80px;
    height: 80px;
  }

  #hyd-hydrushbad-boot .hydrushbad-boot-word {
    font-size: 26px;
  }
}

/* Touch: the game’s 44 px targets, the painted close box inset in its own (its title bar is 51 px tall there). */
@media (pointer: coarse) {
  #hyd-hydrushbad-boot .hydrushbad-boot-bar {
    min-height: 51px;
  }

  #hyd-hydrushbad-boot .hydrushbad-boot-close,
  #hyd-hydrushbad-boot .hydrushbad-boot-close:active {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    border: 0;
    background: none;
    box-shadow: none;
  }

  #hyd-hydrushbad-boot .hydrushbad-boot-close::after {
    position: absolute;
    inset: 10px;
    z-index: -1;
    border: 1px solid #fff;
    border-radius: 4px;
    background: linear-gradient(#e8805a, #d65a2c 45%, #c43a12 55%, #d24a1c);
    box-shadow: inset 0 1px rgba(255, 255, 255, .45);
    pointer-events: none;
    content: '';
  }

  #hyd-hydrushbad-boot .hydrushbad-boot-actions button {
    min-height: 44px;
  }
}

/* Reduced motion, and the site’s own motion switch: no sliding; the track fills as the parts come in. */
@media (prefers-reduced-motion: reduce) {
  #hyd-hydrushbad-boot .hydrushbad-boot-blocks {
    display: none;
  }

  #hyd-hydrushbad-boot .hydrushbad-boot-fill {
    display: block;
    transform: scaleX(var(--hydrushbad-boot-done, 0));
  }
}

body.motion-off #hyd-hydrushbad-boot .hydrushbad-boot-blocks {
  display: none;
}

body.motion-off #hyd-hydrushbad-boot .hydrushbad-boot-fill {
  display: block;
  transform: scaleX(var(--hydrushbad-boot-done, 0));
}
