/* City View (web/js/ext/cityView): the city screen dock, the map legend and the quick panel's "Open City View"
   button. Uses the palette in style.css (--gold, --gold-bright, --ink, --panel, --serif …). --sc = state colour. */

/* ---------- "Open City View" on the quick city panel ---------- */
.cv-open {
  display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 10px; padding: 7px 10px; cursor: pointer;
  font: 13px var(--serif); letter-spacing: .12em; text-transform: uppercase; color: #1c1408;
  background: linear-gradient(180deg, #f3dc9c, #c9a45c 55%, #a8843f);
  border: 1px solid #120d06; border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255,250,230,.7), inset 0 -1px 0 rgba(80,55,15,.6), 0 2px 6px rgba(0,0,0,.45);
}
.cv-open:hover { filter: brightness(1.08); }
.cv-open:active { transform: translateY(1px); }
.cv-open .cv-open-ic { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #24384f; color: #f8f0d8; box-shadow: 0 0 0 1px #120d06; }
.cv-open .cv-open-go { margin-left: auto; font-size: 18px; line-height: 1; }
.cv-plink { margin: 8px 0 0; font-size: 11.5px; line-height: 1.4; color: var(--ink-dim, #b9ab8a); }
.cv-plink button {
  margin-left: 4px; padding: 1px 8px; cursor: pointer; font: 11px var(--serif); letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold-bright, #f3dc9c); background: rgba(201,164,92,.12); border: 1px solid rgba(201,164,92,.55); border-radius: 3px;
}
.cv-plink button:hover, .cv-plink button:focus-visible { background: rgba(201,164,92,.25); }

/* ---------- the dock ---------- */
.app-dock.cv-dock {
  padding: 0 0 14px; scroll-padding-top: 46px;
  background: radial-gradient(120% 60% at 50% 0%, rgba(42,66,92,.55), transparent 70%), linear-gradient(180deg, var(--panel-2), var(--panel));
  border-left: 2px solid #8a6d34;
  box-shadow: -2px 0 0 #120d06, -10px 0 30px rgba(0,0,0,.5), inset 1px 0 0 rgba(255,235,190,.1);
}
.cv-dock .cv-grip { display: none; }
.cv-dock :focus:not(:focus-visible) { outline: none; }

.cv-head { position: relative; padding: 14px 18px 12px 22px; background: linear-gradient(180deg, rgba(255,235,190,.06), transparent); }
.cv-ribbon {
  position: absolute; left: 0; top: 0; bottom: 0; width: 7px;
  background: linear-gradient(180deg, var(--sc), color-mix(in srgb, var(--sc) 55%, #000));
  box-shadow: inset -1px 0 0 rgba(0,0,0,.45), 1px 0 0 rgba(232,199,122,.35);
}
.cv-close { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; }
.cv-kind { font-size: 10px; letter-spacing: .24em; text-transform: uppercase; color: var(--gold); }
.cv-title { display: flex; align-items: center; gap: 12px; margin-top: 6px; padding-right: 30px; }
.cv-crest {
  flex: none; width: 54px; height: 60px; display: grid; place-items: center; position: relative;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(180deg, #f0d48c, #8a6d34);
}
.cv-crest::before {
  content: ""; position: absolute; inset: 3px; clip-path: inherit;
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--sc) 80%, #fff 20%), color-mix(in srgb, var(--sc) 60%, #000));
}
.cv-crest span { position: relative; font: bold 14px var(--sans); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.8); }
.cv-tt { min-width: 0; }
.cv-name {
  margin: 0; font-weight: normal; font-family: var(--serif); font-size: 27px; line-height: 1.1; letter-spacing: .07em;
  text-transform: uppercase; color: var(--gold-bright); text-shadow: 0 1px 0 #120d06, 0 0 18px rgba(236,208,142,.25);
}
.cv-name:focus { outline: none; }
.cv-cap { color: #ffe9a8; }
.cv-full { color: var(--ink-dim); font-size: 12px; margin-top: 2px; }
.cv-head .chips { margin-top: 5px; }

.cv-headline { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.cv-big {
  display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border-radius: 5px;
  background: rgba(0,0,0,.28); border: 1px solid rgba(201,164,92,.28); box-shadow: inset 0 1px 0 rgba(255,235,190,.05);
}
.cv-big .lbl { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); }
.cv-big b { font: 600 19px var(--serif); color: var(--ink); font-variant-numeric: tabular-nums; }
.cv-big .cv-sub, .cv-growth { font-size: 12px; color: var(--ink-dim); }
.cv-growth small { color: var(--ink-dim); font-size: 11px; }

.cv-ranks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 10px; }
.cv-rank { display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: help; text-align: center; }
.cv-medal {
  display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 4px; border-radius: 50%;
  font: bold 13px var(--serif); color: #1a1408; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px #120d06, 0 0 0 3px rgba(232,199,122,.55), 0 3px 6px rgba(0,0,0,.5), inset 0 2px 2px rgba(255,255,255,.45), inset 0 -3px 4px rgba(0,0,0,.25);
}
.cv-rank.gold .cv-medal { background: radial-gradient(circle at 50% 30%, #fff1c2, #e3b851 55%, #9c7425); }
.cv-rank.silver .cv-medal { background: radial-gradient(circle at 50% 30%, #ffffff, #c4ccd4 55%, #7d8894); }
.cv-rank.bronze .cv-medal { background: radial-gradient(circle at 50% 30%, #f5d2b0, #c0814b 55%, #7a4a24); }
.cv-rank-l { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-dim); line-height: 1.2; }

/* tabs */
.cv-tabs {
  position: sticky; top: 0; z-index: 3; display: flex; gap: 2px; padding: 6px 10px;
  background: linear-gradient(180deg, #1b2939, #142030); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 10px rgba(0,0,0,.35); overflow-x: auto; scrollbar-width: none;
}
.cv-tabs::-webkit-scrollbar { display: none; }
.cv-tabs button {
  flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 5px 7px; cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: 4px; color: var(--ink-dim);
  font: 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
.cv-tabs button:hover { color: var(--gold-bright); border-color: rgba(201,164,92,.3); }
.cv-tabs button.on { color: var(--gold-bright); background: linear-gradient(180deg, rgba(201,164,92,.22), rgba(201,164,92,.06)); border-color: rgba(201,164,92,.55); }

/* sections */
.cv-sec { padding: 12px 18px 6px; }
.cv-sec h3 {
  margin: 4px 0 10px; display: flex; align-items: center; gap: 8px;
  font: normal 15px var(--serif); letter-spacing: .2em; text-transform: uppercase; color: var(--gold-bright);
}
.cv-sec h3 svg { color: var(--gold); }
.cv-sec h3::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
.cv-h4 { margin: 14px 0 6px; font: normal 11px var(--serif); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.cv-h4 .muted { font: 11px var(--sans); letter-spacing: 0; text-transform: none; }
.cv-note { font-size: 11px; color: var(--ink-dim); margin: 6px 0 4px; line-height: 1.45; }
.cv-lead { font-size: 12px; color: var(--ink); margin: 0 0 8px; line-height: 1.45; }

.cv-card { padding: 8px 10px 6px; border-radius: 6px; background: rgba(0,0,0,.26); border: 1px solid rgba(201,164,92,.25); }
.cv-card-h { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); }
.cv-card-h span:last-child { font-weight: 700; letter-spacing: 0; font-size: 13px; }
.cv-spark { display: block; width: 100%; height: auto; margin-top: 2px; overflow: visible; }
.cv-spark .cv-ax { font: 10px var(--sans); fill: var(--ink-dim); }
.cv-spark .cv-lab { font: 600 11px var(--sans); fill: var(--ink); paint-order: stroke; stroke: #101822; stroke-width: 3px; }
.cv-spark .cv-lab-hi { fill: var(--gold-bright); font-size: 12px; }
.cv-spark .cv-grid { stroke: rgba(201,164,92,.12); stroke-dasharray: 2 4; }

.cv-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-top: 12px; }
.cv-stat-top { display: flex; flex-direction: column; gap: 1px; font-size: 11px; }
.cv-stat .sl { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-dim); }
.cv-stat .sl svg, .cv-stat .sl .emoji { color: var(--ink-dim); }
.cv-stat .sv { display: flex; align-items: baseline; gap: 6px; }
.cv-stat .sv b { font-size: 15px; font-variant-numeric: tabular-nums; }
.cv-stat .sv small { font-size: 10px; color: var(--ink-dim); }
.cv-meter { position: relative; height: 6px; margin: 4px 0 2px; border-radius: 3px; background: rgba(255,255,255,.07); }
.cv-meter > i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #8a6d34, #ecd08e); }
.cv-meter.good > i { background: linear-gradient(90deg, #4f7a2a, #9fd76a); }
.cv-meter.bad > i { background: linear-gradient(90deg, #8a3a2a, #f08a6a); }
.cv-meter .us { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: #f8f0d8; box-shadow: 0 0 0 1px rgba(0,0,0,.6); border-radius: 1px; }

.cv-legend-tiles { margin-top: 12px; padding: 8px 10px; border-radius: 6px; border: 1px dashed rgba(201,164,92,.3); font-size: 11px; color: var(--ink-dim); }
.cv-legend-tiles p { margin: 6px 0 0; line-height: 1.45; }
.cv-legend-tiles b { color: var(--ink); font-weight: 600; }
.cv-tl { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.cv-tl-i { display: inline-flex; align-items: center; gap: 5px; color: var(--ink); }
.cv-tl-i i { width: 10px; height: 10px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
.cv-tl-i small { color: var(--ink-dim); }

.cv-ctable { font-size: 12px; }
.cv-cr { display: grid; grid-template-columns: 1fr 52px 48px 56px; gap: 6px; align-items: center; padding: 4px 0; border-bottom: 1px dashed rgba(201,164,92,.14); font-variant-numeric: tabular-nums; }
.cv-cr > span:not(:first-child) { text-align: right; }
.cv-cr-h { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); border-bottom: 1px solid rgba(201,164,92,.3); }
.cv-cn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-cn small { color: var(--ink-dim); }
.cv-cn .cv-bar { margin-top: 3px; height: 3px; }

/* generic bars */
.cv-bar { position: relative; height: 5px; border-radius: 3px; background: rgba(255,255,255,.07); }
.cv-bar > i { display: block; height: 100%; border-radius: 3px; }
.cv-bar > b { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: rgba(248,240,216,.85); border-radius: 1px; }

/* economy */
.cv-gdp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cv-gdp > div { display: flex; flex-direction: column; padding: 7px 9px; border-radius: 5px; background: rgba(0,0,0,.26); border: 1px solid rgba(242,201,76,.25); }
.cv-gdp .lbl { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); }
.cv-gdp b { font: 600 18px var(--serif); color: #f2c94c; font-variant-numeric: tabular-nums; }
.cv-gdp small { font-size: 11px; color: var(--ink-dim); }
.cv-yields { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.cv-yield {
  text-align: center; padding: 7px 2px 6px; border-radius: 6px; cursor: help;
  background: linear-gradient(180deg, color-mix(in srgb, var(--yc) 16%, transparent), rgba(0,0,0,.25));
  border: 1px solid color-mix(in srgb, var(--yc) 45%, transparent);
}
.cv-yield .ico { display: flex; justify-content: center; color: var(--yc); filter: drop-shadow(0 1px 1px rgba(0,0,0,.6)); }
.cv-yield .val { font-weight: 700; font-size: 14px; color: var(--yc); font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; }
.cv-yield .lbl { font-size: 9.5px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .06em; }
.cv-yield .rk { font: bold 11px var(--serif); color: var(--gold-bright); margin-top: 2px; }
.cv-yield .rk small { font: 9px var(--sans); color: var(--ink-dim); }
.cv-inds { display: flex; flex-direction: column; gap: 6px; }
.cv-ind { display: grid; grid-template-columns: 22px 1fr auto; gap: 2px 7px; align-items: center; font-size: 12px; }
.cv-ind .cv-bar { grid-column: 2 / 4; }
.cv-ind-ic { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #f8f0d8; background: var(--bg); box-shadow: 0 0 0 1px #120d06, 0 0 0 2px rgba(201,164,92,.5); grid-row: 1 / 3; }
.cv-ind-v { color: var(--ink); font-variant-numeric: tabular-nums; }
.cv-ind-v small { color: var(--ink-dim); margin-left: 3px; }
.cv-ind.und { color: var(--ink-dim); font-style: italic; }
.cv-ind.und .cv-ind-v { color: var(--ink-dim); }
.cv-more summary { cursor: pointer; color: var(--gold); font-size: 12px; margin: 8px 0 6px; }
.cv-lq { display: inline-block; font-size: 10px; font-weight: 700; padding: 0 4px; margin-left: 5px; border-radius: 3px; vertical-align: 1px; font-variant-numeric: tabular-nums; }
.cv-lq.hi { background: rgba(127,191,63,.25); color: #b9e486; box-shadow: inset 0 0 0 1px rgba(159,215,106,.35); }
.cv-lq.mid { background: rgba(255,255,255,.06); color: var(--ink-dim); }
.cv-lq.lo { background: rgba(240,138,106,.12); color: #e0a08a; }

/* workforce: industries as buildings */
.cv-blds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.cv-bld {
  position: relative; display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 7px; padding: 6px 8px 6px 6px;
  border-radius: 5px; background: linear-gradient(180deg, rgba(40,56,74,.65), rgba(14,21,30,.75));
  border: 1px solid rgba(201,164,92,.22); box-shadow: inset 0 1px 0 rgba(255,235,190,.05);
}
.cv-bld.spec { border-color: rgba(236,208,142,.75); box-shadow: inset 0 1px 0 rgba(255,235,190,.12), 0 0 10px rgba(236,208,142,.18); }
.cv-bld-t { display: flex; flex-direction: column; min-width: 0; }
.cv-bld-n { font: 13px var(--serif); color: var(--gold-bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-bld-v { font-size: 11px; color: var(--ink); font-variant-numeric: tabular-nums; }
.cv-bld-v small { color: var(--ink-dim); }
.cv-bld .cv-lq { margin: 0; }
.cv-med {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #f8f0d8; flex: none;
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--bg) 75%, #fff 25%), var(--bg) 60%, color-mix(in srgb, var(--bg) 60%, #000));
  box-shadow: 0 0 0 1.5px #120d06, 0 0 0 3px #c9a45c, 0 0 0 4px #120d06, 0 2px 4px rgba(0,0,0,.5);
}
.cv-schematic { margin-top: 12px; padding: 9px 11px; border-radius: 6px; background: rgba(236,208,142,.06); border: 1px solid rgba(236,208,142,.3); font-size: 12px; line-height: 1.45; }
.cv-schematic p { margin: 8px 0 0; color: var(--ink-dim); }
.cv-schematic b { color: var(--gold-bright); font-weight: normal; font-family: var(--serif); letter-spacing: .04em; }

/* ---------- city-type badge (header) ---------- */
.cv-typeslot:empty { display: none; }
.cv-typeslot { margin-top: 5px; }
.cv-type {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 3px; border-radius: 12px; cursor: help;
  font: 12px var(--serif); letter-spacing: .14em; text-transform: uppercase; color: #fff8e6; text-shadow: 0 1px 1px rgba(0,0,0,.7);
  background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 85%, #fff 15%), color-mix(in srgb, var(--tc) 70%, #000));
  box-shadow: 0 0 0 1px #120d06, 0 0 0 2px rgba(232,199,122,.7), 0 2px 5px rgba(0,0,0,.45);
}
.cv-type.plain { color: var(--ink); text-shadow: none; }
.cv-type-ic { display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; background: rgba(0,0,0,.3); color: #fff8e6; }
.cv-type-l { font-weight: normal; font-family: var(--serif); letter-spacing: .06em; color: color-mix(in srgb, var(--tc) 55%, #fff); }

/* ---------- citizens: figure rows ---------- */
.cv-cz-top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.cv-cz-top:empty { display: none; }
.cv-cz-chip { display: flex; flex-direction: column; padding: 5px 8px; border-radius: 5px; background: rgba(0,0,0,.26); border: 1px solid rgba(201,164,92,.25); cursor: help; }
.cv-cz-chip b { font: 600 17px var(--serif); color: var(--gold-bright); font-variant-numeric: tabular-nums; }
.cv-cz-chip span { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); }
.cv-cz-chip small { font-size: 10.5px; color: var(--ink-dim); }
.cv-great {
  display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding: 6px 10px 6px 6px; border-radius: 6px; font-size: 12px; line-height: 1.4;
  background: linear-gradient(90deg, color-mix(in srgb, var(--fc) 26%, transparent), rgba(236,208,142,.05));
  border: 1px solid rgba(236,208,142,.45); box-shadow: inset 0 1px 0 rgba(255,235,190,.08);
}
.cv-great-fig { flex: none; display: grid; place-items: center; width: 34px; height: 44px; border-radius: 50%/42%; background: radial-gradient(circle at 50% 40%, rgba(255,235,190,.2), rgba(0,0,0,.3)); box-shadow: 0 0 0 1.5px #120d06, 0 0 0 3px #c9a45c; }
.cv-great-fig canvas { width: 22px; height: 33px; }
.cv-great small { display: block; font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.cv-great b { display: block; font: normal 14px var(--serif); color: var(--gold-bright); }
.cv-great span { color: var(--ink-dim); }
.cv-warn { margin: 0 0 8px; padding: 5px 8px; border-radius: 4px; font-size: 11px; color: #f0c8a0; background: rgba(240,138,106,.1); border: 1px dashed rgba(240,138,106,.45); }
.cv-cz { display: flex; flex-direction: column; gap: 4px; }
.cv-cz.unreliable .cv-figs { opacity: .6; filter: saturate(.6); }
.cv-cz-row { padding: 7px 9px 6px; border-radius: 6px; background: linear-gradient(180deg, rgba(40,56,74,.45), rgba(10,16,24,.55)); border: 1px solid rgba(201,164,92,.2); }
.cv-cnames { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.cv-cnames span { font-size: 12px; padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(201,164,92,.3); background: rgba(0,0,0,.2); color: var(--ink); }
.cv-cz-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.cv-cz-h b { font: normal 12px var(--serif); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-bright); }
.cv-cz-h span { font-size: 10.5px; color: var(--ink-dim); }
.cv-figs {
  display: grid; grid-template-columns: repeat(var(--n, 10), minmax(0, 1fr)); gap: 1px;
  max-width: calc(var(--n, 10) * 24px); padding: 2px 0 1px; border-bottom: 1px solid rgba(201,164,92,.25);
}
.cv-fig { position: relative; display: block; aspect-ratio: 2 / 3; cursor: pointer; border-radius: 3px; transition: transform .12s, opacity .12s, filter .12s; }
.cv-fig canvas { display: block; width: 100%; height: 100%; filter: drop-shadow(0 1px 0 rgba(0,0,0,.6)); }
.cv-fig:focus-visible { outline: 1.5px solid var(--gold-bright); outline-offset: 1px; }
.cv-fig.up::after, .cv-fig.down::after { position: absolute; left: 50%; top: -3px; transform: translateX(-50%); font-size: 7px; line-height: 1; text-shadow: 0 0 2px #000, 0 0 3px #000; }
.cv-fig.up::after { content: "▲"; color: #9be88f; }
.cv-fig.down::after { content: "▼"; color: #ff9a8a; }
.cv-cz-row.focus .cv-fig:not(.lit) { opacity: .32; filter: grayscale(.7); }
.cv-cz-row.focus .cv-fig.lit { transform: translateY(-2px); }
.cv-cz-us { display: flex; align-items: center; gap: 5px; max-width: calc(var(--n, 10) * 24px); margin-top: 3px; font-size: 8.5px; letter-spacing: .1em; color: var(--ink-dim); }
.cv-cz-us > div { flex: 1; display: flex; height: 4px; border-radius: 2px; overflow: hidden; opacity: .8; box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
.cv-cz-us i { display: block; height: 100%; }
.cv-cz-out { min-height: 30px; margin-top: 4px; font-size: 11px; color: var(--ink-dim); line-height: 1.35; }
.cv-cz-out.on { color: var(--ink); }
.cv-cz-out small { display: block; color: var(--ink-dim); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.cv-cz-legend { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 2px; font-size: 10.5px; }
.cv-cz-k { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); cursor: default; border-radius: 3px; }
.cv-cz-k i { width: 8px; height: 8px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.6); }
.cv-cz-k small { color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.cv-cz-k em { font-style: normal; font-size: 8px; }
.cv-cz-k em.up { color: #9be88f; }
.cv-cz-k em.down { color: #ff9a8a; }
.cv-cz-k.zero { opacity: .55; }
.cv-cz-k.lit { color: var(--gold-bright); }

/* ---------- districts ---------- */
.cv-dcs { display: flex; flex-direction: column; gap: 6px; }
.cv-dc {
  padding: 7px 9px 7px 7px; border-radius: 6px; font-size: 12px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--dc) 20%, transparent), rgba(10,16,24,.55) 60%);
  border: 1px solid color-mix(in srgb, var(--dc) 45%, rgba(201,164,92,.3)); box-shadow: inset 0 1px 0 rgba(255,235,190,.06);
}
.cv-dc-h { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; }
.cv-dc-hex {
  display: grid; place-items: center; width: 34px; height: 38px; color: #f8f0d8; font-size: 16px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(180deg, color-mix(in srgb, var(--dc) 80%, #fff 20%), color-mix(in srgb, var(--dc) 55%, #000));
  filter: drop-shadow(0 0 0 #e8c77a);
}
.cv-dc-t { display: flex; flex-direction: column; min-width: 0; }
.cv-dc-t b { font: normal 14px var(--serif); letter-spacing: .04em; color: var(--gold-bright); }
.cv-dc-t small { font-size: 10.5px; color: var(--ink-dim); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cv-dc-h .cv-lq { margin: 0; font-size: 11px; padding: 1px 5px; }
.cv-dc-f { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 6px 0 0 42px; }
.cv-dc-f > div { display: flex; flex-direction: column; }
.cv-dc-f span { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); }
.cv-dc-f b { font-size: 13px; font-variant-numeric: tabular-nums; }
.cv-dc-f small { font-size: 10px; color: var(--ink-dim); }
.cv-dc-sub, .cv-dc-mil p, .cv-dc-cav { margin: 5px 0 0 42px; font-size: 11.5px; color: var(--ink-dim); line-height: 1.4; }
.cv-dc-sub b, .cv-dc-mil b { color: var(--ink); font-weight: 600; }
.cv-dc-sub .cv-lq { margin-left: 2px; }
.cv-dc-inst { display: flex; flex-wrap: wrap; gap: 3px 5px; }
.cv-dc-inst span { padding: 0 6px; border-radius: 8px; font-size: 10.5px; color: var(--ink); background: rgba(138,74,58,.3); border: 1px solid rgba(201,164,92,.3); }
.cv-dc-cav { font-style: italic; }
.cv-top { font-size: 11.5px; }
.cv-top-r { display: grid; grid-template-columns: minmax(0, 1fr) 46px 40px 46px 46px; gap: 6px; align-items: center; padding: 4px 0; border-bottom: 1px dashed rgba(201,164,92,.14); font-variant-numeric: tabular-nums; }
.cv-top-r > span:not(:first-child) { text-align: right; }
.cv-top-hd { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); border-bottom: 1px solid rgba(201,164,92,.3); }
.cv-top-n { position: relative; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-bottom: 3px; }
.cv-top-n i { position: absolute; left: 0; bottom: 0; height: 2px; border-radius: 1px; background: linear-gradient(90deg, #8a6d34, #9fd76a); }
.cv-top-r b { color: #b9e486; }
.cv-top-r .good { color: #9be88f; }
.cv-top-r .bad { color: #ff9a8a; }
.cv-rule p { font-size: 11.5px; color: var(--ink-dim); line-height: 1.45; margin: 4px 0 6px; }
.cv-rule p b { color: var(--ink); font-weight: 600; }

/* resources */
.cv-sites { display: flex; flex-direction: column; gap: 5px; }
.cv-site {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 9px; align-items: center; width: 100%; padding: 7px 9px 7px 7px;
  text-align: left; cursor: pointer; border-radius: 5px; background: rgba(0,0,0,.24); border: 1px solid rgba(201,164,92,.22);
  transition: border-color .15s, background .15s;
}
.cv-site:hover, .cv-site:focus-visible, .cv-site.flash { border-color: var(--gold); background: rgba(201,164,92,.12); }
.cv-site.flash { box-shadow: 0 0 0 2px rgba(236,208,142,.5); }
.cv-site-t { display: flex; flex-direction: column; min-width: 0; }
.cv-site-t b { font: normal 13px var(--serif); color: var(--gold-bright); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-site-t small { font-size: 11px; color: var(--ink-dim); }
.cv-site-d { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .85; }
.cv-site-v { font-size: 12px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 6px; }
.cv-site-v i { font-style: normal; color: var(--gold); font-size: 16px; }

/* compare */
.cv-seg { display: inline-flex; margin-bottom: 8px; border: 1px solid rgba(201,164,92,.45); border-radius: 4px; overflow: hidden; }
.cv-seg button { padding: 4px 10px; font-size: 11px; cursor: pointer; background: rgba(0,0,0,.25); border: none; color: var(--ink-dim); }
.cv-seg button + button { border-left: 1px solid rgba(201,164,92,.45); }
.cv-seg button[aria-pressed="true"] { background: linear-gradient(180deg, rgba(201,164,92,.35), rgba(201,164,92,.15)); color: var(--gold-bright); }
.cv-cmp { font-size: 12px; }
.cv-cmp-r { display: grid; grid-template-columns: minmax(0, 1.25fr) repeat(4, minmax(0, 1fr)); gap: 8px; align-items: center; padding: 6px 4px; border-bottom: 1px dashed rgba(201,164,92,.14); }
.cv-cmp-r > span { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.cv-cmp-r em { font-style: normal; font-variant-numeric: tabular-nums; }
.cv-cmp-r small { font-size: 10px; color: var(--ink-dim); }
.cv-cmp-r .cv-bar { height: 4px; }
.cv-cmp-h { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); border-bottom: 1px solid rgba(201,164,92,.3); }
.cv-cmp-r.me { background: linear-gradient(90deg, color-mix(in srgb, var(--sc) 22%, transparent), rgba(201,164,92,.06)); border-radius: 4px; border-bottom-color: transparent; }
.cv-cmp-n { font: 13px var(--serif); color: var(--gold-bright); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
button.cv-cmp-n { padding: 0; background: none; border: none; cursor: pointer; text-decoration: underline; text-decoration-color: rgba(201,164,92,.4); text-underline-offset: 3px; }
button.cv-cmp-n:hover { color: #fff3cf; text-decoration-color: var(--gold); }

.cv-foot { padding: 12px 18px 0; font-size: 11px; color: var(--ink-dim); line-height: 1.45; border-top: 1px solid rgba(201,164,92,.2); margin-top: 10px; }
.cv-foot a { color: var(--gold); }

/* ---------- map legend ---------- */
.cv-maplegend {
  position: fixed; z-index: 11; top: calc(var(--topbar-h) + 10px); left: calc(12px + var(--dock-left, 0px));
  width: max-content; max-width: 250px; padding: 5px 6px 5px 9px; font-size: 11px; color: var(--ink); pointer-events: none;
}
.cv-ml-t { display: flex; align-items: center; gap: 6px; font-size: 11px; white-space: nowrap; min-width: 0; }
.cv-ml-t b {
  font: normal 13px var(--serif); letter-spacing: .06em; text-transform: uppercase; color: var(--gold-bright);
  overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 150px;
}
.cv-ml-k { color: var(--ink-dim); flex: none; }
.cv-ml-sw { flex: none; width: 11px; height: 11px; border-radius: 2px; background: var(--sc); box-shadow: 0 0 0 1px #120d06, 0 0 6px var(--sc); }
.cv-ml-i {
  pointer-events: auto; flex: none; width: 18px; height: 18px; margin-left: 2px; padding: 0; border-radius: 50%; cursor: pointer;
  font: italic bold 11px/16px var(--serif); color: #1c1408; border: 1px solid #120d06;
  background: radial-gradient(circle at 35% 30%, #fff4c4, #e6bd55 55%, #8d6418); box-shadow: 0 1px 0 rgba(0,0,0,.5);
}
.cv-ml-i:hover { filter: brightness(1.1); }
.cv-ml-i:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.cv-maplegend.open .cv-ml-i { background: radial-gradient(circle at 35% 30%, #fff, #f3d47a 55%, #a87a20); box-shadow: 0 0 0 2px rgba(236,208,142,.35); }
.cv-ml-sch { display: flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 10px; font-style: italic; color: var(--ink-dim); white-space: nowrap; }
.cv-ml-sch svg { opacity: .8; }
.cv-ml-body { display: none; width: 228px; white-space: normal; margin-top: 5px; padding-top: 5px; border-top: 1px solid rgba(201,164,92,.3); }
.cv-maplegend.open .cv-ml-body { display: block; }
.cv-maplegend.open .cv-ml-sch { display: none; }
.cv-ml-r { display: flex; align-items: center; gap: 6px; margin: 3px 0; color: var(--ink-dim); }
.cv-ml-r small { opacity: .8; }
.cv-ml-pill { display: inline-flex; align-items: center; gap: 2px; min-width: 34px; justify-content: center; padding: 1px 5px; border-radius: 8px; background: rgba(8,12,18,.86); border: 1px solid rgba(201,164,92,.55); color: #f3e6c4; font-weight: 600; font-size: 10px; }
.cv-ml-hex { width: 34px; height: 14px; display: inline-block; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); background: linear-gradient(180deg, #2b4f8a, #0e141c); box-shadow: inset 0 0 0 1px #e8c77a; }
.cv-ml-n { margin: 6px 0 0; font-style: italic; color: var(--ink-dim); line-height: 1.35; }

/* The quick panel's spot and the minimap give way while the City View is open. */
@media (min-width: 701px) {
  body.cv-on #minimap-wrap { display: none; }
  body.cv-on #lens-area { left: calc(12px + var(--dock-left, 0px)); }
}

@media (max-width: 1100px) and (min-width: 701px) {
  .cv-name { font-size: 23px; }
  .cv-yields { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .cv-yield .val { font-size: 12px; }
}

/* ---------- phones: a bottom sheet ---------- */
@media (max-width: 700px) {
  .app-dock.cv-dock { border-left: none; border-top: 2px solid #8a6d34; box-shadow: 0 -2px 0 #120d06, 0 -10px 30px rgba(0,0,0,.55); transition: transform .18s ease-out; }
  .app-dock.cv-dock.cv-dragging { transition: none; }
  .cv-dock .cv-grip { display: block; position: sticky; top: 0; z-index: 4; height: 16px; margin-bottom: -16px; touch-action: none; }
  .cv-dock .cv-grip::before { content: ""; position: absolute; left: 50%; top: 5px; width: 44px; height: 4px; margin-left: -22px; border-radius: 2px; background: rgba(201,164,92,.65); }
  .cv-head { padding: 16px 14px 10px 18px; touch-action: none; }
  .cv-close { top: 14px; right: 10px; width: 34px; height: 34px; }
  .cv-crest { width: 44px; height: 50px; }
  .cv-crest span { font-size: 12px; }
  .cv-name { font-size: 21px; }
  .cv-big b { font-size: 16px; }
  .cv-medal { min-width: 34px; height: 34px; font-size: 12px; }
  .cv-sec { padding: 10px 14px 4px; }
  .cv-tabs { padding: 5px 6px; }
  .cv-tabs button span { font-size: 10px; }
  .cv-yields { gap: 4px; }
  .cv-yield .val { font-size: 12px; }
  .cv-gdp b { font-size: 15px; }
  .cv-blds { grid-template-columns: 1fr; }
  .cv-dc-f, .cv-dc-sub, .cv-dc-mil p, .cv-dc-cav { margin-left: 0; }
  .cv-top-r { grid-template-columns: minmax(0, 1fr) 42px 36px 42px 42px; gap: 4px; font-size: 11px; }
  .cv-cz-chip b { font-size: 15px; }
  .cv-cmp-r { grid-template-columns: minmax(0, 1.1fr) repeat(4, minmax(0, 1fr)); gap: 5px; font-size: 11px; }
  .cv-maplegend { top: calc(var(--topbar-h) + 6px); left: 6px; max-width: calc(100vw - 12px); padding: 4px 5px 4px 8px; }
  .cv-ml-sch { display: none; }
  .cv-ml-body { width: min(228px, calc(100vw - 30px)); }
  .cv-ml-i { width: 22px; height: 22px; font-size: 12px; line-height: 20px; } /* a finger-sized target */
  body.cv-on .minimap-toggle { display: none; }
}

/* Narrow phones: icon tabs, with the active one still spelled out, so the strip always fits. */
@media (max-width: 480px) {
  .cv-tabs button { flex: 1 1 auto; padding: 5px 4px; }
  .cv-tabs button:not(.on) span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* China data: tables carry only the columns that have values (--nc), the speciality table has no pay column. */
.cv-ctable .cv-cr { grid-template-columns: minmax(0, 1fr) repeat(var(--nc, 3), 64px); }
.cv-cmp .cv-cmp-r { grid-template-columns: minmax(0, 1.25fr) repeat(var(--nc, 3), minmax(0, 1fr)); }
.cv-top-3 .cv-top-r { grid-template-columns: minmax(0, 1fr) 56px 44px; }
.cv-gdp { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.cv-cr-h, .cv-top-hd { text-transform: none; letter-spacing: 0; }
