/*
 * Guild tracker theme.
 *
 * A dark stone-and-gold interface in the spirit of a classic fantasy MMO:
 * framed panels, gold serif headings, class-coloured names, quality-coloured
 * items. Everything is drawn with CSS; there are no image assets and no
 * scripts.
 */

:root {
  --stone-900: #0b0907;
  --stone-800: #14100c;
  --stone-700: #1c1711;
  --stone-600: #272018;
  --stone-500: #3a2f22;
  --edge: #6f5a2c;
  --edge-bright: #a8873f;
  --edge-dim: #3b2f18;
  --gold: #ffd100;
  --gold-soft: #e8c66a;
  --parchment: #e9dcc0;
  --text: #ddd3bf;
  --text-dim: #9d927d;
  --text-faint: #6f6657;
  --danger: #ff5a4a;
  --ok: #4fd06a;
  --warn: #ffb347;
  --xp: #7a4fe0;
  --xp-bright: #a98bff;
  --alliance: #2f6fd6;
  --horde: #c0392b;

  /* Class colours */
  --c-warrior: #c79c6e;
  --c-paladin: #f58cba;
  --c-hunter: #abd473;
  --c-rogue: #fff569;
  --c-priest: #ffffff;
  --c-shaman: #2e8cff;
  --c-mage: #69ccf0;
  --c-warlock: #9482c9;
  --c-druid: #ff7d0a;
  --c-unknown: #c9c2b2;

  /* Item quality colours */
  --q-poor: #9d9d9d;
  --q-common: #ffffff;
  --q-uncommon: #1eff00;
  --q-rare: #2b8cff;
  --q-epic: #b455ff;
  --q-legendary: #ff8000;
  --q-artifact: #e6cc80;

  --font-display: "Palatino Linotype", "Book Antiqua", Palatino, "URW Palladio L", P052, Georgia, serif;
  --font-body: "Trebuchet MS", "Segoe UI", Tahoma, Verdana, "DejaVu Sans", sans-serif;
  --radius: 4px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font: 15px/1.5 var(--font-body);
  background-color: var(--stone-900);
  background-image:
    radial-gradient(1200px 520px at 50% -160px, rgba(255, 170, 60, 0.13), transparent 70%),
    radial-gradient(900px 600px at 100% 100%, rgba(60, 40, 110, 0.12), transparent 70%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 4px);
  background-attachment: fixed;
}

