:root {
  --bg: #f4f1e8;
  --panel: #fffdf6;
  --ink: #23201a;
  --muted: #6b6455;
  --line: #d8d0bc;
  --head: #2c3e6b;
  --head-ink: #f4f1e8;
  --accent: #8a5a12;
  --link: #1d4f91;
  --stripe: #f0ebdc;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c;
    --panel: #1d2027;
    --ink: #e4e0d4;
    --muted: #9a9484;
    --line: #333845;
    --head: #222c47;
    --head-ink: #e4e0d4;
    --accent: #d9a648;
    --link: #8db4ec;
    --stripe: #21252e;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 Verdana, Geneva, "DejaVu Sans", sans-serif;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding: 0.6rem 1rem;
  background: var(--head);
  color: var(--head-ink);
}

header a {
  color: var(--head-ink);
}

.brand {
  font: bold 1.4rem Georgia, "Times New Roman", serif;
  letter-spacing: 0.02em;
}

header .brand {
  color: #e0566f;
}

.brand small {
  margin-left: 0.35rem;
  font: italic 0.75rem Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  color: var(--head-ink);
  opacity: 0.75;
}

header nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

header .rank {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9em;
}

header .rank output {
  min-width: 2.2em;
  font-weight: bold;
  color: var(--accent);
}

header .rank input {
  width: 7rem;
  padding: 0;
  border: none;
  background: none;
  accent-color: var(--accent);
}

/* Values rewritten by the rank slider are highlighted once they differ from base. */
span.up.changed {
  color: var(--accent);
  font-weight: bold;
}

table.upgrades tbody tr.current td {
  background: var(--head);
  color: var(--head-ink);
}

.quick {
  display: flex;
  gap: 0.25rem;
}

input,
select,
button {
  font: inherit;
  padding: 0.25rem 0.4rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
}

button {
  cursor: pointer;
}

main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem;
  overflow-x: auto;
}

h1 {
  margin: 0.5rem 0 0.75rem;
  font: bold 1.5rem Georgia, "Times New Roman", serif;
}

h2 {
  margin: 1.5rem 0 0.5rem;
  font: bold 1.1rem Georgia, "Times New Roman", serif;
  color: var(--accent);
}

h1 small,
h2 small {
  font: normal 0.8rem Verdana, Geneva, sans-serif;
  color: var(--muted);
}

.lede,
.status {
  color: var(--muted);
}

.classes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.5rem;
  padding: 0;
  list-style: none;
}

.classes a {
  display: block;
  padding: 0.5rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.classes span {
  display: block;
  font-size: 0.85em;
  color: var(--muted);
}

ul.recent {
  columns: 16rem;
  padding-left: 0;
  list-style: none;
}

ul.recent li {
  margin-bottom: 0.3rem;
  white-space: nowrap;
}

ul.recent .icon {
  --icon-scale: 0.6;
  margin-right: 0.4rem;
}

ul.recent small {
  color: var(--muted);
}

.levels {
  line-height: 1.9;
}

.levels a {
  display: inline-block;
  min-width: 1.8rem;
  padding: 0 0.25rem;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
}

table {
  border-collapse: collapse;
  background: var(--panel);
}

table.list {
  width: 100%;
}

table.narrow {
  width: auto;
  min-width: 24rem;
}

th,
td {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

thead th {
  background: var(--head);
  color: var(--head-ink);
  white-space: nowrap;
}

tr.level th {
  background: var(--stripe);
  color: var(--accent);
}

table.list tbody tr:nth-child(even) td {
  background: var(--stripe);
}

table.attrs th {
  width: 10rem;
  background: var(--stripe);
  white-space: nowrap;
}

table.slots td:nth-child(n + 3),
table.raw td:first-child {
  text-align: right;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  color: var(--muted);
}

table.raw td:last-child {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  word-break: break-all;
}

.search {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.search label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.85em;
  color: var(--muted);
}

.search input[type="number"] {
  width: 5.5rem;
}

.search select {
  max-width: 16rem;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.tabs a {
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  background: var(--stripe);
}

.tabs a[aria-current="page"] {
  background: var(--head);
  color: var(--head-ink);
}

table.history td.date {
  white-space: nowrap;
  color: var(--muted);
}

.patch h3 {
  margin: 1rem 0 0.4rem;
  font-size: 1rem;
}

ul.spells {
  columns: 16rem;
  padding-left: 1.2rem;
}

ul.spells .more {
  list-style: none;
  color: var(--muted);
}

.description {
  max-width: 52rem;
  margin-bottom: 0.75rem;
  font-style: italic;
}

.description p {
  margin: 0 0 0.4rem;
}

.spell-tip {
  position: fixed;
  z-index: 10;
  width: 24rem;
  max-width: calc(100vw - 2rem);
  padding: 0.6rem 0.75rem;
  font-size: 0.9em;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.tip-head {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-bottom: 0.4rem;
}

/* Icons come from icons.css when the build has them; without it the spans
   collapse to nothing. */
.icon {
  vertical-align: middle;
}

h1 .icon {
  margin-right: 0.5rem;
}

/* Small icons scale the whole sprite down so each tile stays complete; the
   sprite is 16 tiles wide, and icons.css positions in full-size pixels, so
   the positions are scaled by the same factor. */
td.named .icon,
span.named .icon {
  --icon-scale: 0.6;
  margin-right: 0.4rem;
}

span.named {
  white-space: nowrap;
}

.tip-icon {
  flex: none;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.tip-name {
  color: var(--accent);
  font-size: 1.05em;
}

.tip-classes {
  color: var(--muted);
}

.tip-classes.none {
  color: #c0392b;
}

.tip-stats {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.1rem 0.75rem;
  margin: 0 0 0.4rem;
}

.tip-stats dt {
  color: var(--muted);
}

.tip-stats dd {
  margin: 0;
}

.tip-desc {
  margin: 0.3rem 0 0;
  font-style: italic;
}

.notice {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  background: var(--panel);
}

.search label.check {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.toggle {
  display: block;
  margin: 0.5rem 0;
  color: var(--muted);
}

caption {
  padding: 0.3rem 0;
  text-align: left;
  font-weight: bold;
  color: var(--muted);
}

.stack-rules h3 {
  margin: 0.75rem 0 0.3rem;
  font-size: 1rem;
}

.applied-rules p {
  margin: 0.25rem 0;
}

.stack-list {
  margin-bottom: 1rem;
}

.stack-list button {
  margin-top: 0.4rem;
}

table.list tbody tr.own td {
  background: var(--head);
  color: var(--head-ink);
}

tr.own a {
  color: var(--head-ink);
  font-weight: bold;
}

table.list tbody tr.gap td {
  text-align: center;
  font-style: italic;
  color: var(--muted);
  background: var(--panel);
}

td.note {
  color: var(--muted);
  white-space: nowrap;
}

tr.own td.note {
  color: var(--head-ink);
}

footer {
  max-width: 72rem;
  margin: 2rem auto 1rem;
  padding: 0 1rem;
  font-size: 0.8em;
  color: var(--muted);
}
