@font-face { font-family: "Sprout"; src: url("fonts/sprout-8x14.ttf") format("truetype"); font-display: block; }

:root {
  --panel: #f2dcb1; --frame: #563729; --inner: #e1c28c; --line: #e1c28c; --hover: #e5c992; --on: #fbe7a8; --tag: #6b4636;
  --ink: #483129; --muted: #7d5e49; --title: #563729; --accent: #b86f12; --hurt: #c94c36;
  --good: #79c257; --amber: #e6b53d; --crit: #dd6650; --track: #e3c690; --bar: #6b5145;
  --chip-ready: #4f7a33; --chip-shield: #3f7099; --chip-buff: #94661a;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: #9bd4c3; overscroll-behavior: none; }
body { font: 18px/1.1 "Jersey 15", "Sprout", monospace; color: var(--ink); -webkit-font-smoothing: none; }
h1, h2, h3, h4, p { margin: 0; font-weight: 400; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; touch-action: none; cursor: grab; }

.panel {
  background: var(--panel);
  border: 2px solid var(--frame);
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px var(--panel), inset 0 0 0 4px var(--inner), 0 3px 0 rgba(60, 38, 30, .45);
}

/* Panel titles are tags hung on the top of the frame. */
h2 { width: fit-content; margin: -20px 0 8px -4px; padding: 2px 8px; font: 16px/1 "Silkscreen", "Sprout", monospace; color: #fbecc9; background: var(--tag); border-radius: 3px; }
h4 { font-size: 20px; margin-top: 9px; color: var(--title); }

#brand { position: fixed; left: 14px; top: 14px; width: 244px; padding: 11px 14px 10px; }
#brand h1 { font: 24px/1 "Silkscreen", "Sprout", monospace; color: var(--title); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 9px; }
.stats div, .nums div { display: flex; flex-direction: column; min-width: 0; }
.stats b, .nums b { font-weight: 400; font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.stats span, .nums span { font-size: 16px; color: var(--muted); }
#stat-deaths { color: var(--hurt); }

#finder { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); width: min(300px, 34vw); }
#search { width: 100%; height: 40px; padding: 0 14px; outline: none; }
#search::placeholder { color: var(--muted); }
#results { margin-top: 6px; padding: 7px; }
#results button { display: flex; justify-content: space-between; gap: 10px; width: 100%; padding: 5px 8px; background: none; border: 0; border-radius: 3px; }
#results button:hover { background: var(--hover); }
#results em { font-style: normal; color: var(--muted); }
#results p { padding: 5px 8px; color: var(--muted); }

#right { position: fixed; right: 14px; top: 14px; bottom: 14px; width: 248px; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; pointer-events: none; }
#right section { padding: 13px 13px 11px; pointer-events: auto; }
#live { display: flex; flex-direction: column; max-height: 32vh; min-height: 0; }

#board button { display: grid; grid-template-columns: 16px 8px 1fr auto; align-items: center; gap: 6px; width: 100%; padding: 2px 5px; background: none; border: 0; text-align: left; border-radius: 3px; }
#board button:hover { background: var(--hover); }
#board button.on { background: var(--on); }
#board i { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
#board span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#board em { font-style: normal; color: var(--accent); font-variant-numeric: tabular-nums; }
#board .dead span { color: var(--muted); text-decoration: line-through; }
.gem { display: block; width: 8px; height: 8px; box-shadow: 0 0 0 1px rgba(40, 26, 20, .4); }
.gem.warrior { background: #d9744c; } .gem.archer { background: #79b85c; } .gem.mage { background: #a48aeb; }
.gem.paladin { background: #e5b13f; } .gem.bard { background: #ea84ae; } .gem.rock_bard { background: #54ade6; }

#feed { overflow: hidden; min-height: 0; -webkit-mask-image: linear-gradient(#000 78%, transparent); mask-image: linear-gradient(#000 78%, transparent); }
.ev { padding: 4px 3px; color: var(--muted); animation: ev-in .22s cubic-bezier(.2, .8, .3, 1); }
.ev + .ev { border-top: 2px solid var(--line); }
@keyframes ev-in { from { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .ev { animation: none; } }
.ev b { font-weight: 400; color: var(--ink); }
.ev b[style], #c-gear b[style] { filter: brightness(.72) saturate(1.4); }
.ev.link { cursor: pointer; }
.ev.link:hover { background: var(--hover); }
.ev.death b:first-child { color: var(--hurt); }
.ev.boss b, .ev.legend b { color: var(--accent); }
.ev.legend { color: var(--ink); background: var(--on); }

#card { position: fixed; left: 14px; bottom: 14px; width: 312px; padding: 13px 14px; }
#card-close { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; }
#card-close:hover { color: var(--hurt); }
.head { display: flex; gap: 10px; align-items: center; }
.portrait { flex: none; width: 72px; height: 72px; background: var(--track); border-radius: 4px; overflow: hidden; }
#c-face { display: block; width: 72px; height: 72px; image-rendering: pixelated; }
.who { min-width: 0; padding-right: 18px; }
#c-name { font: 16px/1.1 "Silkscreen", "Sprout", monospace; color: var(--title); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub { color: var(--muted); margin-top: 3px; }
#c-class { font-weight: 400; }
.act { margin-top: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.chips:empty { display: none; }
.chip { padding: 1px 7px; font-size: 16px; line-height: 16px; color: var(--muted); background: var(--track); border-radius: 3px; font-variant-numeric: tabular-nums; }
.chip.ready { color: var(--chip-ready); } .chip.shield { color: var(--chip-shield); } .chip.buff { color: var(--chip-buff); }
.bar { position: relative; height: 16px; margin-top: 9px; background: var(--bar); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; }
.bar.hp i { background: var(--good); } .bar.hp i.low { background: var(--amber); } .bar.hp i.crit { background: var(--crit); }
.bar.xp { height: 6px; margin-top: 3px; } .bar.xp i { background: var(--amber); }
.bar span { position: absolute; inset: 0; text-align: center; font-size: 16px; line-height: 15px; color: #fff; font-variant-numeric: tabular-nums; text-shadow: 0 1px 0 rgba(0, 0, 0, .55); }
.nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 9px; }
#c-gear { margin-top: 9px; padding-top: 7px; border-top: 2px solid var(--line); }
.gear { display: flex; justify-content: space-between; gap: 10px; padding: 1px 0; }
.gear b { font-weight: 400; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gear em { flex: none; font-style: normal; color: var(--muted); text-transform: capitalize; }
.gear.empty b { color: var(--muted); }
#c-log { margin-top: 3px; color: var(--muted); }
#c-log div { padding: 1px 0; }

#tip { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); padding: 7px 14px; pointer-events: none; white-space: nowrap; color: var(--muted); }
#tip b { font-weight: 400; color: var(--title); margin-right: 6px; }
#zoom { position: fixed; right: 274px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
#zoom button { width: 38px; height: 38px; padding: 0; font-size: 24px; line-height: 1; color: var(--title); }
#zoom button:hover { background: var(--hover); }

body.clean #brand, body.clean #right, body.clean #finder, body.clean #card { display: none; }
body.clean #zoom { right: 16px; }

@media (max-width: 820px) {
  #brand { left: 8px; right: 8px; top: calc(8px + env(safe-area-inset-top)); width: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; }
  #brand h1 { font-size: 16px; white-space: nowrap; }
  .stats { margin-top: 0; gap: 10px; }
  .stats b { font-size: 20px; }
  .stats span { font-size: 14px; }
  .stats div { align-items: flex-end; }
  #finder { top: calc(64px + env(safe-area-inset-top)); left: 8px; right: 56px; width: auto; transform: none; }
  #right { top: auto; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; }
  /* On a phone only the season strip of this panel shows: the leaderboard would cover half the map. */
  #right #top { padding: 7px 10px 6px; }
  #top h2, #top #board { display: none; }
  #right #live { max-height: 112px; padding-top: 9px; }
  #live h2 { display: none; }
  body.has-card #right { display: none; }
  #card { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; max-height: 56vh; overflow: auto; }
  #zoom { top: calc(64px + env(safe-area-inset-top)); right: 8px; bottom: auto; }
  #tip { display: none; }
  body.clean #zoom { right: 8px; }
}