a {
  color: var(--gold-soft);
  text-decoration: none;
}
a:hover {
  color: var(--gold);
  text-decoration: underline;
}
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.03em;
  text-shadow: 0 2px 0 #000, 0 0 18px rgba(255, 170, 40, 0.18);
}
h1 {
  font-size: 2.3rem;
  line-height: 1.1;
}
h2 {
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
h3 {
  font-size: 1rem;
}
p {
  margin: 0;
}

.wrap {
  width: min(1180px, 100% - 32px);
  margin-inline: auto;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Masthead ---------- */

.masthead {
  border-bottom: 1px solid var(--edge-dim);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.1));
  box-shadow: 0 1px 0 rgba(255, 220, 140, 0.06);
}
.masthead-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 0 0;
}
.guild-mark {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
}
.crest {
  flex: none;
  width: 58px;
  height: 66px;
  display: grid;
  place-items: center;
  font: 700 1.7rem var(--font-display);
  color: var(--gold);
  text-shadow: 0 2px 0 #000;
  background: linear-gradient(160deg, #4a3a1c, #1d160b);
  border: 2px solid var(--edge-bright);
  box-shadow: inset 0 0 0 2px #000, inset 0 0 14px rgba(255, 200, 90, 0.25), 0 3px 10px rgba(0, 0, 0, 0.7);
  clip-path: polygon(0 0, 100% 0, 100% 68%, 50% 100%, 0 68%);
}
.crest.f-alliance {
  background: linear-gradient(160deg, #24509c, #0d1c3a);
}
.crest.f-horde {
  background: linear-gradient(160deg, #8f2318, #2c0906);
}
.guild-name {
  display: block;
  font: 700 2.3rem/1.1 var(--font-display);
  color: var(--gold);
  letter-spacing: 0.03em;
  text-shadow: 0 2px 0 #000, 0 0 18px rgba(255, 170, 40, 0.18);
}
a.guild-name:hover {
  color: #fff0a8;
  text-decoration: none;
}
.guild-sub {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.guild-sub .dot::before {
  content: "\2022";
  margin: 0 8px;
  color: var(--edge);
}

.tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tabs a {
  display: block;
  padding: 9px 18px 8px;
  font: 700 0.84rem var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: linear-gradient(180deg, #221b12, #120e09);
  border: 1px solid var(--edge-dim);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}
.tabs form {
  margin: 0 0 7px 10px;
}
.tabs a:hover {
  color: var(--gold-soft);
  text-decoration: none;
}
.tabs a[aria-current="page"] {
  color: var(--gold);
  background: linear-gradient(180deg, #3a2d16, #1c1610);
  border-color: var(--edge);
  box-shadow: inset 0 1px 0 rgba(255, 220, 140, 0.18);
}

.page {
  flex: 1 0 auto;
  align-content: start;
  padding: 26px 0 56px;
  display: grid;
  gap: 22px;
}

/* ---------- Frames ---------- */

.frame {
  position: relative;
  padding: 18px 20px 20px;
  background:
    linear-gradient(180deg, rgba(255, 220, 150, 0.035), transparent 90px),
    linear-gradient(180deg, var(--stone-700), var(--stone-800));
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow:
    0 0 0 1px #000,
    inset 0 0 0 1px rgba(0, 0, 0, 0.75),
    inset 0 1px 0 1px rgba(255, 225, 150, 0.07),
    0 10px 28px rgba(0, 0, 0, 0.55);
}
/* Corner studs */
.frame::before,
.frame::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 7px;
  height: 7px;
  background: linear-gradient(135deg, #f2d27a, #7c5f22);
  border: 1px solid #000;
  transform: rotate(45deg);
}
.frame::before {
  left: -4px;
}
.frame::after {
  right: -4px;
}
.frame-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: -2px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--edge-dim);
  box-shadow: 0 1px 0 rgba(255, 225, 150, 0.05);
}
.frame-head .aside {
  color: var(--text-dim);
  font-size: 0.84rem;
}

.notice {
  padding: 10px 14px;
  border: 1px solid var(--edge);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  background: rgba(60, 44, 14, 0.5);
  color: var(--parchment);
}
.notice.is-warn {
  border-left-color: var(--warn);
}
.notice.is-error {
  border-left-color: var(--danger);
  background: rgba(80, 20, 14, 0.45);
}
.notice.is-ok {
  border-left-color: var(--ok);
  background: rgba(20, 60, 28, 0.4);
}
.motd {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--parchment);
}
.motd::before {
  content: "Guild message of the day: ";
  font-style: normal;
  color: var(--gold);
}

/* ---------- Summary tiles ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.tile {
  padding: 12px 14px;
  text-align: center;
  background: linear-gradient(180deg, #1f1912, #120e0a);
  border: 1px solid var(--edge-dim);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 225, 150, 0.06);
}
.tile-value {
  display: block;
  font: 700 1.9rem/1.1 var(--font-display);
  color: var(--gold);
  text-shadow: 0 2px 0 #000;
}
.tile-label {
  display: block;
  margin-top: 4px;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ---------- Bar lists (levels, classes) ---------- */

.bars {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bar-row {
  display: grid;
  grid-template-columns: 92px 1fr 30px;
  gap: 10px;
  align-items: center;
  padding: 3px 8px;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 3px;
}
.bar-row:hover {
  color: var(--parchment);
  text-decoration: none;
  background: rgba(255, 220, 140, 0.05);
  border-color: var(--edge-dim);
}
.bar-row.is-active {
  background: rgba(255, 209, 0, 0.08);
  border-color: var(--edge-bright);
}
.bar-label {
  overflow: hidden;
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--class, var(--parchment));
}
.bar-track {
  height: 12px;
  background: #07060a;
  border: 1px solid #000;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--edge-dim), inset 0 1px 2px #000;
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  min-width: 2px;
  background: linear-gradient(180deg, #ffe58a, var(--class, #c99a1e) 55%, color-mix(in srgb, var(--class, #c99a1e) 60%, #000));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.bar-fill.w-0 {
  min-width: 0;
}
.bar-count {
  text-align: right;
  font: 700 0.9rem var(--font-display);
  font-variant-numeric: tabular-nums;
  color: var(--gold-soft);
}

/* ---------- Roster toolbar ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.search {
  display: flex;
  gap: 8px;
  flex: 1 1 260px;
  max-width: 420px;
}
.sorts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  font-size: 0.84rem;
}
.sorts-label {
  margin-right: 6px;
  font: 700 0.74rem var(--font-display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.sorts a {
  padding: 3px 10px;
  color: var(--text-dim);
  border: 1px solid var(--edge-dim);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.3);
}
.sorts a:hover {
  color: var(--gold-soft);
  text-decoration: none;
  border-color: var(--edge);
}
.sorts a[aria-current] {
  color: var(--gold);
  border-color: var(--edge-bright);
  background: rgba(255, 209, 0, 0.08);
}
.sorts.is-roles {
  margin-bottom: 10px;
}
.filter-note {
  margin-bottom: 14px;
  font-size: 0.86rem;
  color: var(--text-dim);
}

/* ---------- Activity feed ---------- */

.feed {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.feed.is-columns {
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 2px 28px;
}
.event {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 5px 6px;
  border-bottom: 1px solid rgba(111, 90, 44, 0.18);
}
.event-mark {
  width: 8px;
  height: 8px;
  align-self: center;
  background: var(--xp-bright);
  border: 1px solid #000;
  transform: rotate(45deg);
  box-shadow: 0 0 6px rgba(169, 139, 255, 0.5);
}
.event.is-cap .event-mark {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(255, 209, 0, 0.7);
}
.event.is-join .event-mark {
  background: var(--ok);
  box-shadow: none;
}
.event.is-leave .event-mark {
  background: var(--text-faint);
  box-shadow: none;
}
.event.is-cap .event-text {
  color: var(--gold-soft);
}
.event-text a.class-name:hover {
  color: var(--class, var(--gold));
}
.event-when {
  font-size: 0.8rem;
  color: var(--text-faint);
  white-space: nowrap;
}
.day {
  margin: 16px 0 6px;
  padding-bottom: 4px;
  font-size: 0.86rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-soft);
  border-bottom: 1px solid var(--edge-dim);
}
.frame-head + .day {
  margin-top: 0;
}
.leaders {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.leader {
  display: grid;
  grid-template-columns: 22px minmax(120px, 1.1fr) 1fr 36px;
  gap: 10px;
  align-items: center;
  padding: 3px 6px;
}
.leader.is-wide {
  grid-template-columns: 22px minmax(110px, 1fr) 1fr minmax(120px, auto);
}
.leader.is-wide .bar-count {
  font-size: 0.8rem;
  white-space: nowrap;
}
.leader-place {
  font: 700 0.9rem var(--font-display);
  text-align: center;
  color: var(--text-dim);
}
.leader:first-child .leader-place {
  color: var(--gold);
}
.tiles.is-small {
  grid-template-columns: repeat(auto-fit, minmax(140px, 200px));
  margin-bottom: 14px;
}
.tiles.is-small .tile-value {
  font-size: 1.4rem;
}

/* ---------- Teams ---------- */

.team-roles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.role-group {
  padding: 10px 12px 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--edge-dim);
  border-top: 3px solid var(--role, var(--edge));
  border-radius: var(--radius);
}
.role-group.is-tank {
  --role: #4f8fdc;
}
.role-group.is-healer {
  --role: #4fd06a;
}
.role-group.is-dps {
  --role: #d0524a;
}
.role-head {
  margin-bottom: 8px;
  font-size: 0.86rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--role, var(--gold));
}
.role-count {
  margin-left: 4px;
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-faint);
}
.role-empty {
  font-size: 0.84rem;
  color: var(--text-faint);
}
.role-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.role-member {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid rgba(111, 90, 44, 0.16);
}
.role-member:last-child {
  border-bottom: 0;
}
.role-member .class-name {
  font-weight: 700;
}
.role-member a.class-name:hover {
  color: var(--class, var(--gold));
}
.role-meta {
  font-size: 0.8rem;
  white-space: nowrap;
  color: var(--text-dim);
}
.role-member.is-admin {
  flex-wrap: wrap;
  justify-content: flex-start;
  padding: 6px 0;
}
.role-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: auto;
}
.team-forms {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: flex-end;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--edge-dim);
}

