/* Translations (src/ui/i18n.js, src/locales/) and the label fitting of src/ui/fit.js.
   Rule: a text never leaves its plate. Labels on buttons, plates and tabs (and the toast) stay on ONE line and
   are shrunk by fit.js (never the button: it keeps its height). Only sentences on a panel (rules, notices) wrap. */

/* A pill's width never comes from its label (it comes from its min-width, grid or flex): the label fills
   the pill and fit.js shrinks it when a language is longer. */
.btn-pill > span {
  display: block;
  width: 0;
  min-width: 100%;
  white-space: nowrap;
}

/* the label sits on the pill's glass, never on its carved ends. Measured on this game's art: the glass of
   pill.webp starts 55 px into its 155 px cap slice, and the cap is drawn 0.787 x the pill height, so the glass
   starts 0.787 x 55 / 155 = 0.279 x the height from each end. The pressed state draws btn-gold.webp (cap 0.5 x
   the height, slice 115): its glass starts about 0.36 x the height (approximate, measured by eye).
   fit.js measures the content box, so the label shrinks to the glass (and a plate as wide as its label grows). */
.btn-pill {
  padding-inline: max(0.3em, calc(var(--ph) * 0.279));
}
.btn-pill[aria-pressed='true'] {
  padding-inline: max(0.3em, calc(var(--ph) * 0.36));
}
.tabs .btn-pill {
  padding-inline: max(1.3em, calc(var(--ph) * 0.36));
}

/* HUD pills (MAX BET, AUTO, TURBO, LATER): the pill grows with its label, glass padding included, as far as its
   column allows; only past that does fit.js shrink the label */
#bet-max > span,
#auto > span,
#turbo > span,
#ws-later > span {
  width: auto;
}

/* auto-spin choices ("100× BET", a big credit number): a wider pill that still grows with a longer language; the
   caption beside it is a sentence and may wrap */
.opt-row .opt-cycle {
  min-width: 11.5em;
}
.opt-row .btn-pill > span {
  width: auto;
} /* ON/OFF too: "DESLIGADO" grows its pill instead of reaching the ends */

/* buy sheet: CANCEL is as wide as its label needs ("ABBRECHEN", "ANNULEREN"); the price button takes the rest */
.buy-actions .btn-pill {
  flex: 0 0 auto;
  max-width: none;
  min-width: max(7em, 64px);
}
#buy-cancel > span {
  width: auto;
}

/* small labels set in em: never under 9 px on a small phone (tools/qa-fit.js reports CSS sizes too) */
.bet-val small {
  font-size: max(0.68em, 9px);
}
.winbar small {
  font-size: max(0.74em, 9px);
}
.winbar:has(.lineinfo:not(:empty)) small {
  font-size: max(0.66em, 9px);
}
.lineinfo {
  font-size: max(0.7em, 9px);
}

/* the row's caption style (.opt-row span: left, gold) is not for the label inside the row's button */
.opt-row .btn-pill > span {
  text-align: center;
  color: inherit;
}

/* ...except the free-coins button, which is as wide as its label (fit.js still caps it) */
#coins-go > span {
  display: inline;
  width: auto;
  min-width: 0;
}

/* gold buttons and tags grow with their label only up to the screen; past that, fit.js shrinks the label */
.btn-gold {
  max-width: calc(100vw - 24px);
}
.btn-gold > span,
.status > span,
.skip > span,
.sheet-body h2 > span {
  display: block;
  white-space: nowrap;
}
/* BUY BONUS sits between the logo and the screen edge: it cannot grow, so its label gets the whole middle */
.btn-buy {
  max-width: 36vw;
  padding: 0 calc(var(--ph) * 0.6);
  letter-spacing: 0.02em;
}
.status {
  max-width: 100%;
}
.skip {
  max-width: 94cqw;
}
.bet-val small,
.winbar small,
#lineinfo {
  white-space: nowrap;
}

/* buy sheet: the confirm button carries the price, so it takes the larger share of the row */
.buy-actions .btn-gold {
  flex-grow: 1.7;
  max-width: 16em;
}
/* CANCEL: never under the 9 px floor of fit.js on a small phone */
.buy-actions .btn-pill > span {
  font-size: max(1em, 9px);
}

/* on/off and choice buttons in the sheets: a full touch target on small phones too */
.opt-row .btn-pill {
  --ph: max(3.5em, 42px);
}

/* quick messages: one line on the carved plate, like every label (fit.js shrinks it); the wider padding keeps a
   long message clear of the carved caps */
.toast {
  padding-inline: calc(var(--ph) * 1.4);
}
.toast > span {
  display: block;
  white-space: nowrap;
}

/* notices of several lines (legal notice with the 18+ text, bonus note): the carved gold bands at the top and
   bottom of pill.webp (41 and 27 px of its 185, ornaments included) keep their one-line thickness instead of
   stretching with the plate, so a 4- or 5-line notice (Russian, German) does not run into them. nine.js bakes it the
   same way. */
.disclaimer,
.note {
  border-image-slice: 41 155 27 fill;
  border-image-width: calc(var(--ph) * 0.222) calc(var(--ph) * 0.787) calc(var(--ph) * 0.146);
}
/* the text keeps clear of this pill's bands (thicker than a plain rim here): air above the first line of the
   notice and under the last line of the banner note (descenders) */
.disclaimer {
  padding-top: max(0.55em, calc(var(--ph) * 0.222 + 0.2em));
}
.note {
  padding-bottom: max(0.75em, calc(var(--ph) * 0.146 + 0.3em));
}
.disclaimer {
  padding-bottom: 0.75em;
  max-width: min(calc(100% - 1.6em), 50em);
} /* wider where there is room: fewer lines */

/* sheet titles keep clear of the close button in the corner (a long title, "COMPRAR GIROS GRÁTIS", shrinks instead) */
.sheet-body h2 {
  padding-inline: max(2.2em, 50px);
}

/* sheet text: long words of some languages may break rather than leave the panel */
.sheet-body {
  overflow-wrap: break-word;
}
.opt-row > span {
  min-width: 0;
}

/* language picker in OPTIONS: pills wide enough that the longest name ("Bahasa Indonesia") stays on the glass,
   clear of this theme's heavy carved caps (2 columns on a phone) */
.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(max(8.5em, 130px), 1fr));
  gap: 0.45em;
  margin: 0.4em 0 0.9em;
}

.lang-grid .btn-pill {
  --ph: max(3.3em, 42px);
  min-width: 0;
  width: 100%;
  font-size: max(0.85em, 9px); /* never under the 9 px floor of fit.js */
  letter-spacing: 0.02em;
}

/* Japanese, Korean and Chinese: the serif headings have no such characters, so use the system sans
   (Yu Gothic / Hiragino / Malgun / PingFang / Microsoft YaHei...) and no letter spacing */
:is(:lang(ja), :lang(ko), :lang(zh))
  :is(.gold-text, .btn-gold, .btn-pill, .status, .skip, .toast, .disclaimer, .note, .sheet-body) {
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    'Hiragino Sans',
    'Yu Gothic UI',
    'Malgun Gothic',
    'Microsoft YaHei',
    'Noto Sans CJK JP',
    sans-serif;
  letter-spacing: 0;
}

/* End of assets/ui/i18n.css */
