/* The phone screens P01 to P10. Tokens and shared components come from ui's CSS. */

.p-screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.p-splash {
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--ink-muted);
}

.p-spacer {
  flex: 1;
}

.p-ellipsis {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.p-tag {
  flex: none;
  padding: 0 6px;
  border-radius: var(--radius-tag);
  background: var(--violet);
  color: var(--on-violet);
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 600;
}

.p-tag--gold {
  padding: 0 8px;
  background: var(--gold);
  color: var(--on-gold);
}

.p-unit {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

.p-face {
  font-size: var(--fs-small);
}

.p-eyebrow {
  color: var(--ink-faint);
}

.p-screen .script {
  display: inline-block;
  white-space: nowrap;
}

:lang(en) .stepper__unit {
  width: auto;
}

/* P01 Join */
.p-join {
  gap: 24px;
  padding: 20px 16px;
}

.p-hero {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.p-hero__text {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  min-width: 0;
}

.p-hero__mascot {
  flex: none;
  width: 136px;
  height: auto;
}

.p-lang {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  height: 48px;
  padding: 0 2px 0 14px;
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  border: 1px solid var(--ink-faint);
}

.p-lang > .icon {
  color: var(--neon);
}

.p-lang__pair {
  display: flex;
  align-items: center;
  gap: 2px;
}

.p-lang__btn {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.p-lang__btn[aria-pressed="true"] {
  background: var(--violet);
}

.p-join__brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.p-join__tagline {
  font-size: var(--fs-h2);
  line-height: var(--lh-heading);
  color: var(--ink-muted);
}

/* Thai has no spaces inside a phrase, so the tagline breaks only where its one space is. */
.p-join__tagline--lines span {
  display: block;
}

.p-join__form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.p-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.p-field label,
.p-colors legend,
.p-section__label {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 500;
  color: var(--ink-muted);
}

.p-input {
  display: block;
  width: 100%;
  height: 56px;
  padding: 0 16px;
  background: var(--surface-raised);
  border: 1px solid var(--neon);
  border-radius: var(--radius-card);
  color: var(--ink);
  font-size: var(--fs-body);
  line-height: var(--lh-text);
}

.p-input--code {
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.p-field__hint,
.p-field__error {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

.p-field__error {
  color: var(--ink);
}

.p-field__hint .icon,
.p-field__error .icon {
  color: var(--neon);
}

.p-colors {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.p-colors legend {
  padding: 0;
}

.p-colors__row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 6px 0;
}

.p-color {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.p-color--violet {
  background: var(--violet);
  color: var(--on-violet);
}

.p-color--neon {
  background: var(--neon);
  color: var(--canvas);
}

.p-color--gold {
  background: var(--gold);
  color: var(--on-gold);
}

.p-color--night {
  background: var(--surface-raised);
  border: 2px solid var(--neon);
  color: var(--ink);
}

.p-color[aria-pressed="true"] {
  box-shadow: 0 0 0 3px var(--canvas), 0 0 0 5px var(--ink);
}

.p-join__end {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

/* P02 Lobby */
.p-lobby {
  gap: 20px;
  padding: 20px 16px;
}

.p-lobby__text {
  gap: 8px;
  padding-top: 12px;
}

.p-lobby__chain {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-muted);
}

.p-lobby__chain .icon {
  color: var(--neon);
}

.p-lobby__aside {
  padding: 8px 0 0 4px;
}

.p-lobby__aside .script {
  transform-origin: left center;
}

.p-level {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.p-level .level-badge {
  flex: none;
}

.p-level__line {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

/* The lobby was drawn to fill 844 px exactly. On a phone that short it closes its gaps to make
   room for the level, so the wait for the host stays on the first screen. */
@media (max-height: 860px) {
  .p-lobby {
    gap: 8px;
    padding: 8px 16px;
  }

  .p-lobby__text {
    padding-top: 4px;
  }

  .p-lobby__aside {
    padding-top: 2px;
  }

  .p-lobby__text h1 {
    font-size: 28px;
    line-height: 1.25;
  }

  .p-level {
    padding: 4px 12px;
  }

  .p-lobby .p-howto {
    gap: 10px;
    min-height: 176px;
    padding: 12px 16px;
  }

  .p-lobby .p-dots {
    margin: -6px 0;
  }

  .p-lobby .p-wait {
    padding: 10px 16px;
  }
}

.p-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.p-mates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.p-mate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 14px 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.p-mate .avatar__dot {
  width: 16px;
  height: 16px;
  border-width: 3px;
}

.p-mate__name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  font-weight: 500;
}

.p-mate__status {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

.p-howto {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 204px;
  padding: 16px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.p-chain {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.p-chain__role {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 66px;
}

.p-chain__you {
  display: flex;
  height: 22px;
}

.p-chain__icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--canvas);
  border: 2px solid var(--neon);
  color: var(--neon);
}

.p-chain__role--me .p-chain__icon {
  background: var(--violet);
  border-color: var(--violet);
  color: var(--on-violet);
}

.p-chain__name {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
  white-space: nowrap;
}

.p-chain__role--me .p-chain__name {
  font-weight: 600;
  color: var(--ink);
}

.p-chain__arrow {
  display: flex;
  align-items: center;
  height: 72px;
  padding-top: 22px;
  color: var(--ink-faint);
}

.p-dots {
  display: flex;
  align-items: center;
  justify-content: center;
}

.p-dot {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.p-dot span {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--ink-faint);
}

.p-dot[aria-current] span {
  width: 24px;
  background: var(--ink);
}

.p-wait {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--ink-faint);
}

.p-wait > .icon {
  color: var(--neon);
}

.p-wait__text {
  display: flex;
  flex-direction: column;
}

.p-wait__title {
  font-weight: 500;
}

.p-wait__sub {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

.p-pick {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.p-pick__btn {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--neon);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.p-pick__btn .icon {
  color: var(--neon);
}

.p-pick__btn[aria-pressed="true"] {
  background: var(--surface-raised);
  border-width: 2px;
}

.p-pick__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.p-pick__name {
  flex: 1;
  display: flex;
  gap: 6px;
  min-width: 0;
  font-weight: 500;
}

.p-pick__chain {
  font-weight: 400;
  color: var(--ink-muted);
}

.p-pick__count {
  flex: none;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

/* P03 to P05 Turn */
.p-turn {
  gap: 12px;
  padding: 16px;
}

.p-head {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.p-head__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.p-head__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.p-head__title {
  font-size: var(--fs-h2);
  line-height: var(--lh-heading);
}

.p-head__team {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

.p-head__team .icon,
.p-pill .icon {
  color: var(--neon);
}

.p-pill {
  flex: none;
}

.p-pill--flip .timer-pill__word {
  order: 2;
}

/* The three tiles share their rows, so a caption of more than one line (the later deliveries
   of a long shipping delay) keeps the numbers on one line. */
.p-facts {
  flex: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: auto auto auto;
  padding: 10px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.p-facts .fact {
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
  white-space: normal;
}

.p-facts .fact + .fact {
  border-left: 1px solid var(--line);
}

.p-facts .fact__title {
  white-space: nowrap;
}

.p-facts .fact__foot {
  white-space: pre-line;
}

.p-facts .fact__title .icon {
  width: 14px;
  height: 14px;
  color: var(--neon);
}

.p-facts .fact--risk .fact__title .icon {
  color: var(--markdown);
}

.p-mid {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.p-mid__open,
.p-mid__sent {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.p-team {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.p-seats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.p-seat {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 134px;
  margin: 0;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: inherit;
  font: inherit;
}

button.p-seat {
  border-color: var(--neon);
  cursor: pointer;
}

button.p-seat--match {
  padding: 7px 5px;
  border-width: 2px;
  background: var(--surface-raised);
}

.p-seat--open {
  padding: 7px 5px;
  border: 2px dashed var(--dashed-deciding);
  background: transparent;
}

.p-seat__name {
  display: flex;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 600;
  white-space: nowrap;
}

:lang(en) .p-seat__name {
  gap: 4px;
}

.p-seat__verb {
  flex: none;
  font-weight: 400;
  color: var(--ink-muted);
}

.p-seat__num {
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 24px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.p-seat__match {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 7px 0 5px;
  border-radius: var(--radius-pill);
  background: var(--violet);
  color: var(--on-violet);
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 500;
  white-space: nowrap;
}

.p-seat__status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
  white-space: nowrap;
}

.p-seat__status .icon {
  color: var(--ink-faint);
}

.p-seat__act {
  flex: 1;
  display: flex;
  align-items: center;
}

.p-suggest {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  height: 44px;
  margin: 0;
  padding: 0 12px;
  border: 2px solid var(--neon);
  border-radius: var(--radius-pill);
  background: var(--canvas);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.p-aside {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.p-aside--cell {
  min-height: 134px;
}

.p-aside--cell .script {
  white-space: normal;
  text-align: center;
}

.p-lock {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface-raised);
  border: 2px solid var(--neon);
  border-radius: var(--radius-card);
  box-shadow: var(--glow-neon);
}

.p-turn--chat .p-lock {
  flex: none;
}

.p-lock__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.p-lock__sender {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.p-lock__who {
  display: flex;
  min-width: 0;
  white-space: nowrap;
}

.p-lock__verb {
  flex: none;
  white-space: pre;
}

.p-lock__icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 2px solid var(--neon);
  border-radius: 50%;
  background: var(--canvas);
  color: var(--neon);
}

.p-lock__tag {
  flex: none;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px 1px 6px;
  border-radius: var(--radius-tag);
  background: var(--violet);
  color: var(--on-violet);
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 600;
  white-space: nowrap;
}

.p-lock__num {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  padding-left: 30px;
}

.p-lock__num .hero-number {
  font-size: 80px;
  line-height: 0.82;
}

.p-lock__unit {
  flex: none;
  min-width: 20px;
  color: var(--ink-muted);
}

.p-lock__to,
.p-lock__why {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
  text-align: center;
}

.p-lock__to .icon {
  color: var(--neon);
}

.p-late {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.p-late__row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.p-late .p-face {
  font-size: var(--fs-body);
}

.p-late__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.p-late__first {
  font-weight: 600;
}

.p-late__second {
  color: var(--ink-muted);
}

.p-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

.p-rule .icon {
  color: var(--neon);
}

.p-late .p-rule {
  justify-content: flex-start;
}

.p-dock {
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  min-height: 204px;
  padding: 8px 12px 10px;
  border-radius: var(--radius-card);
}

/* The send glyph inside the hold ring, turned back upright because the ring is rotated. */
.p-dock .hold__ring {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='rotate(90 12 12)'%3E%3Cpath d='M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z'/%3E%3Cpath d='m21.854 2.147-10.94 10.939'/%3E%3C/g%3E%3C/svg%3E") center / 18px 18px no-repeat;
}

@media (max-height: 760px) {
  .p-dock {
    position: sticky;
    bottom: 0;
    z-index: 2;
  }

  .p-aside {
    min-height: 44px;
    padding-bottom: 8px;
  }
}

/* A phone 800 px tall. A shipping delay of 3 gives the facts strip a second later delivery and
   the recap lane a third truck, and the screen gives the height back so neither one scrolls. */
@media (max-height: 820px) {
  .p-turn {
    gap: 8px;
    padding: 12px 16px;
  }

  .p-facts {
    padding: 8px 0;
  }

  .p-recap--long .p-lane__left {
    padding-top: 0;
    padding-bottom: 0;
  }

  .p-recap--long .p-lane__gap {
    min-height: 20px;
  }

  .p-recap--long .p-lane__row--arrived,
  .p-recap--long .p-out {
    height: 44px;
  }

  .p-recap--long .p-home {
    min-height: 148px;
  }
}

.p-dock__top {
  display: flex;
  flex-direction: column;
}

.p-dock__hint {
  min-height: 1.6em;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
  text-align: center;
}

.p-dock--sent {
  padding: 8px 10px 6px;
  background: var(--surface);
  border: 2px solid var(--line);
}

.p-chainbar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.p-chainbar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.p-chainbar__count {
  font-weight: 600;
}

.p-chainbar__bars {
  display: flex;
  gap: 4px;
}

.p-chainbar__bars span {
  width: 18px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--line);
}

.p-chainbar__bars .p-on {
  background: var(--neon);
}

.p-tiles {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.p-tile {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 12px 6px 6px;
  border-radius: var(--radius-card);
  background: var(--surface-raised);
}

.p-tile .icon {
  color: var(--neon);
}

.p-tile--deciding {
  padding: 10px 4px 4px;
  border: 2px dashed var(--dashed-deciding);
  background: transparent;
  color: var(--ink-muted);
}

.p-tile--deciding .icon {
  color: var(--ink-faint);
}

.p-tile__role {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 600;
  white-space: nowrap;
}

.p-tile__state {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  white-space: nowrap;
}

.p-tile__mine {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 6px;
  border-radius: var(--radius-tag);
  background: var(--violet);
  color: var(--on-violet);
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 500;
  white-space: nowrap;
}

.p-waitline {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 4px;
  color: var(--ink-muted);
}

.p-waitline > .icon {
  color: var(--neon);
}

.p-waitline__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.p-waitline__title {
  font-weight: 500;
  color: var(--ink);
}

.p-waitline__sub {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
}

.p-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.p-foot__facts {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

.p-foot__pills {
  flex: none;
  display: flex;
  gap: 6px;
}

.p-footpill {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 44px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--neon);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.p-footpill .icon {
  color: var(--neon);
}

.p-footpill[aria-pressed="true"] {
  background: var(--violet);
}

.p-footpill[aria-pressed="true"] .icon {
  color: inherit;
}

/* P07 Chat and P08 History */
.p-sheet {
  display: flex;
  flex-direction: column;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.p-sheet--chat {
  position: absolute;
  z-index: 2;
  top: 180px;
  right: 0;
  bottom: 0;
  left: 0;
  gap: 6px;
  padding: 7px 13px 11px;
}

.p-sheet__grab {
  flex: none;
  align-self: center;
  width: 36px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--ink-faint);
}

.p-sheet__head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.p-sheet__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-body);
  line-height: var(--lh-text);
}

.p-sheet__title .icon,
.p-sheet__close .icon {
  color: var(--neon);
}

.p-sheet__close {
  appearance: none;
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 44px;
  margin: 0;
  padding: 0 12px 0 10px;
  border: 1px solid var(--neon);
  border-radius: var(--radius-pill);
  background: var(--canvas);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.p-chat__list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.p-chat__list > :first-child {
  margin-top: auto;
}

.p-chat__empty {
  margin-bottom: auto;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
  text-align: center;
}

.p-msg {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.p-msg--own {
  justify-content: flex-end;
}

.p-bubble {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 6px;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.p-msg--own .p-bubble {
  border-color: var(--violet);
  background: var(--violet);
}

.p-bubble__name {
  max-width: 100%;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 600;
  color: var(--ink-muted);
}

.p-msg--own .p-bubble__name {
  color: var(--on-violet);
}

.p-bubble__text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.p-chat__form {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.p-chat__input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--neon);
  border-radius: var(--radius-pill);
  background: var(--canvas);
  color: var(--ink);
  font-size: var(--fs-body);
}

.p-chat__input::placeholder {
  color: var(--ink-muted);
  opacity: 1;
}

.p-chat__send {
  appearance: none;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--violet);
  color: var(--on-violet);
  cursor: pointer;
}

.p-sheet--history {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.p-sheet__top {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 7px 13px 8px;
}

.p-history {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.p-history__chart {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4px 14px 4px 8px;
}

.p-chart {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.p-chart__legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  white-space: nowrap;
}

.p-chart__key {
  flex: none;
}

.p-chart__and {
  font-weight: 400;
  color: var(--ink-muted);
}

/* The legend lies over the empty top of the plot, as on the artboard. */
.p-chart__plot {
  position: relative;
  margin-top: -31px;
}

.p-chart__plot svg {
  display: block;
  width: 100%;
  height: auto;
}

.p-chart__val {
  position: absolute;
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

.p-chart__val--ours {
  font-weight: 800;
  color: var(--ink);
}

.p-chart__weeks {
  position: relative;
  height: 1.6em;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  white-space: nowrap;
  color: var(--ink-faint);
}

.p-chart__weeks span {
  position: absolute;
  width: 27px;
  margin-left: -13.5px;
  text-align: center;
}

.p-chart__weeks .p-chart__weeks-word {
  left: 0;
  width: auto;
  margin-left: 0;
  color: var(--ink-muted);
}

.p-history__table {
  flex: none;
}

/* The head stays put and the body scrolls under it. Each row is laid out as its own
   fixed table, so the columns line up without one table box around them all. */
.p-history table {
  display: block;
  width: 100%;
  border-spacing: 0;
}

.p-history thead,
.p-history tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.p-history tbody {
  display: block;
  max-height: min(320px, 38dvh);
  overflow-y: auto;
}

.p-history thead th {
  height: 52px;
  padding: 6px 0;
  background: var(--surface-raised);
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 400;
  color: var(--ink-muted);
  text-align: right;
  vertical-align: bottom;
}

/* English column names are longer than the Thai ones the columns were sized for. */
:lang(en) .p-history thead th {
  font-size: var(--fs-label);
}

.p-history thead th.p-strong {
  font-weight: 500;
  color: var(--ink);
}

/* Sized for three-digit figures in every column and for the Thai column names. */
.p-history tr > :nth-child(1) { width: 44px; }
.p-history tr > :nth-child(2) { width: 50px; }
.p-history tr > :nth-child(3) { width: 46px; }
.p-history tr > :nth-child(4) { width: 46px; }
.p-history tr > :nth-child(5) { width: 62px; }
.p-history tr > :nth-child(6) { width: 46px; }
.p-history tr > :nth-child(7) { width: 62px; }

.p-history thead th:last-child,
.p-history td:last-child {
  padding-right: 7px;
}

.p-history tbody {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.p-history tbody tr {
  height: 32px;
}

.p-history tbody tr + tr {
  border-top: 1px solid var(--line);
}

.p-history tbody th {
  padding: 0;
  font-family: var(--font-th);
  font-size: var(--fs-small);
  font-weight: 400;
  color: var(--ink-muted);
  text-align: right;
}

.p-history td {
  padding: 0;
}

.p-quiet {
  color: var(--ink-muted);
}

.p-row--open {
  background: var(--surface-raised);
}

.p-owe {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  color: var(--markdown);
}

.p-owe .icon {
  align-self: center;
}

.p-owe__word {
  font-family: var(--font-th);
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 500;
}

.p-thinking {
  display: flex;
  justify-content: flex-end;
  color: var(--ink-faint);
}

.p-baht {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}

.p-baht__sign {
  font-family: var(--font-th);
  font-size: var(--fs-small);
  font-weight: 400;
}

/* P06 Recap */
.p-recap {
  position: relative;
  z-index: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.p-rail {
  position: absolute;
  z-index: 1;
  top: 26px;
  bottom: 32px;
  left: 21px;
  width: 2px;
  background: var(--violet);
}

.p-wire {
  position: absolute;
  top: 26px;
  right: 59px;
  bottom: 32px;
  width: 0;
  border-left: 2px dashed var(--dashed-deciding);
}

.p-station {
  position: relative;
  flex: none;
  display: grid;
  grid-template-columns: 42px 1fr 88px;
  align-items: center;
  padding-right: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.p-station--up {
  height: 52px;
}

.p-station--down {
  height: 64px;
}

.p-station__node {
  display: flex;
  justify-content: center;
}

.p-node {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 3px solid var(--neon);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  color: var(--ink);
}

.p-station__name {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding-left: 5px;
  white-space: nowrap;
}

.p-station__gloss {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-faint);
}

.p-station__text {
  display: flex;
  flex-direction: column;
  padding-left: 5px;
}

.p-station__text .p-station__name,
.p-station__text .p-lane__word {
  padding-left: 0;
}

.p-station__end {
  display: flex;
  justify-content: center;
  color: var(--neon);
}

.p-lane {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 88px;
  padding-right: 16px;
}

/* The right padding keeps a row's tag clear of the sender's face on the order slip. */
.p-lane__left {
  display: flex;
  flex-direction: column;
  padding: 4px 20px 4px 0;
}

.p-lane__title {
  padding-left: 48px;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 500;
}

.p-lane__row {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 44px 70px auto;
  justify-content: start;
  align-items: center;
  height: 40px;
}

.p-lane__row--arrived {
  height: 48px;
}

.p-lane__row--truck {
  grid-template-columns: 44px minmax(0, 1fr);
  justify-content: stretch;
  height: auto;
  min-height: 40px;
}

/* The tag sits beside the quantity, and under it where the two do not fit one line. */
.p-lane__load {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.p-lane__load .p-lane__qty {
  min-width: 70px;
}

:lang(en) .p-lane__load .p-lane__qty {
  min-width: 84px;
}

.p-lane__load .p-lane__tag {
  margin-left: 4px;
}

.p-lane__row--truck,
.p-lane__row--arrived {
  animation: p-truck-in 600ms ease-out both;
}

.p-lane__mark {
  display: flex;
  justify-content: center;
}

.p-truck {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: var(--violet);
  color: var(--on-violet);
}

.p-truck--here {
  box-shadow: 0 0 0 2px var(--canvas), 0 0 0 5px var(--neon);
}

.p-lane__qty {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding-left: 4px;
}

.p-lane__row--arrived .p-lane__qty,
.p-out .p-lane__qty {
  padding-left: 0;
}

.p-lane__num {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

.p-lane__big {
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 28px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.p-lane__tag {
  padding: 0 8px;
  border-radius: var(--radius-tag);
  background: var(--surface-raised);
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
  white-space: nowrap;
}

.p-lane__word {
  padding-left: 4px;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 500;
  white-space: nowrap;
}

.p-lane__gap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 30px;
}

.p-dotmark {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-pill);
  background: var(--canvas);
  color: var(--neon);
}

.p-lane__right {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 10px;
}

.p-lane__up {
  flex: 1;
  min-height: 44px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.p-slip-wrap {
  position: relative;
  flex: none;
  display: flex;
  animation: p-slip-up 700ms ease-out both;
}

/* Above the slip and its face, on the wire: beside the slip it ran into the delivery rows. */
.p-slip__by {
  position: absolute;
  right: 0;
  bottom: calc(100% + 13px);
  max-width: 110px;
  padding: 0 2px;
  background: var(--canvas);
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
  white-space: nowrap;
}

.p-slip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px 3px 7px;
  border-radius: var(--radius-tag);
  background: var(--gold);
  color: var(--on-gold);
}

.p-slip .p-face {
  position: absolute;
  top: -12px;
  left: -12px;
  border: 2px solid var(--canvas);
}

.p-slip__num {
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 20px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.p-slip__unit {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 500;
}

.p-lane__tail {
  flex: 2;
  width: 2px;
  background: var(--gold);
}

.p-home {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 164px;
  padding: 9px 15px 11px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.p-home__head {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  height: 34px;
}

.p-home__faces {
  display: flex;
  gap: 4px;
}

.p-home__nums {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-left: 47px;
}

.p-home__col {
  display: flex;
  flex-direction: column;
}

.p-home__col--owe {
  align-items: flex-end;
}

.p-home__label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

.p-home__col--risk .p-home__label {
  font-weight: 500;
  color: var(--ink);
}

.p-home__col--risk .p-home__label .icon {
  color: var(--markdown);
}

.p-home__qty {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.p-home__num {
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 40px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.p-home__num--quiet {
  color: var(--ink-muted);
}

.p-home__col--risk .p-home__num {
  color: var(--markdown);
}

.p-home__delta {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 500;
  color: var(--ink-muted);
}

.p-home__col--risk .p-home__delta {
  color: var(--markdown);
}

.p-out {
  position: relative;
  flex: none;
  display: grid;
  grid-template-columns: 1fr 88px;
  align-items: center;
  height: 48px;
  padding-right: 16px;
}

.p-out__up {
  display: flex;
  justify-content: center;
}

.p-orderbox {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 0 10px;
  border: 2px solid var(--neon);
  border-radius: var(--radius-tag);
  background: var(--surface-raised);
  color: var(--ink);
}

.p-recap__auto {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-raised);
  font-size: var(--fs-small);
  line-height: var(--lh-text);
}

.p-recap__auto .icon {
  color: var(--neon);
}

.p-recap__go {
  flex: none;
}

.p-recap__cost {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
  white-space: nowrap;
}

@keyframes p-truck-in {
  from {
    opacity: 0;
    transform: translateY(-36px);
  }
}

@keyframes p-slip-up {
  from {
    transform: translateY(72px);
  }
}

/* P09 Guess */
.p-guess {
  gap: 16px;
  padding: 20px 16px;
}

.p-stop {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.p-stop__mascot {
  flex: none;
  width: 240px;
  height: auto;
  margin-left: 50px;
}

.p-stop__title {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.p-stop__title h1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.p-guess__ask {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.p-guess__ask p {
  color: var(--ink-muted);
}

.p-dock--guess {
  gap: 10px;
  min-height: 0;
  padding: 10px 12px;
}

/* P10 Results */
.p-results {
  gap: 14px;
  padding: 20px 16px;
}

.p-results__text {
  gap: 6px;
  padding-top: 8px;
}

.p-results__eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.p-results__eyebrow .level-badge {
  gap: 6px;
  font-size: var(--fs-small);
  color: var(--ink-muted);
}

.p-results__answer {
  font-size: var(--fs-h2);
  line-height: var(--lh-heading);
}

.p-results__mascot {
  flex: none;
  width: 120px;
  height: auto;
}

.p-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.p-panel--raised {
  background: var(--surface-raised);
}

.p-panel__label {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

.p-panel__hint {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

.p-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
}

.p-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.p-key {
  flex: none;
  width: 18px;
  border-top: 3px solid var(--gold);
  border-radius: 2px;
}

.p-key--demand {
  border-top: 2px dashed var(--ink-faint);
  border-radius: 0;
}

.p-key--stock,
.p-key--owed {
  width: 10px;
  height: 10px;
  border: 0;
  background: var(--violet);
}

.p-key--owed {
  background: var(--markdown);
}

.p-plot {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.p-plot svg {
  display: block;
  width: 100%;
  height: auto;
}

.p-plot__tip {
  display: flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  white-space: nowrap;
}

.p-plot__tip strong {
  font-weight: 600;
  color: var(--gold);
}

.p-plot__base {
  stroke: var(--line);
  stroke-width: 1;
}

.p-plot__demand,
.p-plot__ours {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.p-plot__demand {
  stroke: var(--ink-faint);
  stroke-width: 2;
  stroke-dasharray: 5 4;
}

.p-plot__demand-dot {
  fill: var(--ink-faint);
}

.p-plot__ours {
  stroke: var(--gold);
  stroke-width: 2.5;
}

.p-plot__lead {
  stroke: var(--gold);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.p-plot__peak {
  fill: var(--gold);
  stroke: var(--surface);
  stroke-width: 2;
}

.p-plot__stock {
  fill: var(--violet);
}

.p-plot__owed {
  fill: var(--markdown);
}

.p-plot__zero {
  stroke: var(--ink-faint);
  stroke-width: 1;
}

.p-plot__axis {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

.p-plot__last {
  margin-left: auto;
}

.p-lesson {
  gap: 10px;
}

.p-lesson__role {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--neon);
}

.p-lesson__role .label {
  color: var(--ink);
}

.p-lesson__title {
  font-size: var(--fs-h2);
  line-height: var(--lh-heading);
}

.p-lesson__part {
  display: flex;
  flex-direction: column;
}

.p-lesson__label {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 600;
  color: var(--ink-muted);
}

/* Five steps share the row, so the panel gives its side padding to the role names. */
.p-stairs {
  padding-left: 6px;
  padding-right: 6px;
}

.p-stairs > .p-panel__label,
.p-stairs > .p-panel__hint {
  padding: 0 8px;
}

/* At 360 the five columns are 63 px, and Wholesaler beside Distributor needs 67 px for 8 px between them. */
@media (max-width: 380px) {
  .p-stairs {
    padding-left: 0;
    padding-right: 0;
  }

  .p-stairs__name:nth-child(3) {
    transform: translateX(-1px);
  }

  .p-stairs__name:nth-child(4) {
    transform: translateX(1px);
  }
}

.p-stairs__plot {
  position: relative;
}

.p-stairs__plot svg {
  display: block;
  width: 100%;
  height: auto;
}

.p-stairs__bar {
  fill: var(--line);
}

.p-stairs__bar--customers {
  fill: none;
  stroke: var(--ink-faint);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

.p-stairs__bar--mine {
  fill: var(--gold);
}

.p-stairs__val {
  position: absolute;
  transform: translateX(-50%);
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  white-space: nowrap;
}

.p-stairs__val--mine {
  font-weight: 800;
  color: var(--gold);
}

.p-stairs__names {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.p-stairs__name {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: var(--fs-label);
  line-height: var(--lh-text);
  color: var(--ink-muted);
  white-space: nowrap;
}

.p-stairs__name .icon {
  color: var(--neon);
}

.p-stairs__name--mine {
  color: var(--ink);
}

.p-stairs__you {
  margin-top: 6px;
  padding: 0 6px;
  border-radius: var(--radius-tag);
  background: var(--gold);
  color: var(--on-gold);
  font-weight: 600;
}

/* The real demand takes the width its numbers need (4 then 12 on Extreme), and half at least. */
.p-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(calc(50% - 5px), max-content);
  gap: 10px;
}

.p-pair .p-panel {
  gap: 2px;
}

.p-stat {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 6px;
}

.p-stat__num {
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 36px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.p-stat--quiet .p-stat__num {
  color: var(--ink-muted);
}

.p-rows {
  gap: 0;
  padding: 0;
}

.p-rowline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}

.p-rowline + .p-rowline {
  border-top: 1px solid var(--line);
}

.p-rowline .icon {
  color: var(--neon);
}

.p-rowline strong {
  font-weight: 600;
}

.p-rowline__two {
  display: flex;
  flex-direction: column;
}

.p-winner {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.p-winner > .icon {
  color: var(--neon);
}

.p-winner__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* The winner's cost runs to five digits on Extreme, so the name wraps and is never cut. */
.p-winner__name {
  font-size: var(--fs-h2);
  line-height: var(--lh-heading);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.p-winner__cost {
  flex: none;
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 32px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}

.p-thanks {
  display: flex;
  justify-content: center;
  padding-bottom: 4px;
}

/* Phones narrower than the 390 px artboards. */
@media (max-width: 374px) {
  .p-tiles {
    gap: 4px;
    margin: 0 -4px;
  }

  .p-tile {
    padding: 12px 4px 6px;
  }

  .p-tile--deciding {
    padding: 10px 2px 4px;
  }

  .p-tile__role,
  .p-tile__state {
    font-size: 12px;
  }
}

/* The role reveal, shown once to a phone that has just been dealt a team */
.p-reveal {
  gap: 16px;
  padding: 20px 16px;
  animation: p-reveal-in 320ms ease-out;
}

@keyframes p-reveal-in {
  from {
    opacity: 0;
  }
}

.p-reveal__top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.p-reveal__lead {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.p-reveal__you {
  color: var(--ink-muted);
}

.p-reveal__role {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.p-reveal__badge {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--violet);
  color: var(--on-violet);
}

.p-reveal__name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 28px;
  line-height: 1.25;
}

.p-reveal__gloss {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 400;
  color: var(--ink-muted);
}

.p-reveal__mascot {
  flex: none;
  width: 104px;
  height: auto;
}

.p-reveal__card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.p-reveal__chain {
  font-weight: 600;
}

.p-reveal__does {
  color: var(--ink-muted);
}

.p-reveal__mates ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.p-reveal__mate {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

@media (max-height: 820px) {
  .p-reveal {
    gap: 10px;
    padding: 12px 16px;
  }

  .p-reveal__card {
    gap: 6px;
    padding: 12px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .p-reveal {
    animation: none;
  }
}