/* ---------- Bank goal and contents ---------- */

.goal-figures {
  margin-bottom: 8px;
  font-size: 1.05rem;
  color: var(--parchment);
}
.goal-figures strong {
  font: 700 1.5rem var(--font-display);
  color: var(--gold);
  text-shadow: 0 2px 0 #000;
}
.xp.is-goal {
  height: 22px;
  margin: 0 0 10px;
}
.xp.is-goal .xp-fill {
  background: linear-gradient(180deg, #ffe58a, #c99a1e 55%, #7a5a08);
}
.stock {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 4px 18px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}
.stock li {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 3px 0;
  border-bottom: 1px solid rgba(111, 90, 44, 0.16);
}
.stock-count {
  text-align: right;
  font: 700 0.95rem var(--font-display);
  font-variant-numeric: tabular-nums;
  color: var(--gold-soft);
}
.stock-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--parchment);
}

/* ---------- Gear history ---------- */

.event.is-gear .event-mark {
  background: var(--q-rare);
  box-shadow: 0 0 6px rgba(43, 140, 255, 0.5);
}
.gear-slot {
  color: var(--text-dim);
}
.gear-none {
  font-style: italic;
  color: var(--text-faint);
}
.item-inline {
  font-weight: 700;
  color: var(--quality, var(--q-common));
  text-shadow: 0 1px 0 #000;
}

