/*
 * Beans Out — Setsubun on an arcade cabinet.
 *
 * Same rules as the rest of public/play: plain CSS, no build step, palette
 * hand-copied from the site tokens (see docs/games.md). Shares the two pixel
 * faces with Mug Climb, Stagger Home and Beer Pong; this is the fourth game
 * in that family and is meant to read as part of it.
 */

.mm-hud[hidden], .mm-touch[hidden], .mm-screen[hidden], .mm-initials[hidden],
.mm-keys[hidden], .mm-record[hidden], .mm-btns[hidden], #fuku-count[hidden] {
  display: none !important;
}

.mm-stage canvas { display: block; width: 100%; height: 100%; background: #0a0713; }

:root {
  --mm-gold: #ffc93c;
  --mm-red: #d8382e;
  --mm-blue: #4a86e8;
  --mm-paper: #efe7d2;
  --mm-ink: #fff6e0;
  --mm-panel: rgba(10, 6, 20, 0.84);
  --mm-line: #46305c;
  --mm-num: "Press Start 2P", "Courier New", monospace;
  --mm-px: "DotGothic16", "Courier New", monospace;
}

/* ---- HUD ---------------------------------------------------------------- */

.mm-hud {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  display: flex; flex-direction: column;
  padding: 10px 10px 0; font-family: var(--mm-px);
}
.mm-hud-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }


.mm-panel { background: var(--mm-panel); border: 2px solid var(--mm-line);
  border-bottom-width: 4px; padding: 6px 8px; display: flex; flex-direction: column;
  gap: 3px; line-height: 1; }
.mm-panel.mm-right { align-items: flex-end; }
.mm-panel.mm-mid { align-items: center; }

.mm-lbl { font-family: var(--mm-num); font-size: 7px; letter-spacing: .12em;
  color: rgba(255, 246, 224, 0.55); }
.mm-score { font-family: var(--mm-num); font-size: 13px; color: var(--mm-gold);
  font-variant-numeric: tabular-nums; }
.mm-wave { font-family: var(--mm-num); font-size: 13px; color: var(--mm-ink); }
.mm-best { font-family: var(--mm-num); font-size: 11px;
  color: rgba(255, 246, 224, 0.7); font-variant-numeric: tabular-nums; }

/* Lives are the paper oni masks children wear on the night. */
.mm-masks { display: flex; gap: 5px; margin-top: 2px; }
.mm-masks i { display: block; width: 15px; height: 16px; background: var(--mm-red);
  clip-path: polygon(20% 0, 34% 16%, 66% 16%, 80% 0, 92% 44%, 74% 100%, 26% 100%, 8% 44%); }
.mm-masks i.spent { background: rgba(255, 246, 224, 0.15); }

.mm-fuku { font-family: var(--mm-num); font-size: 7px; letter-spacing: .1em;
  color: var(--mm-gold); margin-top: 2px; }

.mm-toast {
  position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%);
  font-family: var(--mm-num); font-size: 14px; letter-spacing: .05em;
  color: var(--mm-gold); text-shadow: 0 3px 0 #7a3b00; opacity: 0;
  transition: opacity 130ms linear; z-index: 3; pointer-events: none;
  text-align: center; white-space: nowrap;
}
.mm-toast[data-show="true"] { opacity: 1; }
.mm-toast[lang="ja"] { font-family: var(--mm-px); font-size: 26px; }

/* ---- panels ------------------------------------------------------------- */

.mm-screen { position: absolute; inset: 0; z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  background: rgba(6, 4, 14, 0.9); overflow-y: auto; }
.mm-screen p { max-width: 30rem; }

