:root {
  --bg: #15171c;
  --panel: #1f232b;
  --panel2: #282d37;
  --line: #353b47;
  --text: #e8e6e3;
  --muted: #9aa0ab;
  --accent: #6cc04a;
  --warn: #e0a43a;
  --bad: #e2554f;
  --overworld: #5fae4e;
  --the_nether: #c4513f;
  --the_end: #b58ad6;
  --c0: #5aa9e6; --c1: #f0a04b; --c2: #7bc96f; --c3: #e66b9c;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  display: flex; flex-direction: column;
}
button { font: inherit; color: inherit; }
a { color: var(--c0); }

header { background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
.bar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; flex-wrap: wrap; }
h1 { font-size: 17px; margin: 0; letter-spacing: .5px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--panel2); border-radius: 999px; padding: 2px 10px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.chip b { color: var(--text); font-weight: 600; }
.chip.ok b { color: var(--accent); }
.chip.bad b { color: var(--bad); }

.people { display: flex; gap: 8px; padding: 0 16px 8px; overflow-x: auto; scrollbar-width: none; }
.person {
  display: flex; align-items: center; gap: 8px; flex: none;
  background: var(--panel2); border: 1px solid transparent; border-radius: 10px; padding: 5px 10px 5px 6px; cursor: default;
}
.person.on { border-color: #3d5a34; cursor: pointer; }
.person.off { opacity: .55; }
.person .who { display: flex; flex-direction: column; line-height: 1.25; }
.person .name { font-weight: 600; }
.person .sub { font-size: 11.5px; color: var(--muted); }
.vitals { display: flex; gap: 6px; font-size: 11.5px; color: var(--muted); align-items: center; }
.meter { width: 44px; height: 5px; background: #3a3f4a; border-radius: 3px; overflow: hidden; display: inline-block; vertical-align: middle; }
.meter i { display: block; height: 100%; }
.meter.hp i { background: var(--bad); }
.meter.food i { background: var(--warn); }
.dim { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: 0; }

.head { image-rendering: pixelated; border-radius: 4px; flex: none; background: #333; }

nav { display: flex; border-top: 1px solid var(--line); }
nav button {
  flex: 1; background: none; border: 0; padding: 10px 4px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent;
}
nav button.on { color: var(--text); border-bottom-color: var(--accent); }

main { flex: 1; min-height: 0; position: relative; }
.tab { display: none; height: 100%; overflow-y: auto; padding: 16px; }
.tab.on { display: block; }
#tab-map { padding: 0; overflow: hidden; }
#map { width: 100%; height: 100%; border: 0; display: block; }
.wrap { max-width: 980px; margin: 0 auto; }
h2 { font-size: 16px; margin: 4px 0 12px; }
h3 { font-size: 14px; margin: 18px 0 8px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }

/* mainline */
.route { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; counter-reset: step; }
.node { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; position: relative; }
.node::before { counter-increment: step; content: counter(step); position: absolute; right: 10px; top: 8px; font-size: 12px; color: var(--muted); }
.node .t { font-weight: 600; }
.node .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.node .when { font-size: 12px; margin-top: 6px; color: var(--muted); }
.node.done { border-color: #3d5a34; background: #1f2a20; }
.node.done .when { color: var(--accent); }
.total { margin-top: 14px; }
.progress { height: 10px; background: var(--panel2); border-radius: 5px; overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; background: var(--accent); }
details.all { margin-top: 18px; }
details.all summary { cursor: pointer; padding: 8px 0; font-weight: 600; }
.adv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.adv .desc { font-size: 12px; color: var(--muted); }
.adv .ts { font-size: 12px; white-space: nowrap; color: var(--muted); }
.adv.done .ts { color: var(--accent); }
.adv:not(.done) .name { color: var(--muted); }
.frame { font-size: 11px; padding: 0 5px; border-radius: 4px; margin-left: 4px; background: var(--panel2); color: var(--muted); }
.frame.goal { color: #7fb7ff; }
.frame.challenge { color: #d79bff; }

/* sessions */
.sess-h { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.sess-h .no { font-weight: 700; }
.headline { font-size: 15px; font-weight: 600; margin: 4px 0 10px; }
.tag { font-size: 11.5px; border-radius: 4px; padding: 1px 6px; margin-left: 6px; background: var(--panel2); color: var(--muted); }
.tag.live { background: #2d4a27; color: #b8f0a2; }
.row { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.pp { display: inline-flex; align-items: center; gap: 6px; }
.list { margin: 8px 0 0; padding: 0; list-style: none; }
.list li { padding: 3px 0; font-size: 13px; }
.list .tm { color: var(--muted); font-size: 12px; margin-right: 8px; font-variant-numeric: tabular-nums; }
.first { color: var(--warn); }
.sess details summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-top: 8px; }
.mini { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.linkbtn { background: none; border: 0; color: var(--c0); cursor: pointer; padding: 0; font-size: 12px; margin-left: 6px; }

/* players */
.toggle { display: inline-flex; background: var(--panel2); border-radius: 8px; padding: 2px; }
.toggle button { background: none; border: 0; padding: 4px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); }
.toggle button.on { background: var(--panel); color: var(--text); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; font-size: 12.5px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; background: var(--c); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.pcard .top { display: flex; gap: 12px; align-items: center; }
.pcard .nm { font-size: 17px; font-weight: 700; }
.pcard .ttl { color: var(--warn); font-weight: 600; }
.badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.badge { font-size: 11.5px; background: var(--panel2); border-radius: 4px; padding: 1px 6px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-top: 10px; font-size: 13px; }
.kv div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 2px 0; }
.kv span:first-child { color: var(--muted); }
svg.radar { width: 100%; max-width: 320px; display: block; margin: 6px auto; }
svg.radar text { fill: var(--muted); font-size: 11px; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

@media (max-width: 600px) {
  .bar { padding: 8px 12px; gap: 8px; }
  .people { padding: 0 12px 8px; }
  .tab { padding: 12px; }
  .route { grid-template-columns: 1fr 1fr; }
  .kv { grid-template-columns: 1fr; }
}

/* ===== Minecraft look: block textures — deepslate ground, dark-oak header, stone-brick tabs, blackstone cards */
:root {
  --bg: #111; --panel: #1d1d22; --panel2: #2b2b30; --line: #3d3d44;
  --text: #f2f2f2; --muted: #b4b4b4; --accent: #7ed957; --warn: #ffcc4d; --bad: #ff6b5e;
  --c0: #62c3ff; --c1: #ffad42; --c2: #7ed957; --c3: #ff7ab8;
  --tile: 64px;
}
* { image-rendering: pixelated; }
body {
  background: linear-gradient(rgba(8,8,12,.72), rgba(8,8,12,.72)), url("tex/block/deepslate.png") 0 0 / var(--tile);
  text-shadow: 2px 2px 0 rgba(0,0,0,.6);
}

/* header: dark oak planks with a grass edge */
header {
  background: linear-gradient(rgba(0,0,0,.45), rgba(0,0,0,.45)), url("tex/block/dark_oak_planks.png") 0 0 / var(--tile);
  border-bottom: 0; position: relative;
}
header::after { content: ""; display: block; height: 12px;
  background: url("tex/block/grass_block_side.png") 0 0 / var(--tile) auto; background-position: 0 0; filter: saturate(1.1); }
h1 { color: #fff; }
.chip { border-radius: 0; background: rgba(0,0,0,.55); color: #ddd; box-shadow: inset 0 0 0 2px rgba(255,255,255,.08); }
.chip.ok b { color: #8dff6a; }

/* players: item-frame style slots on planks */
.person { border-radius: 0; background: linear-gradient(rgba(0,0,0,.35), rgba(0,0,0,.35)), url("tex/block/spruce_planks.png") 0 0 / 48px;
  border: 0; box-shadow: inset 3px 3px 0 rgba(255,255,255,.18), inset -3px -3px 0 rgba(0,0,0,.45); }
.person.on { box-shadow: inset 3px 3px 0 rgba(255,255,255,.18), inset -3px -3px 0 rgba(0,0,0,.45), 0 0 0 2px #7ed957; }
.person.off { opacity: .6; filter: grayscale(.8); }
.head { border-radius: 0; box-shadow: 0 0 0 2px #000; }
.meter { border-radius: 0; height: 6px; background: #000; box-shadow: 0 0 0 1px #000; }
.meter.hp i { background: #e23b3b; } .meter.food i { background: #c8862d; }
.dim { border-radius: 0; }

/* tabs: stone bricks */
nav { border-top: 0; background: linear-gradient(rgba(0,0,0,.5), rgba(0,0,0,.5)), url("tex/block/stone_bricks.png") 0 0 / 48px; }
nav button { color: #cfcfcf; border-bottom: 4px solid transparent; }
nav button.on { color: #fff; background: rgba(255,255,255,.08); border-bottom-color: #7ed957; }

/* cards: polished blackstone with a block bevel */
.card, .node {
  border-radius: 0; border: 0;
  background: linear-gradient(rgba(10,10,14,.78), rgba(10,10,14,.78)), url("tex/block/polished_blackstone.png") 0 0 / 48px;
  box-shadow: inset 3px 3px 0 rgba(255,255,255,.12), inset -3px -3px 0 rgba(0,0,0,.6), 0 4px 0 rgba(0,0,0,.4);
}
h2 { color: #fff; }

/* mainline: each step is a block; obtained steps light up on oak planks */
.node { display: grid; grid-template-columns: 48px 1fr; column-gap: 10px; align-items: center; padding: 10px; }
.node.done { background: linear-gradient(rgba(20,40,10,.55), rgba(10,20,5,.75)), url("tex/block/oak_planks.png") 0 0 / 48px;
  box-shadow: inset 3px 3px 0 rgba(255,255,255,.22), inset -3px -3px 0 rgba(0,0,0,.5), 0 0 0 2px #7ed957; }
.frame-ico { grid-row: span 3; width: 48px; height: 48px; display: grid; place-items: center;
  background: #8b8b8b; box-shadow: inset 3px 3px 0 #373737, inset -3px -3px 0 #fff; }
.frame-ico .ico { width: 32px; height: 32px; }
.node:not(.done) .frame-ico { background: #555; }
.node:not(.done) .ico { filter: grayscale(1) brightness(.5); }
.node .when { margin-top: 2px; }
.node.done .when { color: #8dff6a; }
.progress { border-radius: 0; height: 14px; background: url("tex/block/bedrock.png") 0 0 / 28px; box-shadow: inset 0 0 0 2px #000; }
.progress i { background: linear-gradient(#8dff6a, #4fa52f); box-shadow: inset 0 -3px 0 rgba(0,0,0,.3); }
.adv { border-bottom: 2px solid rgba(255,255,255,.06); }
.frame { border-radius: 0; }

/* sessions / players */
.tag { border-radius: 0; background: rgba(0,0,0,.5); }
.tag.live { background: #2f5a1e; color: #c8ffb0; }
.toggle { border-radius: 0; background: rgba(0,0,0,.5); }
.toggle button { border-radius: 0; }
.toggle button.on { background: linear-gradient(rgba(0,0,0,.3), rgba(0,0,0,.3)), url("tex/block/oak_planks.png") 0 0 / 32px; color: #fff; }
.badge { border-radius: 0; background: rgba(0,0,0,.55); color: #ffcc4d; }
.pcard .ttl { color: #ffcc4d; }
svg.radar polygon[fill="none"], svg.radar line { stroke: rgba(255,255,255,.15); }

/* ===== Mixed font: game pixel font for titles, names, numbers and controls; system font for running text.
   Pixel glyphs stay crisp only at 16px / 32px. Missing characters fall back to the system font. */
@font-face { font-family: "MCPixel"; src: url("mcpixel.woff2") format("woff2"); font-display: swap; }
h1, h2, h3, nav button, .person .name, .node .t, .headline, .sess-h .no, .pcard .nm, .pcard .ttl, .chip b,
.total b, .badge, .tag, .toggle button, .kv span:last-child, .legend, svg.radar text {
  font-family: "MCPixel", system-ui, sans-serif; font-weight: normal; -webkit-font-smoothing: none;
  font-size: 16px; line-height: 20px;
}
svg.radar text { font-size: 16px; }
h1, h2, .pcard .nm { font-size: 32px; line-height: 36px; }

/* mainline steps carry the advancement's item icon */
.route { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.node::before { display: none; }

/* map loading hint (squaremap takes a few seconds) */
#maploading { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  color: #ddd; font: 16px/20px "MCPixel", system-ui, sans-serif; text-shadow: 2px 2px 0 #000;
  background: linear-gradient(rgba(8,8,12,.8), rgba(8,8,12,.8)), url("tex/block/deepslate.png") 0 0 / 64px; image-rendering: pixelated; }
#maploading.gone { display: none; }

@media (max-width: 600px) {
  .route { grid-template-columns: 1fr; }
  .sess-h > div { min-width: 0; }
  .sess-h .muted { font-size: 12.5px; }
  h1 { font-size: 32px; }
}

/* dimension switcher over the map */
#dims { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; z-index: 5;
  padding: 4px; background: rgba(0,0,0,.55); box-shadow: inset 2px 2px 0 rgba(255,255,255,.1), inset -2px -2px 0 rgba(0,0,0,.5); }
#dims button { border: 0; cursor: pointer; padding: 6px 12px; color: #d6d6d6; white-space: nowrap;
  font: 16px/20px "MCPixel", system-ui, sans-serif; -webkit-font-smoothing: none; text-shadow: 2px 2px 0 rgba(0,0,0,.6);
  background: linear-gradient(rgba(0,0,0,.45), rgba(0,0,0,.45)), url("tex/block/stone_bricks.png") 0 0 / 48px; image-rendering: pixelated;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.18), inset -2px -2px 0 rgba(0,0,0,.5); }
#dims button:hover { color: #fff; }
#dims button.on { color: #fff; background: linear-gradient(rgba(0,0,0,.3), rgba(0,0,0,.3)), url("tex/block/oak_planks.png") 0 0 / 48px;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.25), inset -2px -2px 0 rgba(0,0,0,.5), 0 0 0 2px #7ed957; }
#dims .dim { margin-right: 6px; }
@media (max-width: 600px) { #dims button { padding: 6px 8px; } }
