/* Truco Showdown - overlay panels (pause, sound, settings, language, how to play, win, loss): the navy
   panel, its straight title band sitting on the top edge, the X centred on the top-right corner. The real screen stays
   behind, darkened. Always centred on both axes; a panel that does not fit shrinks as a whole (--k), never scrolls. */
.ov {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-t) + 34px) calc(var(--safe-r) + 16px) calc(var(--safe-b) + 16px) calc(var(--safe-l) + 16px);
}
.ov-dim {
  position: absolute;
  inset: 0;
  background: rgba(8, 14, 50, 0.55);
}
.ov-box {
  --pu: calc(var(--u) * 1.18);
  position: relative;
  width: min(calc(var(--pu) * 540), 100%, var(--vw) - 46px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: calc(var(--pu) * 14);
  padding: calc(var(--pu) * 46) calc(var(--pu) * 14) calc(var(--pu) * 16);
}
/* the smallest letter of a panel: --t */
.ov,
#s-quick {
  --t: 14px;
}
@media (max-width: 389px), (max-height: 500px) {
  .ov,
  #s-quick {
    --t: 13px;
  }
}
/* opening and closing: src/ui/menufx.js (panelIn / panelOut) */
.ov[data-out] {
  pointer-events: none;
}
.fx-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
/* the band: one size in the whole game, centred on the panel's top edge */
.ov-box > .band {
  --bh: calc(var(--pu) * 74);
  position: absolute;
  left: 50%;
  translate: -50% 0;
  top: calc(var(--pu) * -48);
  width: 78%;
  z-index: 2;
}
.ov-box > .x {
  position: absolute;
  z-index: 3;
  --s: max(44px, calc(var(--pu) * 64));
  top: calc(var(--s) * -0.5 - var(--pu) * 14);
  right: calc(var(--s) * -0.5 - var(--pu) * 14);
}
.ov-text {
  margin: 0;
  text-align: center;
  font-size: max(var(--t), calc(var(--pu) * 30));
  line-height: 1.25;
}

/* rows: label on the left, switch / value on the right, thin lines between them */
.list {
  display: flex;
  flex-direction: column;
}
.opt {
  display: flex;
  align-items: center;
  gap: calc(var(--pu) * 14);
  min-height: max(46px, calc(var(--pu) * 74));
  padding: 0 calc(var(--pu) * 16);
  font-size: max(var(--t), calc(var(--pu) * 30));
  text-transform: uppercase;
  text-align: left;
  width: 100%;
  cursor: pointer;
  border-top: 2px solid rgba(110, 140, 230, 0.22);
}
.opt:first-child {
  border-top: 0;
}
.opt > span {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.1;
  min-width: 0;
}
.opt > span > span {
  display: block;
  white-space: nowrap;
}
.opt small {
  font-size: max(var(--t), calc(var(--pu) * 23));
  line-height: 1.15;
  margin: 0.15em 0 0.35em;
  opacity: 0.9;
  font-weight: 500;
  text-transform: none;
}
.opt.go small {
  margin: 0;
  font-size: max(var(--t), calc(var(--pu) * 28));
  opacity: 1;
  text-transform: none;
  white-space: nowrap;
}
.opt .arr {
  height: calc(var(--pu) * 34);
  width: auto;
  flex: none;
}
.help-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: calc(var(--pu) * 14);
}
/* two buttons as wide as their words ask (the quit question: one under the other when they do not fit) */
.row-btns,
.res-btns {
  display: flex;
  gap: calc(var(--pu) * 14);
}
.row-btns {
  flex-wrap: wrap;
}
.row-btns .pill,
.res-btns .pill,
.help-nav .pill {
  --h: max(46px, calc(var(--pu) * 86));
  min-width: 0;
}
.row-btns .pill,
.res-btns .pill {
  flex: 1 1 auto;
  max-width: 100%;
}
.ov .done {
  align-self: center;
  --h: max(46px, calc(var(--pu) * 86));
  min-width: calc(var(--pu) * 280);
}

/* language: the grid of all languages in the settings panel, two columns (three lying down), no scrolling */
.lang-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: calc(var(--pu) * 10);
}
.lang-grid .pill {
  --h: max(44px, calc(var(--pu) * 66));
  min-width: 0;
  width: 100%;
  text-transform: none;
  font-size: calc(var(--h) * 0.42);
}

