/* Faction themes of the match interface (ROADMAP 17j). src/ui/themes.js sets on :root the colours (--steel ... --gold),
   the lettering (--font-t titles and buttons, --font-n numbers, --tt / --ls / --fv / --fst: capitals, spacing, small
   capitals, width), the corner radius (--r) and the baked pictures (--ui-tex the panels' material, --ui-frame a thin
   nine-slice frame, --cur / --nrg the currency and energy marks: tools/sprites/ui_themes.py, ui_frames.py,
   ui_icons.py); html.themed while a faction's theme is on. #cmd-grid is the build grid (src/ui/cmdgrid.js).
   Rules of the look (after the user's note on the first version): the material is only a tint at the edges - icons,
   lists and text sit in dark recessed wells; frames are thin; buttons are plain CSS; calm system faces only.
   All static: nothing here changes per frame. */
:root { --font-t: "Segoe UI", Tahoma, sans-serif; --font-n: Consolas, monospace; --tt: none; --ls: .3px; --fv: normal;
  --fst: normal; --r: 3px; --ui-tex: none; --ui-frame: none; --cur: none; --nrg: none;
  --well: linear-gradient(rgba(0, 0, 0, .55), rgba(0, 0, 0, .48));
  --well-sh: inset 0 1px 5px rgba(0, 0, 0, .85), inset 0 0 0 1px rgba(0, 0, 0, .55), 0 1px 0 color-mix(in srgb, var(--metal-hi) 16%, transparent); }

/* ---------------- lettering */
#app button, .sp-title b, #tooltip b, #hovertip b, .sp-body h4 {
  font-family: var(--font-t); text-transform: var(--tt); letter-spacing: var(--ls); font-variant-caps: var(--fv); font-stretch: var(--fst); }
#tooltip b, #hovertip b { text-transform: none; }
i.cur { display: inline-block; width: 1.05em; height: 1.05em; margin-right: .2em; vertical-align: -.17em; background: var(--cur) center / contain no-repeat; font-style: normal; }

