/* The armory's statistics: the character window's Overview tab
   (js/views/overview.js) and the main page's Tavern Tales (js/views/tales.js).
   Every text colour is a --text-* token or --class-text, listed in
   contrast.json (tests/test_dashboard_contrast.py). */

/* === Overview tab ================================================================ */

.ovpage {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-width: 0;
}

.ov-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 23rem);
  gap: 1.1rem;
  align-items: start;
}

.ov-grid-solo {
  grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 960px) {
  .ov-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.ov-main,
.ov-side {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-width: 0;
}

.ov-card {
  min-width: 0;
  padding: 0.9rem 1rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(212, 175, 55, 0.32);
  background:
    radial-gradient(120% 70% at 0% 0%, rgba(212, 175, 55, 0.06), transparent 60%),
    linear-gradient(180deg, rgba(255, 235, 180, 0.04), rgba(0, 0, 0, 0.3));
  box-shadow: inset 0 1px 0 rgba(255, 235, 180, 0.07), 0 6px 16px rgba(0, 0, 0, 0.32);
}

.ov-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
  font-family: var(--font-display);
  font-size: var(--fs-text);
  font-weight: 800;
  letter-spacing: var(--track-label);
  line-height: 1.25;
  text-transform: uppercase;
  color: var(--text-gold);
}

.ov-title-glyph {
  flex: none;
  width: 1.55rem;
  height: 1.55rem;
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ov-sub {
  margin: 0.15rem 0 0.4rem;
  font-family: var(--font-display);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: var(--track-label);
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ov-note {
  font-size: var(--fs-note);
  font-style: italic;
  line-height: 1.4;
  color: var(--text-faint);
}

/* A thin trough with a gold fill (--fill set from JS). */
.ov-bar {
  position: relative;
  display: block;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.2);
}

.ov-bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--fill, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-mid), var(--gold-bright));
}

/* --- guild honours: gold pills across the top ---------------------------------- */

/* A tidy grid of badges, four to a row on a wide screen (eight, then "+N more"). */
.ov-honours {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  padding: 0.8rem 0.95rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--gold-dim);
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.17), rgba(212, 175, 55, 0.03) 70%);
  box-shadow: 0 0 0 1px var(--ink-line), inset 0 1px 0 rgba(255, 235, 180, 0.1);
}

.ov-honours-title {
  font-family: var(--font-display);
  font-size: var(--fs-small);
  font-weight: 800;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-gold-bright);
}

.ov-honour-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 0.5rem;
}

.ov-honour {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.45rem 0.8rem 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--gold-mid);
  background: linear-gradient(180deg, #3a2e1c, #1c150c);
  box-shadow: inset 0 1px 0 rgba(255, 235, 180, 0.15), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.ov-honour-star {
  flex: none;
  width: 1.65rem;
  height: 1.65rem;
  fill: var(--gold);
  stroke: var(--ink-line);
  stroke-width: 1.6;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px rgba(247, 231, 172, 0.5));
}

.ov-honour-shared .ov-honour-star {
  fill: var(--parchment-dim);
}

.ov-honour-words {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.ov-honour-name {
  font-family: var(--font-display);
  font-size: var(--fs-small);
  font-weight: 800;
  color: var(--text-gold-bright);
}

.ov-honour-text {
  font-size: var(--fs-label);
  color: var(--text-muted);
}

.ov-honour-more,
.tales-more {
  min-height: 2.4rem;
  padding: 0.3rem 1rem;
  border-radius: 999px;
  border: 2px solid rgba(212, 175, 55, 0.55);
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.08), rgba(10, 8, 14, 0.9));
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  font-family: var(--font-display);
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-gold-bright);
  cursor: pointer;
  transition: border-color var(--t-fast);
}

.ov-honour-more:hover,
.tales-more:hover {
  border-color: var(--gold-bright);
}

.ov-honour-more {
  align-self: flex-start;
}

.ov-honour-more:focus-visible,
.tales-more:focus-visible {
  outline: 3px solid var(--gold-bright);
  outline-offset: 2px;
}

.tales-more {
  align-self: center;
}

