/*
  Shared components. Each mirrors a Unity component; the source is named in the comment.
  Sizes are canvas units via --u (see tokens.css).
*/

/* ---- Buttons: BaseButtonView + Prefabs/UI/Buttons/Themes/*.asset ------------------------ */
.btn {
  --btn-base: #ffc800;
  --btn-top: color-mix(in srgb, var(--btn-base) 92%, #ffffff);
  --btn-lip: color-mix(in srgb, var(--btn-base) 84%, #000000);
  --btn-shadow: color-mix(in srgb, var(--btn-base) 58%, #000000);
  --btn-ink: #ffffff;
  --btn-edge: color-mix(in srgb, var(--btn-base) 58%, #000000);
  --btn-h: calc(104 * var(--u));
  --btn-font: calc(36 * var(--u));
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(16 * var(--u));
  min-height: var(--btn-h);
  min-width: calc(var(--btn-h) * 1.6);
  padding: 0 calc(48 * var(--u));
  border-radius: 999px;
  background: linear-gradient(180deg, var(--btn-top), var(--btn-base) 62%);
  box-shadow:
    inset 0 calc(3 * var(--u)) 0 rgba(255, 255, 255, 0.38),
    inset 0 calc(-7 * var(--u)) 0 var(--btn-lip),
    0 calc(10 * var(--u)) calc(16 * var(--u)) color-mix(in srgb, var(--btn-shadow) 42%, transparent);
  color: var(--btn-ink);
  font-weight: var(--w-extrabold);
  font-size: var(--btn-font);
  line-height: 1;
  letter-spacing: var(--tmp-bold);
  text-transform: uppercase;
  /* BaseButtonView 1.3.0: the label and icon are outlined in the button's own dark edge colour
     (reference captures 38-friends-tab, 109-couch-clash-setup), not just drop-shadowed */
  text-shadow: 0 calc(4 * var(--u)) 0 var(--btn-edge);
  -webkit-text-stroke: calc(5 * var(--u)) var(--btn-edge);
  paint-order: stroke fill;
  white-space: nowrap;
  transition:
    transform var(--t-fast) var(--ease-out),
    filter var(--t-fast);
}
/* An em letter-spacing is inherited as a fixed length, so a label that auto-sizes inside a button would keep
   the full-size spacing and overflow: give every descendant its own bold spacing (zero specificity). */
.btn :where(*) {
  letter-spacing: var(--tmp-bold);
}
.btn:hover:not(:disabled) {
  filter: brightness(1.04);
}
.btn:active:not(:disabled),
.btn.is-pressed {
  transform: translateY(calc(6 * var(--u))) scale(0.985);
  box-shadow:
    inset 0 calc(3 * var(--u)) 0 rgba(255, 255, 255, 0.3),
    inset 0 calc(-3 * var(--u)) 0 var(--btn-lip),
    0 calc(4 * var(--u)) calc(8 * var(--u)) color-mix(in srgb, var(--btn-shadow) 34%, transparent);
}
.btn:disabled,
.btn.is-disabled {
  --btn-base: var(--disabled-face);
  --btn-edge: rgba(0, 0, 0, 0.18);
  cursor: default;
  filter: none;
}
.btn__icon {
  width: calc(52 * var(--u));
  height: calc(52 * var(--u));
  object-fit: contain;
  flex: none;
  filter: drop-shadow(calc(2 * var(--u)) 0 0 var(--btn-edge)) drop-shadow(calc(-2 * var(--u)) 0 0 var(--btn-edge))
    drop-shadow(0 calc(2 * var(--u)) 0 var(--btn-edge)) drop-shadow(0 calc(-2 * var(--u)) 0 var(--btn-edge))
    drop-shadow(0 calc(4 * var(--u)) 0 var(--btn-edge));
}
.btn__label {
  overflow: hidden;
  text-overflow: ellipsis;
  /* room for accents (Ä, Ö) above the cap height: line-height 1 would clip them under overflow:hidden */
  padding-block: 0.25em;
  margin-block: -0.25em;
}
.btn__cost {
  display: inline-flex;
  align-items: center;
  gap: calc(8 * var(--u));
  font-size: calc(40 * var(--u));
}
.btn__cost img {
  width: calc(44 * var(--u));
  height: calc(44 * var(--u));
  object-fit: contain;
  filter: none;
}
/* Unity's large buttons in 1.3.0 captures: ~120u tall, ~39u Rubik Bold labels with bold spacing */
.btn--lg {
  --btn-h: calc(120 * var(--u));
  --btn-font: calc(40 * var(--u));
  padding: 0 calc(64 * var(--u));
}
.btn--compact {
  --btn-h: calc(88 * var(--u));
  --btn-font: calc(30 * var(--u));
  padding: 0 calc(36 * var(--u));
}
/* A long call to action: a smaller face and tighter sides so the label ends in no ellipsis at 360 px */
.btn--long {
  --btn-font: calc(31 * var(--u));
  padding: 0 calc(34 * var(--u));
  letter-spacing: 0;
}
.btn--plain {
  text-transform: none;
}
.btn--block {
  display: flex;
  width: 100%;
}
.btn--yellow {
  --btn-base: #ffc800;
  --btn-edge: var(--amber-edge);
}
.btn--green {
  --btn-base: #0d8439;
}
.btn--blue {
  --btn-base: #337fe0;
}
.btn--lila {
  --btn-base: #652d9e;
}
.btn--orange {
  --btn-base: #f38208;
}
.btn--slate {
  --btn-base: #566596;
}
.btn--danger {
  --btn-base: #dd6251;
}
.btn--white {
  --btn-base: #ffffff;
  --btn-ink: var(--ink);
  --btn-edge: transparent;
  --btn-lip: #d8d6d0;
  --btn-shadow: #6b6f80;
  box-shadow:
    inset 0 0 0 calc(2 * var(--u)) #e4e0d8,
    inset 0 calc(-7 * var(--u)) 0 var(--btn-lip),
    0 calc(10 * var(--u)) calc(16 * var(--u)) color-mix(in srgb, var(--btn-shadow) 26%, transparent);
  text-shadow: none;
  -webkit-text-stroke: 0;
}
.btn--white .btn__icon {
  filter: brightness(0) invert(11%) sepia(38%) saturate(2400%) hue-rotate(204deg) brightness(0.92);
}
.btn--accent {
  /* category-accent action (CategoryPreviewTheme): --btn-base is set inline */
}

/* Round icon button (Btn_IconButton_Circle_121_WhiteCustom / header controls) */
.icon-btn {
  --size: var(--control);
  display: inline-grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 calc(3 * var(--u)) calc(6 * var(--u)) rgba(27, 37, 89, 0.18);
  color: var(--ink);
  transition: transform var(--t-fast) var(--ease-out);
}
.icon-btn:active {
  transform: scale(0.94);
}
.icon-btn img {
  width: 52%;
  height: 52%;
  object-fit: contain;
}
.icon-btn svg {
  width: 46%;
  height: 46%;
}
.icon-btn--glass {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: none;
  color: var(--cream);
}
.icon-btn__dot {
  position: absolute;
  top: 6%;
  right: 6%;
  width: calc(24 * var(--u));
  height: calc(24 * var(--u));
  border-radius: 50%;
  background: var(--alert);
  border: calc(3 * var(--u)) solid #fff;
}

/* ---- Currency pills: HubHeader CurrencyHud (Status_Frame_Light pills) --------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: calc(6 * var(--u));
  height: calc(72 * var(--u));
  padding: 0 calc(16 * var(--u)) 0 calc(10 * var(--u));
  border-radius: 999px;
  background: rgba(251, 248, 242, 0.95);
  box-shadow:
    inset 0 0 0 calc(2 * var(--u)) rgba(255, 255, 255, 0.9),
    0 calc(2 * var(--u)) calc(6 * var(--u)) rgba(27, 37, 89, 0.12);
  color: var(--ink);
  font-weight: var(--w-medium);
  font-size: calc(32 * var(--u));
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pill__icon {
  width: calc(46 * var(--u));
  height: calc(46 * var(--u));
  object-fit: contain;
  flex: none;
}
.pill--dark {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: none;
  color: #fff;
}
.pill.is-bump {
  animation: pill-bump 220ms var(--ease-out);
}
@keyframes pill-bump {
  50% {
    transform: scale(1.18);
  }
}

/* ---- Screen header: ScreenHeaderView + HeaderTheme ---------------------------------------- */
.screen-header {
  --band: var(--navy);
  --header-ink: var(--cream);
  position: relative;
  flex: none;
  display: grid;
  grid-template-columns: var(--control) 1fr var(--control);
  align-items: center;
  column-gap: calc(24 * var(--u));
  min-height: calc(var(--header-h) + var(--safe-top));
  padding: calc(var(--safe-top) + 20 * var(--u)) calc(40 * var(--u)) calc(20 * var(--u));
  background: var(--band);
  color: var(--header-ink);
  z-index: 2;
}
.screen-header--rounded {
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}
.screen-header__title {
  min-width: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(2 * var(--u));
}
.screen-header__title h1 {
  max-width: 100%;
  font-weight: var(--w-semibold);
  font-size: calc(50 * var(--u));
  line-height: 1.1;
  color: #fff;
  text-shadow: var(--on-colour-shadow);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.screen-header__title p {
  max-width: 100%;
  font-weight: var(--w-medium);
  font-size: calc(26 * var(--u));
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: var(--on-colour-shadow);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.screen-header__side {
  display: flex;
  align-items: center;
  gap: calc(16 * var(--u));
  min-width: var(--control);
}
.screen-header__side--end {
  justify-content: flex-end;
}
.screen-header .icon-btn {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: none;
  color: #fff;
}
.screen-header .pill {
  background: rgba(255, 255, 255, 0.16);
  /* the same tint, opaque: the mountain decor must not show through behind the count */
  background: color-mix(in srgb, var(--band) 84%, #fff);
  box-shadow: none;
  color: #fff;
  text-shadow: var(--on-colour-shadow);
}

/* ---- Cards, rows, chips --------------------------------------------------------------------- */
.card {
  background: #fff;
  border-radius: var(--radius-card);
  box-shadow: 0 calc(6 * var(--u)) calc(18 * var(--u)) rgba(27, 37, 89, 0.12);
}
.card--warm {
  background: var(--card-warm);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: calc(8 * var(--u));
  height: calc(48 * var(--u));
  padding: 0 calc(18 * var(--u));
  border-radius: 999px;
  background: rgba(27, 37, 89, 0.08);
  color: var(--ink);
  font-weight: var(--w-medium);
  font-size: calc(24 * var(--u));
  white-space: nowrap;
}
.chip--on-colour {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  text-shadow: var(--on-colour-shadow);
}

/* segmented control (SegmentedChipGroup) */
.segmented {
  display: inline-flex;
  padding: calc(6 * var(--u));
  gap: calc(6 * var(--u));
  border-radius: 999px;
  background: rgba(27, 37, 89, 0.08);
}
.segmented button {
  height: calc(68 * var(--u));
  padding: 0 calc(28 * var(--u));
  border-radius: 999px;
  font-weight: var(--w-semibold);
  font-size: calc(26 * var(--u));
  color: var(--ink-soft);
  transition: background var(--t-fast), color var(--t-fast);
}
.segmented button[aria-pressed='true'] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 calc(2 * var(--u)) calc(6 * var(--u)) rgba(27, 37, 89, 0.16);
}

/* ---- Popup: Popup + PopupScreenHeader ------------------------------------------------------ */
.popup-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-top) + 40 * var(--u)) calc(48 * var(--u)) calc(var(--safe-bottom) + 40 * var(--u));
  background: rgba(0, 0, 0, 0.59);
  animation: fade-in var(--t-med) var(--ease-out);
}
.popup {
  position: relative;
  width: min(100%, calc(960 * var(--u)));
  max-height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-card);
  background: var(--card-warm);
  box-shadow: 0 calc(16 * var(--u)) calc(48 * var(--u)) rgba(0, 0, 0, 0.32);
  overflow: hidden;
  animation: pop-in var(--t-med) var(--ease-spring);
}
.popup__header {
  --band: var(--navy);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(6 * var(--u));
  padding: calc(40 * var(--u)) calc(120 * var(--u)) calc(34 * var(--u));
  background: var(--band);
  color: #fff;
  text-align: center;
}
.popup__header h2 {
  font-weight: var(--w-semibold);
  font-size: calc(48 * var(--u));
  line-height: 1.15;
  text-shadow: var(--on-colour-shadow);
}
.popup__header p {
  font-weight: var(--w-medium);
  font-size: calc(28 * var(--u));
  opacity: 0.92;
  text-shadow: var(--on-colour-shadow);
}
.popup__close {
  position: absolute;
  top: calc(24 * var(--u));
  right: calc(24 * var(--u));
}
.popup__body {
  padding: calc(40 * var(--u)) calc(48 * var(--u));
  overflow-y: auto;
  font-size: calc(32 * var(--u));
  line-height: 1.4;
  color: var(--ink);
}
.popup__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: calc(24 * var(--u));
  padding: calc(8 * var(--u)) calc(48 * var(--u)) calc(48 * var(--u));
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
}

/* ---- Toast ---------------------------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + var(--tabbar-h) + 32 * var(--u));
  z-index: 60;
  transform: translateX(-50%);
  max-width: min(90vw, 560px);
  padding: calc(22 * var(--u)) calc(36 * var(--u));
  border-radius: 999px;
  background: rgba(0, 18, 66, 0.92);
  color: #fff;
  font-weight: var(--w-medium);
  font-size: calc(30 * var(--u));
  text-align: center;
  box-shadow: 0 calc(8 * var(--u)) calc(24 * var(--u)) rgba(0, 0, 0, 0.25);
  animation: toast-in var(--t-med) var(--ease-out);
}
.toast--error {
  background: var(--danger-ink);
}
/* A blue popup leaves a quiet band between the hub HUD and its frame. On
   phones this avoids both the popup footer and the raised active tab medal. */
.layout-phone:has(.blue-popup) .toast {
  top: calc(var(--safe-top) + 216 * var(--u));
  bottom: auto;
}
/* Wide layouts have a quiet park margin beyond the modal. Feedback must not
   cover modal actions, reward values, or the Settings toggles. */
@media (min-width: 1200px) {
  .toast {
    left: auto;
    right: 24px;
    bottom: 24px;
    max-width: min(300px, calc((100vw - 760px) / 2 - 48px));
    transform: none;
    border-radius: 24px;
    text-align: left;
    animation-name: toast-in-wide;
  }
}
@keyframes toast-in-wide {
  from { opacity: 0; transform: translateY(12px); }
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
}

/* ---- Loading -------------------------------------------------------------------------------- */
.spinner {
  width: calc(72 * var(--u));
  height: calc(72 * var(--u));
  border-radius: 50%;
  border: calc(8 * var(--u)) solid rgba(27, 37, 89, 0.14);
  border-top-color: var(--yellow);
  animation: spin 900ms linear infinite;
}
.reduced-motion .spinner {
  animation-duration: 2400ms;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.state-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(24 * var(--u));
  padding: calc(64 * var(--u)) calc(48 * var(--u));
  text-align: center;
  color: var(--ink);
}
.state-panel h2 {
  font-weight: var(--w-semibold);
  font-size: calc(40 * var(--u));
}
.state-panel p {
  font-size: calc(30 * var(--u));
  color: var(--ink-muted);
  max-width: 32em;
}

/* ---- Robot flipbook (SpriteSheetFlipbook) -------------------------------------------------- */
.robot {
  position: relative;
  display: block;
  pointer-events: none;
}
.robot canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---- Progress bar ---------------------------------------------------------------------------- */
.progress {
  position: relative;
  height: calc(20 * var(--u));
  border-radius: 999px;
  background: rgba(27, 37, 89, 0.14);
  overflow: hidden;
}
.progress__fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: var(--yellow);
  transition: width var(--t-slow) var(--ease-out);
}

