/* The site header around the game, so play.batre.com looks like batre.com.

   The logo and the menu are laid out with the SAME rules the website uses
   (copied from its published style sheet): the same grid columns, the same
   scaling formulas and the same breakpoints. The website scales its header
   from one number, "the scaling factor": the window width (never more than
   1440px) minus the width of the browser's scrollbar. Here that number is
   --sf, and shell.js measures the scrollbar into --sbw. The website's page
   scrolls, so on a computer that always shows scrollbars its header is 15px
   narrower than this page; --sbw makes this header the same narrower width,
   so the logo and menu sit on the same pixels when you switch tabs.

   Ways the header appears:
   - window 760px or more high and over 1000px wide: the website's header;
   - 751 to 1000px wide: the website's tablet scaling, with Play and a menu button;
   - up to 750px wide (a phone upright): a 72px bar, the website's phone logo sizes;
   - window under 760px high: the same look in 64px, so the game keeps its room;
   - a phone turned sideways: no bar, only a small floating menu button. */

@font-face {
  font-family: 'Wix Madefor Display';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/WixMadeforDisplay-Bold.woff2) format('woff2');
}
@font-face {
  font-family: 'Wix Madefor Text';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/WixMadeforText-Variable.woff2) format('woff2');
}

:root {
  --shell-h: 104px;
  --sbw: 0px;                                   /* the browser's scrollbar width, set by shell.js */
  --sf: calc(min(1440px, 100vw) - var(--sbw));  /* the website's "scaling factor" */
  --shell-display: 'Wix Madefor Display', 'Helvetica Neue', Arial, sans-serif;
  --shell-text: 'Wix Madefor Text', 'Helvetica Neue', Arial, sans-serif;
  --shell-green-top: rgb(107, 165, 91);
  --shell-green-bottom: rgb(98, 152, 84);
}

/* The game area is directly below the header. The page behind it is the
   website's dark grey. */
div#game-stage {
  position: absolute;
  left: 0;
  width: 100%;
  top: var(--shell-h);
  height: calc(100% - var(--shell-h));
  overflow: hidden;
}
div#game-stage:fullscreen { top: 0; height: 100%; background: #2F2F2A; }
div#game-stage:-webkit-full-screen { top: 0; height: 100%; background: #2F2F2A; }

.shell-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: var(--shell-h);
  box-sizing: border-box;
  padding-right: var(--sbw);
  z-index: 20;
  background: linear-gradient(var(--shell-green-top) 0%, var(--shell-green-bottom) 100%);
  box-shadow: rgba(237, 249, 222, 0.55) 0 1px 0 0 inset, rgba(12, 21, 8, 0.42) 0 5px 8px -2px;
  font-family: var(--shell-display);
  color: #fff;
  -webkit-font-smoothing: antialiased;
}
/* the dark ledge along the bottom edge, as on the website */
.shell-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; pointer-events: none; z-index: 1;
  background: rgb(64, 95, 50);
  box-shadow: rgba(187, 218, 158, 0.25) 0 1px 0 inset, rgba(21, 36, 15, 0.5) 0 1px 0;
}
.shell-header *, .shell-menu * { box-sizing: border-box; }
.shell-header a { color: inherit; text-decoration: none; }
.shell-header a.is-play, .shell-menu-panel a.is-play-row { cursor: pointer; }

/* The grid: three columns in the website's proportions, never wider than 1440px */
.shell-inner {
  height: 100%;
  max-width: 1440px;
  margin-left: clamp(0px, calc((100% - 1440px) / 2), 100vw);
  display: grid;
  grid-template-columns: 0.577234fr 1.03114fr 0.391686fr;
  grid-template-rows: minmax(78px, auto);
}