/* Phones: the honours as name-only badges, two to a row. */
@media (max-width: 620px) {
  .ov-honours {
    padding: 0.6rem 0.65rem;
  }

  .ov-honour-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ov-honour {
    padding: 0.3rem 0.5rem 0.3rem 0.3rem;
  }

  .ov-honour-star {
    width: 1.3rem;
    height: 1.3rem;
  }

  .ov-honour-text {
    display: none;
  }
}

/* --- the adventurer's chronicle: big tiles ------------------------------------- */

/* Every tile the same height: the glyph, the number, the label on one line,
   then a short line under it. The card's width picks two or three columns,
   and the last tile of a short row stretches to its end. */
.ov-chronicle {
  container-type: inline-size;
}

.ov-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 0.6rem;
}

.ov-tile:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

@container (min-width: 46rem) {
  .ov-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ov-tile:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .ov-tile:last-child:nth-child(3n + 1) {
    grid-column: 1 / -1;
  }

  .ov-tile:last-child:nth-child(3n + 2) {
    grid-column: span 2;
  }
}

.ov-tile {
  display: grid;
  grid-template-columns: 2.9rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(212, 175, 55, 0.28);
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(212, 175, 55, 0.1), transparent 60%),
    rgba(0, 0, 0, 0.3);
}

.ov-tile-glyph {
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 50%;
  border: 2px solid #d9ad45;
  background: radial-gradient(circle at 36% 28%, #45385a, #120e17 75%);
  box-shadow: 0 0 0 1.5px var(--ink-line), inset 0 -4px 8px rgba(0, 0, 0, 0.5), 0 0 10px rgba(212, 175, 55, 0.22);
}

.ov-tile-glyph .stat-glyph {
  width: 1.7rem;
  height: 1.7rem;
  fill: none;
  stroke: var(--gold-bright);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ov-tile-grim .ov-tile-glyph {
  border-color: #b4483f;
  background: radial-gradient(circle at 36% 28%, #5a2a2a, #170b0b 75%);
}

.ov-tile-grim .ov-tile-glyph .stat-glyph {
  stroke: #ffd2cc;
}

.ov-tile-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ov-tile-num {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 1.2rem + 0.8vw, 1.9rem);
  font-weight: 800;
  line-height: 1.05;
  color: var(--text-gold-bright);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.8);
  font-variant-numeric: tabular-nums;
}

.ov-tile-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--text);
}

.ov-tile-sub {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  margin-top: 0.1rem;
  font-size: var(--fs-note);
  font-style: italic;
  line-height: 1.3;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

/* Phones: two tiles to a row, the glyph above the number. */
@media (max-width: 620px) {
  .ov-tiles {
    gap: 0.5rem;
  }

  .ov-tile {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 0.4rem;
    padding: 0.6rem 0.6rem 0.65rem;
  }

  .ov-tile-label {
    white-space: normal;
  }

  .ov-tile-glyph {
    width: 2.3rem;
    height: 2.3rem;
  }

  .ov-tile-glyph .stat-glyph {
    width: 1.35rem;
    height: 1.35rem;
  }

  /* Four tabs fit in two rows: no glyphs, less padding. */
  .charwin-tab {
    padding: 0.3rem 0.75rem 0.35rem;
  }

  .charwin-tab svg {
    display: none;
  }
}

/* Provisions and loot rolls, under the tiles. */
.ov-extras {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 0.9rem 1.3rem;
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px dashed rgba(212, 175, 55, 0.25);
}

.ov-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.ov-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem 0.2rem 0.35rem;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: rgba(0, 0, 0, 0.35);
  font-size: var(--fs-small);
}

.ov-chip-glyph {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ov-chip-num {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--text-gold-bright);
  font-variant-numeric: tabular-nums;
}

.ov-chip-label {
  color: var(--text-muted);
}

.ov-roll-meter {
  display: flex;
  height: 0.8rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 0 1px var(--ink-line), 0 0 0 2px rgba(212, 175, 55, 0.35);
}

.ov-roll-need {
  width: var(--need, 0%);
  background: linear-gradient(180deg, #ff8a5c, #b8381f);
}

.ov-roll-greed {
  flex: 1;
  background: linear-gradient(180deg, #f7d675, #a8781c);
}

.ov-roll-legend {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0.35rem 0 0.15rem;
  font-family: var(--font-display);
  font-size: var(--fs-small);
  font-weight: 700;
}

.ov-roll-key-need {
  color: var(--text-ember);
}

.ov-roll-key-greed {
  color: var(--text-gold);
}

/* --- bosses felled ---------------------------------------------------------------- */

.ov-dungeons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 0.55rem;
}

.ov-dungeon {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.6rem;
  align-items: start;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--gold-mid);
  background: rgba(0, 0, 0, 0.3);
}

