/* Achievements (#/conquistas): the phase-1 achievements as full-width strips (2026-11-12), their tiers and states.
   Tokens: the site's own (styles/tokens.css + styles-modern.css). The Designer's kit only supplies the pictures
   (web/assets/achievements/, declared in src/achievement-art.mjs) — the layout below stays.

   Sizes of the pictures: seal 32 px and category icon 16 px on a strip, the same seal at 120 px in the details popup
   (a 2x WebP or PNG with a transparent background serves both). */

/* The header: only the title and the medal counts. The whole block opens the same dialog as the details, and the small
   "i" is the keyboard path to it. The sentence, the total and the explanation live in that dialog (.ach-about). */
.ach-head-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  cursor: pointer; }
.ach-head-card:hover, .ach-head-card:focus-within { border-color: var(--color-accent); }
.ach-title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ach-title-row h1 { margin: 0; }
.ach-info { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: inherit; font: inherit; cursor: pointer; }
.ach-info span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: var(--text-xs);
  font-weight: 800; font-style: normal; color: var(--color-accent);
  border: 1px solid rgba(184, 243, 75, .45); }
.ach-info:hover span, .ach-info:focus-visible span { border-color: var(--color-accent); background: rgba(184, 243, 75, .12); }
.ach-info:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* The medal counts: one compact line, the tier's name and its "19/45". */
.ach-tiers { display: flex; flex-wrap: wrap; gap: 8px 10px; margin-top: 0; }
.ach-tier { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border-radius: 999px;
  border: 1px solid var(--surface-border, rgba(130, 178, 154, .22)); background: rgba(6, 25, 37, .4); font-size: var(--text-xs); }
.ach-tier-text { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; }
.ach-tier b { font-variant-numeric: tabular-nums; }
.ach-tier .ach-seal-img, .ach-tier .ach-seal, .ach-tier .ach-seal-art { width: 32px; height: 32px; }
.ach-tier .ach-seal-fallback { font-size: var(--text-xs); }