/* ---------- Class colours ---------- */

.c-warrior { --class: var(--c-warrior); }
.c-paladin { --class: var(--c-paladin); }
.c-hunter { --class: var(--c-hunter); }
.c-rogue { --class: var(--c-rogue); }
.c-priest { --class: var(--c-priest); }
.c-shaman { --class: var(--c-shaman); }
.c-mage { --class: var(--c-mage); }
.c-warlock { --class: var(--c-warlock); }
.c-druid { --class: var(--c-druid); }
.c-unknown { --class: var(--c-unknown); }
.class-name {
  color: var(--class, var(--c-unknown));
}

/* ---------- Roster cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.card {
  position: relative;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  color: inherit;
  background: linear-gradient(180deg, #211a12, #130f0a);
  border: 1px solid var(--edge-dim);
  border-left: 3px solid var(--class, var(--edge));
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 225, 150, 0.05);
  transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
}
a.card:hover {
  text-decoration: none;
  color: inherit;
  border-color: var(--edge-bright);
  border-left-color: var(--class, var(--edge-bright));
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 225, 150, 0.1), 0 6px 16px rgba(0, 0, 0, 0.55);
}
.card.is-unlisted {
  opacity: 0.72;
}

.portrait {
  position: relative;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  overflow: hidden;
  font: 700 1.1rem var(--font-display);
  color: var(--class, var(--gold-soft));
  text-shadow: 0 1px 0 #000;
  background: radial-gradient(circle at 50% 35%, #3a2f22, #0f0c08 75%);
  border: 2px solid var(--edge-bright);
  border-radius: 50%;
  box-shadow: 0 0 0 1px #000, inset 0 0 0 1px #000, inset 0 0 10px rgba(0, 0, 0, 0.9);
}
.portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.portrait.is-large {
  width: 96px;
  height: 96px;
  font-size: 2.1rem;
  border-width: 3px;
}
.level-badge {
  position: absolute;
  left: 50px;
  top: 46px;
  min-width: 26px;
  padding: 0 5px;
  font: 700 0.78rem/18px var(--font-body);
  text-align: center;
  color: var(--gold);
  background: #0b0907;
  border: 1px solid var(--edge-bright);
  border-radius: 10px;
  box-shadow: 0 1px 3px #000;
}

.card-body {
  min-width: 0;
}
.card-name {
  display: block;
  overflow: hidden;
  font: 700 1.02rem var(--font-display);
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--class, var(--parchment));
  text-shadow: 0 1px 0 #000;
}
.card-tags {
  position: absolute;
  top: 9px;
  right: 10px;
  display: flex;
  gap: 4px;
}
.card-name {
  padding-right: 34px;
}
.card.is-unlisted .card-name {
  padding-right: 100px;
}
.card-meta {
  display: flex;
  gap: 0 8px;
  align-items: center;
  overflow: hidden;
  font-size: 0.8rem;
  white-space: nowrap;
  color: var(--text-dim);
}
.card-meta > span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta .player {
  flex: none;
}
.card-meta > .tag {
  flex: none;
}
.card-meta .rank {
  color: var(--text-faint);
}
.tag {
  display: inline-block;
  padding: 0 6px;
  font-size: 0.68rem;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--edge-dim);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.35);
}
.tag.is-gold {
  color: var(--gold);
  border-color: var(--edge);
}
.tag.is-warn {
  color: var(--warn);
  border-color: #6b4a1c;
}
.tag.is-error {
  color: var(--danger);
  border-color: #6b241c;
}
.tag.is-ok {
  color: var(--ok);
  border-color: #1f5a2c;
}

.card-meta .player {
  color: var(--gold-soft);
}
.card-meta .player::before {
  content: "\2022\00a0";
  color: var(--edge);
}
.played-by {
  color: var(--text-dim);
}
.played-by .alt {
  display: inline-block;
  margin: 0 8px 0 2px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 2px 4px 2px 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--edge-dim);
  border-left: 3px solid var(--class, var(--edge));
  border-radius: 3px;
}
.chip.is-missing {
  opacity: 0.6;
}
.person {
  display: grid;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--edge-dim);
}
.person:last-child {
  border-bottom: 0;
}
.person-forms {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: flex-end;
}
.person-forms .field {
  min-width: 170px;
}

/* ---------- Level bar (an experience bar) ---------- */

