/* 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
   (tools/measure-art.py): the straight glass of pill.webp starts 103 px into its 180 px height (0.57), and the
   round end of the glass is clear of the fans from about 0.46 x the height: the label starts there.
   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.46));
}
.btn-pill[aria-pressed='true'] {
  padding-inline: max(0.3em, calc(var(--ph) * 0.46));
}
.tabs .btn-pill {
  padding-inline: max(1.1em, calc(var(--ph) * 0.46));
}

/* HUD pills (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 */
#ws-later > span {
  width: auto;
}

.opt-row .btn-pill > span {
  width: auto;
} /* ON/OFF too: "DESLIGADO" grows its pill instead of reaching the ends */

/* small labels set in em: never under 9 px on a small phone (tools/qa-fit.js reports CSS sizes too) */

/* 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;
}
.status {
  max-width: 100%;
}
.skip {
  max-width: 94cqw;
}

/* 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) * 0.85);
  max-width: calc(100vw - 16px);
}
.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 (30 px each of its 180, 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: 30 104 30 fill;
  border-image-width: calc(var(--ph) * 0.167) calc(var(--ph) * 0.578) calc(var(--ph) * 0.167);
}
/* 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.167 + 0.2em));
}
.note {
  padding-bottom: max(0.75em, calc(var(--ph) * 0.167 + 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: one drop-down in the game's colours (dark felt, gold rim, gold chevron); the list
   itself is the system's own, so "Bahasa Indonesia" or 中文 always fit */
.lang-select {
  flex: none;
  min-width: 9.5em;
  max-width: 62%;
  height: max(3.3em, 42px);
  padding: 0 2.4em 0 1em;
  border: 2px solid transparent;
  border-radius: 1.7em;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 1em;
  font-weight: 800;
  color: var(--gold-1);
  text-overflow: ellipsis;
  cursor: pointer;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23ffe08a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
      right 1em center / 0.8em no-repeat,
    linear-gradient(180deg, #1f4434, #0c2219) padding-box,
    linear-gradient(180deg, #fff0b8, #c99a3c 55%, #7a5512) border-box;
  box-shadow:
    0 0.15em 0.35em rgba(0, 0, 0, 0.5),
    inset 0 0.1em 0.2em rgba(0, 0, 0, 0.5);
}

.lang-select:focus-visible {
  outline: 2px solid #fff3c4;
  outline-offset: 2px;
}
.lang-select option {
  color: #1b120a;
  background: #fff8e6;
  font-weight: 600;
}

/* 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 */