/* pause */
.stack-btns {
  display: flex;
  flex-direction: column;
  gap: calc(var(--pu) * 14);
  padding: 0 calc(var(--pu) * 18);
}
.stack-btns .pill {
  --h: max(46px, calc(var(--pu) * 92));
  width: 100%;
}

/* sound: icon, then the name over its slider */
.vols {
  display: flex;
  flex-direction: column;
  gap: calc(var(--pu) * 22);
  padding: calc(var(--pu) * 6) calc(var(--pu) * 20);
}
.vol {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: calc(var(--pu) * 22);
  align-items: center;
  font-size: max(var(--t), calc(var(--pu) * 32));
  text-transform: uppercase;
}
.vol .ic {
  grid-row: 1 / 3;
  width: calc(var(--pu) * 70);
  height: calc(var(--pu) * 70);
  object-fit: contain;
}
.vol .slider {
  --k: max(40px, calc(var(--pu) * 52));
}

/* how to play */
.help-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--pu) * 16);
  text-align: center;
  padding: 0 calc(var(--pu) * 10);
}
.help-t {
  margin: 0;
  font-size: max(var(--t), calc(var(--pu) * 36));
  line-height: 1.1;
  text-transform: uppercase;
}
.help-page p {
  margin: 0;
  font-size: max(var(--t), calc(var(--pu) * 26));
  line-height: 1.3;
  min-height: 3.9em;
  text-wrap: balance;
}
.help-cards {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--pu) * 8);
  min-height: calc(var(--pu) * 112);
}
.help-cards .card {
  --cw: calc(var(--pu) * 76);
}
.help-cards:has(.card:nth-child(8)) {
  gap: calc(var(--pu) * 4);
}
.help-cards:has(.card:nth-child(8)) .card {
  --cw: calc(var(--pu) * 55);
}
.help-cards .card.back {
  display: none;
} /* the deck: only lying down */
.help-cards .arrow {
  width: calc(var(--pu) * 46);
  height: auto;
}
.help-dots {
  display: flex;
  gap: calc(var(--pu) * 10);
  justify-content: center;
}
.help-dots img {
  width: calc(var(--pu) * 54);
  height: calc(var(--pu) * 54);
}
.help-dots.pages img {
  width: calc(var(--pu) * 20);
  height: calc(var(--pu) * 20);
}
.help-row {
  display: flex;
  gap: calc(var(--pu) * 12);
  justify-content: center;
}
.help-row:has(.pill) {
  align-self: stretch;
  gap: calc(var(--pu) * 8);
}
.help-row .pill {
  --h: max(40px, calc(var(--pu) * 72));
  flex: 1 1 auto;
  min-width: 0;
  border-width: 0 calc(var(--h) * 0.3);
  font-size: max(var(--t), calc(var(--h) * 0.36));
  letter-spacing: 0;
}
.help-row .sq {
  width: calc(var(--pu) * 100);
  height: calc(var(--pu) * 100);
}
.band.mini {
  --bh: calc(var(--pu) * 60);
  width: 86%;
}

/* reveal of a hand */
.ov-hand .ov-box {
  width: min(calc(var(--pu) * 600), 100%, var(--vw) - 46px);
}
.reveal {
  display: flex;
  flex-direction: column;
  gap: calc(var(--pu) * 10);
  width: 100%;
}
.reveal .who {
  display: flex;
  align-items: center;
  gap: calc(var(--pu) * 14);
  padding: calc(var(--pu) * 8) calc(var(--pu) * 14);
  border-top: 2px solid rgba(110, 140, 230, 0.22);
}
.reveal .who:first-child {
  border-top: 0;
}
.reveal .who > img {
  width: calc(var(--pu) * 64);
  height: calc(var(--pu) * 64);
  border-radius: calc(var(--pu) * 14);
  background: #5a2fc6;
  object-fit: cover;
  flex: none;
}
.reveal .who b {
  flex: 1;
  min-width: 0;
  font-size: max(var(--t), calc(var(--pu) * 24));
  text-transform: uppercase;
  white-space: nowrap;
}
.reveal .who .cards {
  display: flex;
  gap: calc(var(--pu) * 6);
}
.reveal .card {
  --cw: max(30px, calc(var(--pu) * 54));
}