.ov-dungeon-glyph {
  width: 2rem;
  height: 2rem;
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ov-dungeon-body {
  min-width: 0;
}

.ov-dungeon-name {
  display: block;
  font-family: var(--font-display);
  font-size: var(--fs-text);
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-gold-bright);
  overflow-wrap: anywhere;
}

.ov-boss-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.15rem;
}

.ov-boss {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.1rem 0.5rem;
  font-size: var(--fs-text);
  line-height: 1.3;
}

.ov-boss-name {
  color: var(--text);
  overflow-wrap: anywhere;
}

.ov-boss-count {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-ember);
}

.ov-boss-when {
  margin-left: auto;
  font-size: var(--fs-small);
  color: var(--text-faint);
}

/* --- exploration ------------------------------------------------------------------- */

.ov-continents {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ov-continent-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.25rem 0.6rem;
  margin-bottom: 0.5rem;
}

.ov-continent-name {
  font-family: var(--font-display);
  font-size: var(--fs-text);
  font-weight: 800;
  color: var(--text-gold-bright);
}

.ov-continent-count {
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.ov-continent-bar {
  grid-column: 1 / -1;
  height: 8px;
}

.ov-zones {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
  gap: 0.5rem 1.1rem;
  margin-bottom: 0.45rem;
}

.ov-zone {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.15rem 0.5rem;
  font-size: var(--fs-text);
  line-height: 1.3;
}

.ov-zone-name {
  color: var(--text);
  overflow-wrap: anywhere;
}

.ov-zone-count {
  font-size: var(--fs-small);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.ov-zone-done .ov-zone-count {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-ok);
}

.ov-zone-bar {
  grid-column: 1 / -1;
}

.ov-zone-bar::after {
  background: linear-gradient(90deg, #2f7d6b, var(--jade));
}

.ov-zone-done .ov-zone-bar::after {
  background: linear-gradient(90deg, var(--gold-mid), var(--gold-bright));
  box-shadow: 0 0 6px rgba(247, 231, 172, 0.6);
}

/* --- reputation (the standing colours come from views.css .rep-*::after) ------------ */

.ov-rep-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.ov-rep {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.15rem 0.6rem;
  font-size: var(--fs-text);
  line-height: 1.3;
}

.ov-rep-name {
  min-width: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.ov-rep-standing {
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.ov-rep-bar {
  grid-column: 1 / -1;
  position: relative;
  display: block;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.22);
}

.ov-rep-bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--fill, 50%);
  border-radius: inherit;
}

/* Lower than .rep-<standing>::after, so the standing's colour wins. */
:where(.ov-rep-bar)::after {
  background: #8a8a8a;
}

.ov-rep-value {
  grid-column: 1 / -1;
  justify-self: end;
  font-size: var(--fs-label);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* --- attributes, like the game's character pane ------------------------------------ */

/* The pane is wide: health and power side by side, the groups in columns. */
.ov-vitals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 0.45rem 1.5rem;
  margin-bottom: 0.85rem;
}

.ov-attr-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.5rem), 1fr));
  gap: 0.8rem 1.5rem;
  align-items: start;
}

