/*
  The blue popup frame (PopupBase) shared by Settings, News and the avatar picker, the Settings rows,
  the switch and the language / contact sheets. Sizes are canvas units via --u.

  The frame is PopupBackgroundBlue1080nostar nine sliced (borders 535 / 280 / 535 / 100). On a popup narrower
  than the two side borders together (880u < 1070u) Unity scales the side borders down to half the width;
  --edge does the same here. The popup is 980u wide on the 1080 canvas minus 100u, 1400u tall, centred.
*/

.popup-screen {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.popup-screen__hub {
  position: absolute;
  inset: 0;
  z-index: 0;
  isolation: isolate;
  pointer-events: none;
}
.popup-screen__dim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.59);
  animation: fade-in var(--t-med) var(--ease-out);
}
.blue-popup {
  --pw: min(calc(100vw - 100 * var(--u)), calc(880 * var(--u)));
  --edge: min(calc(535 * var(--u)), calc(var(--pw) / 2));
  position: relative;
  z-index: 2;
  width: var(--pw);
  height: min(calc(1400 * var(--u)), calc(100% - 2 * var(--safe-top) - 40px));
  animation: pop-in var(--t-med) var(--ease-spring);
}
@media (min-width: 760px) {
  .blue-popup.settings { --pw: min(720px, calc(100vw - 64px)); }
}
.blue-popup__art {
  position: absolute;
  inset: 0;
  border-style: solid;
  border-width: calc(280 * var(--u)) var(--edge) calc(100 * var(--u));
  border-image-slice: 280 535 100 535 fill;
  border-image-width: 1;
  border-image-repeat: stretch;
  pointer-events: none;
  /* on the art, not on the popup: a filter on the popup would become the containing block of the fixed sheets */
  filter: drop-shadow(0 calc(10 * var(--u)) calc(22 * var(--u)) rgba(0, 0, 0, 0.35));
}
/* The sparkles sit in canvas units from the popup's top left corner. The popup is always 880 units wide, so the
   same units hold at every size (a percentage of the width with a fixed top drifted onto the white panel's
   curved top). Both stars stay in the blue head left of the icon and title: their lower edge is above 160 units,
   the white panel's curve begins about 170 units down at the middle and lower still toward the sides. */
.blue-popup__stars img {
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  width: calc(var(--s) * var(--u));
  height: calc(var(--s) * var(--u));
  opacity: 0.5;
  animation: twinkle 2.6s ease-in-out infinite alternate;
  animation-delay: var(--d);
  pointer-events: none;
}
@keyframes twinkle {
  from {
    opacity: 0.15;
    transform: scale(0.8);
  }
  to {
    opacity: 0.75;
    transform: scale(1.1);
  }
}
.reduced-motion .blue-popup__stars img {
  animation: none;
}
.blue-popup__head {
  position: absolute;
  left: calc(110 * var(--u));
  right: calc(110 * var(--u));
  top: calc(50 * var(--u));
  height: calc(100 * var(--u));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(30 * var(--u));
  min-width: 0;
}
.blue-popup__icon {
  height: calc(84 * var(--u));
  width: auto;
  max-width: calc(110 * var(--u));
  object-fit: contain;
  flex: none;
  filter: drop-shadow(0 calc(3 * var(--u)) 0 rgba(0, 40, 120, 0.3));
}
.blue-popup__title {
  min-width: 0;
  font-weight: var(--w-bold);
  font-size: calc(70 * var(--u));
  line-height: calc(100 * var(--u));
  color: #fff;
  text-shadow: 0 calc(4 * var(--u)) 0 rgba(0, 40, 120, 0.32);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.blue-popup__close {
  position: absolute;
  right: calc(42 * var(--u));
  top: calc(56 * var(--u));
  width: calc(88 * var(--u));
  height: calc(88 * var(--u));
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast);
}
.blue-popup__close:hover {
  background: rgba(255, 255, 255, 0.32);
}
.blue-popup__close:active {
  transform: scale(0.94);
}
/* PopupBase's CloseButtonContainer: an 88 circle at 22 % white with the 38 unit icon_white_close glyph */
.blue-popup__close img {
  width: calc(38 * var(--u));
  height: calc(38 * var(--u));
}
.blue-popup__panel {
  position: absolute;
  left: calc(50 * var(--u));
  right: calc(50 * var(--u));
  top: calc(200 * var(--u));
  bottom: calc(100 * var(--u));
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.blue-popup__footer {
  flex: none;
}
/* The frame's white face is nine sliced: its middle band (rows 280..308 of the art) is stretched down the
   whole popup, so the faint texture in those rows became vertical stripes on a tall popup. A plain face of
   the same white covers the stretched band, from where the band starts (80 units under the panel's top) to
   the panel's foot, and from just inside the art's own white edge (its antialiased rim ends 41 of the frame's
   535 side pixels in, so the face's edge stays hidden under the art's). */
.blue-popup__panel {
  isolation: isolate;
}
.blue-popup__panel::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: calc(80 * var(--u));
  bottom: 0;
  left: calc(var(--edge) * 41 / 535 - 50 * var(--u));
  right: calc(var(--edge) * 41 / 535 - 50 * var(--u));
  background: #fefefe;
  pointer-events: none;
}