/* The header's dialog: the sentence, the total, one bar per tier and the explanation. */
.ach-about { display: flex; flex-direction: column; gap: 14px; max-width: 65ch; }
.ach-about-lead { margin: 0; line-height: 1.5; }
.ach-about-total { margin: 0; font-weight: 800; }
.ach-about-label { margin: 0; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.ach-about-tiers { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.ach-about-tier { display: flex; flex-direction: column; gap: 6px; }
.ach-about-tier-head { display: flex; align-items: center; gap: 8px; }
.ach-about-tier-head .ach-seal-img, .ach-about-tier-head .ach-seal, .ach-about-tier-head .ach-seal-art { width: 32px; height: 32px; flex: 0 0 auto; }
.ach-about-tier-head .ach-seal-fallback { font-size: var(--text-xs); }
.ach-about-tier-name { flex: 1 1 auto; min-width: 0; }
.ach-about-tier-head b { font-variant-numeric: tabular-nums; }
.ach-about-rule { margin: 0; font-size: var(--text-sm); color: var(--muted); }

/* The filters: four equal buttons (the chosen one grey) and the category picker. */
.ach-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 4px; }
.ach-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; flex: 0 1 22rem; margin: 0; }
.ach-filter { min-height: 44px; padding: 0 8px; border: 1px solid var(--surface-border, rgba(130, 178, 154, .22)); border-radius: 10px;
  background: transparent; color: inherit; font: inherit; font-size: var(--text-sm); font-weight: 700; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ach-filter:hover { border-color: var(--muted); }
.ach-filter[aria-pressed="true"] { background: #8a8f98; border-color: #8a8f98; color: #fff; }
/* The category picker: a button and a listbox, each option with the category's emblem (a <select> cannot show pictures). */
.ach-pick { position: relative; flex: 0 1 18rem; max-width: 100%; }
.ach-pick-button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 4px 12px; border-radius: 10px;
  border: 1px solid var(--surface-border, rgba(130, 178, 154, .22)); background: rgba(6, 25, 37, .6); color: inherit; font: inherit;
  text-align: left; cursor: pointer; }
.ach-pick-button:hover { border-color: var(--muted); }
.ach-pick-button:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.ach-pick-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ach-pick-caret { flex: 0 0 auto; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid currentColor; }
.ach-pick .ach-cat-img, .ach-pick .ach-cat-mark { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 6px; font-size: var(--text-xs); }
.ach-pick-list { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; max-height: min(24rem, 60vh); overflow-y: auto;
  margin: 0; padding: 4px; list-style: none; border-radius: 10px; border: 1px solid var(--surface-border, rgba(130, 178, 154, .22));
  background: #0b1f28; box-shadow: 0 12px 32px rgba(0, 0, 0, .45); }
.ach-pick-list[hidden] { display: none; }
.ach-pick-list:focus { outline: none; }
.ach-pick-option { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 8px; border-radius: 8px; cursor: pointer; }
.ach-pick-option.is-active { background: rgba(184, 243, 75, .12); }
.ach-pick-option[aria-selected="true"] { font-weight: 800; }

/* The list: one strip per achievement across the page. Left: the tier medal and the category emblem side by side, 48 px
   and always in colour; centre: the name in bold over the description; right: the bar with "6 / 8" beside it, or the date. */
.ach-list { display: grid; gap: 8px; margin-top: 12px; }
.ach-strip { display: grid; grid-template-columns: 7rem minmax(0, 1fr) 14rem; align-items: center; gap: 16px; padding: 10px 16px;
  color: inherit; text-decoration: none; cursor: pointer; border-left: 3px solid transparent; transition: border-color 0.15s ease; }
.ach-strip:hover { border-color: var(--color-accent); text-decoration: none; }
.ach-strip:hover * { text-decoration: none; }
.ach-strip:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.ach-strip-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ach-strip .ach-seal, .ach-strip .ach-seal-img, .ach-strip .ach-seal-art { width: 48px; height: 48px; }
.ach-strip .ach-seal.ach-seal-fallback { font-size: var(--text-base); }
.ach-strip .ach-cat-img, .ach-strip .ach-cat-mark { flex: 0 0 48px; width: 48px; height: 48px; }
.ach-strip-mid { min-width: 0; padding-left: 16px; }
.ach-strip h3 { margin: 0; font-size: var(--text-base); font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.ach-text { margin: 2px 0 0; font-size: var(--text-sm); line-height: 1.4; color: var(--muted); }
/* The right column (2026-11-12, later): the bar always the same width, and under it one small grey line with the count
   and the trail's step (or the date, once unlocked). */
.ach-strip-right { display: flex; align-items: center; flex-direction: column; justify-content: center; gap: 4px; min-width: 0; }
.ach-strip-right .ach-bar { flex: none; width: 12rem; max-width: 100%; }
.ach-count { margin: 0; flex: 0 0 auto; font-size: var(--text-xs); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* The progress bar ("faltam N"): lime to the eye, and an accessible progressbar for a screen reader. */
.ach-bar { height: 8px; border-radius: 999px; background: rgba(6, 25, 37, .75); border: 1px solid var(--surface-border, rgba(130, 178, 154, .22)); overflow: hidden; }
.ach-bar-fill { display: block; height: 100%; background: linear-gradient(90deg, #8fd93a, var(--color-accent)); }

/* The seal (72 px on a card) and the category icon (48 px, on the category row, 2x ready). */
.ach-seal, .ach-seal-img { display: grid; place-items: center; width: 72px; height: 72px; flex: 0 0 auto; }
.ach-seal { border-radius: 50%; }
.ach-seal-img { object-fit: contain; }
/* The Flow medal of a tier: one WebP for the three states; only the locked one is painted (dimmed in grey). The in
   progress state is read from the progress bar, and the unlocked medal keeps its colour with nothing over it. */
.ach-seal-art { position: relative; display: grid; place-items: center; width: 72px; height: 72px; flex: 0 0 auto; }
.ach-seal-art .ach-seal-img { width: 100%; height: 100%; object-fit: contain; }
.ach-seal-art.state-locked .ach-seal-img { filter: grayscale(1) brightness(0.88); opacity: 0.55; }
.ach-cat-img { flex: 0 0 48px; width: 48px; height: 48px; object-fit: contain; }
.toast.ach-toast { display: flex; align-items: center; gap: 10px; border-left-color: #ffd700; }
.toast-icon { flex: 0 0 auto; width: 28px; height: 26px; }
.ach-seal.ach-seal-fallback { font-weight: 800; font-size: var(--text-xl); color: #14200f;
  background: linear-gradient(180deg, #d7b46a, #a8843f); border: 2px solid rgba(255, 255, 255, .18); }
.ach-cat-mark { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 10px; font-size: var(--text-base);
  font-weight: 800; background: rgba(184, 243, 75, .16); color: var(--color-accent); }

/* The tiers: only the seal's colour changes (the kit replaces the disc with its own art). */
.ach-strip.tier-bronze .ach-seal.ach-seal-fallback, .ach-tier.tier-bronze .ach-seal.ach-seal-fallback { background: linear-gradient(180deg, #c98a5d, #8a5432); }
.ach-strip.tier-silver .ach-seal.ach-seal-fallback, .ach-tier.tier-silver .ach-seal.ach-seal-fallback { background: linear-gradient(180deg, #d7dee3, #98a5ad); }
.ach-strip.tier-gold .ach-seal.ach-seal-fallback, .ach-tier.tier-gold .ach-seal.ach-seal-fallback { background: linear-gradient(180deg, #ecc869, #b07f22); }
.ach-strip.tier-platinum .ach-seal.ach-seal-fallback, .ach-tier.tier-platinum .ach-seal.ach-seal-fallback { background: linear-gradient(180deg, #d9f6ff, #79c6db); }
.ach-strip.tier-bronze { border-left-color: #a4683f; }
.ach-strip.tier-silver { border-left-color: #aab7bf; }
.ach-strip.tier-gold { border-left-color: #d8a63c; }
.ach-strip.tier-platinum { border-left-color: #8fd3e6; }

/* The states: every strip is in full colour (owner's request); an unlocked one (only under "Conquistadas") is lit. */
.ach-strip.state-unlocked { box-shadow: inset 0 0 0 1px rgba(184, 243, 75, .35); }
.ach-empty { padding: 18px; text-align: center; }

/* The details popup (#/conquistas?c=<id>): the medal at 120 px, the category mark, the full text and the facts. */
.ach-popup-body { display: flex; flex-direction: column; gap: 14px; max-width: 60ch; }
/* The medal at the top with its tier tag, like the approved mockup. */
.ach-popup-medal { display: flex; flex-direction: column; align-items: center; }
.ach-popup-seal { display: grid; place-items: center; }
.ach-popup-seal .ach-seal, .ach-popup-seal .ach-seal-img, .ach-popup-seal .ach-seal-art { width: 120px; height: 120px; }
.ach-popup-seal .ach-seal.ach-seal-fallback { font-size: var(--text-2xl); }
.ach-popup-tier-tag { margin-top: -10px; padding: 2px 12px; border-radius: 999px; border: 1px solid var(--surface-border, rgba(130, 178, 154, .22));
  background: #0b232c; font-size: var(--text-xs); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.ach-popup-tier-tag.tier-bronze { color: #e6b08a; border-color: #a4683f; }
.ach-popup-tier-tag.tier-silver { color: #dfe8ec; border-color: #aab7bf; }
.ach-popup-tier-tag.tier-gold { color: #f0cc75; border-color: #d8a63c; }
.ach-popup-tier-tag.tier-platinum { color: #bdefff; border-color: #8fd3e6; }
.ach-popup-cat { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; font-size: var(--text-xs);
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.ach-popup-desc { margin: 0 auto; max-width: 42ch; text-align: center; line-height: 1.5; }
/* Condition and current status, with the bar under them. */
.ach-popup-status { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--surface-border, rgba(130, 178, 154, .22)); background: rgba(6, 25, 37, .4); }
.ach-status-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: var(--text-sm); }
.ach-status-line span { color: var(--muted); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.ach-status-line b { min-width: 0; text-align: right; font-variant-numeric: tabular-nums; }
.ach-popup-status .ach-popup-bar { margin-top: 4px; }
.ach-toast-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* A phone: the seal and the category on the left, the name and the description beside them, the bar under the text. */
@media (max-width: 640px) {
  .ach-toolbar { gap: 8px; }
  .ach-pick { flex-basis: 100%; max-width: calc(100% - 56px); }   /* clear of the floating sound/chat button */
  .ach-filters { flex-basis: 100%; }
  .ach-strip { grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; padding: 10px 12px; }
  .ach-strip-left { gap: 6px; }
  .ach-strip .ach-seal, .ach-strip .ach-seal-img, .ach-strip .ach-seal-art, .ach-strip .ach-cat-img, .ach-strip .ach-cat-mark { width: 36px; height: 36px; flex-basis: 36px; }
  .ach-strip-mid { padding-left: 4px; }
  .ach-strip-right { grid-column: 1 / -1; align-items: flex-start; }
  .ach-strip-right .ach-bar { width: 100%; }
  /* The header: the title on one line and the three medal counts on the next, never a third line. */
  .ach-head-card { gap: 8px; padding: 12px 14px; }
  .ach-title-row { width: 100%; justify-content: space-between; }
  .ach-tiers { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; }
  .ach-tier { min-width: 0; gap: 6px; padding: 4px 8px; border-radius: 10px; }
  .ach-tier-text { flex-direction: column; align-items: flex-start; gap: 0; line-height: 1.15; }
  .ach-tier-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-xs); }
  .ach-tier b { font-size: var(--text-xs); white-space: nowrap; }   /* four chips since phase 2: "22/182" never breaks at the slash */
  .ach-tier .ach-seal-img, .ach-tier .ach-seal, .ach-tier .ach-seal-art { width: 20px; height: 20px; }
  .ach-tier .ach-seal-fallback { font-size: var(--text-xs); }
  .ach-status-line { font-size: var(--text-xs); }
}

/* Phase 2 (2026-11-12): the four pickers (category, group, stage, kind) side by side and of the same width, the trail's
   step, the popup's trail list and rarity. The trophy room above the filters is styled in styles-modern.css. */
.ach-toolbar-pickers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 8px 0 4px; }
.ach-toolbar-pickers .ach-pick { flex: none; width: 100%; max-width: none; min-width: 0; }
.ach-toolbar-pickers .ach-pick-button { padding: 4px 10px; }
  background: transparent; color: inherit; font: inherit; font-size: var(--text-sm); font-weight: 700; cursor: pointer; white-space: nowrap; }
.ach-strip.kind-secret .ach-strip-mid h3 { font-style: italic; }
/* The showcase: three cells (trophies, platinums, trails complete) in a band under the header. */
/* The popup: the trail's steps and the rarity line. */
.ach-popup-kind { color: var(--muted); }
.ach-popup-trail .ach-about-label { margin-bottom: 6px; }
.ach-popup-steps { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ach-popup-step { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 2px 8px; border-radius: 8px; font-size: var(--text-sm); }
.ach-popup-step.is-current { background: rgba(184, 243, 75, .12); }
.ach-popup-step .ach-seal-art, .ach-popup-step .ach-seal-img, .ach-popup-step .ach-seal { width: 24px; height: 24px; }
.ach-popup-step .ach-seal-fallback { font-size: var(--text-xs); }
.ach-popup-step-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ach-popup-step-state { flex: 0 0 auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.ach-popup-step.state-unlocked .ach-popup-step-state { color: var(--color-accent); }
.ach-popup-rarity { margin: 0; text-align: center; font-size: var(--text-xs); color: var(--muted); }
/* The public profile: the rarest achievements of the club. */
.ach-profile-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ach-profile-row { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.ach-profile-row .ach-seal-art, .ach-profile-row .ach-seal-img, .ach-profile-row .ach-seal { width: 32px; height: 32px; }
.ach-profile-row .ach-seal-fallback { font-size: var(--text-xs); }
.ach-profile-name { flex: 1 1 auto; min-width: 0; font-weight: 700; }
.ach-profile-pct { flex: 0 0 auto; font-size: var(--text-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .ach-toolbar-pickers { grid-template-columns: minmax(0, 1fr); max-width: calc(100% - 56px); }   /* one under the other (16/11/2026: two by two cut the names), clear of the floating button */
  .ach-toolbar-pickers .ach-pick { flex-basis: auto; max-width: none; }
}

/* COLUNAS DA LISTA (dono, 15/11/2026): cabecalho Tier | Category | Group | Stage | Kind | Achievement | Unlocked sobre
   as faixas, no mesmo grid. A esquerda tem cinco espacos de icone de 48 px (nivel, categoria e os tres que estao sendo
   desenhados para grupo, etapa e tipo, reservados vazios por enquanto); a direita cabe "Unlocked on 13 Nov 2026 · Step 2
   of 4" numa linha so, com folga. */
.ach-list { --ach-icon: 48px; --ach-icon-gap: 8px; --ach-left: calc(5 * var(--ach-icon) + 4 * var(--ach-icon-gap)); --ach-right: 20rem; }
.ach-strip, .ach-list-head { grid-template-columns: var(--ach-left) minmax(0, 1fr) var(--ach-right); }
.ach-list-head { --ach-icon: 48px; --ach-icon-gap: 8px; --ach-left: calc(5 * var(--ach-icon) + 4 * var(--ach-icon-gap)); --ach-right: 20rem;
  display: grid; align-items: end; gap: 16px; margin: 14px 0 -4px; padding: 0 16px 0 19px;   /* 19 = 16 + a borda de 3 px da faixa */
  font-size: var(--text-xs); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.ach-head-left { display: grid; grid-template-columns: repeat(5, var(--ach-icon)); gap: var(--ach-icon-gap); }
.ach-head-left > span { justify-self: center; white-space: nowrap; }
.ach-head-mid { padding-left: 16px; }
.ach-head-right { text-align: center; white-space: nowrap; }
.ach-strip-left { display: grid; grid-template-columns: repeat(5, var(--ach-icon)); gap: var(--ach-icon-gap); justify-items: center; }
.ach-slot { display: block; width: var(--ach-icon); height: var(--ach-icon); object-fit: contain; }
.ach-strip-right .ach-count { white-space: nowrap; }
/* A tela usa a camada lote-1 (styles-lote1.css: icones de 38 px, faixa com 12 px de respiro e 10 px entre colunas, e a
   linha da data com quebra): o cabecalho e os espacos seguem as mesmas medidas, e a data fica numa linha so. */
.lote-1 .ach-list, .lote-1 .ach-list-head { --ach-icon: 38px; --ach-icon-gap: 26px; }   /* o gap abre espaco para os rotulos do cabecalho */
.lote-1 .ach-list-head { gap: 10px; padding: 0 12px 0 13px; }
.lote-1 .ach-strip-right .ach-count { white-space: nowrap !important; }
/* Abaixo de 1100 px as tres colunas fixas espremeriam o nome: a lista usa o arranjo do celular (sem cabecalho, sem os
   espacos vazios, a data ou a barra embaixo do nome). */
@media (max-width: 1100px) {
  .ach-list-head { display: none; }
  .ach-slot { display: none; }
  .ach-strip-left { display: flex; gap: 6px; }
  .ach-strip { grid-template-columns: auto minmax(0, 1fr); }
  .ach-strip-right { grid-column: 1 / -1; align-items: flex-start; }
  .ach-strip-right .ach-bar { width: 100%; }
}
/* "Ver mais" ao fim da lista (dono, 19/11/2026): as 20 primeiras, depois todas. */
.ach-more { display: flex; justify-content: center; padding: var(--space-4, 16px) 0 var(--space-2, 8px); }
.ach-more .btn { min-height: 44px; }