.ov-attrs {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ov-attr {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.12rem 0.15rem;
  border-bottom: 1px dotted rgba(212, 175, 55, 0.16);
  font-size: var(--fs-text);
  line-height: 1.35;
}

.ov-attr-label {
  min-width: 0;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.ov-attr-value {
  margin-left: auto;
  font-family: var(--font-display);
  font-weight: 700;
  text-align: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ov-bonus {
  margin-left: 0.35rem;
  font-size: var(--fs-small);
  color: var(--text-ok);
}

.ov-malus {
  margin-left: 0.35rem;
  font-size: var(--fs-small);
  color: var(--text-bad);
}

.ov-resists {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem 0.3rem;
}

.ov-resist {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
}

.ov-resist-gem {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--res) 40%, #3a3340);
  background: radial-gradient(circle at 38% 30%, #2a2232, #0c0910 75%);
  box-shadow: 0 0 0 1.5px var(--ink-line), inset 0 -4px 8px rgba(0, 0, 0, 0.5);
}

.ov-resist-on .ov-resist-gem {
  border-color: var(--res);
  background: radial-gradient(circle at 38% 30%, color-mix(in srgb, var(--res) 35%, #1a1420), #0c0910 75%);
  box-shadow: 0 0 0 1.5px var(--ink-line), inset 0 -4px 8px rgba(0, 0, 0, 0.5), 0 0 10px color-mix(in srgb, var(--res) 60%, transparent);
}

.ov-resist-num {
  font-family: var(--font-display);
  font-size: var(--fs-small);
  font-weight: 800;
  color: var(--text-strong);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9);
}

.ov-resist-label {
  font-size: var(--fs-label);
  color: var(--text-muted);
}

.ov-resist-fire { --res: #e8583a; }
.ov-resist-frost { --res: #6fb6ff; }
.ov-resist-nature { --res: #5fcf6e; }
.ov-resist-shadow { --res: #a77bff; }
.ov-resist-arcane { --res: #f0a8ff; }

/* --- professions at a glance ------------------------------------------------------- */

.ov-prof-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.ov-prof {
  display: grid;
  grid-template-columns: 1.9rem minmax(0, 1fr);
  gap: 0.2rem 0.6rem;
  align-items: center;
}

.ov-prof-glyph {
  grid-row: 1 / span 3;
  align-self: start;
  width: 1.9rem;
  height: 1.9rem;
  stroke: var(--gold);
}

.ov-prof-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
  font-size: var(--fs-text);
}

.ov-prof-name {
  min-width: 0;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}

.ov-prof-secondary .ov-prof-name {
  color: var(--text-muted);
}

.ov-prof-rank {
  margin-left: auto;
  font-size: var(--fs-small);
  color: var(--text-gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ov-prof-bar {
  height: 8px;
}

.ov-prof-bar::after {
  background: linear-gradient(90deg, #2a55b8, #6fa8ff);
}

.ov-prof-meta {
  font-size: var(--fs-label);
  font-style: italic;
  color: var(--text-faint);
}

.ov-jump {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  margin-top: 0.9rem;
  padding: 0.35rem 1rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--gold-mid);
  background: linear-gradient(180deg, #2c2338, #15111c);
  box-shadow: inset 0 1px 0 rgba(255, 235, 180, 0.12), 0 2px 6px rgba(0, 0, 0, 0.4);
  font-family: var(--font-display);
  font-size: var(--fs-small);
  font-weight: 800;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-gold-bright);
  cursor: pointer;
  transition: border-color var(--t-fast), translate var(--t-fast);
}

.ov-jump:hover {
  border-color: var(--gold-bright);
  translate: 0 -1px;
}

.ov-jump:focus-visible,
.ov-allstats-summary:focus-visible {
  outline: 3px solid var(--gold-bright);
  outline-offset: 2px;
}

/* --- quest log: quest-yellow titles, like the game's log ------------------------------ */

.ov-quest-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 0.4rem 1.1rem;
  margin-top: 0.55rem;
}

.ov-quest {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: var(--fs-text);
  line-height: 1.3;
}

.ov-quest-glyph {
  flex: none;
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.1rem;
  fill: none;
  stroke: var(--warn);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ov-quest-name {
  min-width: 0;
  color: var(--text-warn);
  overflow-wrap: anywhere;
}

a.ov-quest-name:hover {
  text-decoration: underline;
}

/* --- achievements ------------------------------------------------------------------- */

.ov-ach-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}

.ov-ach {
  display: grid;
  grid-template-columns: 1.3rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.2rem 0.5rem;
  font-size: var(--fs-text);
  line-height: 1.3;
}

.ov-ach-glyph {
  width: 1.3rem;
  height: 1.3rem;
  fill: none;
  stroke: var(--gold-dim);
  stroke-width: 2;
  stroke-linejoin: round;
}

.ov-ach-done .ov-ach-glyph {
  fill: var(--gold);
  stroke: var(--ink-line);
}

.ov-ach-name {
  min-width: 0;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.ov-ach-done .ov-ach-name {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-gold-bright);
}

.ov-ach-when {
  font-size: var(--fs-small);
  color: var(--text-faint);
  white-space: nowrap;
}

.ov-ach-bar {
  grid-column: 2 / -1;
}

/* --- every statistic (folded) -------------------------------------------------------- */

.ov-allstats {
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(212, 175, 55, 0.45);
  background: rgba(0, 0, 0, 0.25);
  transition: border-color var(--t-fast);
}

.ov-allstats[open] {
  border-style: solid;
  border-color: rgba(212, 175, 55, 0.35);
}

.ov-allstats-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  list-style: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: var(--fs-text);
  font-weight: 800;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-gold);
}

.ov-allstats-summary::-webkit-details-marker {
  display: none;
}

/* A chevron that turns when the list is open. */
.ov-allstats-summary::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  margin: -0.2rem 0 0 0.35rem;
  rotate: 45deg;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transition: rotate var(--t-fast);
}

.ov-allstats[open] > .ov-allstats-summary::after {
  margin-top: 0.25rem;
  rotate: 225deg;
}

.ov-allstats-summary:hover {
  background: var(--tint-gold);
}

.ov-allstats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 0.9rem 1.5rem;
  padding: 0.3rem 1rem 1rem;
}

.ov-allstats-group {
  min-width: 0;
}

.ov-allstats .ov-attr-value {
  font-family: var(--font-body);
  white-space: normal;
}

/* === Tavern Tales (main page) ======================================================= */

.panel-tales .panel-title::before {
  background: linear-gradient(135deg, #ffe0a8, var(--ember) 55%, #7a3a0a);
}

.tales {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.tales-headline {
  padding: 0.3rem 0.6rem 0;
  font-size: var(--fs-lead);
  line-height: 1.5;
  text-align: center;
  text-wrap: balance;
  color: var(--text);
}

.tales-num {
  font-family: var(--font-display);
  font-size: 1.3em;
  font-weight: 800;
  color: var(--text-gold-bright);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.8), 0 0 14px rgba(212, 175, 55, 0.35);
  font-variant-numeric: tabular-nums;
}

.tales-counters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.6rem), 1fr));
  gap: 0.6rem;
}

/* Wide: even rows (--tc-cols from js/views/tales.js: 14 counters, 2 x 7). */
@media (min-width: 1200px) {
  .tales-counters {
    grid-template-columns: repeat(var(--tc-cols, 7), minmax(0, 1fr));
  }
}

.tales-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.7rem 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(212, 175, 55, 0.3);
  background:
    radial-gradient(100% 80% at 50% 0%, rgba(212, 175, 55, 0.13), transparent 70%),
    rgba(0, 0, 0, 0.32);
  text-align: center;
}

.tales-counter-glyph {
  width: 2.1rem;
  height: 2.1rem;
  margin-bottom: 0.15rem;
  fill: none;
  stroke: var(--gold-bright);
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.35));
}