.xp {
  display: block;
  position: relative;
  height: 9px;
  margin-top: 6px;
  background: #07060a;
  border: 1px solid #000;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--edge-dim), inset 0 1px 2px #000;
  overflow: hidden;
}
.xp-fill {
  display: block;
  height: 100%;
  background: linear-gradient(180deg, var(--xp-bright), var(--xp) 55%, #4a2aa0);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.xp.is-cap .xp-fill {
  background: linear-gradient(180deg, #fff0a8, var(--gold) 55%, #b88a00);
}
/* Notches every tenth, like an experience bar */
.xp::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(0, 0, 0, 0.75) calc(10% - 1px) 10%);
}
.xp.is-tall {
  height: 14px;
}

.empty {
  padding: 34px 16px;
  text-align: center;
  color: var(--text-dim);
}
.empty p {
  margin-top: 16px;
}
.empty strong {
  display: block;
  margin-bottom: 6px;
  font: 700 1.2rem var(--font-display);
  color: var(--gold-soft);
}

/* ---------- Character page ---------- */

.hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
}
.hero-name {
  color: var(--class, var(--gold));
}
.hero-line {
  margin-top: 4px;
  color: var(--parchment);
  font-size: 1.02rem;
}
.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.hero-level {
  text-align: center;
  min-width: 108px;
}
.hero-level .tile-value {
  font-size: 2.8rem;
}
.back {
  font-size: 0.86rem;
  letter-spacing: 0.06em;
}
.back::before {
  content: "\2039\00a0";
}