.mm-logo { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0; }
.mm-logo span { font-family: var(--mm-px); font-size: 46px; color: var(--mm-gold);
  letter-spacing: .08em; line-height: 1; text-shadow: 0 4px 0 #7a3b00; }
.mm-logo em { font-family: var(--mm-num); font-style: normal; font-size: 13px;
  letter-spacing: .1em; color: var(--mm-ink); }
.mm-logo.mm-small span { font-size: 30px; }
.mm-logo.mm-small em { font-size: 10px; }

.mm-fine { font-family: var(--mm-px); font-size: 12px; text-align: center;
  color: rgba(255, 246, 224, 0.5); }
.mm-fine span { color: var(--mm-gold); }

.mm-stats { display: flex; gap: 10px; }
.mm-stat { background: var(--mm-panel); border: 2px solid var(--mm-line);
  border-bottom-width: 4px; padding: 8px 10px; min-width: 78px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mm-stat b { font-family: var(--mm-num); font-size: 14px; color: var(--mm-gold);
  font-variant-numeric: tabular-nums; }
.mm-stat span { font-family: var(--mm-px); font-size: 11px; color: rgba(255, 246, 224, 0.6); }

.mm-signoff { font-family: var(--mm-px); font-size: 13px; text-align: center;
  color: rgba(255, 246, 224, 0.78); max-width: 26rem; }
.mm-record { font-family: var(--mm-num); font-size: 9px; letter-spacing: .1em;
  color: var(--mm-gold); }

.mm-keys { display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-family: var(--mm-px); font-size: 12px; color: rgba(255, 246, 224, 0.62); }
.mm-keys kbd { font-family: var(--mm-num); font-size: 8px; padding: 4px 6px;
  background: #241d3d; border: 2px solid var(--mm-line); color: var(--mm-ink); }
.mm-keys i { font-style: normal; }

.mm-initials { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  justify-content: center; font-family: var(--mm-px); font-size: 12px;
  color: rgba(255, 246, 224, 0.75); }
.mm-initials input { width: 5.2rem; font-family: var(--mm-num); font-size: 14px;
  text-align: center; text-transform: uppercase; letter-spacing: .18em;
  padding: 8px 6px; background: #120e22; border: 2px solid var(--mm-line);
  color: var(--mm-gold); }
.mm-initials input:focus-visible { outline: 2px solid var(--mm-gold); outline-offset: 2px; }

.mm-btn-gold { border-color: rgba(255, 201, 60, 0.6) !important; color: var(--mm-gold) !important; }

/* ---- board -------------------------------------------------------------- */

.mm-board { width: min(100%, 22rem); display: flex; flex-direction: column; gap: 3px; }
.mm-board h3 { margin: 6px 0 2px; font-family: var(--mm-num); font-size: 7px;
  letter-spacing: .12em; color: rgba(255, 246, 224, 0.45); text-align: center; }
.mm-row { display: flex; gap: 8px; align-items: baseline; font-family: var(--mm-num);
  font-size: 9px; padding: 4px 8px; background: rgba(10, 6, 20, 0.6);
  border-left: 3px solid transparent; }
.mm-row .r { width: 1.6em; color: rgba(255, 246, 224, 0.4); }
.mm-row .n { flex: 1; color: var(--mm-ink); letter-spacing: .1em; }
.mm-row .o { color: rgba(255, 246, 224, 0.45); font-size: 8px; }
.mm-row .s { color: var(--mm-gold); font-variant-numeric: tabular-nums; }
.mm-row.me { border-left-color: var(--mm-gold); background: rgba(255, 201, 60, 0.1); }
.mm-empty-row { font-family: var(--mm-px); font-size: 12px; text-align: center;
  color: rgba(255, 246, 224, 0.35); padding: 6px; }

/* ---- touch controls ------------------------------------------------------
   Mug Climb's geometry again: 84px arrows with 28px of clear air between them,
   a deliberately larger action button on the right, everything lifted clear of
   the home indicator. Four games now share it, so nobody relearns the pad. */
.mm-touch { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.mm-touch * { pointer-events: none; }

.mm-tbtn { position: absolute; width: 84px; height: 84px;
  bottom: calc(54px + env(safe-area-inset-bottom, 0px));
  background: rgba(46, 32, 68, 0.72); border: 3px solid #5c4489;
  border-bottom-width: 6px; color: var(--mm-ink); font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  user-select: none; -webkit-user-select: none; }
.mm-tbtn.press { background: var(--mm-gold); color: #3a1400;
  border-color: #a06a00; transform: translateY(3px); }

#tL { left: 14px; }
#tR { left: 126px; }
.mm-tthrow { right: 14px; width: 124px; height: 124px;
  bottom: calc(46px + env(safe-area-inset-bottom, 0px)); }
.mm-tthrow span { font-family: var(--mm-px); font-size: 44px; }

body.mm-touch-on .mm-hud { padding-bottom: calc(178px + env(safe-area-inset-bottom, 0px)); }

@media (orientation: landscape) and (max-height: 520px) {
  .mm-logo span { font-size: 30px; }
  .mm-screen { gap: 8px; padding-top: 8px; padding-bottom: 8px; }
}