/* ---- wide: a desktop-scale popup beside the rail, as tall as its content ----------------------------------
   Phone popups are the prefab's 1400 unit frame. On a tablet, laptop or desktop the same frame is drawn at
   a desktop scale (one canvas unit about half a pixel: 35 px title, 60 px rows), centred in the area right
   of the navigation rail, and only as tall as its content (the window caps it; the content scrolls inside). */
.layout-wide .popup-screen {
  padding: 24px 24px 24px calc(148px + 24px); /* the wide rail (shell.css) */
}
.layout-wide .blue-popup {
  --u: clamp(0.46px, calc((100dvh - 48px) / 1500), 0.52px);
  display: flex;
  flex-direction: column;
  height: auto;
  /* the window (--vh, js/ui/layout.js) less the screen's 24 px margins; a grid item's percentage height has
     no definite base here */
  max-height: calc(var(--vh, 100dvh) - 48px);
  padding: calc(200 * var(--u)) calc(50 * var(--u)) calc(100 * var(--u));
}
/* Settings holds about 2070 units with its frame (every row, the three section labels and the version line): on a
   window tall enough (a 1080 p monitor, a portrait iPad) it is drawn just small enough to show every row; shorter
   windows keep the 0.44 px floor and scroll, ending exactly after a whole row (BluePopup.js, usePeek). */
.layout-wide .blue-popup.settings {
  --u: clamp(0.44px, calc((var(--vh, 100dvh) - 48px) / 2080), 0.52px);
}
.layout-wide .blue-popup__panel {
  position: relative;
  inset: auto;
  flex: 0 1 auto;
  min-height: calc(180 * var(--u));
}
.layout-wide .blue-popup .fade-scroll {
  flex: 0 1 auto;
}

/* A popup whose content is short (the empty News list) is as tall as its content on a phone too, like the wide popup:
   the prefab's 1400 unit frame left more than 290 units of empty white above and below it. */
.layout-phone .blue-popup.is-compact {
  display: flex;
  flex-direction: column;
  height: auto;
  max-height: calc(100% - 2 * var(--safe-top) - 40px);
  padding: calc(200 * var(--u)) calc(50 * var(--u)) calc(100 * var(--u));
}
.layout-phone .blue-popup.is-compact .blue-popup__panel {
  position: relative;
  inset: auto;
  flex: 0 1 auto;
  min-height: calc(180 * var(--u));
}

/* The scroll rail (BluePopup.js useRail; the avatar picker's look, profile.css .profile-rail): a slim track and thumb
   in the white margin between the rows and the white panel's edge, so a list that ends exactly after a whole row
   still shows that more rows follow. Centred in that margin: the rows end 8 units inside the panel and the white face
   reaches about 16 units outside it. */
/* the scroll rail (.scroll-rail, components.css) in this panel's right margin */
.popup-rail {
  right: calc(-4 * var(--u) - max(5px, 11 * var(--u)) / 2);
}

/* a scrolling area that fades under the white panel's edges (AdventureEdgeFadeView) */
.fade-scroll {
  flex: 1;
  min-height: 0;
  --fade-top: 0px;
  --fade-bottom: 0px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent 100%);
}
.fade-scroll.no-fade {
  -webkit-mask-image: none;
  mask-image: none;
}
.fade-scroll.is-scrolled {
  --fade-top: calc(40 * var(--u));
}
/* While more follows below: the usual 48 units, or none when the window was cut exactly after a whole row
   (BluePopup.js sets --snap-fade: 0px), so the last whole row is never washed out and nothing of the next shows; the
   scroll rail says that more follows. Once the list has been scrolled the rows pass through the full 48 units. */
.fade-scroll.has-more {
  --fade-bottom: var(--snap-fade, calc(48 * var(--u)));
}
.fade-scroll.has-more.is-scrolled {
  --fade-bottom: calc(48 * var(--u));
}

/* ---- Settings ------------------------------------------------------------------------------------------ */
.settings__scroll {
  /* 12 units of air under the last row once the list has scrolled to its end (the Version line follows the panel) */
  padding: 0 calc(8 * var(--u)) calc(12 * var(--u));
}
/* The label keeps 12 units of air under its capitals (it stood 2 units above its card, about 3 px at phone scale
   and in the desktop popup); the boxes are 10 units taller than the prefab's 44 and 100 for it. */