.tales-counter-num {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 1.1rem + 0.6vw, 1.65rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-gold-bright);
  font-variant-numeric: tabular-nums;
}

.tales-counter-label {
  font-size: var(--fs-small);
  line-height: 1.25;
  color: var(--text-muted);
}

.tales-facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 1.5rem;
}

.tales-fact {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: var(--fs-text);
  font-style: italic;
  line-height: 1.4;
  color: var(--text-muted);
}

/* A small gold diamond before each fact. */
.tales-fact::before {
  content: "";
  flex: none;
  width: 0.45em;
  height: 0.45em;
  rotate: 45deg;
  translate: 0 -0.1em;
  background: var(--gold);
}

.tales-subhead {
  margin-top: 0.3rem;
  font-family: var(--font-display);
  font-size: var(--fs-name);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
  color: var(--text-gold);
}

.tales-awards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14.5rem), 1fr));
  gap: 0.75rem;
}

/* Wide: four to a row (the first eight are two full rows). */
@media (min-width: 1200px) {
  .tales-awards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.tale {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.7rem 0.8rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--gold-dim);
  background:
    linear-gradient(180deg, rgba(255, 235, 180, 0.06), transparent 40%),
    linear-gradient(180deg, rgba(36, 29, 46, 0.7), rgba(0, 0, 0, 0.4));
  box-shadow: 0 0 0 1px var(--ink-line), inset 0 1px 0 rgba(255, 235, 180, 0.08), 0 8px 18px rgba(0, 0, 0, 0.35);
  transition: translate var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
}

