:root {
  color-scheme: dark;
  --bg: #12100e;
  --surface: #1d1a17;
  --surface-raised: #29241f;
  --border: #3a332b;
  --text: #ece6dc;
  --text-muted: #a39a8c;
  --accent: #f0b232;
  --danger: #e0514b;
  --alliance: #4a8ae0;
  --horde: #d8443c;
  --tank: #8fb3e0;
  --healer: #6cc66c;
  --dps: #e5876a;
  --con-gray: #808080;
  --con-green: #40bf40;
  --con-yellow: #ffff00;
  --con-orange: #ff8040;
  --con-red: #ff2020;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: radial-gradient(circle at 50% -20%, #33261a, var(--bg) 60%) fixed;
}

h2,
h3,
p {
  margin: 0;
}

h2,
h3 {
  line-height: 1.2;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Layout */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 1rem clamp(1rem, 4vw, 2rem);
  border-bottom: 1px solid var(--border);
  background: rgb(0 0 0 / 0.35);
}

.brand {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-decoration: none;
}

.account {
  color: var(--text-muted);
}

.account strong {
  color: var(--text);
}

.account .guild-gold strong {
  color: var(--tile-color);
}

.site-nav {
  display: flex;
  gap: 0.25rem;
}

.site-nav a {
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  background: var(--surface-raised);
  color: var(--accent);
}

.coin-gold { color: #ffd100; }
.coin-silver { color: #c7c7cf; }
.coin-copper { color: #c8763c; }

/* Notices */

.notices {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10;
  display: grid;
  gap: 0.5rem;
  width: min(360px, calc(100vw - 2rem));
  margin: 0;
  padding: 0;
  list-style: none;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.5);
}

.notice p {
  flex: 1;
}

.notice-close {
  padding: 0 0.25rem;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.notice-close:hover {
  color: var(--text);
}

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 4vw, 2rem) 3rem;
}

/* The farm view needs room for both continent tables side by side. */
main:has(.farm) {
  max-width: 1640px;
}

.view-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.view-header h2 {
  font-size: 1.6rem;
}

.view-subtitle {
  margin: 0;
  color: var(--text-muted);
}

.view-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 2rem;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.site-footer a {
  color: var(--text-muted);
}

.site-footer a:hover {
  color: var(--text);
}

.update-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--accent);
  background: var(--surface-raised);
}