/* ---------------- the sidebar: the material only as a tint, a thin frame round it */
#sidebar { position: relative;
  background: linear-gradient(90deg, rgba(0, 0, 0, .5), transparent 9%, transparent 91%, rgba(0, 0, 0, .5)),
    linear-gradient(color-mix(in srgb, var(--steel) 40%, transparent), color-mix(in srgb, var(--steel) 40%, transparent)), var(--ui-tex),
    linear-gradient(90deg, color-mix(in srgb, var(--steel) 55%, #000), var(--steel) 10%, var(--steel-2) 50%, var(--steel) 90%, color-mix(in srgb, var(--steel) 55%, #000)); }
#sidebar::after, #sel-panel::after, #objectives::after, #tooltip::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 3; border: 14px solid transparent; border-image: var(--ui-frame) 28 / 14px round; }
#tooltip::after { border-width: 12px; border-image-width: 12px; }
html.themed #sidebar { padding: 13px 12px; gap: 7px; border-left: 0; }

/* the counter: a plate let into the panel */
html.themed #credits { padding: 4px 6px; font: 600 calc(19px * var(--hud))/1.3 var(--font-n); font-stretch: var(--fst); font-variant-numeric: lining-nums tabular-nums; letter-spacing: 1px;
  color: var(--gold); background: linear-gradient(rgba(0, 0, 0, .78), rgba(0, 0, 0, .6)); border: 1px solid var(--edge); border-radius: var(--r);
  box-shadow: inset 0 1px 5px rgba(0, 0, 0, .9), 0 1px 0 color-mix(in srgb, var(--metal-hi) 22%, transparent);
  text-shadow: 0 0 8px color-mix(in srgb, var(--gold) 35%, transparent); }
#credits i.cur { width: calc(19px * var(--hud)); height: calc(19px * var(--hud)); vertical-align: -3px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .8)); }
html.themed #radar-wrap { border: 1px solid var(--edge); border-radius: var(--r); box-shadow: 0 0 0 1px color-mix(in srgb, var(--metal) 55%, transparent), inset 0 0 12px #000; }
html.themed #power { border: 1px solid var(--edge); box-shadow: 0 0 0 1px color-mix(in srgb, var(--metal) 50%, transparent); }

/* the build columns in a dark well; every cameo on an opaque slot (the icons are see-through) */
html.themed #sb-main { padding: 5px; border-radius: calc(var(--r) + 2px); background: var(--well); box-shadow: var(--well-sh); }
.cameo { border: 1px solid var(--edge); border-radius: var(--r);
  background: radial-gradient(ellipse at 42% 35%, color-mix(in srgb, var(--steel-2) 80%, #fff 5%), color-mix(in srgb, var(--steel) 45%, #000) 78%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .7), inset 0 0 0 1px color-mix(in srgb, var(--metal) 35%, transparent); }
@media (hover: hover) { .cameo:hover { box-shadow: 0 0 0 1px var(--gold), 0 0 8px color-mix(in srgb, var(--gold) 35%, transparent); } }
.cameo .cost { left: 2px; bottom: 2px; padding: 0 3px 0 2px; border-radius: 2px; background: rgba(0, 0, 0, .66);
  font: 600 calc(11px * var(--hud))/calc(13px * var(--hud)) var(--font-n); font-variant-numeric: lining-nums tabular-nums; opacity: 1; }  /* (at least 11 px - step 29 E3.1) */
.cameo .cost i.cur { width: calc(10px * var(--hud)); height: calc(10px * var(--hud)); vertical-align: -1px; margin-right: 2px; }
.power-btn { border: 1px solid var(--edge); border-radius: var(--r); box-shadow: 0 0 0 1px color-mix(in srgb, var(--metal) 55%, transparent), 0 2px 4px rgba(0, 0, 0, .6); }
@media (hover: hover) { .power-btn:hover { box-shadow: 0 0 0 1px var(--gold), 0 0 8px color-mix(in srgb, var(--gold) 35%, transparent); } }

/* ---------------- buttons: plain CSS in the faction's metal */
#app button { border: 1px solid var(--edge); border-radius: var(--r); color: var(--text); font-weight: 600; font-size: calc(11.5px * var(--hud));
  background: linear-gradient(color-mix(in srgb, var(--metal) 62%, var(--steel-2)), color-mix(in srgb, var(--metal) 28%, var(--steel)));
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--metal-hi) 38%, transparent), inset 0 -1px 0 rgba(0, 0, 0, .35), 0 1px 2px rgba(0, 0, 0, .6);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .6); }
@media (hover: hover) { #app button:hover { background: linear-gradient(color-mix(in srgb, var(--metal) 70%, var(--metal-hi)), color-mix(in srgb, var(--metal) 40%, var(--steel)));
  border-color: color-mix(in srgb, var(--accent) 55%, var(--edge)); filter: none;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--metal-hi) 50%, transparent), 0 1px 3px rgba(0, 0, 0, .6); } }
#app button:active { box-shadow: inset 0 1px 3px rgba(0, 0, 0, .7); }
#app button.on { color: #fff; border-color: color-mix(in srgb, var(--accent) 35%, #000);
  background: linear-gradient(color-mix(in srgb, var(--accent) 88%, #fff 6%), color-mix(in srgb, var(--accent) 45%, #000));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 0 8px color-mix(in srgb, var(--accent) 50%, transparent); }
#sb-tools button { padding: 4px 4px; }

/* ---------------- the selection panel and the tooltips: dark over the material, framed */
html.themed #sel-panel { padding: 15px 15px 14px; border: 0; background: linear-gradient(rgba(0, 0, 0, .6), rgba(0, 0, 0, .74)), var(--ui-tex), var(--steel);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .6); }
html.themed #sel-panel::before { left: 22px; right: 22px; top: 5px; height: 1px; opacity: .7; }
html.themed .sp-title b { font-size: calc(14px * var(--hud)); color: var(--gold); }
html.themed .sp-head img { border: 1px solid var(--edge); border-radius: var(--r); background: rgba(0, 0, 0, .5);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--metal) 60%, transparent); }
html.themed .sp-hp { border-color: var(--edge); box-shadow: 0 0 0 1px color-mix(in srgb, var(--metal) 55%, transparent); }
html.themed .sp-body h4 { color: color-mix(in srgb, var(--gold) 50%, var(--muted)); }
html.themed .sp-ab li::marker { color: var(--accent-hi); }
html.themed .sp-actions kbd { border-color: color-mix(in srgb, var(--metal-hi) 50%, transparent); background: rgba(0, 0, 0, .5); color: var(--gold); }
html.themed #tooltip { padding: 12px 14px; border: 0; background: linear-gradient(rgba(0, 0, 0, .64), rgba(0, 0, 0, .78)), var(--ui-tex), var(--steel);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .75); }
html.themed #tooltip b { color: var(--gold); }
html.themed #hovertip { border-color: var(--edge); background: rgba(0, 0, 0, .82); box-shadow: 0 0 0 1px color-mix(in srgb, var(--metal) 65%, transparent), 0 4px 10px rgba(0, 0, 0, .6); }

