/*
 * The game client's look (docs/CLIENT.md), over the canvas on the game pages
 * (/practice/ and /p/<code>), after style.css. Woodcut in color: ink
 * outlines, hard ink shadows, flat paper and wood; Londrina Solid Black for
 * the display words, Inter for labels. No italics, no gradients, no glass.
 * Every button is at least 44 px tall for a thumb.
 */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --marigold: #f2b705;
  --violet: #8e44ad;
  --power: #ff7a3d;
  --release: #33b6e8;
  --shadow-sm: 3px 3px 0 var(--ink);
}

body.game {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  position: fixed;
  inset: 0;
}
#pitch {
  touch-action: none;
}
#ui {
  font-family: var(--jt-font-body);
  font-size: 15px;
  line-height: 1.35;
  z-index: 1;
}
#ui [hidden] {
  display: none !important;
}

/* ---------- buttons ---------- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: 44px;
  min-width: 44px;
  padding: 6px 16px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font-family: var(--display);
  font-weight: 900;
  font-size: 19px;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: none;
}
.btn:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.btn.go {
  background: var(--marigold);
}
.btn.big {
  min-height: 60px;
  font-size: 30px;
  padding-inline: 34px;
}
.btn.small {
  font-size: 16px;
  padding: 4px 12px;
}
.btn.plain {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.btn.plan {
  font-size: 15px;
  padding: 4px 9px;
  background: var(--wood);
}
.btn.plan.view.on,
.btn.plan.walk.on {
  background: var(--ink);
  color: var(--paper);
}

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

#ui .hud {
  pointer-events: none;
}
.hud-rail {
  position: absolute;
  color: var(--ink);
  top: calc(var(--safe-top) + 10px);
  left: calc(var(--safe-left) + 12px);
  max-width: 44vw;
  padding: 5px 12px 6px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.rail-name {
  font-family: var(--display);
  font-weight: 900;
  font-size: 20px;
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-what,
.rail-counts {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.rail-counts {
  color: #5b4a2c;
}

.center {
  position: absolute;
  top: calc(var(--safe-top) + 74px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 92vw;
  text-align: center;
}
.flag {
  padding: 4px 18px 6px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 4px 4px 0 rgba(23, 20, 15, 0.45);
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1.05;
  letter-spacing: 0.02em;
}
.verdicts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.chip {
  display: inline-block;
  padding: 2px 9px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
/* an off-target verdict (LONG, SHORT, SHAKY, PULLED LEFT, ...): inverted like
   the flag, larger and heavier, so it cannot read as an on-target chip */
.chip.off {
  padding: 3px 11px 4px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 3px 3px 0 rgba(23, 20, 15, 0.45);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.05em;
}
.rest {
  padding: 2px 10px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--wood);
  font-size: 14px;
  font-weight: 800;
}
.status {
  position: absolute;
  top: calc(var(--safe-top) + 14px);
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 14px 5px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: var(--marigold);
  font-family: var(--display);
  font-weight: 900;
  font-size: 22px;
  line-height: 1;
  white-space: nowrap;
}
.adv {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + 14px);
  padding: 2px 10px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.plans {
  position: absolute;
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px;
  align-items: end;
}
#ui .plans {
  pointer-events: none;
}
.plans .btn {
  pointer-events: auto;
}
.plan-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plans > .btn.view,
.plans > .btn.walk {
  grid-column: 1 / span 2;
}
.plans.split {
  grid-template-columns: auto 1fr auto;
  align-items: start;
}
.plans.split > .plan-col:nth-child(2) {
  grid-column: 3;
  grid-row: 1;
}
.plans.split > .btn.view {
  grid-column: 1;
  grid-row: 2;
}
.plans.split > .btn.walk {
  grid-column: 3;
  grid-row: 2;
}

.skip-btn {
  position: absolute;
  right: calc(var(--safe-right) + 12px);
  top: calc(var(--safe-top) + 64px);
}