.backup-status {
  align-self: center;
  margin-right: auto;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.backup-status.overdue {
  color: var(--accent);
}

.change-list {
  display: grid;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.change-list h3 {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.change-date {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.change-list ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.notice .button.small {
  margin-top: 0.4rem;
}

/* Buttons */

.modal {
  max-width: min(26rem, calc(100vw - 2rem));
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.modal::backdrop {
  background: rgb(0 0 0 / 0.6);
}

.modal p {
  margin-top: 0.75rem;
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.button:hover {
  border-color: var(--text-muted);
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #1a1408;
}

.button.primary:not(:disabled):hover {
  background: #ffc654;
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.button.danger {
  color: var(--danger);
}

.button.danger:hover {
  border-color: var(--danger);
  background: rgb(224 81 75 / 0.12);
}

.button.subtle {
  background: transparent;
  color: var(--text-muted);
  font-weight: 400;
}

.button.small {
  padding: 0.3rem 0.75rem;
  font-size: 0.875rem;
}

/* Roster */

.guild-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
}

.chip:hover {
  color: var(--text);
}

.chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgb(240 178 50 / 0.12);
  color: var(--text);
}

.chip .count {
  padding: 0 0.45rem;
  border-radius: 999px;
  background: var(--surface-raised);
  font-size: 0.75rem;
}

/* A guild's faction shows as the chip's left edge and the roster subtitle color. */
.guild-chip {
  border-left: 3px solid var(--tile-color);
}

.roster .guild-title {
  color: var(--tile-color);
}

.role-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.sort-control select {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.role-summary li {
  padding: 0.25rem 0.75rem;
  border-left: 3px solid var(--role-color);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
}

.role-summary strong {
  color: var(--text);
}

.role-tank { --role-color: var(--tank); }
.role-healer { --role-color: var(--healer); }
.role-dps { --role-color: var(--dps); }

.character-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.character-card {
  --class-color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--class-color);
  border-radius: var(--radius);
  background: var(--surface);
}

.class-icon {
  flex: none;
  border: 2px solid var(--class-color);
  border-radius: 8px;
  object-fit: cover;
}

.character-info {
  display: grid;
  flex: 1;
  gap: 0.3rem;
  min-width: 0;
}

.character-name {
  font-size: 1.15rem;
  color: var(--class-color);
  overflow-wrap: anywhere;
}

.guild-tags,
.farm-status {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badge {
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--badge-color, var(--border));
  border-radius: 4px;
  background: var(--surface-raised);
  color: var(--badge-color, var(--text));
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-tank { --badge-color: var(--tank); }
.badge-healer { --badge-color: var(--healer); }
.badge-dps { --badge-color: var(--dps); }
.badge-alliance { --badge-color: var(--alliance); }
.badge-horde { --badge-color: var(--horde); }
.badge-contested { --badge-color: var(--text-muted); }
.badge-sanctuary { --badge-color: var(--healer); }
.badge-wanted { --badge-color: var(--accent); }
.badge-top-damage { --badge-color: var(--accent); }
.badge-alpha { --badge-color: var(--dps); }

.card-link {
  height: 100%;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.card-link:hover {
  border-color: var(--class-color);
  background: var(--surface-raised);
}

.empty {
  padding: 2rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  text-align: center;
}

/* Character form */

.character-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 2rem;
}

.form-fields {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-label {
  margin-bottom: 0.35rem;
  padding: 0;
  font-weight: 600;
}

.field > .field-label {
  margin-bottom: 0;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.welcome {
  margin: 0.25rem 0;
}

.field-error {
  font-size: 0.85rem;
  color: var(--danger);
}

.field-error:empty {
  display: none;
}

input[type="text"],
input[type="number"],
input[type="search"] {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

[aria-invalid="true"] {
  border-color: var(--danger);
}

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

/* Tile pickers (race, class, role) */

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
  gap: 0.5rem;
}

.faction-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.faction-alliance { --tile-color: var(--alliance); }
.faction-horde { --tile-color: var(--horde); }

.faction-picker {
  grid-template-columns: 1fr 1fr;
}

.faction-name {
  margin-bottom: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tile-color);
}

.tile {
  position: relative;
  display: block;
  cursor: pointer;
}

.tile-body {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-muted);
  transition: border-color 0.15s, background-color 0.15s, opacity 0.15s;
}

.tile-body img {
  flex: none;
  border: 1px solid var(--tile-color, var(--border));
  border-radius: 4px;
}

.tile-text {
  display: grid;
  line-height: 1.25;
}

.tile-text small {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.tile:hover .tile-body {
  border-color: var(--tile-color, var(--text-muted));
  color: var(--text);
}

.tile input:checked + .tile-body {
  border-color: var(--tile-color, var(--accent));
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 1px var(--tile-color, var(--accent));
  color: var(--text);
  font-weight: 600;
}

.tile input:focus-visible + .tile-body {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tile.unavailable .tile-body {
  opacity: 0.35;
}

.tile:has(input:disabled) {
  cursor: not-allowed;
}

.tile.unavailable:hover .tile-body {
  opacity: 0.7;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--accent);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.preview {
  position: sticky;
  top: 1rem;
}

.preview-label {
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

@media (max-width: 720px) {
  .character-form {
    grid-template-columns: 1fr;
  }

  .preview {
    position: static;
    order: -1;
  }
}

/* Farming */

.farm-income {
  color: var(--text-muted);
}

.farm-characters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.farmer {
  --class-color: var(--text-muted);
  --difficulty-color: var(--con-gray);
  position: relative;
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--difficulty-color);
  border-radius: var(--radius);
  background: var(--surface);
}

/* Classic con colors for the zone being farmed; idle characters stay gray. */
.farmer.difficulty-green { --difficulty-color: var(--con-green); }
.farmer.difficulty-yellow { --difficulty-color: var(--con-yellow); }
.farmer.difficulty-orange { --difficulty-color: var(--con-orange); }
.farmer.difficulty-red { --difficulty-color: var(--con-red); }

.farmer.selected {
  border-color: var(--accent);
  border-left-color: var(--difficulty-color);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.farmer-select {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.35rem 0.75rem;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.farmer-info {
  display: grid;
  min-width: 0;
}

/* Name on its own line above the icon, never wrapping. */
.farmer-select .character-name {
  grid-column: 1 / -1;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.farmer-level,
.farmer-zone {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.farmer-zone {
  color: var(--accent);
}

.farmer-recall {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

.farmer:has(.farmer-recall) .farmer-select {
  padding-right: 4.5rem;
}

.xp-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg);
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #7a3fbf, #b77dff);
  transition: width 0.9s linear;
}

.farmer-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.zone-intro {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

/* Yellow "!" in the style of a WoW quest giver; shows its text on hover or keyboard focus. */
.quest-hint {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  cursor: help;
  border-radius: 4px;
}

.quest-hint:focus-visible {
  outline: 2px solid var(--accent);
}

.quest-mark {
  display: block;
  padding: 0 0.3rem;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
  color: #ffd100;
  -webkit-text-stroke: 1px #3a2400;
  text-shadow: 0 0 2px #000, 1px 2px 2px rgb(0 0 0 / 0.8), 0 0 8px rgb(255 209 0 / 0.45);
}

.hint-text {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 50%;
  display: none;
  width: max-content;
  max-width: 320px;
  margin-top: 0.35rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid #9a9a9a;
  border-radius: 6px;
  background: rgb(4 4 20 / 0.96);
  color: #ffffff;
  font-size: 0.85rem;
  line-height: 1.35;
  transform: translateX(-50%);
}

.quest-hint:hover > .hint-text,
.quest-hint:focus > .hint-text {
  display: block;
}

/* Side by side when there's room; stacked on narrow screens. */
.continents {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 640px), 1fr));
  align-items: start;
  gap: 1.5rem;
}

.continent {
  min-width: 0;
  container-type: inline-size;
}

.continent h3 {
  margin-bottom: 0.5rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
}

.table-scroll {
  /* Positioned, so the visually hidden header text stays inside the scroller instead of widening the page. */
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* A glow at an edge with more table past it, so a sideways scroll is easy to spot. The covers scroll with
     the table and hide the glow once that edge is reached. */
  background:
    linear-gradient(to right, var(--bg) 30%, rgb(18 16 14 / 0)) left / 3rem 100% no-repeat local,
    linear-gradient(to left, var(--bg) 30%, rgb(18 16 14 / 0)) right / 3rem 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgb(240 178 50 / 0.45), rgb(240 178 50 / 0)) left / 1rem 100% no-repeat,
    radial-gradient(farthest-side at 100% 50%, rgb(240 178 50 / 0.45), rgb(240 178 50 / 0)) right / 1rem 100% no-repeat,
    var(--bg);
}

.zone-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.zone-table th,
.zone-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.zone-table thead th {
  background: var(--surface-raised);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.zone-table tbody tr:last-child > * {
  border-bottom: 0;
}

.zone-table tbody tr:hover {
  background: var(--surface);
}

.zone-table tbody th {
  font-weight: 600;
}

.zone-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.zone-table .reduced {
  color: var(--text-muted);
}

.zone-table tr.locked > *:not(.zone-action) {
  opacity: 0.45;
}

.zone-table tr.current {
  background: rgb(240 178 50 / 0.1);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Takes the table's spare width and wraps between names, so a busy zone grows taller instead of wider. */
.zone-table .zone-farmers {
  width: 100%;
  min-width: 8rem;
  white-space: normal;
  font-size: 0.85rem;
}

.zone-farmers > span {
  white-space: nowrap;
}

.zone-action {
  text-align: right;
}

.lock-reason {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* When a continent's column is too narrow for the whole table (phones, tablets, and both continents side by
   side), each zone is a small card instead of a table row: name and action; then faction, levels and rates,
   wrapping as needed; then who's farming. That way the Send buttons are never hidden off to the side. */
@container (max-width: 50rem) {
  .zone-table,
  .zone-table tbody {
    display: block;
  }

  .zone-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .zone-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
  }

  /* Ends the first line after the name and action. */
  .zone-table tbody tr::after {
    content: "";
    flex-basis: 100%;
    order: 1;
    margin-top: -0.25rem;
  }

  .zone-table tbody tr:last-child {
    border-bottom: 0;
  }

  .zone-table tbody th,
  .zone-table tbody td,
  .zone-table .num {
    padding: 0;
    border: 0;
    text-align: left;
  }

  .zone-table .zone-name {
    flex: 1 1 0;
    min-width: 0;
    white-space: normal;
  }

  .zone-table .zone-action {
    max-width: 8rem;
    text-align: right;
    white-space: normal;
  }

  .zone-table .zone-faction,
  .zone-table .zone-levels,
  .zone-table .zone-xp,
  .zone-table .zone-gold {
    order: 2;
    font-size: 0.85rem;
    color: var(--text-muted);
  }

  .zone-levels::before { content: "Level "; }
  .zone-xp::after { content: " XP/hr"; }
  .zone-gold::after { content: " /hr"; }

  .zone-table .zone-farmers {
    flex-basis: 100%;
    order: 3;
    width: auto;
    min-width: 0;
  }

  .zone-table .zone-farmers:empty {
    display: none;
  }

  .zone-farmers::before {
    content: "Farming: ";
    color: var(--text-muted);
  }
}

@media (max-width: 480px) {
  .faction-columns {
    grid-template-columns: 1fr;
  }
}

.farmer-gear {
  justify-self: start;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Character sheet */

main:has(.character-sheet) {
  max-width: 1200px;
}

.sheet-subtitle {
  color: var(--text-muted);
}

.sheet-status {
  margin-top: 0.15rem;
  font-size: 0.9rem;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sheet-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  align-items: start;
}

.paper-doll,
.sheet-stats,
.sheet-panel {
  padding: 1rem;
  border: 1px solid var(--border);
  border-top: 3px solid var(--class-color);
  border-radius: var(--radius);
  background: var(--surface);
}

.paper-doll {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0.75rem;
}

.slot-column,
.slot-row,
.loot-log,
.bag {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.slot-row {
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.doll-center {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 0.5rem;
  width: 120px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* WoW item quality colors */
.q-empty { --quality: var(--border); }
.q-poor { --quality: #9d9d9d; }
.q-common { --quality: #ffffff; }
.q-uncommon { --quality: #1eff00; }
.q-rare { --quality: #0070dd; }
.q-epic { --quality: #a335ee; }

/* An item's [Name] in running text, e.g. a notice. */
.item-quality {
  color: var(--quality);
}

.slot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.25rem;
  border-radius: 6px;
  background: var(--surface-raised);
}

.slot:focus-visible {
  outline: 2px solid var(--accent);
}

.slot-right {
  flex-direction: row-reverse;
  text-align: right;
}

.item-icon {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border: 2px solid var(--quality);
  border-radius: 6px;
  background: var(--bg);
}

.item-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.icon-fallback {
  font-weight: 700;
  color: var(--quality);
}

.q-empty .icon-fallback {
  color: var(--text-muted);
}

.slot-text {
  display: grid;
  min-width: 0;
}

.slot-name {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.item-name {
  overflow: hidden;
  font-size: 0.85rem;
  color: var(--quality);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.q-empty .item-name {
  color: var(--text-muted);
}

/* Classic-style item tooltip, shown on hover or keyboard focus. */
.tooltip {
  position: absolute;
  z-index: 20;
  display: none;
  width: max-content;
  max-width: 320px;
  padding: 0.5rem 0.7rem;
  border: 1px solid #9a9a9a;
  border-radius: 6px;
  background: rgb(4 4 20 / 0.96);
  color: #ffffff;
  font-size: 0.85rem;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  pointer-events: none;
}

.slot:hover > .tooltip,
.slot:focus > .tooltip {
  display: block;
}

.slot-left .tooltip { top: 0; left: 100%; margin-left: 0.5rem; }
.slot-right .tooltip { top: 0; right: 100%; margin-right: 0.5rem; }
.slot-bottom .tooltip { bottom: 100%; left: 0; margin-bottom: 0.5rem; }

.tooltip p {
  margin: 0;
}

.tooltip .split {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
}

.tt-name {
  font-size: 1rem;
  color: var(--quality);
}

.tt-effect {
  color: #1eff00;
}

.tt-description {
  color: #ffd100;
}

.tt-origin {
  color: var(--text-muted);
}

.sheet-stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem 1.5rem;
}

.stat-group h3,
.sheet-panel h3 {
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
  color: var(--accent);
}

.stat-group dl {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.1rem 1rem;
  margin: 0;
  font-size: 0.875rem;
}

.stat-group dt {
  color: var(--text-muted);
}

.stat-group dd {
  margin: 0;
  text-align: right;
}

/* WoW quest-giver "!" that reveals an explanation on hover or keyboard focus. */
.info-mark {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  cursor: help;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: #ffd100;
  text-shadow: 0 0 2px #000, 0 0 6px rgb(255 209 0 / 0.6);
}

.info-mark:focus-visible {
  outline: 2px solid var(--accent);
  border-radius: 4px;
}

.info-mark .tooltip {
  top: 100%;
  right: 0;
  margin-top: 0.4rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  text-shadow: none;
}

.info-mark:hover > .tooltip,
.info-mark:focus > .tooltip {
  display: block;
}

/* An info mark that sits at the end of a line of text instead of a panel's corner. */
.info-mark.inline {
  position: relative;
  top: auto;
  right: auto;
  margin-left: 0.35rem;
  font-size: 1.1rem;
  vertical-align: -0.1rem;
}

.note {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sheet-panel {
  display: grid;
  gap: 0.5rem;
}

.sheet-panel .empty {
  padding: 1rem;
}

/* Quest panel sections (Quest Log, Best Rewards) are set apart by a divider. */
.sheet-quests > h3:not(:first-child) {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* Talents: sheet tile and the three-tree selector. Gold borders mark the spec's default build. */
.talent-tile {
  justify-items: start;
}

.talent-tile p {
  margin: 0;
}

.talent-tile .empty {
  padding: 0;
}

.talent-tile-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.talent-tile-body > div {
  flex: 1;
  min-width: 10rem;
}

.talent-tile-spec {
  font-weight: 600;
  color: var(--class-color);
}

.spec-icon {
  --quality: var(--class-color);
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 2px solid var(--class-color);
  border-radius: 6px;
  background: var(--bg);
}

.spec-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.talent-help {
  margin: 0 0 1rem;
}

.talent-legend {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  border: 2px solid var(--border);
  border-radius: 3px;
  box-shadow: 0 0 0 1px var(--bg), 0 0 0 3px #ffd100;
  margin: 0 0.2rem 0 0.2rem;
  vertical-align: -0.1em;
}

.talent-points-left {
  color: var(--accent);
}

.talent-trees {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.talent-tree {
  padding: 1rem;
  border: 1px solid var(--border);
  border-top: 3px solid var(--class-color);
  border-radius: var(--radius);
  background: var(--surface);
}

.talent-tree h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--accent);
}

.tree-points {
  color: var(--text-muted);
}

.talent-grid {
  display: grid;
  grid-template-columns: repeat(4, 52px);
  gap: 14px;
  justify-content: center;
}

.talent {
  position: relative;
  z-index: 1;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  /* Touch and hold removes a point, so keep the phone's text selection and callout menu out of the way. */
  -webkit-touch-callout: none;
  user-select: none;
}

.talent:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.talent-icon {
  position: absolute;
  inset: 2px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 5px;
}

.talent-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.talent.locked .talent-icon {
  filter: grayscale(1) brightness(0.5);
}

.talent.available { border-color: #1eff00; }
.talent.learned { border-color: #1eff00; }
.talent.maxed { border-color: #ffd100; }
.talent.locked { cursor: default; }

/* Default-build picks: a dashed gold ring until learned, then a solid glowing ring outside the border (kept
   apart from the maxed gold border). Unlearned icons are dimmed so learned ones stand out. */
.talent.default.available::before,
.talent.default.locked::before {
  position: absolute;
  inset: -6px;
  content: '';
  border: 2px dashed rgb(255 209 0 / 0.75);
  border-radius: 11px;
  pointer-events: none;
}

.talent.default.learned,
.talent.default.maxed {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px #ffd100, 0 0 12px 2px rgb(255 209 0 / 0.45);
}

.talent.available .talent-icon {
  filter: grayscale(0.7) brightness(0.75);
}

.talent-rank {
  position: absolute;
  right: -8px;
  bottom: -8px;
  z-index: 2;
  padding: 0 0.3rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.3;
  color: #1eff00;
}

.talent.locked .talent-rank,
.talent.available .talent-rank { color: var(--text-muted); }
.talent.maxed .talent-rank { color: #ffd100; }

.talent .tooltip {
  top: 0;
  left: 100%;
  margin-left: 0.6rem;
  min-width: 220px;
  background: rgb(4 4 20);
  font-weight: 400;
}

.talent.tip-left .tooltip {
  right: 100%;
  left: auto;
  margin-right: 0.6rem;
  margin-left: 0;
}

/* Each talent stacks at z-index 1, so the hovered one is raised to keep its tooltip above its neighbours.
   Keyboard focus only, so a clicked talent doesn't keep its tooltip open while hovering another. */
.talent:hover,
.talent:focus-visible {
  z-index: 30;
}

.talent:hover > .tooltip,
.talent:focus-visible > .tooltip {
  display: block;
}

/* Touch screens have no hover, so a tapped talent keeps showing what it does. */
@media (hover: none) {
  .talent:focus {
    z-index: 30;
  }

  .talent:focus > .tooltip {
    display: block;
  }
}

.talent .tooltip .tt-name { color: #ffffff; }
.talent .tooltip .tt-requires { color: var(--con-red); }
.talent .tooltip .tt-desc { color: #ffd100; }
.talent .tooltip .tt-next,
.talent .tooltip .tt-default,
.talent .tooltip .tt-hint { margin-top: 0.4rem; }
.talent .tooltip .tt-default { color: #ffd100; font-weight: 700; }
.talent .tooltip .tt-support { color: var(--text-muted); }
.talent .tooltip .support-full,
.talent .tooltip .tt-hint { color: #1eff00; }

.talent-arrow {
  position: relative;
  z-index: 0;
  pointer-events: none;
}

.talent-arrow::before {
  position: absolute;
  content: '';
  background: var(--border);
}

.talent-arrow.down::before {
  top: 26px;
  bottom: 26px;
  left: calc(50% - 2px);
  width: 4px;
}

.talent-arrow.across::before {
  top: calc(50% - 2px);
  right: 26px;
  left: 26px;
  height: 4px;
}

.talent-arrow.met::before {
  background: #ffd100;
}

/* Arrowhead touching the edge of the talent the arrow unlocks. */
.talent-arrow::after {
  position: absolute;
  content: '';
  border: 7px solid transparent;
}

.talent-arrow.down::after {
  bottom: 52px;
  left: calc(50% - 7px);
  border-top-color: var(--border);
  border-bottom-width: 0;
}

.talent-arrow.right::after {
  top: calc(50% - 7px);
  right: 52px;
  border-left-color: var(--border);
  border-right-width: 0;
}

.talent-arrow.left::after {
  top: calc(50% - 7px);
  left: 52px;
  border-right-color: var(--border);
  border-left-width: 0;
}

.talent-arrow.met.down::after { border-top-color: #ffd100; }
.talent-arrow.met.right::after { border-left-color: #ffd100; }
.talent-arrow.met.left::after { border-right-color: #ffd100; }

.loot-source {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.quest-log,
.quest-objectives {
  margin: 0;
  padding: 0;
  list-style: none;
}

.quest-log {
  display: grid;
  gap: 0.4rem;
}

.quest-title {
  color: var(--accent);
}

.quest-objectives {
  padding-left: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.quest-objectives .done {
  text-decoration: line-through;
}

.quest-log > li > .loot-source {
  display: block;
}

.quest-log .badge {
  font-size: 0.7rem;
}

.route-level {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

.path-mark {
  margin-left: 0.4rem;
  padding: 0 0.35rem;
  border: 1px solid #ffd100;
  border-radius: 999px;
  color: #ffd100;
  font-size: 0.7rem;
  font-weight: 600;
  vertical-align: middle;
}

.bag {
  grid-template-columns: repeat(auto-fill, 48px);
}

/* Bag, then recent loot, beside the questing panel. */
.sheet-stack {
  display: grid;
  gap: 1.5rem;
  align-content: start;
}

.bag-group + .bag-group {
  margin-top: 0.75rem;
}

.bag-label {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.bag-label.off-spec,
.bag-label.wanted-label {
  color: var(--accent);
}

.spec-picker {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.spec-picker select {
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
}

/* Paper doll and talents on top, PvP filling the rest of the column beside the stats. */
.sheet-column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1.5rem;
  align-self: stretch;
}

.sheet-pvp {
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  align-content: start;
}

.pvp-rank {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.rank-icon {
  flex: none;
  border-radius: 6px;
}

.pvp-rank-text {
  display: grid;
  flex: 1;
  gap: 0.3rem;
}

.rank-fill {
  background: linear-gradient(90deg, #b8860b, var(--accent));
}

.pvp-days {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: right;
}

.pvp-days th,
.pvp-days td {
  padding: 0.2rem 0.4rem;
}

.pvp-days thead th {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: uppercase;
}

.pvp-days tbody th {
  font-weight: 400;
  text-align: left;
  color: var(--text-muted);
}

.pvp-tally {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0;
  text-align: center;
}

.pvp-tally div {
  padding: 0.4rem;
  border-radius: 6px;
  background: var(--surface-raised);
}

.pvp-tally dt {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.pvp-tally dd {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.pvp-log {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.pvp-log li {
  display: grid;
  gap: 0.1rem;
  padding: 0.35rem 0.5rem;
  border-left: 3px solid var(--pvp-result);
  border-radius: 6px;
  background: var(--surface-raised);
  font-size: 0.85rem;
}

.pvp-win { --pvp-result: #1eff00; }
.pvp-loss { --pvp-result: #ff4040; }
.pvp-draw { --pvp-result: var(--text-muted); }

.pvp-headline {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.pvp-foe,
.pvp-when,
.pvp-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pvp-when {
  flex: none;
}

/* World PvP page */

.encounter-tally {
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  margin-bottom: 1.25rem;
}

.world-pvp > .note {
  margin-bottom: 0.75rem;
}

.pvp-standings {
  margin-bottom: 1.25rem;
}

.pvp-standings h3 {
  margin: 0 0 0.25rem;
}

.pvp-standings .note {
  margin: 0 0 0.75rem;
}

.standings-factions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1rem;
  align-items: start;
}

.standings-alliance { --faction-color: var(--alliance); }
.standings-horde { --faction-color: var(--horde); }

.standings {
  width: 100%;
  border-collapse: collapse;
  border-top: 3px solid var(--faction-color);
  border-radius: 6px;
  background: var(--surface-raised);
  font-size: 0.85rem;
  text-align: right;
}

.standings caption {
  padding-bottom: 0.3rem;
  font-weight: 700;
  text-align: left;
  color: var(--faction-color);
}

.standings th,
.standings td {
  padding: 0.3rem 0.5rem;
}

.standings thead th {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: uppercase;
}

.standings th:first-child,
.standings td:first-child {
  width: 2.5rem;
  text-align: left;
}

.standings th:nth-child(2) {
  text-align: left;
}

.standings tbody th {
  font-weight: 400;
}

.standings tbody th a {
  color: var(--class-color);
  font-weight: 700;
}

.standings-title {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.standings tbody tr + tr {
  border-top: 1px solid var(--border);
}

.standings-out {
  opacity: 0.55;
}

.encounter-list {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.encounter-alliance { --encounter-color: var(--alliance); }
.encounter-horde { --encounter-color: var(--horde); }
.encounter-none { --encounter-color: var(--text-muted); }

.encounter-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--encounter-color);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.encounter-row:hover {
  border-color: var(--encounter-color);
  background: var(--surface-raised);
}

.encounter-shape {
  flex: none;
  min-width: 4.5rem;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  background: var(--surface-raised);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.encounter-main {
  display: grid;
  flex: 1;
  min-width: 0;
}

.encounter-meta,
.encounter-when {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.encounter-when {
  flex: none;
}

.encounter-summary {
  margin-bottom: 1.25rem;
  padding: 0.6rem 0.85rem;
  border-left: 4px solid var(--encounter-color);
  border-radius: 6px;
  background: var(--surface);
}

.encounter-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.encounter-members {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.encounter-member {
  --class-color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--tile-color);
  border-radius: var(--radius);
  background: var(--surface);
}

.encounter-member.dead {
  opacity: 0.65;
}

.encounter-member .character-name {
  font-size: 1rem;
}

.encounter-member .character-name a {
  color: inherit;
}

.encounter-timeline {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.encounter-timeline li {
  display: flex;
  gap: 0.75rem;
}

.encounter-time {
  flex: none;
  min-width: 2.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.encounter-breakdown {
  --class-color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--class-color);
  border-radius: var(--radius);
  background: var(--surface);
}

.encounter-breakdown summary {
  display: grid;
  gap: 0.4rem;
  cursor: pointer;
  list-style: none;
}

.encounter-breakdown summary::-webkit-details-marker {
  display: none;
}

.encounter-breakdown summary .encounter-meta::after {
  content: ' ▸';
}

.encounter-breakdown[open] summary .encounter-meta::after {
  content: ' ▾';
}

.encounter-breakdown.dead .actor {
  text-decoration: line-through;
  text-decoration-color: var(--text-muted);
}

.breakdown-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.fate {
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fate-alive { background: color-mix(in srgb, var(--con-green) 22%, transparent); color: var(--con-green); }
.fate-died { background: color-mix(in srgb, var(--danger) 22%, transparent); color: var(--danger); }
.fate-escaped { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }

.stat-bars {
  display: grid;
  gap: 0.3rem;
}

.stat-bar {
  display: grid;
  grid-template-columns: 4rem 1fr minmax(7.5rem, auto);
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}

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

.stat-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat-bar .meter-bar {
  height: 0.7rem;
  border-radius: 999px;
}

.stat-bar .meter-bar > span {
  border-radius: 999px;
}

.meter-health.hp-high > span { background: linear-gradient(90deg, #2f9e44, #51cf66); }
.meter-health.hp-mid > span { background: linear-gradient(90deg, #e67700, #fcc419); }
.meter-health.hp-low > span { background: linear-gradient(90deg, #a61e1e, #f03e3e); }
.stat-health.hp-low .stat-value { color: var(--danger); font-weight: 600; }

.meter-heal > span {
  background: var(--healer);
}

.versus-group {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.versus-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.versus-title {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.8rem;
}

.versus-labels .versus-alliance { color: var(--alliance); }
.versus-labels .versus-horde { color: var(--horde); }

.versus-bar {
  display: flex;
  gap: 2px;
  height: 0.9rem;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.versus-bar > span {
  flex-basis: 0;
  animation: meter-grow 0.6s ease-out both;
}

.versus-bar > .versus-alliance { background: var(--alliance); transform-origin: left; }
.versus-bar > .versus-horde { background: var(--horde); transform-origin: right; }

.encounter-abilities {
  width: 100%;
  margin-top: 0.5rem;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.encounter-abilities th,
.encounter-abilities td {
  padding: 0.15rem 0.4rem;
  text-align: right;
}

.encounter-abilities th:first-child {
  text-align: left;
}

.encounter-abilities thead th {
  color: var(--text-muted);
  font-weight: 600;
}

.encounter-abilities tbody th {
  font-weight: normal;
}

.encounter-log {
  max-height: 28rem;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  font-size: 0.9rem;
}

.encounter-log li {
  display: flex;
  gap: 0.75rem;
  padding: 0.1rem 0;
}

.encounter-log li > span:nth-child(2) {
  flex: 1;
}

.encounter-log .encounter-time {
  min-width: 3.5rem;
}

.encounter-hp {
  flex: none;
  min-width: 3.5rem;
  color: var(--text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.encounter-log .encounter-mark {
  font-weight: 600;
}

/* Warcraft Logs coloring: players in their class color, abilities in their spell school's. */
.actor {
  color: var(--class-color);
  font-weight: 600;
}

/* Names everywhere: characters in their class color, guilds in their faction's (see dom.js). */
.char-name {
  color: var(--class-color);
}

.guild-name {
  color: var(--tile-color);
}

.spell {
  --school-color: var(--text);
  color: var(--school-color);
}

.school-physical { --school-color: #ffff00; }
.school-holy { --school-color: #ffe680; }
.school-fire { --school-color: #ff8000; }
.school-nature { --school-color: #4dff4d; }
.school-frost { --school-color: #80ffff; }
.school-shadow { --school-color: #8080ff; }
.school-arcane { --school-color: #ff80ff; }

.meter-bar {
  --school-color: var(--text-muted);
  display: block;
  height: 0.35rem;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}

.meter-bar > span {
  display: block;
  height: 100%;
  background: var(--school-color);
  transform-origin: left;
  animation: meter-grow 0.6s ease-out both;
}

@keyframes meter-grow {
  from { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .meter-bar > span,
  .versus-bar > span {
    animation: none;
  }
}

.meter-bar.meter-class > span {
  background: var(--class-color);
}

.encounter-share {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

.encounter-share .meter-bar {
  width: 4rem;
}

/* Dungeons page */

.dungeon-list {
  display: grid;
  gap: 0.4rem;
  margin: 1rem 0 1.5rem;
  padding: 0;
  list-style: none;
}

.dungeon-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.dungeon-queues {
  display: flex;
  flex: none;
  gap: 1rem;
}

.dungeon-queue {
  display: grid;
  min-width: 8rem;
}

.dungeon-queue .faction-name {
  margin-bottom: 0;
}

.dungeon-runs-title {
  margin-bottom: 0.75rem;
}

.dungeon-meter-boards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  gap: 1rem 1.5rem;
}

.dungeon-meter {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.dungeon-meter h4,
.dungeon-meters h3 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.dungeon-meter h4 {
  margin: 0 0 0.5rem;
}

.dungeon-meter .stat-bar {
  grid-template-columns: 6.5rem 1fr minmax(8.5rem, auto);
}

.dungeon-meter .stat-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.death-log {
  display: grid;
  gap: 0.2rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

/* Character sheet dungeon panel */

.dungeon-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.dungeon-picks {
  display: grid;
  gap: 0.35rem;
  max-height: 22rem;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.dungeon-picks > li {
  display: grid;
  gap: 0.15rem;
  padding: 0.4rem 0.6rem;
  border-left: 3px solid var(--border);
  border-radius: 6px;
  background: var(--surface-raised);
  font-size: 0.85rem;
}

.dungeon-picks > li.in-range {
  border-left-color: var(--class-color);
}

.dungeon-pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.dungeon-queued {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--class-color);
}

.dungeon-quests {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Farming For: the quests, drops and dungeons behind what the character is doing. */
.sheet-focus {
  margin-bottom: 1.5rem;
}

.focus-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  align-items: start;
}

.focus-column {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.focus-column h4 {
  margin: 0;
  font-size: 0.85rem;
}

.focus-list,
.focus-drops {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
}

.focus-dungeon {
  display: grid;
  gap: 0.3rem;
  padding: 0.4rem 0.6rem;
  border-left: 3px solid var(--class-color);
  border-radius: 6px;
  background: var(--surface-raised);
}

.focus-dungeon .slot {
  background: var(--surface);
}

.focus-scroll {
  max-height: 30rem;
  padding-right: 0.25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.focus-scroll .tooltip {
  position: fixed;
  margin: 0;
}

.focus-list > li > .loot-source {
  display: block;
}

.focus-dungeon .badge {
  font-size: 0.7rem;
}

.target-meta {
  overflow: hidden;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Wanted item: gear rows the player can click to have the character go after the item. */
.slot.wantable,
.slot.wanted {
  cursor: pointer;
}

.slot.wantable:hover {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.slot.wanted {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.slot.wanted .badge {
  font-size: 0.7rem;
}

.want-box {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1rem;
  padding: 0.6rem 0.75rem;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--surface-raised);
}

.want-box h4 {
  margin: 0;
  font-size: 0.85rem;
}

.want-box .note {
  margin: 0;
}

.want-box .slot {
  background: var(--surface);
}

.want-sources {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.want-finder {
  display: grid;
  gap: 0.35rem;
  max-width: 32rem;
}

.want-results {
  max-height: 18rem;
}

.want-results .note {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.place-drops-box summary {
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

.place-drops {
  max-height: 16rem;
  margin-top: 0.35rem;
  padding-right: 0.25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.place-drops .tooltip {
  position: fixed;
  margin: 0;
}

@media (max-width: 640px) {
  .dungeon-row {
    flex-wrap: wrap;
  }

  /* The queues take their own line, so long name lists wrap instead of running off the screen. */
  .dungeon-queues {
    flex: 1 1 100%;
    min-width: 0;
  }

  .dungeon-queue {
    flex: 1;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .encounter-sides {
    grid-template-columns: 1fr;
  }

  .encounter-row {
    flex-wrap: wrap;
  }
}

@media (min-width: 901px) {
  /* The log is sized by the column, not its entries, so a long log scrolls instead of stretching the row;
     the rest of the panel keeps its height. */
  .sheet-pvp .pvp-log {
    contain: size;
    min-height: 8rem;
  }
}

@media (max-width: 900px) {
  .sheet-layout {
    grid-template-columns: 1fr;
  }

  .talent-trees {
    grid-template-columns: 1fr;
  }

  .pvp-log {
    max-height: 24rem;
  }
}

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

  .doll-center {
    display: none;
  }

  .slot-row {
    grid-template-columns: 1fr;
  }

  /* No room beside an item or talent on a phone, so tooltips dock to the bottom of the screen. */
  .tooltip,
  .hint-text {
    position: fixed;
    inset: auto 0.5rem 0.5rem !important;
    width: auto;
    min-width: 0;
    max-width: none;
    max-height: 60vh;
    margin: 0 !important;
    overflow: hidden;
    background: rgb(4 4 20);
    transform: none;
  }

  /* The nav gets its own row, its links splitting it evenly. */
  .site-nav {
    flex: 1 1 100%;
  }

  .site-nav a {
    flex: 1;
    padding-inline: 0.25rem;
    text-align: center;
    white-space: nowrap;
  }
}

/* Touch screens: controls at least 44px tall (Apple's and WCAG's touch target size), and form controls at
   16px so iOS doesn't zoom in when one is tapped. */
@media (pointer: coarse) {
  .button,
  .chip,
  .site-nav a,
  .sort-control select,
  .spec-picker select {
    min-height: 2.75rem;
  }

  .site-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sort-control select,
  .spec-picker select,
  input[type="search"] {
    font-size: 1rem;
  }

  .notice-close {
    min-width: 2.75rem;
    min-height: 2.75rem;
    margin: -0.6rem -0.75rem -0.6rem 0;
  }

  /* Small links get a bigger tap area without moving anything around them. */
  .farmer-gear,
  .site-footer a {
    padding-block: 0.6rem;
    margin-block: -0.6rem;
  }

  #app a:not([class]),
  #app a.char-name,
  .notice a {
    padding-block: 0.35rem;
  }

  .quest-hint {
    padding: 0.4rem;
    margin: -0.4rem -0.1rem;
  }
}
