/* Characters (top bar menu) and the Achievements panel (the vault window has css/vault.css). Semantic tokens from style.css only.
   The character menu may cover the battle canvas while it is open: it is opaque, with square corners and no blurred
   shadow (see the Firefox note in style.css), and only exists in the DOM flow while open (hidden otherwise). */

/* ---------------------------------------------------------------- top bar: the character button */
.tb-char-text { display: flex; flex-direction: column; min-width: 0; }
#tb-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tb-job { display: block; white-space: nowrap; }
.tb-char-btn {
  display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; font: inherit; color: inherit;
  background: transparent; border: 1px solid transparent; border-left-color: var(--border-soft); border-radius: 0;
  padding: 4px 10px 4px var(--s-4); min-height: 44px;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.tb-char-btn:hover { background: var(--surface-3); border-color: var(--border-soft); }
.tb-char-btn[aria-expanded="true"] { background: var(--sel-softer); border-color: var(--sel-line); }
.tb-caret { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--text-muted); flex: none; }
.tb-char-btn[aria-expanded="true"] .tb-caret { transform: rotate(180deg); }

/* ---------------------------------------------------------------- the menu */
.char-menu {
  position: absolute; z-index: var(--z-pop); width: 320px; max-width: calc(100vw - 16px); max-height: min(70vh, 520px); overflow-y: auto;
  padding: 6px; background: var(--surface-1); border: 1px solid var(--border-accent); border-radius: 0;
  box-shadow: inset 0 0 0 1px var(--frame-hi), 0 3px 0 var(--shade); /* no blur: see the note at the top */
}
.char-menu[hidden] { display: none; }
.char-menu-head { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 8px 8px; font-size: var(--fs-micro); font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-muted); }
.char-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name played" "meta played"; gap: 1px 10px; width: 100%;
  padding: 8px 10px; margin: 0 0 2px; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: 0; /* square: the menu can lie over the battle canvas */
}
.char-item:hover, .char-item:focus-visible { background: var(--surface-3); border-color: var(--border-soft); }
.char-item:focus-visible { outline: 2px solid var(--sel); outline-offset: -2px; }
.char-item.on { background: var(--sel-soft); border-color: var(--sel-line); cursor: default; }
.char-item .char-name { grid-area: name; font-weight: 800; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char-item .char-meta { grid-area: meta; font-size: var(--fs-sm); color: var(--text-soft); }
.char-item .char-played { grid-area: played; align-self: center; font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.char-item .char-played.now { color: var(--sel-text); }
.char-item.empty { border: 1px dashed var(--border); }
.char-item.empty .char-name { color: var(--sel-text); }
.char-item.buy { margin-top: 4px; border-color: var(--border-soft); background: var(--surface-sunken); }
.char-item[disabled] { opacity: 0.6; cursor: not-allowed; }
.char-menu-foot { padding: 8px 8px 2px; border-top: 1px solid var(--border-soft); margin-top: 4px; line-height: 1.35; }

/* creator: name hint and error */
.cr-name-hint { margin: -4px 0 6px; }
#cr-error { margin: 0 0 8px; }

/* ---------------------------------------------------------------- achievements */
.ach-summary { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: var(--s-4); align-items: end; }
.ach-summary b { font-size: var(--fs-2xl); color: var(--text-strong); font-variant-numeric: tabular-nums; }
.ach-title-pick { display: flex; flex-direction: column; min-width: 0; }
.ach-title-pick select { width: 100%; }
/* one plain list per topic (owner 2026-11-10): heading with done / total, rows split by hairlines */
.ach-sec { margin-top: var(--s-4); }
.ach-sec-h {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); margin: 0 2px 2px; padding-bottom: 5px;
  border-bottom: 1px solid var(--border); font-family: var(--title); font-size: 14.5px; font-weight: 800; letter-spacing: 0.4px; color: var(--text-title);
}
.ach-sec-h .muted { font-family: var(--font); font-size: var(--fs-xs); font-weight: 800; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.ach-list { list-style: none; margin: 0; padding: 0; }
.ach-row { padding: 7px 4px 8px; border-bottom: 1px solid var(--hairline-2); }
.ach-row:last-child { border-bottom: 0; }
.ach-line { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); }
.ach-name { color: var(--text-strong); }
.ach-pts { flex: none; font-size: var(--fs-xs); font-weight: 800; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ach-row.done .ach-pts { color: var(--sel-text); }
.ach-desc { color: var(--text-soft); line-height: 1.4; }
.ach-reward { color: var(--text-muted); }
.ach-bar { margin-top: 5px; height: 12px; }
.ach-done { margin-top: 3px; font-weight: 700; color: var(--good-text); }
.ach-check { margin-right: 5px; }
.rank-title, .friend-title { font-size: var(--fs-xs); font-weight: 700; color: var(--sel-text); }

@media (max-width: 760px) {
  .tb-char-btn { grid-area: char; padding-left: 10px; min-height: 38px; }
  .ach-summary { grid-template-columns: 1fr 1fr; }
  .ach-title-pick { grid-column: 1 / -1; }
}
#cr-cancel { text-decoration: none; }