.tale:hover,
.tale:focus-within {
  translate: 0 -2px;
  border-color: var(--gold-mid);
  box-shadow: 0 0 0 1px var(--ink-line), inset 0 1px 0 rgba(255, 235, 180, 0.08), 0 10px 22px rgba(0, 0, 0, 0.45), 0 0 18px rgba(212, 175, 55, 0.18);
}

.tale-shame {
  border-color: #6e2a24;
  background:
    linear-gradient(180deg, rgba(255, 180, 170, 0.05), transparent 40%),
    linear-gradient(180deg, rgba(60, 23, 20, 0.75), rgba(0, 0, 0, 0.4));
}

.tale-shame:hover,
.tale-shame:focus-within {
  border-color: #a8392f;
}

.tale-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tale-seal {
  flex: none;
  width: 1.7rem;
  height: 1.7rem;
  fill: var(--gold);
  stroke: var(--ink-line);
  stroke-width: 1.6;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(247, 231, 172, 0.45));
}

.tale-shame .tale-seal {
  fill: none;
  stroke: #ff9a90;
  stroke-width: 2.1;
  stroke-linecap: round;
  filter: drop-shadow(0 0 5px rgba(214, 69, 63, 0.5));
}

.tale-title {
  font-family: var(--font-display);
  font-size: var(--fs-small);
  font-weight: 800;
  letter-spacing: var(--track-label);
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--text-gold);
}

.tale-shame .tale-title {
  color: var(--text-shame);
}

.tale-winner {
  display: grid;
  grid-template-columns: 2.9rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
}

.tale-bust {
  width: 2.9rem;
  height: 2.9rem;
}

.tale-body {
  min-width: 0;
}

.tale-line {
  font-family: var(--font-display);
  font-size: var(--fs-text);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.tale-who {
  font-weight: 800;
  color: var(--class-text);
}

.tale-who:hover {
  text-decoration: underline;
}

.tale-value {
  display: block;
  margin-top: 0.1rem;
  font-size: var(--fs-text);
  line-height: 1.3;
  color: var(--text-gold-bright);
}

.tale-shame .tale-value {
  color: var(--text-shame);
}

.tale-quip {
  font-size: var(--fs-note);
  font-style: italic;
  line-height: 1.35;
  color: var(--text-muted);
}

.tale-runner {
  margin-top: auto;
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(212, 175, 55, 0.22);
  font-size: var(--fs-small);
  line-height: 1.35;
  color: var(--text-faint);
  overflow-wrap: anywhere;
}

.tale-runner-label {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-muted);
}

.tale-runner .tale-who {
  font-weight: 700;
}

/* --- Legacy points (js/views/overview.js legacyCard, js/legacy.js) ------------------------ */

.ov-legacy-lead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.55rem;
  margin: 0.1rem 0 0.35rem;
}

.ov-legacy-num {
  font-family: var(--font-display);
  font-size: var(--fs-title);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text-gold-bright);
}

.ov-legacy-unit {
  font-family: var(--font-display);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-muted);
}

.ov-legacy-bar {
  margin: 0.35rem 0 0.6rem;
}

.ov-legacy-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.ov-legacy-step {
  min-width: 2.5rem;
  padding: 0.1rem 0.55rem;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  background: #120e18;
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text-muted);
}

.ov-legacy-step-on {
  border-color: var(--gold);
  background: var(--surface-gold);
  font-weight: 700;
  color: var(--text-on-gold);
}

.ov-legacy-all {
  margin: 0.2rem 0 0.6rem;
}

.ov-legacy-summary {
  padding: 0.3rem 0;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-gold);
}

.ov-legacy-summary:focus-visible {
  outline: 3px solid var(--gold-bright);
  outline-offset: 2px;
}

.ov-legacy-group {
  margin-top: 0.55rem;
}

/* every source: what to do for it wraps beside the name (a long one mustn't squeeze the name) */
.ov-legacy-group .ov-ach {
  grid-template-columns: 1.3rem minmax(0, 1.1fr) minmax(0, 1fr);
}

.ov-legacy-group .ov-ach-when {
  white-space: normal;
  text-align: right;
  overflow-wrap: anywhere;
}