/* ---- Category medallion (CategoryPlayTile icon disc) ----------------------------------------- */
.medallion {
  display: grid;
  place-items: center;
  width: calc(116 * var(--u));
  height: calc(116 * var(--u));
  flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  overflow: hidden;
}
.medallion img {
  width: 76%;
  height: 76%;
  object-fit: contain;
}
.medallion__letter {
  font-weight: var(--w-bold);
  font-size: calc(54 * var(--u));
  color: #fff;
  text-shadow: var(--on-colour-shadow);
}

/* single-colour icon (TintedIcon) */
.tinted-icon {
  display: inline-block;
  flex: none;
  width: 1em;
  height: 1em;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

/* sub-sprite of a sheet (SpriteImg) */
.sprite-img {
  display: block;
  background-repeat: no-repeat;
}

/* scroll rail (components/scroll-rail.js): a slim track and thumb in a scrolling panel's right margin, where the
   browsers' own scroll bars are hidden; each screen sets its right offset */
.scroll-rail {
  position: absolute;
  width: max(5px, calc(11 * var(--u)));
  z-index: 3;
  border-radius: 99px;
  background: rgba(60, 120, 215, 0.14);
  touch-action: none;
  cursor: pointer;
}
.scroll-rail[hidden] {
  display: none;
}
.scroll-rail i {
  display: block;
  width: 100%;
  min-height: 36px;
  border-radius: inherit;
  background: rgba(60, 120, 215, 0.72);
  cursor: grab;
}
.scroll-rail i:active {
  cursor: grabbing;
}

/* header decoration (ScreenHeader DecorSlot: mountains at 57%) */
.screen-header__decor {
  position: absolute;
  right: calc(10 * var(--u));
  bottom: 0;
  width: calc(394 * var(--u));
  height: auto;
  opacity: 0.57;
  pointer-events: none;
  z-index: -1;
}
.screen-header {
  isolation: isolate;
  overflow: hidden;
}

/* ticket meter under the tickets pill (CurrencyHud Pill_Tickets/Meter: 18u insets, 11u up, 5u tall) */
.pill--meter {
  position: relative;
  min-width: calc(172 * var(--u));
}
.pill__meter {
  position: absolute;
  left: calc(18 * var(--u));
  right: calc(18 * var(--u));
  bottom: calc(11 * var(--u));
  height: calc(5 * var(--u));
  border-radius: calc(2.5 * var(--u));
  background: rgba(0, 0, 0, 0.14);
  overflow: hidden;
}
.pill__meter > span {
  display: block;
  width: var(--fill);
  height: 100%;
  border-radius: inherit;
  background: #ffc937;
}