/* ---------------- the energy meter: upright in the sidebar, lying in the top bar of the bottom panel */
#power-fill { height: calc(var(--v, 0) * 1%); }
#power-use { bottom: calc(var(--u, 0) * 1%); }

/* ---------------- the build grid in the selection panel */
#cmd-grid { display: flex; flex-direction: column; gap: 5px; }
#cmd-grid .cg-cells { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
#cmd-grid .cameo { width: auto; }
#cmd-grid .cameo kbd { position: absolute; right: 2px; bottom: 2px; z-index: 2; padding: 0 3px; border-radius: 2px; font: 600 calc(11px * var(--hud))/calc(13px * var(--hud)) var(--font-n);
  color: var(--text); background: rgba(0, 0, 0, .66); border: 1px solid color-mix(in srgb, var(--metal-hi) 30%, transparent); }
#cmd-grid .cg-next { aspect-ratio: 4 / 3; padding: 0; font-size: calc(11px * var(--hud)); }
.sp-grid:empty { display: none; }
.sp-grid { margin-top: 3px; padding: 5px; border-radius: calc(var(--r) + 1px); background: var(--well); box-shadow: var(--well-sh); }

/* ---------------- a few touches of their own */
.th-grey #credits { text-shadow: 0 0 10px color-mix(in srgb, var(--gold) 65%, transparent); }

/* ---------------- controls: the group bar (src/ui/groupbar.js), the panel of many selected (src/ui/selgroup.js), the
   controls list in the pause menu (src/ui/help.js) */
#group-bar { position: absolute; right: 10px; bottom: 10px; z-index: 6; display: flex; gap: 3px; }
#group-bar[hidden] { display: none; }
#app #group-bar button { position: relative; width: calc(46px * var(--hud)); height: calc(36px * var(--hud)); padding: 0; overflow: hidden; border-radius: var(--r); }
#group-bar img { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); object-fit: cover; opacity: .85; pointer-events: none; }
#group-bar b, #group-bar span { position: absolute; z-index: 1; font: 700 calc(11px * var(--hud))/1 var(--font-n); text-shadow: 1px 1px 0 #000, 0 0 3px #000; pointer-events: none; }
#group-bar b { left: 3px; top: 2px; font-size: calc(12px * var(--hud)); color: var(--gold); }
#group-bar span { right: 3px; bottom: 2px; color: #fff; }
#group-bar .gb-idle i { position: absolute; inset: 3px 0 auto; text-align: center; font: normal calc(16px * var(--hud))/1 sans-serif; color: var(--gold); pointer-events: none; }
#view-wrap:has(#sel-panel:not([hidden])) #group-bar { max-width: calc(100% - 30px - calc(316px * var(--hud))); flex-wrap: wrap-reverse; justify-content: flex-end; }
.sg-head { font-size: calc(12px * var(--hud)); color: var(--gold); }
.sg-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(44px * var(--hud)), 1fr)); gap: 4px; max-height: calc(150px * var(--hud)); overflow-y: auto; padding: 4px;
  border-radius: calc(var(--r) + 1px); background: var(--well); box-shadow: var(--well-sh); }
