@font-face {
  font-family: "Press Start 2P";
  src: url("pixel-font.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #111510;
  --panel: #1b2119;
  --border: #414b35;
  --muted: #a0aa91;
  --text: #e8ead7;
  --gold: #e8bf67;
  --green: #bed78a;
  --pixel: "Press Start 2P", monospace;
  font: 14px ui-monospace, "Cascadia Code", "DejaVu Sans Mono", monospace;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
html:has(dialog[open]), body:has(dialog[open]) { overflow: hidden; overscroll-behavior: none; }
body {
  margin: 0;
  background-image: radial-gradient(#81916b14 1px, transparent 1px);
  background-size: 8px 8px;
}
main { width: min(100% - 48px, 1000px); margin: auto; padding: 36px 0; }
a { color: var(--gold); text-underline-offset: 4px; }
a:hover { color: #ffe3a4; }
button, select { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 3px solid var(--gold); outline-offset: 5px; }
h1, h2, p { margin: 0; }
h2 { font-size: 18px; font-weight: 600; }
p { line-height: 1.8; }
.masthead { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 24px; text-align: center; margin-bottom: 28px; }
h1 {
  font: 400 clamp(22px, 4.7vw, 44px) / 1.65 var(--pixel);
  letter-spacing: -2px;
  color: #f1edd4;
  text-shadow: 0 4px #5e6544;
}
h1 span { color: var(--gold); text-shadow: 0 4px #76562d; }
.tagline { max-width: 58ch; margin: 8px auto 12px; color: var(--muted); font-size: 13px; }
.masthead-links { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px 22px; margin-top: 8px; font-size: 12px; }
.contact-link { display: inline-flex; align-items: center; justify-content: center; padding: 3px; }
.record-bars { position: relative; isolation: isolate; max-width: 600px; margin: 20px auto 0; padding: 0 8px; }
.record-bars::before { content: ""; position: absolute; z-index: -1; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 120px; height: 150px; background: url("mage-ad7c6d58.png") no-repeat 0 -150px / 2560px 1280px; image-rendering: pixelated; opacity: .16; pointer-events: none; }
.record-bar + .record-bar { margin-top: 10px; }
.record-label { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.record-label strong { color: var(--gold); }
.record-track { height: 14px; border: 1px solid var(--border); background: var(--bg); overflow: hidden; }
.record-fill { display: block; height: 100%; width: 0; background: var(--green); }
.record-scale { position: relative; height: 30px; font-size: 10px; color: var(--muted); }
.record-start, .record-mid, .record-end { position: absolute; top: 13px; }
.record-start { left: 0; }
.record-mid { left: 48%; transform: translateX(-50%); }
.record-end { right: 0; }
.record-marker { position: absolute; top: -2px; left: 0; transform: translateX(-50%); color: var(--gold); line-height: 1; font-size: 12px; }
.depth-gauge { width: 200px; color: var(--gold); }
.depth-label { font-size: 11px; color: var(--muted); }
.depth-gauge svg { display: block; width: 100%; margin-top: 12px; overflow: visible; }
.depth-track, .depth-progress { fill: none; stroke-width: 8; }
.depth-track { stroke: var(--border); }
.depth-progress { stroke: var(--green); }
.depth-ticks path { fill: none; stroke: var(--muted); stroke-width: 2; }
.depth-ticks text { fill: var(--muted); font: 10px ui-monospace, monospace; }
.depth-pointer { fill: var(--gold); }
.depth-pivot { fill: var(--bg); stroke: var(--gold); stroke-width: 3; }
.depth-reading { margin-top: -3px; font-size: 12px; }
.depth-reading strong { font: 14px / 1.8 var(--pixel); }
.depth-reading span { color: var(--muted); }
.about-dialog { width: min(720px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow-y: auto; overscroll-behavior: contain; padding: 24px; border: 1px solid var(--border); background: var(--panel); color: var(--text); text-align: left; }
.about-dialog::backdrop { background: #000b; }
.about-dialog .section-heading { flex-wrap: wrap; padding-right: 32px; }
.dialog-close { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 26px; line-height: 1; }
.dialog-close:hover { color: var(--gold); }
.about-dialog form { margin: 0; }
.about-copy { font-size: 12px; }
.about-copy p + p { margin-top: 12px; }
.about-copy blockquote { margin: 16px 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--border); color: var(--muted); }
.about-copy blockquote p { margin: 0; }
.about-copy h3 { margin: 20px 0 6px; font-size: 13px; line-height: 1.6; }
.player-panel { border: 2px solid #586148; background: var(--panel); box-shadow: 5px 5px 0 #070a07; }
.player-screen { position: relative; aspect-ratio: 16 / 10; min-height: 220px; background: #0a0e0a; }
video { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: contain; background: #080a08; image-rendering: pixelated; }
.player-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; }
.pixel-label { font: 12px / 2 var(--pixel); color: var(--muted); }
.play-button { position: absolute; inset: 0; margin: auto; width: max-content; height: max-content; display: flex; flex-direction: column; align-items: center; gap: 22px; border: 0; background: transparent; color: var(--text); font-family: var(--pixel); font-size: 10px; text-shadow: 2px 2px #000; padding: 12px; }
.play-icon { display: grid; place-items: center; width: 88px; height: 72px; background: var(--gold); box-shadow: 5px 5px 0 #433820, 0 0 0 2px #15170f; }
.play-icon::after { content: ""; border-top: 14px solid transparent; border-bottom: 14px solid transparent; border-left: 22px solid #222618; margin-left: 6px; }
.play-button:hover .play-icon { background: #ffdb87; transform: translate(-2px, -2px); box-shadow: 7px 7px 0 #433820; }
.player-caption { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); }
.player-caption:has(#details:empty) { display: none; }
#details { font-size: 11px; color: var(--muted); }
.playback-speed { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.playback-speed select { padding: 6px 8px; border: 1px solid var(--border); background: var(--bg); color: var(--gold); border-radius: 0; }
.playback-speed select:disabled { cursor: default; opacity: .5; }
.run-navigation { display: flex; justify-content: space-between; margin-top: 8px; }
.run-navigation-next { display: flex; align-items: center; gap: 12px; }
.run-arrow { display: grid; place-items: center; width: 36px; height: 32px; padding: 0; border: 1px solid var(--border); background: var(--panel); color: var(--gold); font-size: 26px; line-height: 1; }
.run-arrow:hover:not(:disabled) { border-color: var(--gold); }
.run-arrow:disabled { color: var(--muted); opacity: .35; cursor: default; }
.message:empty, .update-notice:has(#notice:empty), .changes-list:empty, #change-summary:empty, #stats-message:empty { display: none; }
.message { color: #f2bd8c; border: 1px solid #775938; padding: 12px 16px; margin-top: 18px; }
.update-notice { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; color: var(--gold); font-size: 12px; }
.text-button { border: 0; background: none; color: var(--gold); padding: 5px 0; text-decoration: underline; text-underline-offset: 4px; }
.changes-panel { margin-top: 28px; padding: 22px; border: 1px solid var(--border); background: var(--panel); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 18px; }
.commit-link { padding: 8px 10px; border: 1px solid #786840; background: #302c1d; text-decoration: none; white-space: nowrap; font-size: 11px; }
#change-summary { font-size: 13px; color: #d1d8c3; white-space: pre-wrap; overflow-wrap: anywhere; }
.changes-list { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.changes-list li { position: relative; padding: 6px 0 6px 22px; line-height: 1.65; overflow-wrap: anywhere; }
.changes-list li::before { content: "+"; position: absolute; left: 0; top: 6px; color: var(--green); font-weight: bold; }
.recent-section { margin-top: 28px; }
.run-list { margin: 0; padding: 4px; list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; max-height: 360px; overflow-y: auto; scrollbar-gutter: stable; }
.run-list:empty { display: none; }
.run-list:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.run-list > li { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; }
.run-log-download { grid-column: 2; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; padding: 6px; }
.run-video-download { grid-column: 3; display: inline-flex; align-items: center; justify-content: center; padding: 6px; }
.run-info-button { grid-column: 4; justify-self: center; }
.download-icon { border-bottom: 1px solid currentColor; line-height: 1; font-size: 16px; }
.run-button { min-width: 0; width: 100%; display: grid; grid-template-columns: repeat(8, minmax(0, auto)); gap: 10px; align-items: center; text-align: left; border: 1px solid var(--border); background: #181e16; color: var(--text); padding: 8px 10px; font-size: 12px; }
#recent-heading { display: inline; }
#runs-info-open { margin-left: 8px; vertical-align: middle; }
.run-button:hover { background: #242d1e; border-color: #7d8c61; }
.run-button[aria-pressed="true"] { border-color: var(--gold); background: #282a1b; box-shadow: inset 3px 0 var(--gold); }
.run-id { color: var(--gold); font-weight: 600; }
.run-id, .run-duration, .run-level, .run-depth, .run-gold, .run-turns, .run-strength { white-space: nowrap; }
.run-button > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.run-duration, .run-level, .run-depth, .run-gold, .run-turns, .run-strength { color: var(--muted); }
.run-outcome { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.empty-list { color: var(--muted); font-size: 12px; }
footer { margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--border); text-align: center; font-size: 11px; color: var(--muted); }
footer a { color: #cbd3b9; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

@media (min-width: 601px) and (max-width: 900px) {
  .run-button { grid-template-columns: repeat(4, minmax(0, 1fr)); font-size: 11px; }
}

@media (max-width: 600px) {
  main { width: calc(100% - 28px); padding-top: 28px; }
  .masthead { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .depth-gauge { justify-self: center; width: 180px; }
  h1 { letter-spacing: -1px; }
  .player-screen { aspect-ratio: 4 / 3; }
  .pixel-label { font-size: 9px; }
  .player-caption { padding: 12px; }
  .changes-panel { padding: 18px 14px; margin-top: 22px; }
  .section-heading { gap: 14px; flex-wrap: wrap; }
  .commit-link { font-size: 10px; }
  .run-button { padding: 8px 6px; gap: 8px 5px; grid-template-columns: repeat(3, minmax(0, 1fr)); font-size: 10px; }
  .run-list > li { gap: 4px; grid-template-columns: minmax(0, 1fr) auto auto; }
  .run-log-download { padding: 6px 2px; }
  .run-video-download { padding: 6px 2px; }
  .download-icon { font-size: 14px; }
}
@media (max-width: 420px) {
  .run-button { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Charts have independent, bounded containers so resize does not affect playback. */
.stats-section { margin-block: 2rem; }
.stats-heading { display: flex; align-items: center; gap: 8px; margin-block: 1rem; }
.stats-heading h2, .stats-heading h3 { margin: 0; }
.info-button { flex: 0 0 auto; display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 1px solid var(--muted); border-radius: 50%; background: transparent; color: var(--gold); font: bold 12px Georgia, serif; }
.info-button:hover { border-color: var(--gold); background: #302c1d; }
.stats-chart { position: relative; height: 340px; margin-block: 1.5rem; }
.stats-table-scroll { overflow-x: auto; max-height: 32rem; }
.stats-table { border-collapse: collapse; width: 100%; font-size: .85rem; }
.stats-table th, .stats-table td { text-align: left; vertical-align: top; padding: .6rem; border-bottom: 1px solid #454a42; }
.stats-table th { white-space: nowrap; }
@media (max-width: 600px) { .stats-chart { height: 380px; } }
.current-run {
  position: relative;
  margin-top: 12px;
  grid-column: 1 / -1;
  width: 100%;
  padding: 16px 16px 10px;
  border: 2px solid var(--border);
  border-top: 0;
  background: transparent;
  text-align: center;
  overflow-wrap: anywhere;
}
.current-run p { margin: .35rem 0; }
#realtime-title {
  position: absolute;
  top: 0;
  left: -2px;
  transform: translateY(-50%);
  width: calc(100% + 4px);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  line-height: 1.8;
}
#realtime-title::before, #realtime-title::after { content: ""; flex: 1; min-width: 16px; border-top: 2px solid var(--border); }
.live-summary { line-height: 1.8; }
.live-hp { display: flex; align-items: center; gap: 10px; max-width: 600px; margin: 8px auto; text-align: left; }
#live-hp-label { min-width: 7ch; font-variant-numeric: tabular-nums; white-space: nowrap; }
.live-hp-track { flex: 1; height: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--bg); }
.live-hp-fill { display: block; height: 100%; background: var(--green); }
.live-hp-fill.low { background: #e46060; }
#live-heading { color: var(--gold); white-space: nowrap; }
.live-metrics { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); text-align: left; margin: 8px auto; max-width: 600px; border: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.live-metrics > div { display: flex; align-items: baseline; gap: 8px; min-width: 0; padding: 6px 8px; }
.live-metrics dt { color: var(--muted); font-size: 12px; }
.live-metrics dd { margin: 0; }
#live-event { min-height: 1.8em; }
#live-equipment { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }
#live-equipment:empty { display: none; }
#live-buffs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 6px; }
#live-buffs:empty { display: none; }
.buff-slot { position: relative; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; background: var(--bg); color: var(--text); cursor: pointer; }
.buff-icon { width: 14px; height: 14px; image-rendering: pixelated; }
.buff-slot[aria-expanded="true"] .equipment-tooltip, .buff-slot:focus-visible .equipment-tooltip { display: block; }
@media (hover: hover) { .buff-slot:hover .equipment-tooltip { display: block; } }
@media (pointer: coarse) { .buff-slot { width: 36px; height: 36px; } }
.equipment-slot { position: relative; display: grid; place-items: center; width: 48px; height: 48px; padding: 6px; border: 1px solid #91938c; background: #575853; color: var(--text); cursor: pointer; }
.equipment-slot.cursed { background: #a4322d; border-color: #e28d80; }
.equipment-slot.unknown { background: #b058ac; border-color: #e0a2dc; }
.equipment-slot.uncursed-unknown { background: #3e58a0; border-color: #9baee4; }
.equipment-sprite { display: block; width: 32px; height: 32px; background-image: url("items-dc6687b3.png"); background-size: 512px 1024px; image-rendering: pixelated; }
.equipment-unknown { font: 16px var(--pixel); }
.equipment-upgrade { position: absolute; bottom: 1px; right: 2px; color: var(--green); font: bold 12px / 1.2 ui-monospace, monospace; text-shadow: 1px 1px #000, -1px -1px #000; }
.equipment-upgrade.degraded { color: #ff9999; }
.equipment-tooltip { display: none; position: absolute; z-index: 5; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: max-content; max-width: min(220px, 70vw); padding: 8px; border: 1px solid var(--border); background: var(--bg); font: 12px / 1.5 ui-monospace, monospace; pointer-events: none; }
.equipment-slot:hover .equipment-tooltip, .equipment-slot:focus .equipment-tooltip { display: block; }
@media (max-width: 480px) {
  .current-run { padding: 14px 10px 10px; }
  .live-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