.menu-btn {
  position: absolute;
  top: calc(var(--safe-top) + 10px);
  right: calc(var(--safe-right) + 12px);
}
.tray {
  position: absolute;
  top: calc(var(--safe-top) + 10px);
  right: calc(var(--safe-right) + 100px);
  display: flex;
  gap: 8px;
}
.tray .btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- loading ---------- */

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  background: var(--grass);
  color: var(--paper);
  text-align: center;
}
.loading-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(64px, 16vw, 140px);
  line-height: 0.9;
  color: var(--paper);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 6px 6px 0 var(--ink);
}
.loading-title span {
  display: block;
  font-size: 0.36em;
  color: var(--wood);
}
.loading-text {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.04em;
  animation: kubb-pulse 1.2s ease-in-out infinite alternate;
}
@keyframes kubb-pulse {
  from {
    opacity: 0.55;
  }
  to {
    opacity: 1;
  }
}

/* ---------- cards ---------- */

#ui .card-layer,
#ui .panel-host {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 3;
}
#ui .card-layer {
  z-index: 4;
}
/* the report card stays above the winner card and the panels, which go on under it */
#ui .report-scrim,
#ui .sheet-scrim {
  z-index: 5;
}
.panel-host > *,
.card-layer > * {
  pointer-events: auto;
}
.scrim {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 12px) calc(var(--safe-right) + 12px)
    calc(var(--safe-bottom) + 12px) calc(var(--safe-left) + 12px);
  background: rgba(23, 20, 15, 0.45);
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  pointer-events: auto;
}
.scrim > * {
  /* centred, and still scrolled from the top when taller than the screen */
  margin: auto;
  flex: none;
}
.card {
  width: min(460px, 100%);
  padding: 18px 20px 20px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.card h2,
.card h3 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-weight: 900;
  line-height: 1;
}
.card h2 {
  font-size: clamp(32px, 7vw, 42px);
}
.card h3 {
  font-size: 26px;
}
.card p {
  margin: 0 0 8px;
}
.kicker {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5b4a2c;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  align-items: center;
}
.card .detail {
  font-family: var(--jt-font-mono);
  font-size: 12px;
  word-break: break-word;
}