#app .sg-cell { position: relative; aspect-ratio: 4 / 3; padding: 0; overflow: hidden; border-radius: var(--r); }
.sg-cell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.sg-cell em { display: block; padding: 2px; font: normal calc(9px * var(--hud))/1.1 var(--font-t); white-space: normal; }
.sg-n { position: absolute; right: 3px; top: 2px; font: 700 calc(11px * var(--hud))/1 var(--font-n); color: #fff; text-shadow: 1px 1px 0 #000, 0 0 3px #000; pointer-events: none; }
.sg-hp { position: absolute; left: 3px; right: 3px; bottom: 3px; height: 3px; background: rgba(0, 0, 0, .75); pointer-events: none; }
.sg-hp i { display: block; width: 100%; height: 100%; background: #4ad34a; }
.sg-hp i.mid { background: #e8c83a; }
.sg-hp i.low { background: #e84a3a; }
#screen-pause .help { max-width: 640px; max-height: 46vh; overflow-y: auto; font-size: 12px; }
#app .sg-cell.on { box-shadow: 0 0 0 1px var(--gold), 0 0 7px color-mix(in srgb, var(--gold) 60%, transparent); }
.cameo .rep { display: none; position: absolute; left: 3px; top: 1px; z-index: 2; font: 700 calc(14px * var(--hud))/1 var(--font-n); color: var(--gold); text-shadow: 1px 1px 0 #000, 0 0 3px #000; pointer-events: none; }
.cameo.rep .rep { display: block; }

/* ---------------- the radar's buttons, the tactical map, the message log (src/ui/minimap.js, tactical.js, msglog.js) */
#mm-tools { position: absolute; right: 5px; top: 5px; z-index: 4; display: flex; gap: 2px; opacity: .55; transition: opacity .15s; }
@media (hover: hover) { #radar-wrap:hover #mm-tools { opacity: 1; } }
#app #mm-tools button { width: calc(20px * var(--hud)); height: calc(18px * var(--hud)); padding: 0; font: calc(12px * var(--hud))/1 sans-serif; border-radius: 2px; }
#tactical { position: absolute; left: 50%; top: 50%; z-index: 9; transform: translate(-50%, -50%); padding: 8px 10px 10px; border-radius: 4px;
  background: rgba(8, 9, 10, .9); box-shadow: 0 0 0 1px var(--metal), 0 12px 40px rgba(0, 0, 0, .8); }
#tactical[hidden], #msg-log[hidden] { display: none; }
#tactical .tm-head, #msg-log .ml-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
#tactical .tm-head b, #msg-log .ml-head b { color: var(--gold); font: 600 calc(14px * var(--hud)) var(--font-t); text-transform: var(--tt); letter-spacing: var(--ls); }
#tactical .tm-head small, #msg-log .ml-head small { flex: 1; color: var(--muted); font-size: calc(11px * var(--hud)); }
#app #tactical .tm-head button, #app #msg-log .ml-head button { padding: 1px 7px; }
#tactical canvas { display: block; cursor: crosshair; border: 1px solid #000; box-shadow: 0 0 0 1px var(--metal); }
#msg-log { position: absolute; left: 10px; top: 30px; z-index: 8; width: min(calc(560px * var(--hud)), calc(100% - 20px)); padding: 8px 10px; border-radius: 4px;
  background: rgba(8, 9, 10, .9); box-shadow: 0 0 0 1px var(--metal), 0 10px 30px rgba(0, 0, 0, .7); }
#msg-log ol { margin: 0; padding: 0; list-style: none; max-height: 46vh; overflow-y: auto; font-size: calc(12px * var(--hud)); }
#msg-log li { display: flex; gap: 4px; padding: 2px 0; color: #9fe07a; border-bottom: 1px solid rgba(255, 255, 255, .04); }
#msg-log li.sys { color: #9ab; font-style: italic; }
#msg-log li.chat { color: #fff; }
#msg-log time { flex: none; min-width: calc(42px * var(--hud)); color: var(--muted); font: calc(11px * var(--hud)) var(--font-n); }
/* Wieczny Sojusz by the credits (ui/eternal_ui.js): Glory under a wreath, the export rate with its chart, sanctions, the
   Grey Zone, contracts; the Depot's stock on the "Granddad's" cameo. */
#credits .ws { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; justify-content: center; margin-top: 2px; font-size: calc(11px * var(--hud)); letter-spacing: .3px; }
#credits .ws i { font-style: normal; white-space: nowrap; }
#credits .sh { display: block; margin-top: 2px; font-size: calc(11px * var(--hud)); letter-spacing: .3px; }  /* Szpon Harpii: the elite roster, the briefing's target (ui/talon_ui.js) */
#credits .sh.full { color: #ff8a70; }
#credits .sh-hvt { display: block; font-weight: normal; color: #7fe0c4; }
#credits .fo-wind { display: inline-block; margin-left: 4px; font-size: calc(12px * var(--hud)); font-weight: normal; letter-spacing: 0; vertical-align: middle; color: #e8c47a; text-shadow: 0 0 6px rgba(216, 96, 172, .45); }  /* Federacja Oaz: the wind rose (ui/oasis_ui.js) */
#credits .fo-wind i { display: inline-block; font-style: normal; width: 1.1em; text-align: center; }
#credits .fo-wind.turning { color: #ffe2a0; }
#credits .wsglory { color: #f0cf6a; font-weight: 700; font-size: calc(13px * var(--hud)); text-shadow: 0 0 6px rgba(212, 169, 58, .55); }
#credits .wsglory::before { content: '❦'; margin-right: 3px; color: #d4a93a; }
#credits .wsglory.full { color: #fff3c4; }
#credits .wsrate { display: inline-flex; align-items: flex-end; gap: 4px; color: #ece6da; }
#credits .wsrate b { font-weight: normal; }
#credits .wsrate b.up { color: #8fe08f; }
#credits .wsrate b.down { color: #ff8a7a; }
#credits .wsrate.capped b { text-decoration: line-through; text-decoration-color: rgba(255, 120, 100, .8); }
#credits .wsrate.off { opacity: .45; }
#credits .wschart { display: inline-flex; align-items: flex-end; gap: 1px; height: calc(12px * var(--hud)); text-decoration: none; }
#credits .wschart s { display: inline-block; width: 2px; background: #b06a5a; text-decoration: none; }
#credits .wschart s.up { background: #d4a93a; }
#credits .wssanc { display: inline-flex; align-items: center; gap: 2px; color: #ff9a8a; }
#credits .wssanc s { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, .16); text-decoration: none; }
#credits .wssanc s.on { background: #e2342a; box-shadow: 0 0 4px rgba(226, 52, 42, .8); }
#credits .wssanc b { font-weight: normal; margin-left: 3px; }
#credits .wsgrey { color: #c8c8c8; padding: 0 4px; border: 1px solid rgba(200, 200, 200, .4); border-radius: 2px; }
#credits .wsmob { color: #ffc98a; }
#credits .wsup { color: #ffb08a; }
#credits .wsstrike { color: #fff; background: #b0142a; padding: 0 5px; border-radius: 2px; font-weight: 700; letter-spacing: 1px; }
.cameo .cost .wsstock { margin-right: 3px; padding: 0 2px; border-radius: 2px; color: #1a1408; background: rgba(212, 169, 58, .92); box-shadow: 0 0 0 1px #000; font-weight: 700; }
#credits .wx { display: inline-flex; align-items: center; gap: 2px; margin-left: 5px; vertical-align: middle; font-size: calc(11px * var(--hud)); font-weight: normal; letter-spacing: 0; color: var(--th-muted, #b8c0c8); }  /* the match's weather (ui/weather_ui.js) */
#credits .wx img { width: calc(14px * var(--hud)); height: calc(14px * var(--hud)); image-rendering: auto; }
#credits .wx i { font-style: normal; opacity: .7; }
#credits .wx b { font-weight: normal; color: var(--th-num, #cfe8ff); }
#credits .wx.front b { color: #ffb070; }
.kf-menu { position: fixed; z-index: 30; display: flex; flex-direction: column; gap: 2px; min-width: 150px; padding: 5px; background: rgba(20, 24, 30, .95); border: 1px solid #5a4330; box-shadow: 0 0 0 1px #08090b, 0 4px 12px rgba(0, 0, 0, .6); font: calc(12px * var(--hud)) "Bahnschrift", "Segoe UI", sans-serif; color: #eef3f8; }  /* Konfederacja Szczytów: the Weather Front's choice (ui/peak_ui.js) */
.kf-menu p { margin: 0 0 3px; color: #9fd3ff; text-transform: uppercase; letter-spacing: 1px; font-size: calc(11px * var(--hud)); }
.kf-menu button { display: flex; align-items: center; gap: 6px; padding: 2px 6px 2px 2px; background: #272b31; border: 1px solid #3a4048; color: inherit; font: inherit; text-align: left; cursor: pointer; }
@media (hover: hover) { .kf-menu button:hover { border-color: #9fd3ff; background: #2f3640; } }
.kf-menu button img { width: calc(20px * var(--hud)); height: calc(20px * var(--hud)); }
