/* =====================================================================
   Buzz Wire: a penny-arcade electric machine in a dim hall. The board
   (painted by game.js) sits behind its glass in a mahogany frame with
   brass terminals: copper wire on black ebonite, electric-blue sparks,
   orange paper tickets. Everything round it is the machine's enamel:
   cobalt plates with white lettering and a white keyline, brass rivets,
   the name in wood type (Holtwood One SC) and the rest in an old
   typefoundry roman (Old Standard TT). No stripes, no bulbs, no teal.
   ===================================================================== */

:root {
  --hall: #120b08;
  --hall-hi: #2a1912;
  --cobalt: #1f4ea6;
  --cobalt-hi: #2c62c4;
  --cobalt-dk: #143672;
  --white: #f4f6fb;
  --white-dim: rgba(244, 246, 251, 0.78);
  --brass: #c9a24a;
  --brass-hi: #ecd28c;
  --brass-dk: #7d5d1e;
  --copper: #c47a45;
  --spark: #8fd8ff;
  --ticket: #f29a38;
  --red: #e0675a;
  --rivet: radial-gradient(circle at 35% 35%, #f5e2a8 0 1.2px, #c9a24a 2px, #6e5016 3.4px, transparent 3.8px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Old Standard TT", Georgia, serif; color: var(--white);
  background:
    radial-gradient(ellipse at 50% 38%, rgba(196, 122, 69, 0.13), transparent 62%),
    radial-gradient(circle at 50% 50%, var(--hall-hi), var(--hall) 72%);
  background-color: var(--hall);
  overflow: hidden;
}
.nav-back-games {
  position: fixed; top: 14px; left: 16px; z-index: 50;
  font-family: "Old Standard TT", Georgia, serif; font-size: 14px; font-weight: 700; letter-spacing: 0.03em;
  color: var(--cobalt-dk); text-decoration: none;
  background: var(--white); border: 2px solid var(--cobalt); border-radius: 6px;
  box-shadow: inset 0 0 0 2px var(--white), inset 0 0 0 3px rgba(31, 78, 166, 0.45), 0 2px 0 var(--cobalt-dk), 0 4px 10px rgba(0, 0, 0, 0.4);
  padding: 6px 12px;
}
.nav-back-games:hover { background: #ffffff; }

kbd {
  font-family: inherit; font-size: 11px; font-weight: 700;
  color: var(--cobalt-dk); background: var(--white); border-radius: 3px; padding: 0 5px 1px; margin: 0 1px;
}

/* ---- the machine: the board with its plate and meters ------------------- */
.hall { position: fixed; inset: 0; }
.cabinet[hidden] { display: none; }
.cabinet { position: absolute; border-radius: 6px; box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.5); }
.cabinet canvas { position: absolute; left: 0; top: 0; display: block; border-radius: 6px; touch-action: none; cursor: crosshair; }
.log, .helm { position: absolute; }
.log[hidden], .helm[hidden] { display: none; }

.log { display: flex; flex-direction: column; gap: 4px; }
body.wide .log { align-items: flex-end; text-align: right; }
body.tall .log { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 2px 14px; text-align: center; }
.log-name { font-family: "Holtwood One SC", Georgia, serif; font-size: 15px; letter-spacing: 0.02em; color: var(--brass-hi); }
.log-stage { font-size: 13px; font-style: italic; color: var(--white-dim); }
.log-row { font-size: 13px; color: var(--white-dim); }
.log-row b { font-size: 18px; font-weight: 700; color: var(--white); font-variant-numeric: tabular-nums; }
.log-k { text-transform: uppercase; letter-spacing: 0.1em; font-size: 11px; }
.log-best { font-size: 13px; }
.log-best.won { color: var(--brass-hi); font-weight: 700; }

.helm { display: flex; flex-direction: column; gap: 8px; }
.meters { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.meter { font-size: 13px; color: var(--white-dim); display: inline-flex; align-items: center; gap: 6px; }
.meter b { font-size: 17px; font-weight: 700; color: var(--ticket); font-variant-numeric: tabular-nums; }
.meter-k { text-transform: uppercase; letter-spacing: 0.1em; font-size: 11px; }
/* the beat: four lamps, the one for this beat lit */
.beats { display: inline-flex; gap: 5px; }
.beats i { width: 11px; height: 11px; border-radius: 50%; background: #3a2a1c; box-shadow: inset 0 0 0 1px var(--brass-dk); }
.beats i.on { background: var(--spark); box-shadow: inset 0 0 0 1px #e9f7ff; }
html.fx-on .beats i.on { box-shadow: inset 0 0 0 1px #e9f7ff, 0 0 8px 2px rgba(143, 216, 255, 0.55); }
.status { font-size: 14px; line-height: 1.4; min-height: 2.8em; color: var(--white); }
.status.bad { color: #ffb4a8; }
.status.good { color: var(--brass-hi); font-weight: 700; }

/* enamel buttons: white with cobalt lettering; the main one brass */
.helm button, .card .row button {
  font-family: "Old Standard TT", Georgia, serif; font-size: 14px; font-weight: 700; letter-spacing: 0.03em; cursor: pointer;
  color: var(--cobalt-dk); background: var(--white);
  border: 2px solid var(--cobalt); border-radius: 6px; padding: 6px 12px;
  box-shadow: inset 0 0 0 2px var(--white), inset 0 0 0 3px rgba(31, 78, 166, 0.4), 0 2px 0 var(--cobalt-dk);
}
.helm button:hover, .card .row button:hover { background: #ffffff; }
.helm button:active, .card .row button:active { transform: translateY(1px); box-shadow: inset 0 0 0 2px var(--white), inset 0 0 0 3px rgba(31, 78, 166, 0.4); }
.card .row button.go, .playbtn {
  background: linear-gradient(175deg, #f5e2a8, #d9b25a 46%, #b88d32); color: #2a1a06; border-color: var(--brass-dk);
  box-shadow: inset 0 0 0 1px rgba(255, 246, 214, 0.65), 0 2px 0 var(--brass-dk);
}
.tools { display: flex; flex-wrap: wrap; gap: 8px; }
.keys { font-size: 12px; line-height: 1.5; color: var(--white-dim); font-style: italic; }

/* ---- the cards: cobalt enamel plates, riveted ---------------------------- */
.panel {
  position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
  padding: 26px 16px; overflow-y: auto; background: rgba(18, 11, 8, 0.55);
}
.panel[hidden] { display: none; }
.panel > .card { margin: auto; }
.card {
  width: min(460px, 100%); color: var(--white);
  background: var(--rivet) 8px 8px / 8px 8px no-repeat, var(--rivet) calc(100% - 8px) 8px / 8px 8px no-repeat,
              var(--rivet) 8px calc(100% - 8px) / 8px 8px no-repeat, var(--rivet) calc(100% - 8px) calc(100% - 8px) / 8px 8px no-repeat,
              linear-gradient(170deg, var(--cobalt-hi), var(--cobalt) 45%, var(--cobalt-dk));
  border-radius: 12px; position: relative;
  box-shadow: inset 0 0 0 2px rgba(13, 36, 82, 0.6), 0 3px 0 #0d2452, 0 16px 40px rgba(0, 0, 0, 0.55);
  padding: 24px 26px 20px;
}
/* the enamel's white keyline, a little in from the edge */
.card::before { content: ""; position: absolute; inset: 5px; border: 2px solid rgba(244, 246, 251, 0.85); border-radius: 8px; pointer-events: none; }
.card h1, .card h2 { font-family: "Holtwood One SC", Georgia, serif; font-weight: 400; color: var(--white); letter-spacing: 0.02em; }
.card h1 { font-size: 30px; line-height: 1.1; }
.card h1 span::after { content: ""; display: inline-block; width: 0.5em; height: 0.62em; margin-left: 0.25em; vertical-align: 0.05em;
  background: var(--ticket); clip-path: polygon(55% 0, 10% 58%, 45% 58%, 30% 100%, 90% 38%, 55% 38%, 75% 0); }
.card h2 { font-size: 21px; }
.card .tag { color: var(--brass-hi); font-style: italic; font-size: 14px; margin: 4px 0 10px; }
.card .how { font-size: 14px; line-height: 1.5; margin-bottom: 12px; color: var(--white); }
.pick { display: flex; align-items: center; gap: 12px; padding: 8px 10px; margin-bottom: 12px; border: 1.5px dashed rgba(244, 246, 251, 0.55); border-radius: 6px; background: rgba(13, 36, 82, 0.35); }
.pick canvas { flex: none; width: 76px; height: 76px; border-radius: 3px; }
.pick-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pick-text b { font-size: 16px; font-weight: 700; }
.pick-text small { font-size: 12.5px; color: var(--white-dim); line-height: 1.4; }
.playbtn {
  width: 100%; font-family: "Old Standard TT", Georgia, serif; font-size: 17px; font-weight: 700; letter-spacing: 0.04em; cursor: pointer;
  border: 2px solid var(--brass-dk); border-radius: 6px; padding: 9px 12px;
}
.playbtn:active { transform: translateY(1px); }
.levels-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; margin-bottom: 8px; }
.card .levels-head .levels-k { margin-bottom: 0; }
.tally { font-size: 13px; color: var(--white-dim); }

/* the levels: a stage to a row, its numeral first; one cleared is brass,
   one not yet open a faint dotted outline */
.levels { margin-top: 14px; }
.card .levels-k { font-size: 15px; letter-spacing: 0.06em; margin-bottom: 8px; }
.grid { display: grid; grid-template-columns: auto repeat(5, 1fr); gap: 5px 6px; align-items: center; }
.stage-k { font-size: 12px; font-weight: 700; color: var(--brass-hi); text-align: right; padding-right: 2px; white-space: nowrap; }
.stage-k small { display: block; font-size: 10.5px; font-weight: 400; font-style: italic; color: var(--white-dim); }
.lv {
  position: relative; width: 32px; height: 32px; justify-self: center; padding: 0; cursor: pointer;
  font-family: "Old Standard TT", Georgia, serif; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--cobalt-dk);
  background: var(--white); border: 2px solid var(--white); border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--cobalt);
}
.lv:hover { background: #ffffff; }
.lv.cleared { background: linear-gradient(175deg, #f5e2a8, #d9b25a 50%, #b88d32); color: #2a1a06; border-color: var(--brass-hi); box-shadow: inset 0 0 0 1px rgba(125, 93, 30, 0.6); }
.lv.current { outline: 2.5px solid var(--ticket); outline-offset: 2px; }
.lv.locked { color: rgba(244, 246, 251, 0.5); border: 1.5px dotted rgba(244, 246, 251, 0.55); background: transparent; box-shadow: none; cursor: not-allowed; }
.lv.nope { animation: bw-nope 0.3s ease; }
html.fx-off .lv.nope { animation: none; }
@keyframes bw-nope { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.lock-note { min-height: 16px; margin-top: 8px; text-align: center; font-size: 13px; font-weight: 700; color: #ffd0c7; }

@media (min-width: 680px) {
  .card.menu { width: min(860px, 100%); display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
  .card.menu .levels { margin-top: 2px; }
}

/* the end card */
.card.end { text-align: center; width: min(420px, 100%); }
.card .big { font-size: 26px; font-weight: 700; margin: 6px 0 4px; font-variant-numeric: tabular-nums; color: var(--brass-hi); }
.card .stats { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 4px 0 16px; font-size: 13.5px; color: var(--white-dim); }
.stats .best { font-weight: 700; color: var(--cobalt-dk); border: 2px solid var(--white); border-radius: 999px; padding: 2px 12px; background: var(--white); }
.stats .best.record { background: linear-gradient(175deg, #f5e2a8, #d9b25a 50%, #b88d32); color: #2a1a06; border-color: var(--brass-hi); }
.card .row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* ---- phones -------------------------------------------------------------- */
@media (max-width: 520px) {
  .panel { padding-top: 60px; }
  .card { padding: 20px 18px 16px; }
  .card h1 { font-size: 26px; }
  .card .how { font-size: 13px; line-height: 1.45; }
  .grid { gap: 4px 5px; }
  .lv { width: 30px; height: 30px; font-size: 13px; }
  .status { font-size: 13px; min-height: 2.7em; }
}
/* short of room (a phone with its bars showing, a short laptop window): the
   menu closer set, everything still on it */
@media (max-height: 720px) {
  .panel { padding-top: 58px; padding-bottom: 10px; }
  .card { padding-top: 16px; padding-bottom: 12px; }
  .card .tag { margin: 2px 0 6px; }
  .card .how { margin-bottom: 8px; line-height: 1.4; }
  .pick { padding: 5px 8px; margin-bottom: 8px; }
  .pick canvas { width: 60px; height: 60px; }
  .playbtn { padding: 7px 10px; }
  .levels { margin-top: 8px; }
  .lock-note { margin-top: 4px; }
  .lock-note:empty { min-height: 0; margin-top: 0; }
}
@media (max-width: 520px) and (max-height: 700px) {
  .panel { padding: 56px 10px 8px; }
  .card { padding: 14px 16px 10px; }
  .card h1 { font-size: 22px; }
  .card .tag { margin: 0 0 4px; font-size: 13px; }
  .card .how { font-size: 12px; line-height: 1.3; margin-bottom: 6px; }
  .pick { gap: 9px; margin-bottom: 6px; padding: 4px 8px; }
  .pick canvas { width: 46px; height: 46px; }
  .pick-text b { font-size: 15px; }
  .levels { margin-top: 8px; }
  .levels-head { margin-bottom: 4px; }
  .grid { gap: 2px 5px; }
  .lv { width: 28px; height: 28px; }
  .helm { gap: 5px; }
  .status { min-height: 2.6em; line-height: 1.3; }
}
/* a phone on its side: the two columns close set, so the whole card shows */
@media (min-width: 680px) and (max-height: 430px) {
  .panel { padding: 52px 12px 6px; }
  .card { padding: 12px 18px 10px; }
  .card.menu { column-gap: 20px; }
  .card h1 { font-size: 21px; }
  .card .tag { font-size: 12.5px; margin: 0 0 4px; }
  .card .how { font-size: 11.5px; line-height: 1.32; margin-bottom: 6px; }
  .pick { padding: 4px 8px; gap: 8px; margin-bottom: 6px; }
  .pick canvas { width: 44px; height: 44px; }
  .pick-text b { font-size: 14px; }
  .pick-text small { font-size: 11.5px; line-height: 1.3; }
  .playbtn { font-size: 15px; padding: 5px 10px; }
  .tally { font-size: 12px; }
  .card .levels-k { font-size: 14px; }
  .levels-head { margin-bottom: 4px; }
  .grid { gap: 2px 6px; }
  .stage-k { font-size: 11px; }
  .stage-k small { font-size: 10px; }
  .lv { width: 27px; height: 27px; font-size: 12.5px; }
  .lock-note { margin-top: 2px; }
  .log-name { font-size: 13px; }
  .status { font-size: 12.5px; }
}

.gs-pause { background: rgba(18, 11, 8, 0.6); }