/* Character sheet: gear down both sides of the figure, weapons below. */
.doll {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 300px) minmax(0, 1fr);
  gap: 10px 18px;
  align-items: start;
}
.doll-col,
.doll-weapons {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.doll-weapons {
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 300px));
  justify-content: center;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--edge-dim);
}
.doll-center {
  display: grid;
  gap: 14px;
  align-content: start;
  justify-items: center;
  min-height: 100%;
  padding: 12px;
  background:
    radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--class, #806020) 22%, transparent), transparent 70%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.15));
  border: 1px solid var(--edge-dim);
  border-radius: var(--radius);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
}
.render {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
}
.render-fallback {
  width: 150px;
  height: 190px;
  margin-top: 18px;
  display: grid;
  place-items: center;
  font: 700 3.4rem var(--font-display);
  color: var(--class, var(--gold-soft));
  text-shadow: 0 3px 0 #000;
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.5));
  border: 2px solid var(--edge);
  box-shadow: inset 0 0 0 2px #000, 0 6px 18px rgba(0, 0, 0, 0.7);
  clip-path: polygon(0 0, 100% 0, 100% 72%, 50% 100%, 0 72%);
}
.stats {
  width: 100%;
  font-size: 0.88rem;
  padding-top: 10px;
  border-top: 1px solid var(--edge-dim);
}
.stats dd {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.slot {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--edge-dim);
  border-radius: var(--radius);
  cursor: default;
}
.slot:hover,
.slot:focus {
  border-color: var(--quality, var(--edge));
  outline: none;
  background: rgba(255, 220, 140, 0.04);
}
.slot.is-flipped {
  grid-template-columns: minmax(0, 1fr) 40px;
  text-align: right;
}
.slot.is-flipped .icon {
  order: 2;
}
.slot.is-empty {
  --quality: var(--edge-dim);
  opacity: 0.55;
}
.slot-text {
  min-width: 0;
}
.slot-text > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slot-empty {
  font-size: 0.82rem;
  color: var(--text-faint);
}
.slot .ilvl {
  font-size: 0.8rem;
}
.icon-label {
  padding: 0 1px;
  font-size: 0.5rem;
  line-height: 1.15;
  letter-spacing: 0;
  text-align: center;
  overflow-wrap: anywhere;
}

/* Item tooltip, shown on hover and on keyboard or touch focus. */
.tooltip {
  display: none;
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  width: min(310px, 86vw);
  padding: 9px 11px 10px;
  text-align: left;
  font-size: 0.86rem;
  line-height: 1.38;
  white-space: normal;
  color: #fff;
  background: rgba(7, 9, 20, 0.97);
  border: 1px solid #9a9a9a;
  border-radius: 6px;
  box-shadow: 0 0 0 1px #000, 0 10px 26px rgba(0, 0, 0, 0.85);
  pointer-events: none;
}
.slot.is-flipped .tooltip {
  left: auto;
  right: 0;
}
.slot:hover .tooltip,
.slot:focus .tooltip {
  display: block;
}
.tip-title {
  display: block;
  margin-bottom: 1px;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--quality, #fff);
}
.tip-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.tip-line.is-gold {
  color: var(--gold);
}
.tip-line.is-green {
  color: var(--q-uncommon);
}
.tip-line.is-yellow {
  color: #ffe58a;
}
.tip-line.is-dim {
  color: #9d9d9d;
}
.gear-check {
  margin-top: 14px;
  padding-top: 12px;
  font-size: 0.88rem;
  color: var(--text-dim);
  border-top: 1px solid var(--edge-dim);
}
.gear-check strong {
  color: var(--gold-soft);
}
.bar-row.is-wide {
  grid-template-columns: 130px 1fr 78px;
}

.icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: linear-gradient(145deg, #2a2219, #0c0a07);
  border: 1px solid var(--quality, var(--edge-dim));
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px #000, 0 0 6px color-mix(in srgb, var(--quality, transparent) 35%, transparent);
}
.icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.q-poor { --quality: var(--q-poor); }
.q-common { --quality: var(--q-common); }
.q-uncommon { --quality: var(--q-uncommon); }
.q-rare { --quality: var(--q-rare); }
.q-epic { --quality: var(--q-epic); }
.q-legendary { --quality: var(--q-legendary); }
.q-artifact { --quality: var(--q-artifact); }
.item-name {
  display: block;
  color: var(--quality, var(--q-common));
  font-weight: 700;
  text-shadow: 0 1px 0 #000;
}
.item-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--text-dim);
}
.item-enchant {
  color: var(--q-uncommon);
}
.ilvl {
  font: 700 0.9rem var(--font-display);
  color: var(--gold-soft);
}

/* ---------- Footer ---------- */

.footer {
  padding: 18px 0 30px;
  border-top: 1px solid var(--edge-dim);
  color: var(--text-faint);
  font-size: 0.8rem;
  text-align: center;
}
.footer p + p {
  margin-top: 4px;
}

/* ---------- Buttons and forms (admin) ---------- */

