/* The Menu (docs/THEMENU.md 5 and 7.5): the button, the sheet over the game, the grid, one entry in full, and the toast.
   Used by index.html (the game) and card.html (the public page). The house palette and Pixelify Sans; every picture is a
   16 by 12 canvas scaled by a whole number (4x in the grid, 8x in an entry, 2x in the toast), drawn crisp. */

/* the button: a small red book and "Menu 12/151" */
.menubtn{ font:inherit; font-size:15px; font-weight:700; color:var(--ink); background:var(--white); border:3px solid var(--ink);
  border-radius:0; display:inline-flex; align-items:center; gap:6px; padding:3px 10px 3px 7px; min-height:38px;
  box-shadow:0 3px 0 var(--ink); cursor:pointer; touch-action:manipulation; white-space:nowrap; line-height:1; }
.menubtn svg{ display:block; flex:none; }
.menubtn .mlabel{ display:block; }
.menubtn:active{ transform:translateY(2px); box-shadow:0 1px 0 var(--ink); }
.menubtn:focus-visible{ outline:3px dashed var(--ketchup); outline-offset:2px; }
@media (prefers-reduced-motion: reduce){ .menubtn:active{ transform:none; } }

/* the sheet: full screen over the running game */
.booksheet{ position:absolute; inset:0; z-index:45; display:none; flex-direction:column; background:var(--butter); }
.booksheet.on{ display:flex; }
.booksheet:focus{ outline:none; }
.bstrip{ flex:none; margin:0; min-height:32px; max-height:52px; padding:6px 12px 5px; font-size:14px; font-weight:600; line-height:1.25;
  background:var(--white); color:var(--ink); border-bottom:3px solid var(--ink); overflow:hidden; }