.settings__section {
  height: calc(54 * var(--u));
  margin-top: calc(34 * var(--u));
  padding: 0 calc(10 * var(--u)) calc(12 * var(--u));
  display: flex;
  align-items: flex-end;
  font-weight: var(--w-medium);
  font-size: calc(36 * var(--u));
  line-height: 1;
  color: #5f6877;
}
.settings__section--tall {
  height: calc(110 * var(--u));
  margin-top: 0;
  padding-bottom: calc(12 * var(--u));
}
/* The Version line stands centred between the list's end (the panel's foot) and the white face's lower edge, which is
   about 71 units below it: the 20 unit line (the prefab's) sits 44 units under the foot (its glyphs a little lower than
   the box's centre). The wide popup draws it a size larger (24 units, about 11 px). */
.settings__version {
  position: absolute;
  left: calc(50 * var(--u));
  right: calc(50 * var(--u));
  bottom: calc(-44 * var(--u));
  text-align: center;
  font-weight: var(--w-medium);
  font-size: calc(20 * var(--u));
  color: #5e9ce2;
  pointer-events: none;
}
.layout-wide .settings__version {
  bottom: calc(-45 * var(--u));
  font-size: calc(24 * var(--u));
}

.settings-profile {
  position: relative;
  height: calc(200 * var(--u));
  border-radius: calc(36 * var(--u));
  background: #f1f7fd;
  box-shadow:
    inset 0 0 0 calc(2 * var(--u)) #d6e6f7,
    0 calc(4 * var(--u)) calc(8 * var(--u)) rgba(27, 37, 89, 0.08);
}
.settings-profile__avatar {
  position: absolute;
  left: calc(20 * var(--u));
  top: 50%;
  width: calc(150 * var(--u));
  height: calc(150 * var(--u));
  transform: translateY(-50%);
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  transition: transform var(--t-fast) var(--ease-out);
}
.settings-profile__avatar:hover {
  transform: translateY(-50%) scale(1.04);
}
.settings-profile__avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.settings-profile__avatar img.is-placeholder {
  filter: brightness(0.66) saturate(0.4) sepia(0.15) hue-rotate(190deg);
  opacity: 0.92;
}
.settings-profile__name {
  position: absolute;
  left: calc(200 * var(--u));
  right: calc(150 * var(--u));
  top: 50%;
  height: calc(70 * var(--u));
  transform: translateY(-50%);
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: calc(12 * var(--u));
  background: transparent;
  font-weight: var(--w-semibold);
  font-size: calc(42 * var(--u));
  color: #031c26;
  text-overflow: ellipsis;
  outline: none;
}
.settings-profile__name:focus {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 calc(4 * var(--u)) #6ba8ec;
  padding: 0 calc(12 * var(--u));
  margin-left: calc(-12 * var(--u));
}
.settings-profile__name::placeholder {
  color: rgba(3, 28, 38, 0.5);
}
.settings-profile__edit {
  position: absolute;
  right: calc(40 * var(--u));
  top: 50%;
  width: calc(80 * var(--u));
  height: calc(80 * var(--u));
  transform: translateY(-50%);
  transition: transform var(--t-fast) var(--ease-out);
}
.settings-profile__edit:hover {
  transform: translateY(-50%) scale(1.06);
}
.settings-profile__edit img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 calc(3 * var(--u)) calc(4 * var(--u)) rgba(27, 37, 89, 0.18));
}

.settings-row {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: calc(120 * var(--u));
  padding: 0 calc(26 * var(--u)) 0 calc(20 * var(--u));
  gap: calc(50 * var(--u));
  border-radius: calc(36 * var(--u));
  background: #fdfdfe;
  box-shadow:
    inset 0 0 0 calc(2 * var(--u)) #e4e8ef,
    0 calc(3 * var(--u)) calc(6 * var(--u)) rgba(27, 37, 89, 0.07);
  text-align: left;
  color: #031c26;
  transition: background var(--t-fast);
}
button.settings-row:hover {
  background: #f4f7fb;
}
button.settings-row:active {
  background: #eaeff7;
}
.settings-row__icon,
.settings-row__disc {
  flex: none;
  width: calc(80 * var(--u));
  height: calc(80 * var(--u));
  object-fit: contain;
}
.settings-row__disc--teal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(8 * var(--u));
  border-radius: 50%;
  background: #13b5a6;
}
.settings-row__disc--notifications {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #1b2559;
}
.settings-row__disc--notifications img {
  width: 64%;
  height: 64%;
  object-fit: contain;
}
/* Delete account: the game's own trash glyph (Action_Delete, the danger action icon) on the danger red, set like the
   Notifications disc, so the destructive row no longer shares Privacy's green shield */