/* ---- Logo: mark and ".com" ---- */
.shell-logo-cell {
  grid-area: 1 / 1 / 2 / 2;
  width: 150px; min-height: 71.7031px;
  margin-left: max(0.5px, calc(0.0192688 * var(--sf)));
  place-self: center start;
  display: grid; grid-template-rows: 1fr; grid-template-columns: minmax(0, 1fr);
}
.shell-logo-box {
  width: max-content; min-height: 73.2578px;
  place-self: start center;
  margin-top: min(-0.5px, calc(-0.001229 * var(--sf)));
  margin-right: max(0.5px, calc(0.0003954 * var(--sf)));
  display: flex; flex-direction: row;
  transform: scale(1.18); transform-origin: left center;   /* the website adds this on screens over 750px */
}
.shell-logo-mark {
  order: 1; position: relative; display: block;
  width: max(0.5px, calc(0.0621631 * var(--sf)));
  aspect-ratio: 1 / 0.6612723214285714;
  margin-right: min(-0.5px, calc(-0.0027668 * var(--sf)));
  align-self: center;
  transform: translateY(7.6px) scale(1.12); transform-origin: left center;
}
.shell-logo-mark svg { position: absolute; inset: 0; margin: auto; width: 100%; height: 100%; fill: #fff; }
.shell-com {
  order: 2; position: relative;
  width: max(0.5px, calc(0.0411067 * var(--sf)));
  margin-top: min(-0.5px, calc(-0.0118577 * var(--sf)));
  align-self: center;
  transform: translate(9.55px, 8.45px);
  font-size: max(0.5px, calc(0.0158103 * var(--sf)));
  line-height: 1.3em; font-weight: 700; letter-spacing: 0; white-space: nowrap;
}

/* ---- Menu ---- */
.shell-nav-cell {
  grid-area: 1 / 2 / 2 / 3;
  min-height: 90px; place-self: start stretch;
  padding-right: max(0.5px, calc(0.0711462 * var(--sf)));
  display: grid; grid-template-rows: 1fr; grid-template-columns: minmax(0, 1fr);
}
.shell-nav-inner {
  grid-area: 1 / 1 / 2 / 2; position: relative;
  width: 94.9499%; min-height: 44.9609px; place-self: center;
  margin-right: max(0.5px, calc(0.0004152 * var(--sf)));
}
.shell-nav {
  position: absolute; right: 0; top: 50%;
  margin-right: min(-0.5px, calc(-0.0116601 * var(--sf)));
  width: 102.779%;
  padding: 6px;
  transform: translateY(calc(-50% + 7px));
}
.shell-nav ul { display: flex; gap: 10px 12px; margin: 0; padding: 0; list-style: none; width: 100%; min-width: 0; }
.shell-nav li { display: flex; flex: 1 1 auto; min-width: 0; min-height: 60px; }   /* boxes grow to fill the menu, and shrink their side padding on narrower windows, as the website's do */
.shell-nav a {
  display: flex; align-items: center; justify-content: center; width: 100%; min-width: 0;
  padding: 0 35px; border-radius: 12px;
  font-size: max(0.5px, calc(0.0171875 * var(--sf)));
  line-height: 1.4em; font-weight: 700; white-space: nowrap;
  transition: background-color .18s, box-shadow .18s, transform .18s;
}
.shell-nav a:hover { background-color: rgba(236, 244, 223, 0.16); }
.shell-nav a:focus-visible { outline: 2px solid rgb(252, 252, 245); outline-offset: 4px; border-radius: 6px; }

/* Play: always the raised, off-white button. Pressing sinks it into the
   header, as a real button would. */
.shell-header a.is-play, .shell-header a.is-play:hover {
  color: rgb(41, 67, 34);
  background: linear-gradient(rgb(247, 250, 239) 0%, rgb(236, 244, 223) 48%, rgb(227, 237, 207) 100%);
  box-shadow: rgba(255, 255, 255, 0.95) 0 1px 0 0 inset, rgba(255, 255, 255, 0.3) 0 0 0 1px inset,
              rgb(64, 92, 52) 0 5px 0 0, rgba(25, 43, 18, 0.22) 0 8px 10px 0;
}
.shell-header a.is-play:hover { background: linear-gradient(rgb(255, 255, 255) 0%, rgb(241, 247, 231) 55%, rgb(232, 240, 218) 100%); }
.shell-header a.is-play:active {
  transform: translateY(2px);
  box-shadow: rgba(255, 255, 255, 0.8) 0 1px 0 0 inset, rgb(64, 92, 52) 0 3px 0 0, rgba(25, 43, 18, 0.18) 0 4px 6px 0;
}

/* ---- Right side: the fullscreen button, and the account spot ---- */
.shell-right-cell { grid-area: 1 / 3 / 2 / 4; place-self: center end; }
.shell-right { display: flex; align-items: center; gap: 14px; margin-right: 24px; }
.shell-icon-btn {
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px;
  background: transparent; color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.shell-icon-btn:hover { background: rgba(255, 255, 255, 0.13); }
.shell-icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.shell-burger { display: none; }
/* The menu button shows bars, and a cross while the menu is open */
.shell-burger .cross { display: none; }
.shell-burger[aria-expanded="true"] .bars { display: none; }
.shell-burger[aria-expanded="true"] .cross { display: inline; }

/* The account icon is built but kept hidden until sign-in routing exists
   (milestone M4). Remove the hidden attribute in index.html to show it. */
.shell-account {
  width: 39px; height: 39px; border-radius: 50%;
  background: rgb(252, 252, 245); color: rgb(47, 47, 42);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: rgba(242, 249, 230, 0.55) 0 0 0 1px, rgba(42, 66, 32, 0.55) 0 3px 0 0, rgba(25, 43, 18, 0.18) 0 5px 8px 0;
}
.shell-account[hidden] { display: none; }
.shell-account svg { width: 22px; height: 22px; fill: currentColor; }
.shell-icon-btn[hidden], .shell-menu[hidden], .shell-dialog-wrap[hidden], .shell-footer[hidden], .shell-dialog-note[hidden] { display: none; }

/* Privacy and Terms, in the empty strip under the game when the window leaves
   at least 24px there (index.html decides). */
.shell-footer { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font-family: var(--shell-text); font-size: 12px; line-height: 16px; color: rgba(255, 255, 255, 0.6); z-index: 2; }
.shell-footer a { color: inherit; text-decoration: none; padding: 0 6px; }
.shell-footer a:hover { color: #fff; text-decoration: underline; }
div#game-stage:fullscreen .shell-footer, div#game-stage:-webkit-full-screen .shell-footer { display: none; }

/* ---- 751 to 1000px wide: the website's tablet sizes. The menu becomes Play
   and a menu button. ---- */
@media (max-width: 1000px) {
  .shell-inner { display: flex; align-items: center; }
  .shell-logo-cell { flex: none; }
  .shell-logo-mark { width: max(0.5px, calc(0.1084752 * var(--sf))); aspect-ratio: 1 / 0.66110183639399; }
  .shell-com { width: max(0.5px, calc(0.0690571 * var(--sf))); margin-top: min(-0.5px, calc(-0.0199203 * var(--sf))); font-size: max(0.5px, calc(0.0265604 * var(--sf))); }
  .shell-nav-cell { margin-left: auto; min-height: 0; padding: 0; display: block; place-self: auto; }
  .shell-nav-inner { width: auto; min-height: 0; margin: 0; }
  .shell-nav { position: static; transform: none; margin: 0; width: auto; padding: 0; }
  .shell-nav li:not(.play-item) { display: none; }
  .shell-nav li { min-height: 0; }
  .shell-nav a { padding: 8px 20px; font-size: 16px; line-height: 20px; border-radius: 10px; }
  .shell-header a.is-play { box-shadow: rgba(255, 255, 255, 0.95) 0 1px 0 0 inset, rgb(64, 92, 52) 0 3px 0 0, rgba(25, 43, 18, 0.22) 0 5px 6px 0; }
  .shell-right-cell { place-self: auto; }
  .shell-right { gap: 0; margin: 0 6px 0 8px; }
  .shell-burger { display: inline-flex; }
  .shell-footer { display: none; }
}

/* ---- Up to 750px wide: a phone upright. 72px bar; the logo uses the website's phone sizes ---- */
@media (max-width: 750px) {
  :root { --shell-h: 72px; }
  .shell-logo-cell { width: auto; min-height: 0; margin-left: calc(0.0313 * var(--sf)); }   /* the website's phone header starts the logo about 12px in */
  .shell-logo-box { min-height: 0; place-self: center; margin-top: 0; margin-right: 0; transform: none; align-self: center; }
  .shell-logo-mark { width: max(0.5px, calc(0.209968 * var(--sf))); aspect-ratio: 1 / 0.6604166666666668; margin-right: min(-0.5px, calc(-0.008 * var(--sf))); margin-top: max(0.5px, calc(0.0085013 * var(--sf))); align-self: flex-start; transform: none; }
  .shell-com { width: max(0.5px, calc(0.1386667 * var(--sf))); margin-top: min(-0.5px, calc(-0.04 * var(--sf))); font-size: max(0.5px, calc(0.0533336 * var(--sf))); transform: none; }
}

/* ---- Windows under 760px high: the same look in 64px, fixed sizes ---- */
@media (max-height: 759px) and (min-width: 751px) {
  :root { --shell-h: 64px; }
  .shell-logo-cell { margin-left: 24px; transform: scale(0.62); transform-origin: left center; }
  /* the website drops the logo 7.6px for its taller bar: not needed in 64px */
  .shell-logo-mark { transform: scale(1.12); }
  .shell-com { transform: translate(9.55px, 0.85px); }
}
@media (max-height: 759px) and (min-width: 1001px) {
  .shell-inner { grid-template-rows: 100%; }   /* one row exactly as tall as the 64px bar, so nothing sits low */
  .shell-nav-cell { display: flex; justify-content: center; align-items: center; min-height: 0; padding: 0; place-self: stretch; }
  .shell-nav-inner { width: auto; min-height: 0; margin: 0; place-self: auto; }
  .shell-nav { position: static; transform: none; margin: 0; width: auto; padding: 0; }
  .shell-nav ul { gap: 8px; width: auto; min-width: 0; }
  .shell-nav li { flex-grow: 0; min-height: 0; }
  .shell-nav a { padding: 10px 24px; font-size: 18px; line-height: 24px; border-radius: 10px; width: auto; }
}

/* The phone bar's menu button, and the phone menu */
@media (max-width: 1000px), (max-height: 500px) { .shell-burger { display: inline-flex; } }

/* ---- Phone turned sideways: no bar. Only a small round menu button floats at
   the top left, over the dark edge; its menu holds everything, Play first. ---- */
@media (max-height: 500px) {
  :root { --shell-h: 0px; }
  .shell-header { height: 0; padding: 0; background: none; box-shadow: none; }
  .shell-header::after { display: none; }
  .shell-inner { display: block; }
  .shell-logo-cell, .shell-nav-cell, #shell-fs, .shell-account { display: none; }
  .shell-right-cell { position: static; }
  .shell-right { margin: 0; display: block; }
  .shell-burger {
    position: absolute; left: 8px; top: 8px; width: 40px; height: 40px; border-radius: 20px;
    background: rgba(98, 152, 84, 0.92); box-shadow: rgba(12, 21, 8, 0.5) 0 2px 6px;
  }
  .shell-burger:hover { background: rgba(98, 152, 84, 0.92); }
  .shell-menu .shell-menu-panel { display: flex; flex-direction: column; width: 240px; margin: 8px 0 0 8px; border-radius: 14px; max-height: calc(100% - 16px); overflow-y: auto; padding-top: 52px; }
  .shell-menu-panel a.is-play-row { order: -1; }
}

/* The phone menu: slides down from under the bar */
.shell-menu { position: absolute; left: 0; right: 0; top: var(--shell-h); bottom: 0; z-index: 19; background: rgba(0, 0, 0, 0.8); }
.shell-menu-panel {
  background: linear-gradient(var(--shell-green-top) 0%, var(--shell-green-bottom) 100%);
  box-shadow: rgba(12, 21, 8, 0.42) 0 8px 12px -2px;
  padding: 8px 12px 12px;
  font-family: var(--shell-text);
  transform: translateY(-12px); opacity: 0;
  transition: transform .18s ease-out, opacity .18s ease-out;
}
.shell-menu.open .shell-menu-panel { transform: none; opacity: 1; }
.shell-menu-panel a { display: flex; align-items: center; min-height: 46px; padding: 0 16px; border-radius: 12px; color: #fff; text-decoration: none; font-size: 16px; font-weight: 500; }
.shell-menu-panel a:active { background: rgba(27, 51, 20, 0.28); }
/* Play, the page the player is on, is the highlighted row */
.shell-menu-panel a.is-play-row {
  color: rgb(41, 67, 34); font-weight: 700;
  background: linear-gradient(rgb(247, 250, 239) 0%, rgb(236, 244, 223) 48%, rgb(227, 237, 207) 100%);
  box-shadow: rgb(64, 92, 52) 0 3px 0 0;
  margin-bottom: 3px;
}
.shell-menu-panel .shell-menu-legal { display: flex; gap: 4px; margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(237, 249, 222, 0.3); order: 5; }
.shell-menu-panel .shell-menu-legal a { min-height: 44px; font-size: 14px; font-weight: 400; color: rgba(255, 255, 255, 0.9); }

/* "Leave your game?" in the Batre style */
.shell-dialog-wrap { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.7); display: flex; align-items: center; justify-content: center; padding: 16px; }
.shell-dialog {
  width: min(100%, 380px); padding: 24px 22px 20px; border-radius: 16px;
  background: #2F2F2A; color: #fff; text-align: center;
  box-shadow: rgba(237, 249, 222, 0.25) 0 0 0 1px inset, rgba(0, 0, 0, 0.5) 0 12px 32px;
  font-family: var(--shell-text);
}
.shell-dialog h2 { margin: 0 0 8px; font-family: var(--shell-display); font-size: 24px; line-height: 30px; font-weight: 700; }
.shell-dialog p { margin: 0 0 20px; font-size: 16px; line-height: 22px; color: rgba(255, 255, 255, 0.85); }
.shell-dialog-buttons { display: flex; gap: 12px; }
.shell-dialog button {
  flex: 1; min-height: 48px; border: 0; border-radius: 12px; cursor: pointer;
  font-family: var(--shell-display); font-size: 18px; font-weight: 700; color: #fff;
  background: rgba(255, 255, 255, 0.12);
  -webkit-tap-highlight-color: transparent;
}
/* Stay is the safe, default choice, so it is the raised green one */
.shell-dialog button.stay {
  background: linear-gradient(rgb(247, 250, 239) 0%, rgb(236, 244, 223) 48%, rgb(227, 237, 207) 100%);
  color: rgb(41, 67, 34);
  box-shadow: rgb(64, 92, 52) 0 4px 0 0;
}
.shell-dialog button:focus-visible, .shell-header a:focus-visible, .shell-icon-btn:focus-visible, .shell-menu-panel a:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* the line that appears when the browser blocks the new tab */
.shell-dialog .shell-dialog-note { margin: -8px 0 16px; font-size: 14px; line-height: 19px; color: rgb(255, 214, 160); }