.btn {
  display: inline-block;
  padding: 7px 16px 6px;
  font: 700 0.84rem var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 1px 0 #000;
  cursor: pointer;
  background: linear-gradient(180deg, #a32417, #6a1009 55%, #4a0a05);
  border: 1px solid var(--edge-bright);
  border-radius: 4px;
  box-shadow: 0 0 0 1px #000, inset 0 1px 0 rgba(255, 190, 160, 0.35), 0 2px 5px rgba(0, 0, 0, 0.6);
}
.btn:hover {
  color: #fff3b0;
  text-decoration: none;
  background: linear-gradient(180deg, #c22d1d, #82150c 55%, #5a0d07);
}
.btn:active {
  transform: translateY(1px);
}
.btn.is-quiet {
  color: var(--gold-soft);
  background: linear-gradient(180deg, #2f2618, #18130c);
  box-shadow: 0 0 0 1px #000, inset 0 1px 0 rgba(255, 225, 150, 0.12);
}
.btn.is-quiet:hover {
  background: linear-gradient(180deg, #3d3120, #201a10);
}
.btn.is-small {
  padding: 3px 10px 2px;
  font-size: 0.72rem;
}

.form {
  display: grid;
  gap: 16px;
  max-width: 620px;
}
.field {
  display: grid;
  gap: 5px;
}
.field label,
.field .label {
  font: 700 0.8rem var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-soft);
}
.hint {
  font-size: 0.82rem;
  color: var(--text-dim);
}
.input,
select.input,
textarea.input {
  width: 100%;
  padding: 8px 10px;
  color: var(--parchment);
  font: inherit;
  background: #0a0806;
  border: 1px solid var(--edge-dim);
  border-radius: 3px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8);
}
textarea.input {
  resize: vertical;
}
.input.is-mono {
  font: 0.82rem/1.45 ui-monospace, "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;
}
.input:focus {
  border-color: var(--gold);
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8), 0 0 0 2px rgba(255, 209, 0, 0.2);
}
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.check {
  display: flex;
  gap: 8px;
  align-items: baseline;
  color: var(--parchment);
}
.check input {
  accent-color: #c99a1e;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.kv + .actions {
  margin-top: 16px;
}
.inline-form {
  display: inline;
}

/* ---------- Tables (admin) ---------- */

.table-scroll {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.table th {
  padding: 8px 10px;
  text-align: left;
  font: 700 0.74rem var(--font-display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-soft);
  border-bottom: 1px solid var(--edge);
  white-space: nowrap;
}
.table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(111, 90, 44, 0.25);
  vertical-align: middle;
}
.table tr:hover td {
  background: rgba(255, 220, 140, 0.035);
}
.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.table .is-hidden-row td {
  opacity: 0.55;
}

.note-form {
  display: flex;
  gap: 6px;
  min-width: 220px;
}
.note-form .input {
  padding: 3px 8px;
}

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 18px;
  margin: 0;
}
.kv dt {
  color: var(--text-dim);
}
.kv dd {
  margin: 0;
  color: var(--parchment);
}

.log {
  max-height: 340px;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  font: 0.8rem/1.55 ui-monospace, "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;
  list-style: none;
  background: #070605;
  border: 1px solid var(--edge-dim);
  border-radius: 3px;
}
.log time {
  color: var(--text-faint);
  margin-right: 8px;
}
.log .is-warn {
  color: var(--warn);
}
.log .is-error {
  color: var(--danger);
}

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 22px;
}

.login {
  width: min(420px, 100% - 32px);
  margin: 12vh auto 0;
}
.login h1 {
  margin-bottom: 4px;
  font-size: 1.7rem;
}

.admin-bar {
  background: repeating-linear-gradient(135deg, rgba(120, 20, 10, 0.5) 0 12px, rgba(60, 10, 5, 0.5) 12px 24px);
  border-bottom: 1px solid var(--edge);
  color: var(--parchment);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  padding: 3px 0;
}