.settings-row__disc--danger {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--danger);
}
.settings-row__disc--danger img {
  width: 64%;
  height: 64%;
  object-fit: contain;
}
/* Restore purchases: the game's replay action glyph on the purchase green */
.settings-row__disc--restore {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #1f9a4b;
}
.settings-row__disc--restore img {
  width: 64%;
  height: 64%;
  object-fit: contain;
}
.settings-row__disc--teal i {
  width: calc(11 * var(--u));
  height: calc(34 * var(--u));
  border-radius: calc(3 * var(--u));
  background: #fff;
}
.settings-row__label {
  flex: 1;
  min-width: 0;
  font-weight: var(--w-medium);
  font-size: calc(36 * var(--u));
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-row.is-danger .settings-row__label {
  color: #ad292e;
}
.settings-row__value {
  flex: none;
  font-weight: var(--w-medium);
  font-size: calc(28 * var(--u));
  color: #5f6877;
}
.settings-row__caret {
  flex: none;
  width: calc(27 * var(--u));
  height: calc(41 * var(--u));
  margin-right: calc(14 * var(--u));
  transition: transform var(--t-med) var(--ease-out);
}
.settings-row__caret img {
  width: 100%;
  height: 100%;
}
.settings-language.is-open .settings-row__caret {
  transform: rotate(90deg);
}

/* the switch (FormElements/Switch.prefab, 179x98 at 0.8) */
.switch {
  position: relative;
  flex: none;
  width: calc(143 * var(--u));
  height: calc(78 * var(--u));
}
.switch__off,
.switch__on {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-size: 100% 100%;
  transition: opacity var(--t-med);
}
.switch__on {
  opacity: 0;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}
.switch.is-on .switch__on {
  opacity: 1;
}
.switch__handle {
  position: absolute;
  left: calc(4 * var(--u));
  top: calc(8 * var(--u));
  width: calc(62 * var(--u));
  height: calc(62 * var(--u));
  transition: transform var(--t-med) var(--ease-out);
}
.switch.is-on .switch__handle {
  transform: translateX(calc(70 * var(--u)));
}

/* the language list inside its row (SettingLanguageController: 120u collapsed, 500u open) */
.settings-language {
  border-radius: calc(36 * var(--u));
  background: #fdfdfe;
  box-shadow:
    inset 0 0 0 calc(2 * var(--u)) #e4e8ef,
    0 calc(3 * var(--u)) calc(6 * var(--u)) rgba(27, 37, 89, 0.07);
}
.settings-language > .settings-row {
  box-shadow: none;
  background: transparent;
}
.settings-language__list {
  display: flex;
  flex-direction: column;
  height: calc(380 * var(--u));
  padding: calc(8 * var(--u)) calc(40 * var(--u)) 0 calc(82 * var(--u));
}
.settings-language__list[hidden] {
  display: none;
}
.settings-language__item {
  display: flex;
  align-items: center;
  gap: calc(19 * var(--u));
  height: calc(110 * var(--u));
  border-radius: calc(24 * var(--u));
  text-align: left;
  font-weight: var(--w-medium);
  font-size: calc(36 * var(--u));
  color: #031c26;
}
.settings-language__item:hover {
  background: #f1f5fb;
}
/* the 128 x 84 flag sprites at 0.7, plain: no frame, no rounding (SettingLanguageController) */
.settings-language__flag {
  width: calc(90 * var(--u));
  height: calc(59 * var(--u));
  flex: none;
  object-fit: cover;
}

/* ---- sheets (the shared navy Popup) --------------------------------------------------------------------- */
.language-sheet__body,
.contact-sheet__body {
  text-align: center;
  font-weight: var(--w-medium);
  color: var(--ink-muted);
}
.language-sheet__body.is-failed {
  color: var(--danger-ink);
}
.language-sheet__bar {
  height: calc(24 * var(--u));
  margin-top: calc(28 * var(--u));
  border-radius: 999px;
  background: rgba(27, 37, 89, 0.12);
  overflow: hidden;
}
.language-sheet__bar span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-green);
  animation: sheet-bar 1.3s ease-in-out infinite alternate;
}
@keyframes sheet-bar {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(150%);
  }
}
.reduced-motion .language-sheet__bar span {
  animation: none;
  width: 100%;
}
.language-sheet__caption {
  margin-top: calc(20 * var(--u));
  text-align: center;
  font-size: calc(26 * var(--u));
  color: var(--ink-soft);
}
.contact-sheet__address {
  margin-top: calc(16 * var(--u));
  text-align: center;
  font-weight: var(--w-bold);
  font-size: calc(38 * var(--u));
  color: var(--ink);
  user-select: all;
  -webkit-user-select: all;
}