.bstrip.hot{ background:var(--ketchup); color:var(--white); }
.bbody{ position:relative; flex:1; min-height:0; display:flex; flex-direction:column; }
/* the roof and its sign, as the storefront draws them */
.bhead{ flex:none; display:flex; align-items:center; gap:10px; padding:10px 12px;
  background:repeating-linear-gradient(90deg,#8E3B1F 0 9px,#9E4A2A 9px 18px); border-bottom:3px solid var(--ink); }
.bsign{ flex:1; min-width:0; background:var(--white); border:3px solid var(--ink); box-shadow:inset 0 0 0 4px var(--ketchup); padding:6px 10px 5px; text-align:center; }
.bsign h2,.bsign h1{ margin:0; font-size:26px; line-height:1; color:var(--ketchup); text-shadow:2px 2px 0 var(--ink); white-space:nowrap; }
.bback{ font:inherit; font-size:16px; font-weight:700; color:var(--ink); background:var(--white); border:3px solid var(--ink); border-radius:0;
  min-height:44px; padding:6px 12px; box-shadow:0 3px 0 var(--ink); cursor:pointer; touch-action:manipulation; flex:none; }
.bback:active{ transform:translateY(2px); box-shadow:0 1px 0 var(--ink); }
.bback:focus-visible,.bcell:focus-visible,.menutoast:focus-visible{ outline:3px dashed var(--ketchup); outline-offset:2px; }
/* the awning under the roof: ketchup and white, with the scalloped edge */
.awning{ flex:none; height:22px; border-bottom:0;
  background:
    repeating-linear-gradient(90deg,var(--ketchup) 0 18px,var(--white) 18px 36px) 0 0/100% 15px no-repeat,
    repeating-linear-gradient(90deg,transparent 0 3px,var(--ketchup) 3px 15px,transparent 15px 21px,var(--white) 21px 33px,transparent 33px 36px) 0 15px/100% 7px no-repeat; }
/* the two tabs under the awning (docs/HUD.md 2): Menu, the book, and Stats, this visit's numbers */
.btabs{ flex:none; display:grid; grid-template-columns:1fr 1fr; margin:8px 12px 4px; border:3px solid var(--ink); background:var(--white); box-shadow:0 3px 0 var(--ink); }
.btab{ font:inherit; font-size:16px; font-weight:700; line-height:1; color:var(--ink); background:var(--white); border:0; border-radius:0; min-height:40px; padding:6px 8px;
  cursor:pointer; touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
.btab + .btab{ border-left:3px solid var(--ink); }
.btab[aria-selected="true"]{ background:var(--ink); color:var(--butter); }
.btab:focus-visible{ outline:3px dashed var(--ketchup); outline-offset:-5px; }
/* (position and z-index: the pane is its own stacking context, so a cell lifted for the moment's slip or pop stays under the entry's slip) */
.bscroll{ position:relative; z-index:1; flex:1; min-height:0; overflow-y:auto; padding:6px 12px 28px; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
.bscroll[hidden]{ display:none; }
.bsh{ margin:0 0 6px; font-size:13px; font-weight:700; color:var(--muted); }
.bsrows .drow{ font-size:17px; padding:4px 0; border-bottom:2px dashed rgba(58,36,20,.35); }
.bsrows .drow:last-child{ border-bottom:0; }
.bsrows .drow span:last-child{ font-weight:700; text-align:right; }
.blife{ margin:0; font-size:16px; line-height:1.35; }
.bstats .btot{ margin-bottom:12px; }
/* the totals, on receipt paper */
.btot{ background:var(--white); border:3px solid var(--ink); box-shadow:0 4px 0 var(--ink); padding:10px 12px 11px; margin:4px 0 14px; }
.bcount{ margin:0; font-size:22px; font-weight:700; line-height:1.15; }
.bmeter{ position:relative; height:16px; margin-top:8px; border:3px solid var(--ink); background:var(--tile); overflow:hidden; }
.bmeter[hidden]{ display:none; }
.bmeter i{ position:absolute; left:0; top:0; bottom:0; width:0; }
.bmeter .ms{ background:var(--butter-deep); }
.bmeter .mh{ background:var(--ketchup); }
.bnote{ margin:8px 0 0; font-size:14px; line-height:1.3; color:var(--muted); }
.bnote[hidden]{ display:none; }
/* the grid: four across on a phone, three on the narrowest */
.bgrid{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
@media (max-width:359px){ .bgrid{ grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media (min-width:500px){ .bgrid{ grid-template-columns:repeat(5,minmax(0,1fr)); } }
.bcell{ font:inherit; color:var(--ink); position:relative; display:flex; flex-direction:column; align-items:center; justify-content:flex-start;
  gap:4px; min-width:0; min-height:114px; margin:0; padding:22px 3px 7px; background:var(--white); border:2px solid var(--ink);
  border-radius:0; cursor:pointer; text-align:center; touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
.bcell .bno{ position:absolute; top:0; left:0; padding:2px 5px 1px; font-size:11px; font-weight:700; line-height:1.2; color:var(--muted); }
.bcell.limited .bno{ background:var(--ketchup); color:var(--white); }
.bcell.vault .bno{ background:var(--ink); color:var(--butter); }
.bcell .bfig{ display:block; width:64px; height:48px; flex:none; }
.bspr,.dspr,.tspr{ display:block; image-rendering:pixelated; image-rendering:crisp-edges; }
.bcell .bspr{ width:64px; height:48px; }
.bcell .bn{ display:block; max-width:100%; font-size:12px; line-height:1.15; overflow-wrap:break-word; hyphens:manual; }
.bcell .bn.long{ font-size:10px; letter-spacing:-.02em; }
.bcell .bn.longer{ font-size:9px; letter-spacing:-.04em; }
.bcell.seen .bn{ color:var(--muted); }
.bcell.had{ border-width:3px; padding:21px 2px 6px; box-shadow:0 3px 0 var(--ink); }
.bcell .bhad{ position:absolute; top:-3px; right:-3px; font-size:10px; font-weight:700; line-height:1.2; padding:1px 3px;
  background:var(--ketchup); color:var(--white); border:2px solid var(--ink); }
.bcell.unknown{ background:var(--tile); border-style:dashed; justify-content:center; padding-top:16px; }
.bcell .bq{ font-size:22px; font-weight:700; letter-spacing:2px; color:rgba(58,36,20,.4); }
.bcell:active{ transform:translateY(1px); }
@media (prefers-reduced-motion: reduce){ .bcell:active,.bback:active{ transform:none; } }
/* docs/SCARCITY.md 4: the mark for the three rarest words, pips under the name (one rare, two super rare, three ultra rare) */
.bcell .brare{ display:flex; gap:3px; margin-top:auto; padding-top:3px; }
.bcell .brare .pip{ display:block; width:7px; height:7px; background:var(--ketchup); border:2px solid var(--ink); }
.bcell.seen .brare .pip{ background:var(--tile); }
/* docs/SCARCITY.md 5, the moment: the cell pops (up and back with a ketchup flash) and a slip rises under it, over the row below */
.bcell.marked{ z-index:3; }
.bcell.pop{ animation:bppop .6s ease-out; z-index:4; }
@keyframes bppop{ 0%{ transform:none; box-shadow:0 3px 0 var(--ink); } 35%{ transform:scale(1.14); box-shadow:0 0 0 7px var(--ketchup); } 100%{ transform:none; box-shadow:0 3px 0 var(--ink); } }
.bcell .bslip{ position:absolute; left:-7px; right:-7px; top:calc(100% + 4px); margin:0; padding:4px 5px 5px; font-size:11px; font-weight:700; line-height:1.2; text-align:center;
  background:var(--white); color:var(--ink); border:2px solid var(--ink); box-shadow:0 3px 0 var(--ink); animation:bpslip .22s ease-out; }
@media (prefers-reduced-motion: reduce){ .bcell.pop,.bcell .bslip{ animation:none; } }
.bpub{ margin:18px 0 0; text-align:center; font-size:15px; }
.bpub a{ color:var(--ink); font-weight:600; }
.bpub a[hidden]{ display:none; }
/* docs/THEMENU.md 7.8: one quiet line under the book: save the Menu to an account, or sign this phone out of it */
.bacct{ margin:14px 0 0; text-align:center; font-size:14px; line-height:1.4; color:var(--muted); }
.bacct[hidden]{ display:none; }
.bacct .linkbtn{ display:block; margin:2px auto 0; font-size:15px; font-weight:600; color:var(--ink); padding:6px 4px; }
.bacct .linkbtn[hidden]{ display:none; }

/* one entry in full, over the grid, under the strip */
.bdetail{ position:absolute; inset:0; z-index:2; display:none; flex-direction:column; background:var(--butter); }
.bdetail.on{ display:flex; }
.bdbar{ flex:none; display:flex; align-items:center; gap:12px; padding:10px 12px; background:var(--white); border-bottom:3px solid var(--ink); }
.bdtitle{ margin:0; font-size:18px; font-weight:700; }
.bdbox{ flex:1; min-height:0; overflow-y:auto; padding:14px 16px 28px; overscroll-behavior:contain; }
.dstage{ display:flex; justify-content:center; align-items:flex-end; min-height:132px; padding:18px 0 14px; border:3px solid var(--ink);
  background:repeating-conic-gradient(var(--white) 0 25%, var(--tile) 0 50%) 0 0/28px 28px; box-shadow:0 4px 0 var(--ink); }
.dstage .dspr{ width:128px; height:96px; }
.dstage.unknown{ align-items:center; background:var(--tile); border-style:dashed; box-shadow:none; }
.dq{ font-size:52px; font-weight:700; letter-spacing:4px; color:rgba(58,36,20,.4); }
.dpaper{ margin-top:14px; background:var(--white); border:3px solid var(--ink); box-shadow:0 5px 0 var(--ink); padding:14px 14px 16px; }
.dpaper hr{ border:0; border-top:2px dashed var(--ink); margin:12px 0; }
.dhead{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.dno{ margin:0; font-size:30px; font-weight:700; line-height:1; color:var(--ketchup); text-shadow:2px 2px 0 var(--ink); }
.dname{ margin:8px 0 0; font-size:26px; line-height:1.1; overflow-wrap:anywhere; }
.dtier{ flex:none; display:inline-block; font-size:14px; font-weight:700; padding:2px 7px; border:2px solid var(--ink); background:var(--white); color:var(--ketchup); }
.dtier.limited{ background:var(--ketchup); color:var(--white); }
.dtier.vault{ background:var(--ink); color:var(--butter); }
.dtier.core{ color:var(--ink); }
.drow{ display:flex; justify-content:space-between; align-items:baseline; gap:10px; padding:2px 0; font-size:18px; }
.drow.big{ font-size:24px; font-weight:700; }
.drow.no span:last-child{ color:var(--muted); }
/* docs/SCARCITY.md 4: the rarity word and "N ever", then "Yours" and the first number */
.drow.rare span:first-child{ font-weight:700; color:var(--ketchup); }
.drow.yours span:last-child{ font-weight:700; }
.dline{ margin:10px 0 0; font-size:16px; color:var(--muted); }
.dpaper.unknown .dline{ margin-top:8px; }
.dserh{ margin:0; font-size:13px; font-weight:700; color:var(--muted); }
.dfirst{ margin:6px 0 0; font-size:46px; font-weight:700; line-height:1; color:var(--ketchup); text-shadow:3px 3px 0 var(--ink); letter-spacing:1px; }
.drest{ margin:10px 0 0; font-size:17px; line-height:1.35; overflow-wrap:anywhere; }
.dblurb{ margin:0; font-size:16px; line-height:1.35; color:var(--ink); }

/* the toast: a slip in the top right corner, over the Menu button it belongs to and as tall as the game's top row (44 px),
   so it covers neither your place at the left of that row, nor the world, nor the order sheet under the row (the phone
   review: it used to lie across the whole top of the screen). Tapping it opens The Menu at the new entry, as the button
   under it would open The Menu. At the bottom of the sheet while the sheet is open. */
.menutoast{ position:absolute; z-index:46; right:0; top:0; height:44px; max-width:70%; display:none; align-items:center; gap:8px; margin:0;
  padding:2px 10px 3px 8px; background:var(--white); color:var(--ink); border:0; border-left:3px solid var(--ink); border-bottom:3px solid var(--ink); border-radius:0;
  font:inherit; font-size:13px; font-weight:600; line-height:1.15; text-align:left; cursor:pointer; touch-action:manipulation; overflow:hidden; }
.menutoast.on{ display:flex; animation:bpslip .22s ease-out; }
.menutoast[hidden]{ display:none; }
.menutoast.insheet{ top:auto; bottom:12px; right:8px; left:8px; max-width:none; height:auto; min-height:48px; border:3px solid var(--ink); box-shadow:0 4px 0 var(--ink); }
.menutoast .tfig{ display:block; flex:none; width:32px; height:24px; }
.menutoast .tspr{ width:32px; height:24px; }
.menutoast .ttext{ min-width:0; overflow:hidden; }
.menutoast .ttext b{ display:block; color:var(--ketchup); font-weight:700; white-space:nowrap; }
.menutoast:not(.insheet) .ttext{ white-space:nowrap; text-overflow:ellipsis; }
.menutoast.insheet .ttext{ overflow-wrap:anywhere; font-size:15px; }
.menutoast.insheet .ttext b{ display:inline; }
@keyframes bpslip{ from{ transform:translateY(-8px); opacity:0; } to{ transform:none; opacity:1; } }
@media (prefers-reduced-motion: reduce){ .menutoast.on{ animation:none; } }