/* result (win, loss): the friends stand ON the panel's band, big; stars, score, two equal buttons */
.ov-result .ov-box {
  width: min(calc(var(--pu) * 590), 100%);
  align-items: center;
  padding-top: calc(var(--pu) * 58);
  gap: calc(var(--pu) * 16);
}
.ov-result .ov-box > .band {
  --bh: calc(var(--pu) * 104);
  width: 88%;
  top: calc(var(--pu) * -64);
  z-index: 3;
  font-size: calc(var(--bh) * 0.72);
}
.res-faces {
  --fh: calc(var(--pu) * 276);
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + var(--pu) * 10);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  pointer-events: none;
  z-index: 1;
  clip-path: inset(-100% -60% 0 -60%);
} /* they come up from behind the band: never over the panel */
.res-faces .hero {
  position: relative;
  z-index: 1;
  height: var(--fh);
  width: auto;
}
.res-faces .side {
  height: calc(var(--fh) * 0.62);
  width: calc(var(--fh) * 0.62);
  margin: 0 calc(var(--fh) * -0.1);
}
.res-faces .s0 {
  order: 1;
}
.res-faces .s1 {
  order: -1;
} /* as at the table: seat 1 on the right, seat 3 on the left */
.res-stars {
  display: flex;
  gap: calc(var(--pu) * 24);
}
.res-stars .st {
  position: relative;
  width: calc(var(--pu) * 100);
  height: calc(var(--pu) * 100);
}
.res-stars .st img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.res-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--pu) * 14);
  font-size: calc(var(--pu) * 60);
}
.res-score > b {
  line-height: 0.7;
  translate: 0 -0.12em;
}
/* the number keeps its width while it counts */
.res-score .num {
  display: inline-block;
  margin: 0;
  font-size: inherit;
  text-align: center;
}
.res-score .pill {
  --h: calc(var(--pu) * 94);
  min-width: calc(var(--pu) * 222);
  font-size: calc(var(--h) * 0.54);
  pointer-events: none;
}
.res-score.bar {
  --sch: calc(var(--pu) * 104);
  display: flex;
  align-items: stretch;
  width: 100%;
  height: var(--sch);
  gap: 0;
  filter: drop-shadow(0 calc(var(--pu) * 4) calc(var(--pu) * 6) rgba(5, 10, 40, 0.35));
}
.res-score.bar .sc {
  border-width: 0 calc(var(--sch) * 0.28);
  flex: 0 0 39%;
  font-size: calc(var(--pu) * 52);
  gap: calc(var(--pu) * 10);
}
.res-score.bar .sc > span {
  margin-left: calc(var(--sch) * -0.18);
}
.res-score.bar .sc b {
  margin-right: calc(var(--sch) * -0.18);
}
.res-score.bar .sc.mid {
  flex: 1 1 0;
  flex-direction: column;
  gap: calc(var(--pu) * 6);
  font-size: calc(var(--pu) * 25);
  text-transform: uppercase;
}
.res-score.bar .sc.mid small {
  display: block;
  font-size: max(13px, calc(var(--pu) * 23));
  line-height: 1;
  white-space: nowrap;
  margin: 0 calc(var(--sch) * -0.2);
}
.res-score.bar .dots {
  display: flex;
  gap: calc(var(--pu) * 8);
}
.res-score.bar .dots img {
  width: calc(var(--pu) * 24);
  height: calc(var(--pu) * 24);
}
.res-score.bar .sc > span,
.res-score.bar .sc b {
  font-size: inherit;
}
.res-btns {
  width: 100%;
}
.res-btns .pill {
  font-size: calc(var(--h) * 0.5);
}
/* the champions: Dona Nena with the trophy at her side, the stars of the whole circuit */
.ov-champ .res-faces .cup {
  height: calc(var(--fh) * 0.78);
  width: auto;
  margin: 0 0 0 calc(var(--fh) * -0.12);
}
.res-btns.rows {
  flex-direction: column;
  align-items: center;
} /* two long labels: one over the other, never smaller letters */
.res-btns.rows .pill {
  width: 82%;
  flex: none;
}
.champ-stars {
  gap: calc(var(--h) * 0.1);
}
.champ-stars > span {
  margin-left: 0;
} /* room between the star and the "140/150" label (the label's -.22h margin would eat the gap) */
/* with the champions panel open, Dona Nena's seat at the table (top) is hidden: it would show through the dim, behind the trophy */
#app:has(.ov-champ) .seat[data-seat='2'] {
  visibility: hidden;
}
.champ-stars img {
  width: calc(var(--h) * 0.78);
  height: calc(var(--h) * 0.78);
  margin-left: calc(var(--h) * -0.18);
}

