:root {
  --bg: #0e0c0a;
  --panel: #17140f;
  --panel-2: #201b14;
  --line: #3a3124;
  --text: #ece3d0;
  --muted: #a89a80;
  --gold: #e2b866;
  --green: #5fbf5a;
  --accent: var(--gold);
  --cell: 54px;
  color-scheme: dark;
}
[data-class="warrior"] { --accent: #c69b6d; }
[data-class="paladin"] { --accent: #f48cba; }
[data-class="hunter"] { --accent: #aad372; }
[data-class="rogue"] { --accent: #fff468; }
[data-class="priest"] { --accent: #ffffff; }
[data-class="shaman"] { --accent: #2f8fff; }
[data-class="mage"] { --accent: #3fc7eb; }
[data-class="warlock"] { --accent: #8788ee; }
[data-class="druid"] { --accent: #ff7c0a; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--gold); }
h1, h2, h3, .brand { font-family: "Cinzel", Georgia, serif; letter-spacing: 0.02em; }

.site-head {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1120px; margin: 0 auto; padding: 14px 16px;
}
.brand { color: var(--gold); text-decoration: none; font-size: 1.25rem; font-weight: 700; }
.site-head nav a { color: var(--muted); text-decoration: none; margin-left: 18px; font-size: 0.95rem; }

main { max-width: 1120px; margin: 0 auto; padding: 0 16px 48px; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin: 18px 0 6px; }
.hero p { color: var(--muted); margin: 0 0 18px; max-width: 760px; }
.hero .build { color: var(--gold); white-space: nowrap; }

.class-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.class-tabs a {
  --c: var(--gold);
  display: inline-block; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--c); text-decoration: none; font-weight: 600; font-size: 0.92rem;
}
.class-tabs a[aria-current="page"] { background: var(--c); color: #111; border-color: var(--c); }

.toolbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px;
  padding: 10px 14px; margin-bottom: 14px;
  background: rgba(23, 20, 15, 0.94); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 10px;
}
.toolbar .stat { color: var(--muted); font-size: 0.9rem; }
.toolbar .stat b { color: var(--text); font-size: 1.1rem; margin-left: 4px; }
.toolbar .actions { margin-left: auto; display: flex; gap: 8px; }
button { font: inherit; cursor: pointer; }
.btn {
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text);
}
.btn.primary { background: var(--accent); color: #111; border-color: var(--accent); font-weight: 600; }

#calc { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.tree {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 14px;
}
.tree header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tree header img { border-radius: 6px; }
.tree h3 { margin: 0; font-size: 1.05rem; color: var(--accent); }
.tree-pts { margin-left: auto; font-weight: 700; color: var(--text); }
.reset-tree { background: none; border: 0; color: var(--muted); font-size: 0.8rem; padding: 2px 4px; }
.reset-tree:hover { color: var(--text); }

.grid {
  position: relative; display: grid;
  grid-template-columns: repeat(4, var(--cell)); grid-template-rows: repeat(7, var(--cell));
}
.arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.arrows path { fill: none; stroke: #4a3f2e; stroke-width: 4px; vector-effect: non-scaling-stroke; }
.arrows path.on { stroke: var(--gold); }

.talent {
  position: relative; z-index: 1; place-self: center;
  width: 44px; height: 44px; padding: 0; border-radius: 7px;
  border: 2px solid #4d4434; background: #000;
}
.talent img { display: block; width: 40px; height: 40px; border-radius: 5px; }
.talent .rank {
  position: absolute; right: -8px; bottom: -8px;
  min-width: 26px; padding: 0 4px; border-radius: 6px;
  background: #0b0a08; border: 1px solid #4d4434;
  font-size: 0.72rem; font-weight: 700; line-height: 16px; color: var(--muted);
}
.talent.locked img { filter: grayscale(1) brightness(0.45); }
.talent.open { border-color: var(--green); }
.talent.open .rank { color: var(--green); border-color: var(--green); }
.talent.partial { border-color: var(--green); box-shadow: 0 0 8px rgba(95, 191, 90, 0.45); }
.talent.partial .rank { color: var(--green); border-color: var(--green); }
.talent.maxed { border-color: var(--gold); box-shadow: 0 0 10px rgba(226, 184, 102, 0.55); }
.talent.maxed .rank { color: var(--gold); border-color: var(--gold); }
.talent:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

#tip {
  position: fixed; z-index: 20; width: 300px; max-width: calc(100vw - 16px);
  padding: 10px 12px; border-radius: 10px;
  background: #0b0a08; border: 1px solid #5a4d36; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  font-size: 0.9rem; pointer-events: none;
}
.tip-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.tip-head img { border-radius: 6px; }
.tip-head strong { display: block; color: #fff; }
.tip-head span { color: var(--muted); font-size: 0.82rem; }
#tip p { margin: 4px 0; white-space: pre-line; }
#tip .req { color: #ff6b5e; }
#tip .desc { color: var(--gold); }
#tip .next-label { color: var(--muted); margin-top: 8px; font-size: 0.82rem; }
.tip-actions { display: flex; gap: 8px; margin-top: 10px; }
.tip-actions button { flex: 1; padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); }
.tip-actions button:disabled { opacity: 0.4; }

#flash {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30;
  padding: 8px 16px; border-radius: 999px; background: var(--gold); color: #111; font-weight: 600;
}

.content { max-width: 760px; margin: 40px auto 0; }
.content h2 { font-size: 1.35rem; margin: 32px 0 8px; color: var(--gold); }
.content p, .content li { color: #d6ccb6; }
.content dt { font-weight: 700; margin-top: 14px; }
.content dd { margin: 4px 0 0; color: #d6ccb6; }
.content h3 { font-size: 1.1rem; margin: 26px 0 8px; color: var(--accent); }
.content h3 small { font-family: system-ui, sans-serif; font-size: 0.8rem; color: var(--muted); letter-spacing: 0; font-weight: 400; margin-left: 6px; }
.new-list { list-style: none; padding: 0; margin: 0 0 12px; }
.new-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.new-list li:first-child { border-top: 0; }
.new-list img { flex: none; border-radius: 6px; border: 1px solid #4d4434; }
.new-list div { min-width: 0; }
.new-list b { color: #fff; }
.new-list .meta { color: var(--muted); font-size: 0.85rem; }
.new-list .was { display: block; color: var(--muted); font-size: 0.85rem; font-style: italic; }
.new-list p { margin: 4px 0 0; color: var(--gold); font-size: 0.93rem; overflow-wrap: anywhere; }
.crumbs { margin-top: 10px; font-size: 0.88rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.preview-note { margin: 10px 0 0; padding: 6px 12px; border: 1px dashed #ff6b5e; border-radius: 8px; color: #ff6b5e; font-size: 0.9rem; }
.site-foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
.site-foot div { max-width: 1120px; margin: 0 auto; padding: 18px 16px 10px; }

/* level selector, Classic comparison, saved builds */
.toolbar select {
  margin-left: 4px; padding: 2px 4px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit; font-weight: 700;
}
.toolbar .actions { flex-wrap: wrap; }
.btn[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
#compare-legend { margin: -6px 0 12px; font-size: 0.85rem; color: var(--muted); }
.tag-new { display: inline-block; padding: 0 4px; border-radius: 4px; background: var(--gold); color: #111; font-size: 0.68rem; font-weight: 800; line-height: 15px; }
.tag-changed { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #6fb3ff; }
.talent.is-new::before, .talent.is-changed::before { content: ""; position: absolute; z-index: 2; pointer-events: none; }
.talent.is-new::before {
  content: "NEW"; left: -7px; top: -8px; padding: 0 3px; border-radius: 4px;
  background: var(--gold); color: #111; font-size: 0.6rem; font-weight: 800; line-height: 13px;
}
.talent.is-changed::before { left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: #6fb3ff; border: 1px solid #0b0a08; }
.comparing .talent:not(.is-new):not(.is-changed) img { opacity: 0.55; }
#tip .classic { color: #6fb3ff; font-size: 0.85rem; }
.builds { margin: -4px 0 14px; font-size: 0.92rem; }
.builds summary { cursor: pointer; color: var(--muted); width: max-content; }
.builds form { display: flex; gap: 8px; margin: 10px 0; max-width: 420px; }
.builds input {
  flex: 1; min-width: 0; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font: inherit;
}
#build-list { list-style: none; margin: 0; padding: 0; max-width: 620px; }
#build-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 0; border-top: 1px solid var(--line); }
#build-list .link { background: none; border: 0; padding: 0; color: var(--gold); text-decoration: underline; text-align: left; overflow-wrap: anywhere; }
#build-list .meta { color: var(--muted); font-size: 0.85rem; }
#build-list .btn { margin-left: auto; padding: 3px 10px; font-size: 0.82rem; }
#build-list .empty { color: var(--muted); }

/* feedback */
.site-head nav { display: flex; align-items: center; }
.nav-btn { margin-left: 18px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 0.9rem; }
.nav-btn:hover { border-color: var(--gold); }
#tip.interactive { pointer-events: auto; }
#tip .tip-report { margin: 8px 0 0; text-align: right; }
#tip .tip-report button { background: none; border: 0; padding: 0; color: var(--muted); font-size: 0.8rem; text-decoration: underline; }
#tip .tip-report button:hover { color: var(--text); }
#feedback {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0;
  border: 1px solid #5a4d36; border-radius: 14px; background: var(--panel); color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}
#feedback::backdrop { background: rgba(0, 0, 0, 0.6); }
#fb-form { display: flex; flex-direction: column; padding: 18px 20px 20px; }
#fb-form h2 { margin: 0 0 10px; font-size: 1.25rem; color: var(--gold); }
#fb-form label { margin-top: 10px; font-weight: 600; font-size: 0.92rem; }
#fb-form select, #fb-form textarea, #fb-form input {
  margin-top: 4px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; width: 100%;
}
#fb-form textarea { resize: vertical; min-height: 110px; }
#fb-form small { color: var(--muted); font-size: 0.8rem; margin-top: 3px; }
.fb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.fb-context-label { margin: 14px 0 2px; color: var(--muted); font-size: 0.82rem; }
#fb-context { margin: 0; padding-left: 18px; color: var(--muted); font-size: 0.82rem; }
#fb-context code { color: var(--text); overflow-wrap: anywhere; }
#fb-status { min-height: 1.4em; margin: 10px 0 0; font-size: 0.9rem; }
#fb-status.ok { color: var(--green); }
#fb-status.err { color: #ff6b5e; }
.fb-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.fb-actions a { margin-right: auto; color: var(--muted); font-size: 0.85rem; }
.fb-actions .btn:disabled { opacity: 0.6; cursor: progress; }
.site-foot a { color: var(--muted); }

/* content pages: races, abilities, beta changes */
.content.wide { max-width: 1000px; }
.content h3 a { color: inherit; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 16px; max-width: 1120px; margin: 0 auto; padding: 0 16px 18px; }
.foot-links a { color: var(--muted); }
.table-wrap { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--line); border-radius: 10px; }
.table-wrap table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.table-wrap caption { caption-side: bottom; text-align: left; padding: 8px 10px; color: var(--muted); font-size: 0.82rem; }
.table-wrap th, .table-wrap td { padding: 7px 8px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.table-wrap thead th { border-top: 0; background: var(--panel-2); white-space: nowrap; }
.matrix td { text-align: center; white-space: nowrap; }
.matrix td.yes { color: var(--text); }
.matrix td.new { color: #111; background: var(--gold); font-weight: 700; font-size: 0.78rem; }
.matrix th[scope="row"] { white-space: nowrap; }
.matrix th[scope="row"] a { color: var(--text); }
.faction { display: block; font-size: 0.75rem; font-weight: 400; color: var(--muted); }
.faction.alliance { color: #7fb0ff; }
.faction.horde { color: #ff8a7a; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.race { scroll-margin-top: 12px; }
.ability-list { list-style: none; padding: 0; margin: 0 0 12px; }
.ability-list li { padding: 9px 0; border-top: 1px solid var(--line); }
.ability-list li:first-child { border-top: 0; }
.ability-list b { color: #fff; }
.ability-list .meta, .race .meta { color: var(--muted); font-size: 0.85rem; }
.ability-list p { margin: 4px 0 0; color: var(--gold); font-size: 0.93rem; overflow-wrap: anywhere; }
.ability-list p.was { color: var(--muted); font-style: italic; font-size: 0.85rem; }
.variants { margin: 4px 0 0; padding-left: 18px; color: var(--gold); font-size: 0.93rem; }
.badge { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 800; line-height: 17px; vertical-align: 1px; text-transform: uppercase; letter-spacing: 0.03em; }
.badge.new { background: var(--gold); color: #111; }
.badge.changed { background: #6fb3ff; color: #111; }
.badge.removed { background: #ff6b5e; color: #111; }
.facts li { margin: 6px 0; }
.hub-class h3 small, .build-pair h2 small { font-family: system-ui, sans-serif; font-size: 0.8rem; color: var(--muted); letter-spacing: 0; font-weight: 400; margin-left: 6px; }
.diff del { color: #ff8a7a; text-decoration: line-through; }
.diff .was { color: var(--muted); font-style: italic; }
.diff ins { color: var(--green); text-decoration: none; background: rgba(95, 191, 90, 0.15); }
.hero del { color: #ff8a7a; }
.hero ins { color: var(--green); text-decoration: none; }

@media (max-width: 760px) {
  .site-head nav a, .nav-btn { margin-left: 12px; font-size: 0.88rem; }
  .nav-btn { padding: 3px 10px; }
  :root { --cell: 50px; }
  .toolbar { gap: 4px 14px; padding: 8px 10px; }
  .toolbar .stat { font-size: 0.8rem; }
  .toolbar .stat b { font-size: 0.95rem; }
  .toolbar .actions { gap: 6px; }
  .toolbar .actions .btn { padding: 5px 10px; font-size: 0.85rem; }
  #tip { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto; max-width: none;
         border-radius: 14px 14px 0 0; pointer-events: auto; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}
@media (pointer: coarse) { #tip { pointer-events: auto; } }
