/* The site dressed like the TrueshotLodge addon's window (itself styled after the game's profession window):
   a bronze-and-gold frame around dark stone panels, gold headings, cream text and tan highlights.
   The palette is in foreverscheme.css; this file is the components. Loaded after site.css. */

/* Marcellus is the nearest free match to the game's Friz Quadrata. Served from the site (public/font/marcellus/, SIL
   Open Font License, OFL.txt there): no request to Google's servers, and no third-party connection before a heading
   can be drawn. The layout preloads the latin file. */
@font-face {
  font-family: "Marcellus";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../font/marcellus/marcellus-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Marcellus";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../font/marcellus/marcellus-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
    U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --ft-font-heading: "Marcellus", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
}

body {
  background-color: var(--ft-panel-deep);
  background-image:
    radial-gradient(ellipse 120% 60% at 50% 0, rgba(184, 151, 109, 0.08), transparent 70%),
    linear-gradient(#171413, #0c0b0a);
  background-attachment: fixed;
}

h1, h2, h3 {
  font-family: var(--ft-font-heading);
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px #000;
}

a {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* ---- The window: the whole page sits in a metal frame -------------------------------------------- */

main.container {
  position: relative;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem 1.5rem;
  border: 4px solid var(--ft-metal);
  border-image: linear-gradient(160deg, var(--ft-metal-light), var(--ft-metal) 38%, var(--ft-metal-dark) 62%, var(--ft-metal) 82%, var(--ft-metal-light)) 1;
  background:
    linear-gradient(180deg, #1e1b18, #171413 55%, #110f0d);
  box-shadow:
    0 0 0 1px #000,
    0 10px 40px rgba(0, 0, 0, 0.65),
    inset 0 0 0 1px rgba(0, 0, 0, 0.9),
    inset 0 0 60px rgba(0, 0, 0, 0.45);
}

/* ---- Navigation: the window's tabs --------------------------------------------------------------- */

main > nav {
  font-family: var(--ft-font-heading);
  font-size: 1.12rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--ft-metal-dark);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
}

main > nav a[role="button"] {
  padding: 0.7rem 1.15rem;
  font-size: 1.05em;
  background: linear-gradient(180deg, #2c1c11, #1a110a);
  border: 1px solid var(--ft-metal);
  color: var(--ft-tan);
  box-shadow: inset 0 1px 0 rgba(255, 233, 180, 0.12), 0 1px 3px rgba(0, 0, 0, 0.6);
  transition: color 0.12s, border-color 0.12s, box-shadow 0.12s;
}

main > nav a[role="button"]:hover {
  color: var(--ft-gold);
  border-color: var(--ft-tan);
  box-shadow: inset 0 1px 0 rgba(255, 233, 180, 0.2), 0 0 10px rgba(255, 209, 0, 0.22);
}

main > nav a[role="button"][aria-current="page"] {
  color: var(--ft-gold);
  border-color: var(--ft-metal-light);
  background: linear-gradient(180deg, #42291a, #26160c);
}

/* The Upload button stands apart, like the game's red panel buttons. */
main > nav a[role="button"].outline {
  background: linear-gradient(180deg, #7a2a22, #4a1713);
  border-color: var(--ft-metal-light);
  color: var(--ft-gold);
}

main > nav a[role="button"].outline:hover {
  background: linear-gradient(180deg, #92352b, #5b1f19);
}

/* ---- Icons: bronze frame --------------------------------------------------------------------------- */

/* Icon frames stay the game's silver-grey: the colors on them carry meaning. */

/* ---- Cards: the addon's inset panels with a header bar like a recipe category ----------------------- */

article {
  border: 1px solid #000;
  border-radius: 3px;
  background: linear-gradient(180deg, #201d1a, #161310);
  box-shadow:
    inset 0 0 0 1px #3a2d1b,
    inset 0 0 22px rgba(0, 0, 0, 0.5),
    0 2px 6px rgba(0, 0, 0, 0.5);
  transition: box-shadow 0.15s;
}

article > footer {
  background: rgba(0, 0, 0, 0.28);
  border-top: 1px solid #000;
  box-shadow: 0 -1px 0 #2d2318;
}

article strong {
  color: var(--ft-gold);
  font-weight: 600;
}

.meta {
  color: var(--ft-muted);
}

table th {
  color: var(--ft-gold);
  font-family: var(--ft-font-heading);
  font-weight: 600;
  border-bottom: 1px solid var(--ft-metal);
  background: rgba(0, 0, 0, 0.25);
}

/* ---- Controls ------------------------------------------------------------------------------------------- */

button,
[type="submit"],
[type="button"],
[role="button"] {
  border-color: var(--ft-metal);
}

button:not(.outline):not(.secondary),
[type="submit"] {
  background: linear-gradient(180deg, #7a2a22, #4a1713);
  border: 1px solid var(--ft-metal-light);
  color: var(--ft-gold);
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, 0.2), 0 1px 3px #000;
}

button:not(.outline):not(.secondary):hover,
[type="submit"]:hover {
  background: linear-gradient(180deg, #92352b, #5b1f19);
  color: #ffe27a;
}

select,
input:not([type="checkbox"]):not([type="radio"]),
textarea {
  border: 1px solid var(--ft-metal-dark);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

select:focus,
input:focus {
  border-color: var(--ft-tan);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(198, 175, 141, 0.25);
}

/* ---- Footer, messages and badges ------------------------------------------------------------------- */

main > footer.site-footer {
  border-top-color: var(--ft-metal-dark);
  color: var(--ft-muted);
}

.collector-message {
  border-left-color: var(--ft-gold);
  background: rgba(0, 0, 0, 0.3);
}

.collector-badge {
  background: #2b2118;
  border: 1px solid var(--ft-metal-dark);
  color: var(--ft-tan);
}

.collector-badge--new { background: #1f4160; color: #dbe9f7; border-color: #3a6a96; }
.collector-badge--fill { background: #1f4a2a; color: #dcf1e0; border-color: #3c7a4a; }
.collector-badge--differs { background: #5b3a0e; color: #ffe2a8; border-color: var(--ft-metal); }
/* Matches: a quiet grey, so the green stays for tames (.collector-badge--tamed). */
.collector-badge--match { background: #2b2b2b; color: #c4c4c4; border-color: #4f4f4f; }
.collector-badge--skipped { background: #2a2622; color: #b9b2a6; border-color: #4a4239; }
/* A tame whose only change is recording it was tamed: the tamed seal's green (.tamed-badge in split.css). */
.collector-badge--tamed { background: rgba(30, 90, 45, 0.55); color: #b9f0c4; border-color: #3c7a4a; }
.collector-badge[title] { cursor: help; }

/* A tame's spellbook on the collector page: one spell per line with its badge. */
.tame-spells { margin: 0 0 0.25rem; padding: 0; }
.tame-spells li { list-style: none; margin: 0 0 0.2rem; padding: 0; }

details > summary {
  color: var(--ft-tan);
}

::selection {
  background: rgba(255, 209, 0, 0.3);
}

/* Scrollbars in the same metal. */
* {
  scrollbar-color: var(--ft-metal) #171413;
}

.side-badge {
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--ft-metal-dark);
  background: #2b2118;
  color: var(--ft-tan);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Faction colors, the same ones the addon uses for its trainer rows. */
.side-badge--alliance { background: #172a4d; border-color: #3f68b8; color: #9fc0ff; }
.side-badge--horde { background: #4d1a1a; border-color: #b84545; color: #ff9c9c; }

.zone-map {
  position: relative;
  line-height: 0;
  border: 1px solid #000;
  box-shadow: 0 0 0 1px #3a2d1b;
}

.zone-map > img:not(.zone-pin) {
  display: block;
  width: 100%;
  height: auto;
}

.zone-pin {
  position: absolute;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 3px #000);
  pointer-events: none;
}

details.rank {
  margin-bottom: 0.4rem;
  border: 1px solid #000;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.22);
  box-shadow: inset 0 0 0 1px #2d2318;
}

details.rank > summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  list-style: none;
  cursor: pointer;
  background: linear-gradient(180deg, #3d2616, #25160b);
  box-shadow: inset 0 1px 0 rgba(212, 170, 110, 0.16);
  color: var(--ft-gold);
}

details.rank > summary::-webkit-details-marker { display: none; }

details.rank > summary::before {
  content: "+";
  width: 1rem;
  color: var(--ft-gold);
  font-weight: 700;
  text-align: center;
}

details.rank[open] > summary::before { content: "\2212"; }

details.rank > summary:hover {
  background: linear-gradient(180deg, #4d3020, #2e1b0e);
}

details.rank > summary .rank-name {
  font-family: var(--ft-font-heading);
  font-size: 1.1rem;
}

details.rank > summary .rank-req {
  margin-left: auto;
  color: var(--ft-muted);
  font-size: 0.9rem;
}

details.rank > summary .rank-count {
  min-width: 1.6rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: #2b2118;
  border: 1px solid var(--ft-metal-dark);
  color: var(--ft-tan);
  font-size: 0.8rem;
  text-align: center;
}

.rank-body {
  padding: 0.75rem 1rem 1rem;
}

.rank-body > p {
  margin: 0 0 0.5rem;
}

/* ---- Collector page ------------------------------------------------------------------------------------- */

article.upload-panel {
  padding: 1.25rem 1.5rem;
}

article.upload-panel input[type="file"] {
  padding: 0.9rem;
  border: 1px dashed var(--ft-metal);
  background: rgba(0, 0, 0, 0.3);
}

details.panel {
  margin-bottom: 1rem;
  border: 1px solid #000;
  border-radius: 3px;
  background: linear-gradient(180deg, #201d1a, #161310);
  box-shadow: inset 0 0 0 1px #3a2d1b, 0 2px 6px rgba(0, 0, 0, 0.5);
}

details.panel > summary {
  display: flex;
  align-items: center;
  list-style: none;
  cursor: pointer;
  padding: 0.5rem 1rem;
  background: linear-gradient(180deg, #3d2616, #25160b);
  border-bottom: 1px solid #000;
  box-shadow: inset 0 1px 0 rgba(212, 170, 110, 0.18);
}

details.panel > summary::-webkit-details-marker { display: none; }

details.panel > summary::before {
  content: "+";
  width: 1.4rem;
  color: var(--ft-gold);
  font-weight: 700;
}

details.panel[open] > summary::before { content: "\2212"; }

details.panel > summary:hover {
  background: linear-gradient(180deg, #4d3020, #2e1b0e);
}

details.panel > summary h3 {
  margin: 0;
  font-size: 1.2rem;
}

details.panel > summary h3 small {
  color: var(--ft-muted);
  font-family: inherit;
  text-shadow: none;
}

details.panel:not([open]) > summary {
  border-bottom: 0;
}

details.panel > *:not(summary) {
  margin-left: 1rem;
  margin-right: 1rem;
}

details.panel > summary + * {
  margin-top: 1rem;
}

details.panel > *:last-child {
  margin-bottom: 1rem;
}

details.panel table {
  margin-bottom: 0;
}

details.panel .overflow-auto {
  border: 1px solid #000;
  box-shadow: 0 0 0 1px #2d2318;
}

/* ---- Fixes after the first look ---------------------------------------------------------------------------- */

/* Panels and ranks use their own +/- marker, not Pico's arrow. */
details.rank > summary::after,
details.panel > summary::after {
  display: none;
}

details.rank > summary .rank-name {
  color: var(--ft-tan);
  font-family: inherit;
  font-weight: 600;
  font-size: 1rem;
}

article.upload-panel input[type="file"]::file-selector-button {
  margin-right: 0.9rem;
  padding: 0.45rem 1rem;
  border: 1px solid var(--ft-metal-light);
  border-radius: 3px;
  background: linear-gradient(180deg, #7a2a22, #4a1713);
  color: var(--ft-gold);
  cursor: pointer;
}

article.upload-panel input[type="file"]::file-selector-button:hover {
  background: linear-gradient(180deg, #92352b, #5b1f19);
}

/* Navigation fit: the logo never shrinks, and the tabs drop to a second row when the window is narrow. */
main > nav {
  flex-wrap: wrap;
  row-gap: 0.75rem;
}

main > nav ul:last-child {
  flex-wrap: wrap;
  justify-content: flex-end;
  row-gap: 0.5rem;
}

main > nav a[role="button"] {
  padding: 0.65rem 0.95rem;
  font-size: 1rem;
}

@media (max-width: 1150px) {
  main > nav ul:last-child {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ---- Matched to the addon in game ------------------------------------------------------------------------ */

/* A faint grain on the window, like the dirty stone of the profession window's background. */
main.container {
  isolation: isolate; /* the grain below sits behind the content, inside the frame */
}

main.container::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5  0 0 0 0 0.45  0 0 0 0 0.4  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* The inner panels are a touch greyer than the window, like the details pane in the addon. */
details.panel {
  background: linear-gradient(180deg, #211f1d, #171513);
}

/* A spell in a pet's spellbook that differs from the abilities table. */
.spell-diff {
  padding: 0 0.25rem;
  border-bottom: 1px dashed var(--ft-gold);
  color: var(--ft-gold);
  cursor: help;
}

/* The ability's text sits beside the rank name in its heading. */
details.rank > summary .rank-desc {
  flex: 1;
  min-width: 0;
  color: var(--ft-bronze);
  font-size: 0.9rem;
  line-height: 1.3;
}

@media (max-width: 720px) {
  details.rank > summary {
    flex-wrap: wrap;
  }

  details.rank > summary .rank-desc {
    flex-basis: 100%;
    order: 5;
    margin-left: 1.75rem;
  }
}

/* The rank's stats and requirements sit together on the right of its heading. */
details.rank > summary .rank-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  max-width: 38%;
  margin-left: auto;
  text-align: right;
  line-height: 1.3;
}

details.rank > summary .rank-meta .rank-req {
  margin-left: 0;
  color: var(--ft-muted);
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  details.rank > summary .rank-meta {
    flex-basis: 100%;
    max-width: none;
    order: 6;
    align-items: flex-start;
    margin-left: 1.75rem;
    text-align: left;
  }
}

/* The button that commits a whole section to the database. */
button.commit-button {
  width: auto;
  margin: 0;
  padding: 0.1rem 0.6rem;
  font-size: 0.8rem;
  color: var(--ft-gold);
  border-color: var(--ft-metal-light);
}

/* The creatures on the collector page: each value a Commit would change is highlighted, the value in pets now
   struck through and the new one after it; a row with changes is marked on its left edge. */
.diff-cell {
  background: rgba(255, 209, 0, 0.09);
  box-shadow: inset 0 0 0 1px rgba(255, 209, 0, 0.28);
}

del.diff-old {
  color: var(--ft-muted);
  text-decoration-color: #c0503f;
}

ins.diff-new {
  color: var(--ft-gold);
  font-weight: 600;
  text-decoration: none;
}

table.creature-diff tr.diff-row--changes > td:first-child {
  box-shadow: inset 3px 0 0 var(--ft-gold);
}

table.creature-diff tr.diff-row--new > td:first-child {
  box-shadow: inset 3px 0 0 #3a6a96;
}

/* A tamed beast's row: the green of the tamed seal (.tamed-badge in split.css). */
table.creature-diff tr.diff-row--tamed > td:first-child {
  box-shadow: inset 3px 0 0 #3c7a4a;
}

/* The family, as its icon, before the creature's name. */
table.creature-diff td.family {
  width: 1%;
  text-align: center;
}

/* The collector tables' first column (when it was seen or tamed) and last (Commit and Reject) stay on one line; the
   last column's heading is for screen readers only. */
table.creature-diff td.when,
td.actions {
  white-space: nowrap;
}

table.creature-diff td.when {
  font-size: 0.85rem;
}

/* Every collector table (creatures, spellbooks, trainer entries, Beast Training) keeps Commit, Reject and Hold in this
   narrow last column, so they never crowd the comparison text beside them. */
td.actions {
  width: 1%;
}

td.actions .line-buttons {
  margin-top: 0;
}

table .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.diff-warning {
  color: #ff9c9c;
}

/* A value shown for reference but not used (a tame's speed as its pet showed it, after the hunter's haste). */
.diff-unused {
  color: var(--ft-muted);
}

/* The collector page's sections (Creatures, Trainers), each holding its panels. */
.collect-section {
  margin: 1.75rem 0 0;
}

.collect-section-title {
  margin: 0 0 0.2rem;
  padding: 0 0 0.35rem;
  font-size: 1.45rem;
  color: var(--ft-gold);
  border-bottom: 1px solid var(--ft-metal);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
}

.collect-section-title small {
  font-size: 0.75em;
  color: var(--ft-tan);
}

.collect-section-note {
  margin: 0 0 0.75rem;
  color: var(--ft-muted);
}

/* An entry another TrueshotLodge user sent over the addon's channel. */
.shared-by {
  color: #8fb7d9;
  font-style: italic;
}

/* A line's Commit and Reject (or Rejected and Undo), side by side. */
.line-buttons {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.3rem;
}

/* A line's Commit and Reject: a green check above a red X. */
.line-buttons--stacked {
  flex-direction: column;
  gap: 0.2rem;
}

button.icon-button {
  width: 1.6rem;
  height: 1.6rem;
  margin: 0;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
}

/* The theme paints every submit button red, so the check needs its own green behind it. */
button.icon-button--commit {
  color: #eafff0;
  background: linear-gradient(180deg, #2e7a3f, #174a24);
  border-color: #4fd16b;
}

button.icon-button--commit:hover {
  color: #fff;
  background: linear-gradient(180deg, #379149, #1d5a2c);
  border-color: #7be693;
}

button.icon-button--reject {
  color: #ff7b7b;
  border-color: #b84545;
}

button.icon-button--reject:hover {
  color: #fff;
  background: #8f3232;
  border-color: #ff7b7b;
}

/* Hold for validation (and, on that list, back to the uploads to handle): amber, neither yes nor no. Its own
   background, like the check's, so the theme's red does not show through. */
button.icon-button--hold {
  color: #ffd27a;
  background: rgba(0, 0, 0, 0.35);
  border-color: #b8893a;
}

button.icon-button--hold:hover {
  color: #1b1408;
  background: linear-gradient(180deg, #e0a845, #a8762a);
  border-color: #ffd27a;
}

button.icon-button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 1px;
}

.commit-form,
.reject-form,
.hold-form {
  display: inline;
  margin: 0;
}

button.reject-button {
  width: auto;
  margin: 0;
  padding: 0.1rem 0.6rem;
  font-size: 0.8rem;
  color: var(--surface-content);
  border-color: #6b6259;
}

button.reject-button:hover {
  color: #ff9c9c;
  border-color: #b84545;
}

/* "Commit all" sits at the right of its section's heading, with Reject all and Undo all beside it. */
button.commit-all {
  white-space: nowrap;
}

.section-buttons {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  white-space: nowrap;
}

h4.commit-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* The Upload button is greyed out, and cannot be clicked, until a file is chosen. The file field is required,
   so it is invalid while empty (the browser also stops the form from being sent). */
article.upload-panel form:has(input[type="file"]:invalid) button[type="submit"] {
  opacity: 0.4;
  filter: grayscale(0.7);
  cursor: not-allowed;
  pointer-events: none;
}

/* With seven menus the tabs no longer fit beside the logo: they get their own row under it, spread across. */
main > nav ul:last-child {
  width: 100%;
  justify-content: space-between;
}

@media (max-width: 1150px) {
  main > nav ul:last-child {
    justify-content: flex-start;
  }
}

/* ---- Side tabs: the addon window's icon tabs on the frame's right edge ------------------------------------ */

/* On wide windows the sections are square icon tabs hanging off the frame's right edge, like the addon's. The rail
   is sticky, so it stays in view however far the page scrolls; each tab opens its section. The window gives up
   enough width for them. Narrow windows have the same tabs under the title. */
.side-tabs {
  display: none;
}

/* Each tab's name: the game's dark tooltip, on the tab's left (the rail is at the screen's edge), shown at once under
   the pointer or keyboard focus. */
.side-tab__label {
  display: none;
}

@media (min-width: 1100px) {
  .side-tab__label {
    position: absolute;
    top: 50%;
    right: calc(100% + 12px);
    display: block;
    padding: 0.35rem 0.7rem;
    white-space: nowrap;
    color: var(--ft-gold);
    font-family: var(--ft-font-heading);
    font-size: 1rem;
    background: rgba(6, 7, 20, 0.96);
    border: 1px solid #7a7a8c;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
    transform: translateY(-50%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.08s;
  }

  a.side-tab:is(:hover, :focus-visible) .side-tab__label {
    opacity: 1;
    visibility: visible;
  }
}

@media (min-width: 1100px) {
  main.container {
    max-width: min(1450px, calc(100vw - 9rem));
  }

  main > nav ul.top-tabs {
    display: none;
  }

  .side-tabs {
    display: block;
    position: sticky;
    top: 1.5rem;
    z-index: 20;
    height: 0;
  }

  /* Just outside the frame: past the window's padding and its 4px border. */
  .side-tabs__rail {
    position: absolute;
    top: 0;
    left: calc(100% + 1.5rem + 4px);
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.5rem 0.4rem 0.5rem 0.3rem;
    background: linear-gradient(90deg, #0d0b09, #1a1511);
    border: 1px solid #000;
    border-left: 0;
    box-shadow: 0 0 0 1px var(--ft-metal-dark), 4px 6px 18px rgba(0, 0, 0, 0.6);
  }

  .side-tab {
    position: relative;
    margin: 0;
  }

  a.side-tab {
    display: block;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 2px solid var(--ft-metal);
    border-radius: 3px;
    background: #000;
    box-shadow: inset 0 0 0 1px #000, 0 1px 3px rgba(0, 0, 0, 0.8);
    cursor: pointer;
    transition: border-color 0.12s, box-shadow 0.12s, filter 0.12s;
  }

  .side-tab img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 1px;
    filter: brightness(0.82) saturate(0.85);
    transition: filter 0.12s;
  }

  a.side-tab:hover img,
  a.side-tab[aria-current="page"] img {
    filter: none;
  }

  a.side-tab:hover {
    border-color: var(--ft-tan);
    box-shadow: inset 0 0 0 1px #000, 0 0 8px rgba(255, 209, 0, 0.3);
  }

  /* The current section: the gold frame of the addon's selected tab. */
  a.side-tab[aria-current="page"] {
    border-color: var(--ft-gold);
    box-shadow: inset 0 0 0 1px #000, 0 0 10px rgba(255, 209, 0, 0.55);
  }

  /* Upload sits apart at the bottom of the rail. */
  a.side-tab--upload {
    margin-top: 0.6rem;
  }

  a.side-tab--upload::before {
    content: "";
    position: absolute;
    top: -0.55rem;
    left: 4px;
    right: 4px;
    border-top: 1px solid var(--ft-metal-dark);
  }

}

/* ---- Window header: the addon's portrait, title bar and title ---------------------------------------------- */

/* The header spans the frame (out to the window's padding): a dark title bar along the top with the site name and
   version, the round portrait over the top-left corner, and the page's title in gold with a line under it. */
.window-header {
  position: relative;
  margin: -1.25rem -1.5rem 1.25rem;
  padding: 0 1.5rem 0.9rem;
  border-bottom: 1px solid var(--ft-metal-dark);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
  text-align: center;
}

.window-titlebar {
  margin: 0 -1.5rem;
  padding: 0.3rem 3rem;
  background: linear-gradient(180deg, #0c0a08, #161210);
  border-bottom: 2px solid var(--ft-metal);
  box-shadow: 0 1px 0 #000, inset 0 -1px 0 rgba(255, 233, 180, 0.08);
  color: var(--ft-gold);
  font-family: var(--ft-font-heading);
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.window-version {
  color: var(--ft-npc);
}

/* The portrait: the logo (the TrueshotLodge target, transparent) over the frame's corner with a soft shadow, a little
   larger than the round portrait it replaced and centred where it was. The original bronze ring is kept in the
   portrait lab (lab/portrait, ?portrait=ring) in case it comes back. */
.window-portrait {
  position: absolute;
  z-index: 2;
  top: -30px;
  left: -30px;
  display: block;
  width: 112px;
  height: 112px;
}

.window-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.8));
}

.window-portrait:hover img {
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 8px rgba(255, 209, 0, 0.35));
}

/* The page's title and the line under it on the left, clear of the logo, as the addon's tab title. */
.window-title {
  margin: 0.85rem 0 0;
  padding: 0 1rem 0 5rem;
  text-align: left;
}

.window-title h1 {
  margin: 0;
  color: var(--ft-gold);
  font-size: 1.75rem;
  font-weight: 400;
  text-shadow: 0 1px 2px #000;
}

.window-title p {
  margin: 0.15rem 0 0;
  color: var(--surface-content);
  font-size: 0.95rem;
}

/* With the logo gone, the top tabs are the whole nav; on wide windows the side tabs take over and it goes. */
main > nav.top-nav ul.top-tabs {
  width: 100%;
}

@media (min-width: 1100px) {
  main > nav.top-nav {
    display: none;
  }
}

@media (max-width: 720px) {
  .window-portrait {
    top: -21px;
    left: -2px; /* the frame is 4px from the screen's edge here: keep the whole target on screen */
    width: 78px;
    height: 78px;
  }

  .window-title {
    padding: 0 1rem 0 3.5rem;
  }

  .window-title h1 {
    font-size: 1.4rem;
  }
}

/* Money as the game shows it: 3 [gold] 35 [silver] 75 [copper]. */
.money {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  white-space: nowrap;
  vertical-align: baseline;
}

.money .coin {
  display: inline-flex;
  align-items: center;
  gap: 0.15em;
}

.money .coin img {
  width: 1em;
  height: 1em;
  vertical-align: middle;
}

/* Editing forms. */
.npc-edit {
  margin-left: 0.5em;
  font-size: 0.75em;
  opacity: 0.6;
}

.npc-edit:hover {
  opacity: 1;
}

form.pet-editor article h3 {
  margin-bottom: 0.75rem;
}

.pet-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0 1rem;
}

.pet-editor-grid .wide {
  grid-column: 1 / -1;
}

.pet-editor-links {
  padding-left: 0;
}

.pet-editor-links li {
  list-style: none;
}

.pet-editor-links li label {
  display: inline-flex;
  align-items: center;
  margin-right: 0.75em;
  font-size: 0.85em;
}

.pet-editor-actions {
  display: flex;
  gap: 0.75rem;
}

.pet-editor-actions > * {
  width: auto;
  margin: 0;
  padding-inline: 2rem;
}

article.pet-editor form[role="search"] {
  display: flex;
  gap: 0.75rem;
}

article.pet-editor form[role="search"] button {
  width: auto;
}

.pet-editor-results tr.hidden-pet td {
  opacity: 0.55;
}