@media (orientation: landscape) {
  .ov {
    padding-top: calc(var(--safe-t) + 30px);
  }
  .ov-box {
    --pu: calc(var(--u) * 0.86);
    width: min(calc(var(--pu) * 640), 100%);
  }
  .ov-settings .ov-box {
    width: min(calc(var(--pu) * 640), 100%);
  }
  .ov-lang .ov-box {
    width: min(calc(var(--pu) * 860), 100%);
  }
  .lang-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .lang-grid .pill {
    --h: max(44px, calc(var(--pu) * 58));
  }
  .opt {
    min-height: max(44px, calc(var(--pu) * 62));
  }
  .vol {
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-rows: auto;
  }
  .vol .ic {
    grid-row: auto;
    width: calc(var(--pu) * 58);
    height: calc(var(--pu) * 58);
  }
  .vol > span {
    min-width: 5em;
  }
  .ov-help .ov-box {
    width: min(calc(var(--pu) * 760), 100%);
  }
  .help-page p {
    min-height: 2.6em;
    order: 2;
  }
  .help-t {
    order: 1;
  }
  .help-dots.pages {
    order: 3;
  } /* lying down: the pictures first, big, their name under them */
  .help-cards .card {
    --cw: calc(var(--pu) * 98);
  }
  .help-cards .arrow {
    width: calc(var(--pu) * 60);
  }
  .help-cards:has(.card:nth-child(8)) .card {
    --cw: calc(var(--pu) * 78);
  }
  .help-cards .card.back {
    display: block;
  }
  .ov-result .ov-box {
    width: min(calc(var(--pu) * 560), 100%);
    padding-top: calc(var(--pu) * 46);
    gap: calc(var(--pu) * 10);
  }
  .ov-result .ov-box > .band {
    --bh: calc(var(--pu) * 94);
    top: calc(var(--pu) * -62);
  }
  .res-faces {
    --fh: calc(var(--pu) * 268);
  }
  .res-stars .st {
    width: calc(var(--pu) * 82);
    height: calc(var(--pu) * 82);
  }
  .res-score .pill {
    --h: calc(var(--pu) * 74);
    min-width: calc(var(--pu) * 210);
  }
  .res-btns .pill {
    --h: max(46px, calc(var(--pu) * 84));
  }
  .ov-result.lost .ov-box {
    width: min(calc(var(--pu) * 660), 100%);
  }
  .ov-result.lost .res-faces {
    --fh: calc(var(--pu) * 240);
  }
  .ov-result.lost .st {
    width: calc(var(--pu) * 92);
    height: calc(var(--pu) * 92);
  }
  .ov-result.lost .res-score .pill {
    --h: calc(var(--pu) * 82);
    min-width: calc(var(--pu) * 230);
  }
  .reveal {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .ov-hand .ov-box {
    width: min(calc(var(--pu) * 960), 100%);
  }
}
/* a phone lying down: the panels use the width they have, so nothing has to shrink (touch 44 px, letters 13 px) */
@media (orientation: landscape) and (max-height: 500px) {
  .ov {
    padding-top: calc(var(--safe-t) + 24px);
    padding-bottom: calc(var(--safe-b) + 8px);
  }
  .ov-box {
    width: min(620px, 100%);
    padding: 20px 8px 4px;
    gap: 8px;
  }
  .ov-pause .ov-box,
  .ov-sound .ov-box {
    width: min(440px, 100%);
  }
  .ov-settings .ov-box,
  .ov-rules .ov-box {
    width: min(700px, 100%);
  }
  .ov-hand .ov-box {
    width: min(760px, 100%);
  }
  .ov-box:not(.ov-result *) > .band {
    width: min(78%, 340px);
  }
  .ov-settings:not(.ov-lang) .list {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 22px;
  }
  .ov-settings .opt:nth-child(2) {
    border-top: 0;
  }
  .ov-settings .opt.go:nth-child(odd) {
    grid-column: 1 / -1;
  }
  .row-btns .pill,
  .help-nav .pill {
    --h: 46px;
  }
  .help-page {
    gap: 7px;
  }
  .help-cards {
    min-height: 0;
  }
  .help-cards .card {
    --cw: calc(var(--pu) * 88);
  }
  .ov-result .ov-box {
    width: min(380px, 100%);
    padding-top: 24px;
    gap: 5px;
  }
}
/* End of css/panels.css (complete file). */