.handoff-body {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
}
.handoff .took {
  font-weight: 700;
}
.handoff .lines {
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  font-family: var(--display);
  font-weight: 900;
  font-size: 22px;
  line-height: 1.15;
}
.handoff .bases {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.card-map {
  display: block;
  width: 120px;
  height: 200px;
}
.winner .stats {
  font-weight: 800;
}
.players {
  margin: 0;
  padding-left: 1.1em;
}

.options {
  width: min(560px, 100%);
}
.opt {
  display: grid;
  grid-template-columns: 6.5em 1fr;
  gap: 4px 10px;
  align-items: center;
  margin-top: 8px;
}
.opt-label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.name {
  min-height: 44px;
  padding: 6px 10px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: #fff;
  font: 700 17px var(--jt-font-body);
  color: var(--ink);
  user-select: text;
  -webkit-user-select: text;
}
.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.seg-btn {
  appearance: none;
  min-height: 44px;
  padding: 4px 11px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font: 700 14px var(--jt-font-body);
  cursor: pointer;
  touch-action: manipulation;
}
.seg-btn[aria-checked="true"] {
  background: var(--ink);
  color: var(--paper);
}
.seg-btn:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.menu .menu-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
/* the release this page is, at the menu's foot */
.menu-version {
  margin: 12px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: #5b4a2c;
  text-align: center;
  user-select: text;
  -webkit-user-select: text;
}

/* a new version is out (src/ui/update.js): small, under MENU on a wide
   screen (the minimap is bottom left, the dial bottom right) */
.update-note {
  position: absolute;
  right: calc(var(--safe-right) + 12px);
  top: calc(var(--safe-top) + 66px);
  max-width: min(420px, calc(100% - 24px));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 700;
}

/* the report card (src/ui/report.js) */
.report {
  width: min(560px, 100%);
}
.report-field {
  display: grid;
  gap: 4px;
  margin-top: 10px;
}
.report-text {
  width: 100%;
  min-height: 72px;
  padding: 8px 10px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: #fff;
  font: 500 16px/1.4 var(--jt-font-body);
  color: var(--ink);
  resize: vertical;
  user-select: text;
  -webkit-user-select: text;
}
.report-text:disabled {
  opacity: 0.6;
}
.report-note {
  margin-top: 10px;
  font-size: 14px;
}
.report-status:empty {
  display: none;
}
.report-status {
  font-weight: 700;
}

/* the score sheet (src/ui/sheet.js) */
.sheet {
  width: min(640px, 100%);
}
.sheet-note {
  font-size: 14px;
}
.sheet-tools {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
.sheet-text {
  margin: 8px 0 0;
  max-height: min(52vh, 460px);
  overflow: auto;
  padding: 8px 10px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: #fff;
  font: 500 13px/1.45 var(--jt-font-mono);
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
}
.sheet-status:empty {
  display: none;
}
.sheet-status {
  margin-top: 8px;
  font-weight: 700;
}

.howto {
  width: min(520px, 100%);
}
.howto-body {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 14px;
  align-items: center;
}
.howto-dial {
  width: 180px;
  height: 200px;
}

/* the raise and punishment panels: at the bottom, the pitch above */
.panel {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 12px);
  transform: translateX(-50%);
  width: min(520px, calc(100% - 24px));
  padding: 10px 14px 12px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.panel .row {
  margin-top: 8px;
}
.panel-text {
  margin: 2px 0 0;
  font-weight: 700;
}
.why {
  margin: 6px 0 0;
  display: inline-block;
  padding: 2px 10px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: #e2483d;
  color: var(--paper);
  font-family: var(--display);
  font-weight: 900;
  font-size: 18px;
}

/* ---------- a shared pitch: the lobby, whose throw, shouts ---------- */

.lobby {
  width: min(640px, 100%);
}
.lobby .name {
  width: 100%;
  min-width: 0;
}
.lobby-status {
  color: #b3123f;
}
.teams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.team {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 8px 10px 10px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: #fff;
}
.card .team-head {
  margin: -8px -10px 2px;
  padding: 6px 10px;
  border-bottom: 3px solid var(--ink);
  border-radius: 3px 3px 0 0;
  font-size: 22px;
}
.team-a .team-head {
  background: var(--marigold);
  color: var(--ink);
}
.team-b .team-head {
  background: var(--violet);
  color: var(--paper);
}
.team-count {
  float: right;
  font-family: var(--jt-font-body);
  font-size: 13px;
  font-weight: 800;
  line-height: 22px;
}
.roster {
  margin: 0;
  padding: 0;
  list-style: none;
}
.member {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  font-weight: 700;
}
.member {
  flex-wrap: wrap;
}
.member-name {
  flex: 0 1 auto;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dot {
  flex: none;
  width: 10px;
  height: 10px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #2f9e44;
}
.member.away {
  color: #6b6255;
}
.member.away .dot {
  background: transparent;
}
.tag {
  flex: none;
  padding: 0 5px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
}
.tag.you {
  background: var(--ink);
  color: var(--paper);
}
.card .team-empty {
  margin: 0;
  color: #5b4a2c;
  font-size: 14px;
}
.team .btn {
  margin-top: auto;
}
.watch-row,
.share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 10px;
}
.card .watchers {
  flex: 1 1 14em;
  margin: 0;
}
.watchers .who.away {
  color: #6b6255;
}
.link-text {
  min-width: 0;
  font-family: var(--jt-font-mono);
  font-size: 13px;
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
}
.lobby-options {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 2px solid var(--ink);
}
.lobby-options h3 {
  font-size: 22px;
}
.opt-value {
  font-weight: 700;
}
.access-note {
  margin: 4px 0 10px;
  font-size: 14px;
}
.card .waiting {
  flex: 1 1 12em;
  margin: 0;
  font-weight: 800;
}
/* START (or the wait for it) stays in reach while the lobby scrolls */
.lobby .start-row {
  position: sticky;
  z-index: 1;
  bottom: calc(-12px - var(--safe-bottom));
  margin: 12px -20px -20px;
  padding: 10px 20px calc(20px + var(--safe-bottom));
  border-top: 2px solid var(--ink);
  border-radius: 0 0 6px 6px;
  background: var(--paper);
}
.card .lobby-note {
  margin: 10px 0 0;
  font-weight: 700;
}

.whose {
  display: inline-block;
  margin: 0 0 8px;
  padding: 2px 10px 4px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  font-family: var(--display);
  font-weight: 900;
  font-size: 20px;
  line-height: 1.1;
}
.card .whose.mine {
  background: var(--marigold);
}
.status.theirs {
  background: var(--paper);
}
.status.mine {
  background: var(--marigold);
}

.net {
  position: absolute;
  top: calc(var(--safe-top) + 48px);
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  padding: 3px 10px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-align: center;
}
.net.warn {
  background: #e2483d;
  color: var(--paper);
}
.shout-bar {
  position: absolute;
  left: calc(var(--safe-left) + 12px);
  top: calc(var(--safe-top) + 92px);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 24px);
}
.shout-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.shouts {
  position: absolute;
  top: calc(var(--safe-top) + 146px);
  left: calc(var(--safe-left) + 12px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}
.shout {
  padding: 2px 10px 4px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  animation: shout-in 0.18s ease-out;
}
.shout-name {
  margin-right: 6px;
  font-size: 13px;
  font-weight: 800;
}
.shout-word {
  font-family: var(--display);
  font-weight: 900;
  font-size: 20px;
}
@keyframes shout-in {
  from {
    transform: scale(0.6);
  }
}

/* ---------- a replay (src/replay/player.js) ---------- */

/* the controls along the bottom, the score sheet down the right */
.replay-bar {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 12px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: max-content;
  max-width: calc(100% - 24px - var(--safe-left) - var(--safe-right));
  padding: 8px 10px 10px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.replay-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.replay-kicker {
  font-family: var(--display);
  font-weight: 900;
  font-size: 18px;
  line-height: 1;
}
.replay-count {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.replay-note {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #7a3b00;
}
.replay-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.replay-speeds {
  display: inline-flex;
  gap: 4px;
}
.replay-controls .btn[aria-pressed="true"][data-speed] {
  background: var(--ink);
  color: var(--paper);
}
.replay-sheet {
  position: absolute;
  top: calc(var(--safe-top) + 64px);
  right: calc(var(--safe-right) + 12px);
  width: min(300px, 32vw);
  max-height: calc(100% - 64px - 150px - var(--safe-top) - var(--safe-bottom));
  display: flex;
  flex-direction: column;
  padding: 8px 10px 10px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.replay-sheet-text {
  flex: 1 1 auto;
  min-height: 0;
  margin: 6px 0 0;
  overflow: auto;
  font: 500 12px/1.45 var(--jt-font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
}
/* the advantage line and the shouts give the bottom to the replay */
.replaying .adv,
.replaying .shout-bar {
  display: none;
}
.teams-line {
  font-weight: 700;
}

/* ---------- the embed, /e/<code> (src/embed/embed.js) ---------- */

/* It fills whatever frame it is given; below this it scrolls rather than crush. */
body.embed {
  min-width: 300px;
  min-height: 188px;
  overflow: auto;
  background: var(--paper);
}
.embed-link {
  position: absolute;
  top: calc(var(--safe-top) + 8px);
  left: calc(var(--safe-left) + 8px);
  z-index: 30;
  padding: 3px 8px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font: 700 13px/1.2 var(--jt-font-sans, system-ui, sans-serif);
  text-decoration: none;
}
/* the link has the top-left corner, so the HUD's panel sits below it */
body.embed .hud-rail {
  top: calc(var(--safe-top) + 40px);
}
.embed-link:hover,
.embed-link:focus-visible {
  background: var(--marigold);
}
.embed-scrim {
  background: rgba(23, 20, 15, 0.2);
}
.embed-quiet {
  text-align: center;
}
.embed-quiet .btn {
  text-decoration: none;
}
/* in a small frame the bar keeps to one tight row and the end card scrolls */
body.embed .replay-bar {
  max-width: calc(100% - 16px);
}
body.embed .replay-controls {
  flex-wrap: wrap;
  justify-content: center;
}
.embed-text {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin: 8px 0 0;
  padding: 8px 10px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: #fff;
  font: 500 13px/1.45 var(--jt-font-mono);
  resize: none;
  user-select: text;
  -webkit-user-select: text;
}

/* ---------- a tall screen (a phone held upright) ---------- */

@media (max-aspect-ratio: 20/21) {
  .tray {
    top: calc(var(--safe-top) + 86px);
    left: calc(var(--safe-left) + 12px);
    right: auto;
  }
  .center {
    top: calc(var(--safe-top) + 128px);
  }
  /* the status pill goes under the rail and the menu */
  .status {
    top: calc(var(--safe-top) + 78px);
    font-size: 19px;
  }
  .net {
    top: calc(var(--safe-top) + 108px);
  }
  .shout-bar {
    top: calc(var(--safe-top) + 120px);
  }
  .shouts {
    top: calc(var(--safe-top) + 174px);
  }
  .adv {
    bottom: auto;
    top: calc(var(--safe-top) + 72px);
    left: auto;
    right: calc(var(--safe-right) + 100px);
    transform: none;
  }
  .howto-body {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .handoff-body {
    grid-template-columns: 1fr;
  }
  .card-map {
    justify-self: center;
  }
}

/* a short screen (a phone on its side): tighter cards */
@media (max-height: 460px) {
  .card {
    padding: 12px 16px 14px;
  }
  .card h2 {
    font-size: 30px;
  }
  .opt {
    margin-top: 4px;
  }
  .howto-body {
    grid-template-columns: 140px 1fr;
  }
  .howto-dial {
    width: 140px;
    height: 156px;
  }
  .center {
    top: calc(var(--safe-top) + 64px);
  }
  .flag {
    font-size: 30px;
  }
  /* START stays in reach while the options scroll */
  .start-row,
  .lobby .start-row {
    position: sticky;
    z-index: 1;
    /* to the screen's edge, past the scrim's padding */
    bottom: calc(-12px - var(--safe-bottom));
    margin: 8px -16px -14px;
    padding: 8px 16px calc(24px + var(--safe-bottom));
    border-top: 2px solid var(--ink);
    background: var(--paper);
  }
  /* the raise and punishment panel sits to the side, off the baseline */
  .panel {
    left: auto;
    right: calc(var(--safe-right) + 12px);
    top: calc(var(--safe-top) + 64px);
    bottom: auto;
    transform: none;
    width: min(300px, 38%);
  }
}

@media (max-width: 420px) {
  .replay-bar {
    left: calc(var(--safe-left) + 12px);
    right: calc(var(--safe-right) + 12px);
    transform: none;
    width: auto;
    max-width: none;
  }
  .replay-sheet {
    left: calc(var(--safe-left) + 12px);
    width: auto;
  }
  .teams {
    gap: 6px;
  }
  .team {
    padding: 8px 8px 10px;
  }
  .card .team-head {
    margin: -8px -8px 2px;
    padding: 6px 8px;
    font-size: 20px;
  }
  .lobby .opt {
    grid-template-columns: 5.5em 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-text,
  .shout {
    animation: none;
  }
}

/* a tall screen: the minimap is top right and the dial bottom centre, so the
   notice sits over the pitch just above the dial */
@media (max-aspect-ratio: 20/21) {
  .update-note {
    top: auto;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(var(--safe-bottom) + 42vh);
    width: max-content;
  }
}