@media (max-width: 720px) {
  h1,
  .guild-name {
    font-size: 1.7rem;
  }
  .masthead-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }
  .hero {
    grid-template-columns: auto 1fr;
  }
  .hero-level {
    grid-column: 1 / -1;
  }
  .doll {
    grid-template-columns: minmax(0, 1fr);
  }
  .team-roles {
    grid-template-columns: minmax(0, 1fr);
  }
  .doll-center {
    order: -1;
  }
  .doll-weapons {
    grid-template-columns: minmax(0, 1fr);
  }
  .slot.is-flipped {
    grid-template-columns: 40px minmax(0, 1fr);
    text-align: left;
  }
  .slot.is-flipped .icon {
    order: 0;
  }
  .slot.is-flipped .tooltip {
    left: 0;
    right: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/*
 * Width steps for bars. The pages use these classes instead of inline
 * styles so the site can run under a Content-Security-Policy that forbids
 * inline styling.
 */
.w-0 { width: 0%; }
.w-1 { width: 1%; }
.w-2 { width: 2%; }
.w-3 { width: 3%; }
.w-4 { width: 4%; }
.w-5 { width: 5%; }
.w-6 { width: 6%; }
.w-7 { width: 7%; }
.w-8 { width: 8%; }
.w-9 { width: 9%; }
.w-10 { width: 10%; }
.w-11 { width: 11%; }
.w-12 { width: 12%; }
.w-13 { width: 13%; }
.w-14 { width: 14%; }
.w-15 { width: 15%; }
.w-16 { width: 16%; }
.w-17 { width: 17%; }
.w-18 { width: 18%; }
.w-19 { width: 19%; }
.w-20 { width: 20%; }
.w-21 { width: 21%; }
.w-22 { width: 22%; }
.w-23 { width: 23%; }
.w-24 { width: 24%; }
.w-25 { width: 25%; }
.w-26 { width: 26%; }
.w-27 { width: 27%; }
.w-28 { width: 28%; }
.w-29 { width: 29%; }
.w-30 { width: 30%; }
.w-31 { width: 31%; }
.w-32 { width: 32%; }
.w-33 { width: 33%; }
.w-34 { width: 34%; }
.w-35 { width: 35%; }
.w-36 { width: 36%; }
.w-37 { width: 37%; }
.w-38 { width: 38%; }
.w-39 { width: 39%; }
.w-40 { width: 40%; }
.w-41 { width: 41%; }
.w-42 { width: 42%; }
.w-43 { width: 43%; }
.w-44 { width: 44%; }
.w-45 { width: 45%; }
.w-46 { width: 46%; }
.w-47 { width: 47%; }
.w-48 { width: 48%; }
.w-49 { width: 49%; }
.w-50 { width: 50%; }
.w-51 { width: 51%; }
.w-52 { width: 52%; }
.w-53 { width: 53%; }
.w-54 { width: 54%; }
.w-55 { width: 55%; }
.w-56 { width: 56%; }
.w-57 { width: 57%; }
.w-58 { width: 58%; }
.w-59 { width: 59%; }
.w-60 { width: 60%; }
.w-61 { width: 61%; }
.w-62 { width: 62%; }
.w-63 { width: 63%; }
.w-64 { width: 64%; }
.w-65 { width: 65%; }
.w-66 { width: 66%; }
.w-67 { width: 67%; }
.w-68 { width: 68%; }
.w-69 { width: 69%; }
.w-70 { width: 70%; }
.w-71 { width: 71%; }
.w-72 { width: 72%; }
.w-73 { width: 73%; }
.w-74 { width: 74%; }
.w-75 { width: 75%; }
.w-76 { width: 76%; }
.w-77 { width: 77%; }
.w-78 { width: 78%; }
.w-79 { width: 79%; }
.w-80 { width: 80%; }
.w-81 { width: 81%; }
.w-82 { width: 82%; }
.w-83 { width: 83%; }
.w-84 { width: 84%; }
.w-85 { width: 85%; }
.w-86 { width: 86%; }
.w-87 { width: 87%; }
.w-88 { width: 88%; }
.w-89 { width: 89%; }
.w-90 { width: 90%; }
.w-91 { width: 91%; }
.w-92 { width: 92%; }
.w-93 { width: 93%; }
.w-94 { width: 94%; }
.w-95 { width: 95%; }
.w-96 { width: 96%; }
.w-97 { width: 97%; }
.w-98 { width: 98%; }
.w-99 { width: 99%; }
.w-100 { width: 100%; }
