/* Spud & Root: town/bar.html, arm wrestling (bar-armwrestle.js).
   Everything sits inside the engine's host; the top 64px belong to the
   engine's Done and Sound buttons, and on phones the bottom 90px or so to its
   caption strip. */

.aw {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-body);
  color: var(--white);
  cursor: pointer;
  outline: none;
}

.aw__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- Score ---------- */
.aw__score {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px 5px 14px;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  background: var(--cream);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  pointer-events: none;
}
.aw__side {
  display: flex;
  align-items: center;
  gap: 7px;
}
.aw__label {
  font-size: 1rem;
}
.aw__num {
  min-width: 1.6em;
  padding: 0 0.3em;
  font-size: 1.35rem;
  line-height: 1.5;
  text-align: center;
  color: var(--white);
  background: var(--potato-russet);
  border: 2px solid var(--ink);
  border-radius: 10px;
}
.aw__them {
  background: #7a5a9a;
}
.aw__clock {
  min-width: 2.2em;
  padding: 0 0.4em;
  font-size: 1rem;
  line-height: 1.9;
  text-align: center;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
}
.aw__clock.is-late {
  background: var(--logo-yellow);
}
.aw__face {
  width: 30px;
  height: 40px;
  object-fit: contain;
  margin-left: -2px;
}

/* ---------- Help button ---------- */
.aw__help-btn {
  position: absolute;
  top: 72px;
  right: 16px;
  width: 44px;
  height: 44px;
  padding: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--white);
  border: var(--stroke) solid var(--ink);
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
}
.aw__help-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

/* ---------- Calls: Ready, Go, who won the bout ---------- */
.aw__call {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 38%;
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 1.6rem + 4vw, 4.5rem);
  line-height: 1.05;
  color: var(--white);
  -webkit-text-stroke: 8px var(--ink);
  paint-order: stroke fill;
  text-shadow: 4px 4px 0 var(--ink);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) scale(0.85);
  transition: opacity 0.2s ease, transform 0.25s var(--ease-spring);
}
.aw__call.is-on {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}
.aw__call--small {
  font-size: clamp(2rem, 1.4rem + 3vw, 3.5rem);
}
.aw__call--go {
  color: var(--logo-green);
}
.aw__call--win {
  color: var(--logo-yellow);
  font-size: clamp(1.6rem, 1.1rem + 2.6vw, 3rem);
}
.aw__call--lose {
  color: var(--cream);
  font-size: clamp(1.6rem, 1.1rem + 2.6vw, 3rem);
}

/* ---------- The prompt: "Tap to push" ---------- */
/* Kept above the engine's caption strip (about 90px) at every size but the
   short landscape one, where it joins the column under the score. */
.aw__prompt {
  position: absolute;
  left: 50%;
  bottom: 104px;
  margin: 0;
  padding: 6px 18px;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
  white-space: nowrap;
  color: var(--ink);
  background: var(--logo-yellow);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
  transition: transform 0.07s ease, box-shadow 0.07s ease;
}
.aw__prompt:empty {
  display: none;
}
.aw__prompt.is-press {
  transform: translate(calc(-50% + 2px), 2px);
  box-shadow: 2px 2px 0 var(--ink);
}
/* the play area has keyboard focus: ring the prompt, not the whole screen */
.aw:focus-visible .aw__prompt {
  outline: 3px solid var(--white);
  outline-offset: 3px;
}

.aw__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Panels: start, result, how to play ---------- */
.aw__panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(340px, calc(100% - 32px));
  padding: 20px 22px 22px;
  text-align: center;
  color: var(--ink);
  background: var(--cream);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: default;
  touch-action: auto;
}
.aw__panel[hidden] {
  display: none;
}
.aw__title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.15;
}
.aw__text {
  margin: 0 0 16px;
  font-size: 1rem;
  line-height: 1.45;
}
.aw__how .aw__text {
  text-align: left;
}
.aw__btn {
  min-height: 48px;
  padding: 10px 28px;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--logo-yellow);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.aw__btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}
.aw__btn:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink);
}
.aw__btn--white {
  background: var(--white);
}
.aw button:focus-visible {
  outline: 3px solid var(--logo-yellow);
  outline-offset: 3px;
}

/* ---------- Narrow and short screens ----------
   bar-armwrestle.js sets these classes from the play area's size, the same
   test it uses to lay out the scene. */
.aw--narrow .aw__score {
  gap: 7px;
  padding: 4px 6px 4px 11px;
}
.aw--narrow .aw__label {
  font-size: 0.9375rem;
}
.aw--narrow .aw__num {
  font-size: 1.15rem;
}
.aw--narrow .aw__face {
  width: 24px;
  height: 32px;
}
.aw--tiny .aw__face {
  display: none;
}

/* Short (landscape phone): help, score and prompt stack in a column under
   the engine's Sound button, and the scene takes the height. */
.aw__hud {
  display: contents;
}
.aw--short .aw__hud {
  position: absolute;
  top: 66px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.aw--short .aw__hud > * {
  position: static;
  transform: none;
}
.aw--short .aw__help-btn {
  width: 40px;
  height: 40px;
}
.aw--short .aw__score {
  order: 1;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 6px 8px 6px 10px;
  border-radius: var(--radius-md);
}
.aw--short .aw__side {
  justify-content: space-between;
  gap: 10px;
}
.aw--short .aw__name {
  order: -1;
}
.aw--short .aw__face {
  display: none;
}
.aw--short .aw__num {
  font-size: 1.05rem;
}
.aw--short .aw__clock {
  order: 3;
  align-self: center;
  line-height: 1.6;
}
.aw--short .aw__prompt {
  order: 2;
  padding: 4px 14px;
  font-size: 1rem;
}
.aw--short .aw__prompt.is-press {
  transform: translate(2px, 2px);
}
.aw--short .aw__panel {
  padding: 14px 18px 16px;
}
.aw--short .aw__text {
  margin-bottom: 10px;
}

/* reduced motion: calls just appear */
.aw--still .aw__call,
.aw--still .aw__btn,
.aw--still .aw__prompt {
  transition: none;
}
.aw--still .aw__call {
  transform: translateY(-50%);
}
@media (prefers-reduced-motion: reduce) {
  .aw__call,
  .aw__btn,
  .aw__prompt {
    transition: none;
  }
}
