@font-face {
  font-family: 'Minecraft';
  src: url('https://raw.githubusercontent.com/IdreesInc/Minecraft-Font/main/Minecraft.otf') format('opentype');
}

:root {
  /* States: blue / yellow / orange rather than green / red, readable with color blindness. */
  --waiting: #ff8a1f;
  --working: #ffd23f;
  --done: #4da6ff;
  --sleeping: #9a9a9a;
  /* Fill levels, same hues as the status line. */
  --level-low: #00afff;
  --level-mid: #ffd700;
  --level-high: #ff5f00;
  /* Account colors, in order of appearance. */
  --account-0: #005faf;
  --account-1: #ffaf00;
  --account-2: #7b3fb5;
  --account-3: #1f8a70;
  --sky-top: #78a7ff;
  --sky-bottom: #c6dcff;
  --panel-bg: #1b1820;
  --panel-card: rgba(255, 255, 255, 0.06);
  --text: #ffffff;
  --muted: #a8a8a8;
  --shadow: 2px 2px 0 rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

/* The hidden attribute must win over the display values set by classes. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--panel-bg);
  color: var(--text);
  font-family: 'Minecraft', ui-monospace, monospace;
}

#app {
  display: flex;
  height: 100vh;
}

#stage {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(var(--sky-top), var(--sky-bottom));
}

#world {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* --- map labels: little text, to leave the characters visible ------------------------------- */

.tag,
.nametag,
.wing-tag {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  text-shadow: var(--shadow);
  will-change: transform;
}

/* Villagers of the player hovered in the panel. */
.tag {
  padding: 2px 5px 3px;
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
  background: rgba(0, 0, 0, 0.6);
}

.tag--waiting { --status: var(--waiting); }
.tag--working { --status: var(--working); }
.tag--done { --status: var(--done); }

.status-icon {
  color: var(--status);
}

/* Nametag above a player, as in the game: one line, translucent black background. */
.nametag {
  padding: 1px 5px 2px;
  font-size: 11px;
  line-height: 1.25;
  background: rgba(0, 0, 0, 0.42);
}

.nametag--waiting { --status: var(--waiting); }
.nametag--working { --status: var(--working); }
.nametag--done { --status: var(--done); }
.nametag--leaving { --status: var(--muted); opacity: 0.7; }
.nametag--stuck { --status: #b0b0b0; }
.nametag--hl { outline: 1px solid #fff; }

/* Long wait: the nametag turns orange and pulses. */
.nametag--urgent {
  color: #000;
  text-shadow: none;
  background: var(--waiting);
  animation: alert-glow 0.6s ease-in-out infinite;
}

.nametag--urgent .status-icon {
  color: #000;
}

@keyframes alert-glow {
  50% { box-shadow: 0 0 0 3px var(--waiting); }
}

/* Account sign, in front of its wing. */
.wing-tag {
  padding: 2px 8px 3px;
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border-left: 4px solid var(--sign, #fff);
}

.wing-tag--slot-0 { --sign: var(--account-0); }
.wing-tag--slot-1 { --sign: var(--account-1); }
.wing-tag--slot-2 { --sign: var(--account-2); }
.wing-tag--slot-3 { --sign: var(--account-3); }
.wing-tag--nether { --sign: #ff5a26; color: #ffb35c; }
.wing-tag--end { --sign: #c27bff; color: #e2c6ff; }

/* --- boss bars: each account's quotas, at the top of the scene ------------------------------------- */

#bossbars {
  position: absolute;
  z-index: 3;
  top: calc(var(--toolbar-height, 30px) + 18px);
  left: 50%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 28px;
  width: max-content;
  max-width: calc(100% - 24px);
  transform: translateX(-50%);
  pointer-events: none;
}

.bossbar {
  display: grid;
  justify-items: center;
  gap: 3px;
}

.bossbar__title {
  font-size: 12px;
  text-shadow: var(--shadow);
  white-space: nowrap;
}

.bossbar__title b {
  font-weight: normal;
}

.bossbar__alert {
  color: var(--level-high);
}

/* The game sprites (182 x 5 pixels), scaled up twice. */
.bossbar__bar {
  position: relative;
  width: 364px;
  height: 10px;
  background: var(--bar) 0 0 / 100% 100%;
  image-rendering: pixelated;
}

.bossbar__bar i {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--fill) 0 0 / 364px 100%;
  image-rendering: pixelated;
}

/* --- room tooltip, Minecraft item tooltip style ---------------------------------------------- */

.mc-tooltip {
  position: absolute;
  z-index: 6;
  left: 0;
  top: 0;
  display: grid;
  gap: 3px;
  max-width: 340px;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.3;
  color: #fff;
  text-shadow: var(--shadow);
  background: rgba(16, 0, 16, 0.94);
  border: 2px solid transparent;
  border-image: linear-gradient(#5000ff, #28007f) 1;
  box-shadow: 0 0 0 2px rgba(16, 0, 16, 0.94);
  pointer-events: none;
}

.mc-tooltip__title {
  font-size: 13px;
}

.mc-tooltip__muted {
  color: #aaa;
}

.mc-tooltip__status--waiting { color: var(--waiting); }
.mc-tooltip__status--working { color: var(--working); }
.mc-tooltip__status--done { color: var(--done); }
.mc-tooltip__status--stuck { color: #b0b0b0; }

.mc-tooltip__line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mc-tooltip__villagers {
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  color: #ccc;
}

.status-icon--waiting { --status: var(--waiting); }
.status-icon--working { --status: var(--working); }
.status-icon--done { --status: var(--done); }

/* --- gauges -------------------------------------------------------------- */

.level--low { --level: var(--level-low); }
.level--mid { --level: var(--level-mid); }
.level--high { --level: var(--level-high); }

.ctx__bar {
  display: inline-block;
  width: 46px;
  height: 5px;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
}

.ctx__bar i {
  display: block;
  height: 100%;
  background: var(--level, var(--muted));
}

.ctx {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--level);
}

.badge {
  display: inline-block;
  padding: 0 4px;
  font-size: 0.8em;
  text-shadow: none;
  vertical-align: 1px;
}

.badge--slot-0 { background: var(--account-0); color: #fff; }
.badge--slot-1 { background: var(--account-1); color: #000; }
.badge--slot-2 { background: var(--account-2); color: #fff; }
.badge--slot-3 { background: var(--account-3); color: #fff; }

/* --- scene: chat, buttons, banners ------------------------------------- */

#chat {
  position: absolute;
  left: 12px;
  bottom: 12px;
  max-width: min(560px, 60%);
  display: flex;
  flex-direction: column;
  gap: 1px;
  pointer-events: none;
}

.chat__line {
  padding: 2px 6px;
  /* Dark enough to stay readable on snow. */
  background: rgba(0, 0, 0, 0.62);
  font-size: 12px;
  text-shadow: var(--shadow);
  transition: opacity 2s;
}

.chat__line b { font-weight: normal; color: #fff; }
.chat__line--waiting { color: var(--waiting); }
.chat__line--done { color: var(--done); }
.chat__line--join,
.chat__line--working { color: var(--working); }
.chat__line--villager { color: #55ffff; }
.chat__line--leave { color: var(--muted); }
.chat__line--theme-nether { color: #ff7a3a; }
.chat__line--theme-end { color: #c27bff; }
.chat__line--old { opacity: 0.55; }

#toolbar {
  position: fixed;
  z-index: 10;
  top: 10px;
  left: 10px;
  right: 400px;
  flex-wrap: wrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

#toolbar button,
#toolbar .switch {
  padding: 4px 9px;
  font: inherit;
  font-size: 11px;
  color: #fff;
  text-shadow: var(--shadow);
  background: #6f6f6f;
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 #a8a8a8, inset -2px -2px 0 #4a4a4a;
  cursor: pointer;
}

#toolbar select {
  padding: 3px 6px;
  font: inherit;
  font-size: 11px;
  color: #fff;
  background: #3a3a3a;
  border: 2px solid #000;
}

.demo-tag {
  padding: 4px 8px;
  font-size: 11px;
  color: #000;
  background: #ffd23f;
  border: 2px solid #000;
}

#toolbar button:hover,
#toolbar .switch:hover {
  background: #7d86c4;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch__track {
  position: relative;
  width: 26px;
  height: 14px;
  background: #3a3a3a;
  border: 2px solid #000;
}

.switch__track::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  background: #d8d8d8;
  transition: transform 0.15s;
}

.switch input:checked + .switch__track {
  background: #4da6ff;
}

.switch input:checked + .switch__track::after {
  transform: translateX(12px);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid #fff;
}

.banner {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: 0;
  padding: 10px 16px;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.6);
  text-shadow: var(--shadow);
}

.banner--alert {
  top: 12px;
  transform: translateX(-50%);
  color: var(--waiting);
}

/* --- panel ------------------------------------------------------------- */

#panel {
  width: 380px;
  flex: none;
  overflow: hidden;
  padding: 12px 12px 8px;
  background: var(--panel-bg);
  border-left: 4px solid #000;
  box-shadow: inset 3px 0 0 #3b3542;
  text-shadow: var(--shadow);
  font-size: 12px;
  line-height: 1.3;
}

.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.panel__head h1 {
  margin: 0;
  font-size: 18px;
  font-weight: normal;
  color: #ffd23f;
}

.counts {
  display: flex;
  gap: 8px;
  font-size: 14px;
}

.count--waiting { color: var(--waiting); }
.count--working { color: var(--working); }
.count--done { color: var(--done); }
.count--sleeping { color: var(--sleeping); }

.usage {
  display: grid;
  gap: 6px;
  margin: 10px 0 8px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.3);
}

.account {
  display: grid;
  gap: 3px;
}

.quota {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quota__label {
  width: 24px;
  color: var(--muted);
}

.quota__text {
  color: var(--muted);
}

.quota__text b {
  font-weight: normal;
  color: var(--level, #fff);
}

.icons {
  display: flex;
  gap: 1px;
}

.icon {
  position: relative;
  width: 14px;
  height: 14px;
}

.icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

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

.all-clear {
  margin: 4px 0 8px;
  color: var(--done);
}

.group h2 {
  margin: 10px 0 5px;
  font-size: 13px;
  font-weight: normal;
  color: var(--status);
}

.group h2 span {
  color: var(--muted);
}

.group--waiting { --status: var(--waiting); }
.group--working { --status: var(--working); }
.group--done { --status: var(--done); }
.group--sleeping { --status: var(--sleeping); }

.card {
  display: flex;
  gap: 8px;
  margin-bottom: 5px;
  padding: 6px 7px;
  background: var(--panel-card);
  border-left: 4px solid var(--status);
}

.card--waiting {
  background: rgba(255, 138, 31, 0.14);
}

.card:hover,
.sleeper:hover {
  background: rgba(255, 255, 255, 0.12);
}

.face {
  width: 28px;
  height: 28px;
  flex: none;
  image-rendering: pixelated;
  box-shadow: 0 0 0 1px #000;
}

.face--small {
  width: 14px;
  height: 14px;
}

.card__body {
  min-width: 0;
  flex: 1;
}

.card__title {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__status {
  color: var(--status);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__meta {
  color: var(--muted);
  font-size: 11px;
}

.card__villagers {
  margin: 3px 0 0;
  padding: 0;
  list-style: none;
  font-size: 11px;
}

.villager {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.villager--working { --status: var(--working); }
.villager--done { --status: var(--done); color: var(--muted); }

.card__quote {
  margin-top: 2px;
  color: #d8d8d8;
  font-size: 11px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sleepers {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
}

.sleeper {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 1px 4px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}

.sleeper__name {
  overflow: hidden;
  text-overflow: ellipsis;
  color: #cfcfcf;
}

.sleeper__meta {
  margin-left: auto;
  flex: none;
}

/* Compaction steps, from lightest to tightest, so everything fits without scrolling. Each step
   also hides what the previous ones hide. */
#panel:is([data-density='compact'], [data-density='tiny'], [data-density='micro'], [data-density='nano']) .card__quote,
#panel:is([data-density='tiny'], [data-density='micro'], [data-density='nano']) .sleeper__meta,
#panel:is([data-density='micro'], [data-density='nano']) :is(.sleeper__name, .card__villagers),
#panel[data-density='nano'] :is(.card .tasks, .card__where) {
  display: none;
}

/* One line per card: the project and branch are abbreviated, the context and cost stay whole. */
#panel:is([data-density='micro'], [data-density='nano']) .card__meta {
  display: flex;
  gap: 4px;
  white-space: nowrap;
}

#panel:is([data-density='micro'], [data-density='nano']) .card__where {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

#panel:is([data-density='micro'], [data-density='nano']) .card__gauges {
  flex-shrink: 0;
}

#panel:is([data-density='tiny'], [data-density='micro'], [data-density='nano']) .card {
  margin-bottom: 3px;
  padding: 3px 6px;
}

#panel:is([data-density='tiny'], [data-density='micro'], [data-density='nano']) .group h2 {
  margin: 6px 0 3px;
}

#panel[data-density='tiny'] .sleepers {
  grid-template-columns: 1fr 1fr;
}

#panel:is([data-density='micro'], [data-density='nano']) .sleepers {
  grid-template-columns: repeat(auto-fill, 22px);
}

#panel:is([data-density='micro'], [data-density='nano']) .sleeper {
  padding: 2px;
}

/* --- task progress, context, cost ---------------------------------- */

.tasks {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.tasks__text {
  overflow: hidden;
  text-overflow: ellipsis;
  color: #e8e0c8;
}

/* One slot per task, like inventory slots: done, in progress (blinking), to do. */
.pips {
  display: inline-flex;
  flex: none;
  gap: 1px;
  padding: 1px;
  background: #1a1a1a;
  box-shadow: 0 0 0 1px #000;
}

.pip {
  width: 7px;
  height: 7px;
  background: #4a4a4a;
}

.pip--done { background: #55ff55; box-shadow: inset -1px -1px 0 #2a9a2a; }
.pip--current { background: #ffd23f; animation: pip-blink 1s steps(2) infinite; }

@keyframes pip-blink {
  50% { background: #7a6420; }
}

/* Context as a Minecraft experience bar: segments, level color (blue, yellow, orange). */
.xp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--level, var(--muted));
}

.xp b {
  font-weight: normal;
}

.xp__bar {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 6px;
  background: #222;
  box-shadow: 0 0 0 1px #000;
}

.xp__bar i {
  display: block;
  height: 100%;
  background: var(--level, var(--muted));
}

.xp__bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 5px, rgba(0, 0, 0, 0.55) 5px 6px);
}

.emerald {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: #7dffa0;
}

.emerald img,
.item-icon {
  width: 13px;
  height: 13px;
  image-rendering: pixelated;
}










.card--urgent {
  background: rgba(255, 90, 0, 0.28);
  animation: alert-glow 0.5s ease-in-out infinite;
}

.card--stuck .card__status {
  color: #c8c8c8;
}

.card {
  position: relative;
  cursor: pointer;
}

.sleeper {
  cursor: pointer;
}

.card .tasks {
  font-size: 11px;
  margin: 1px 0;
}

.card__history {
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 2px;
  background: transparent;
  border: 0;
  cursor: pointer;
  opacity: 0.7;
}

.card__history:hover {
  opacity: 1;
}

.card__history .item-icon {
  width: 16px;
  height: 16px;
}

.quota__forecast {
  margin: -1px 0 2px 30px;
  font-size: 11px;
  color: var(--level-high);
}



/* --- messages in the "Advancement Made" style ------------------------------------- */

#toasts {
  position: fixed;
  z-index: 30;
  top: 52px;
  right: 400px;
  display: grid;
  gap: 6px;
  width: 300px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #212121;
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 #555, inset -2px -2px 0 #111;
  text-shadow: var(--shadow);
  animation: toast-in 0.25s ease-out;
  transition: transform 0.5s, opacity 0.5s;
}

.toast--out {
  transform: translateX(30px);
  opacity: 0;
}

@keyframes toast-in {
  from { transform: translateX(40px); opacity: 0; }
}

.toast__icon {
  width: 28px;
  height: 28px;
  flex: none;
}

.toast__title {
  font-size: 12px;
  color: #ffd23f;
}

.toast--warn .toast__title {
  color: var(--waiting);
}

.toast__text {
  font-size: 11px;
  color: #eee;
}

/* --- session history ------------------------------------------------ */

#history {
  position: fixed;
  z-index: 25;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}

.history__panel {
  display: flex;
  flex-direction: column;
  width: min(640px, 90vw);
  max-height: 80vh;
  background: #c6c6c6;
  color: #3f3f3f;
  border: 3px solid #000;
  box-shadow: inset 3px 3px 0 #fff, inset -3px -3px 0 #555;
}

.history__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 8px;
}

.history__head > div {
  flex: 1;
  min-width: 0;
}

.history__title {
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history__sub {
  font-size: 11px;
  color: #555;
}

.history__head button {
  padding: 5px 9px;
  font: inherit;
  font-size: 11px;
  color: #fff;
  text-shadow: var(--shadow);
  background: #6f6f6f;
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 #a8a8a8, inset -2px -2px 0 #4a4a4a;
  cursor: pointer;
}

.history__list {
  margin: 0;
  padding: 0 14px 14px;
  overflow: auto;
  list-style: none;
}

.history__item {
  display: flex;
  gap: 8px;
  padding: 6px;
  margin-bottom: 3px;
  background: #8b8b8b;
  box-shadow: inset 2px 2px 0 #373737, inset -2px -2px 0 #fff;
  color: #fff;
  text-shadow: var(--shadow);
}

.history__icon {
  width: 22px;
  height: 22px;
  flex: none;
  image-rendering: pixelated;
}

.history__meta {
  font-size: 10px;
  color: #ffd23f;
}

.history__item--prompt .history__meta { color: #7cc4ff; }

.history__text {
  font-size: 12px;
  word-break: break-word;
}

.history__empty {
  padding: 0 14px 14px;
}







/* --- Usage screen ------------------------------------------------------------- */

#stats {
  position: fixed;
  z-index: 25;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}

/* Colors as variables: simple mode swaps them for its light ones. */
.stats__panel {
  --st-bg: #1b1820;
  --st-card: rgba(255, 255, 255, 0.05);
  --st-text: #ffffff;
  --st-muted: #a8a8a8;
  --st-line: rgba(255, 255, 255, 0.12);
  --st-track: rgba(255, 255, 255, 0.08);
  --st-accent: var(--working);
  --st-slot-0: var(--account-0);
  --st-slot-1: var(--account-1);
  --st-slot-2: var(--account-2);
  --st-slot-3: var(--account-3);
  width: min(940px, 94vw);
  max-height: 94vh;
  overflow: auto;
  padding: 18px 22px 14px;
  color: var(--st-text);
  background: var(--st-bg);
  border: 2px solid #2a0a5e;
  outline: 2px solid #000;
}

.stats__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.stats__head h2 {
  flex: 1;
  margin: 0;
  font-size: 20px;
  font-weight: normal;
  text-shadow: var(--shadow);
}

.stats__toggle {
  display: inline-flex;
  padding: 2px;
  background: var(--st-card);
  border: 1px solid var(--st-line);
}

.stats__toggle button,
.stats__close {
  padding: 5px 10px;
  font: inherit;
  font-size: 12px;
  color: var(--st-muted);
  background: none;
  border: 0;
  cursor: pointer;
}

.stats__toggle button.is-active {
  color: #000;
  background: var(--st-accent);
}

.stats__close {
  color: var(--st-text);
}

.stats__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 28px;
  margin-bottom: 14px;
}

.stats__headline b {
  display: block;
  font-size: 36px;
  line-height: 1;
  font-weight: normal;
  text-shadow: var(--shadow);
}

.stats__headline span {
  margin-right: 10px;
  color: var(--st-muted);
}

.stats__headline em {
  font-style: normal;
  color: var(--st-accent);
}

.stats__figures {
  display: flex;
  gap: 26px;
  margin: 0;
}

.stats__figures dt {
  font-size: 11px;
  color: var(--st-muted);
}

.stats__figures dd {
  margin: 2px 0 0;
  font-size: 18px;
}

.stats__shares {
  display: grid;
  gap: 6px;
  margin: 0 0 18px;
  padding: 10px 12px;
  list-style: none;
  background: var(--st-card);
}

.stats__share {
  display: grid;
  grid-template-columns: minmax(90px, 140px) 1fr 80px minmax(130px, 180px);
  align-items: center;
  gap: 12px;
}

.stats__share .badge {
  justify-self: start;
}

.stats__share b {
  justify-self: end;
  font-weight: normal;
}

.stats__track {
  height: 10px;
  background: var(--st-track);
}

.stats__track .stats__fill {
  display: block;
  height: 100%;
}

.stats__muted {
  font-size: 11px;
  color: var(--st-muted);
}

.stats__fill--slot-0 { background: var(--st-slot-0); }
.stats__fill--slot-1 { background: var(--st-slot-1); }
.stats__fill--slot-2 { background: var(--st-slot-2); }
.stats__fill--slot-3 { background: var(--st-slot-3); }

/* Stacked chart: gridlines with their value on the left, one column per hour or per day. */
.stats__chart {
  position: relative;
  padding: 8px 0 26px 64px;
}

.stats__plot {
  position: relative;
  height: 230px;
  border-bottom: 1px solid var(--st-muted);
}

.stats__gridline {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed var(--st-line);
}

.stats__gridline span {
  position: absolute;
  right: calc(100% + 8px);
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--st-muted);
  white-space: nowrap;
}

.stats__columns {
  position: absolute;
  inset: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
}

.stats__chart--week .stats__columns {
  gap: 18px;
  padding: 0 10px;
}

.stats__column {
  position: relative;
  height: 100%;
  cursor: default;
}

.stats__stack {
  display: flex;
  flex-direction: column-reverse;
  height: 100%;
}

.stats__segment {
  flex: none;
  width: 100%;
}

.stats__column:hover .stats__stack {
  filter: brightness(1.3);
  background: var(--st-track);
}

.stats__column--future {
  opacity: 0.35;
}

.stats__label {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--st-muted);
  white-space: nowrap;
}

.stats__column--now .stats__label {
  color: var(--st-accent);
}

.stats__column--now::after {
  content: '';
  position: absolute;
  top: calc(100% + 1px);
  left: 50%;
  width: 6px;
  height: 3px;
  transform: translateX(-50%);
  background: var(--st-accent);
}

.stats__tip {
  position: absolute;
  top: 0;
  left: 64px;
  min-width: 170px;
  pointer-events: none;
}

.stats__tip div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stats__tip b {
  margin-left: auto;
  font-weight: normal;
}

.stats__tip-total {
  margin-top: 3px;
  padding-top: 3px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.stats__dot {
  display: inline-block;
  width: 10px;
  height: 10px;
}

.stats__note,
.stats__empty {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--st-muted);
}

.stats__empty {
  padding: 30px 0;
  text-align: center;
}

/* --- sky, lightning ----------------------------------------------- */

#sky,
#flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#sky {
  overflow: hidden;
  transition: background 2s;
}

.sky__stars {
  position: absolute;
  inset: 0;
  background-size: 512px 256px;
  image-rendering: pixelated;
  opacity: 0;
  transition: opacity 2s;
}

/* Square Minecraft sun: its black background disappears in "screen" mode. */
.sky__sun {
  position: absolute;
  width: 72px;
  height: 72px;
  transform: translate(-50%, -50%);
  image-rendering: pixelated;
  mix-blend-mode: screen;
  transition: left 2s, top 2s, opacity 2s;
}

.sky__moon {
  position: absolute;
  mix-blend-mode: screen;
  top: 9%;
  right: 14%;
  width: 56px;
  height: 56px;
  background-size: 400% 200%;
  image-rendering: pixelated;
  opacity: 0;
  transition: opacity 2s;
}

#flash {
  background: #fff;
  opacity: 0;
}

#world,
#flash {
  z-index: 1;
}

#labels,
#chat {
  z-index: 2;
}

.banner {
  z-index: 3;
}

/* --- settings ---------------------------------------------------------------------------------------------- */

#settings {
  position: fixed;
  z-index: 25;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
}

.settings__panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(720px, 94vw);
  max-height: 88vh;
  padding: 14px 16px;
  overflow: auto;
  color: #3f3f3f;
  background: #c6c6c6;
  border: 3px solid #000;
  box-shadow: inset 3px 3px 0 #fff, inset -3px -3px 0 #555;
}

.settings__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings__panel h2,
.settings__panel h3 {
  margin: 0;
  font-weight: normal;
}

.settings__panel h3 {
  margin-bottom: 6px;
  font-size: 13px;
}

.settings__hint,
.settings__meta {
  margin: 0 0 8px;
  font-size: 11px;
  color: #555;
}

.settings__meta code {
  font: inherit;
  color: #333;
}

.settings__accounts {
  display: grid;
  gap: 6px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.settings__account {
  padding: 8px;
  background: #8b8b8b;
  box-shadow: inset 2px 2px 0 #373737, inset -2px -2px 0 #fff;
  color: #fff;
  text-shadow: var(--shadow);
}

.settings__account .settings__meta,
.settings__account .settings__meta code {
  color: #e6e6e6;
}

.settings__line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.settings__panel input:not([type='checkbox']) {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  font: inherit;
  font-size: 12px;
  color: #fff;
  background: #000;
  border: 2px solid #a0a0a0;
}

.settings__panel button {
  padding: 3px 9px;
  font: inherit;
  font-size: 11px;
  color: #fff;
  text-shadow: var(--shadow);
  background: #6f6f6f;
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 #a8a8a8, inset -2px -2px 0 #4a4a4a;
  cursor: pointer;
}

.settings__check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  white-space: nowrap;
}

.settings__chip {
  flex: none;
  width: 12px;
  height: 12px;
  background: var(--account-0);
  border: 2px solid #000;
}

.settings__chip--slot-1 { background: var(--account-1); }
.settings__chip--slot-2 { background: var(--account-2); }
.settings__chip--slot-3 { background: var(--account-3); }
.settings__chip--off { opacity: 0.3; }

.settings__ok {
  flex: 1;
  font-size: 11px;
}

.settings__message {
  margin: 0;
  padding: 6px 8px;
  font-size: 12px;
  color: #fff;
  background: #3a3a3a;
}

/* --- Focus mode and zoom ----------------------------------------------------------- */

/* Focus: the scene darkens except the rooms that wait for you, cut out of the mask. */
#focus-mask {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* On the whole drawing: Chrome ignores CSS filters on the shapes inside an SVG. */
  filter: blur(6px);
}

#focus-mask path {
  fill: rgba(8, 6, 14, 0.7);
}

.nametag--dim {
  opacity: 0.3;
}

body.focus #panel .group:not(.group--waiting),
body.focus #panel .usage,
body.focus #bossbars {
  opacity: 0.35;
}

body.focus #focus-toggle {
  color: #000;
  background: var(--waiting);
  text-shadow: none;
}

.zoom-hint {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 14px;
  margin: 0;
  padding: 4px 10px;
  transform: translateX(-50%);
  font-size: 12px;
  color: #fff;
  text-shadow: var(--shadow);
  background: rgba(16, 0, 16, 0.8);
  pointer-events: none;
}

.mc-tooltip__hint {
  color: #8a8a8a;
  font-size: 11px;
}

/* Villager lines open the villager's history. */
.villager[data-villager] {
  cursor: pointer;
}

.villager[data-villager]:hover {
  text-decoration: underline;
}

/* --- Reduced motion ------------------------------------------------------------- */

/* The system asks for less motion: no blinking, no sliding, no pulsing (the 3D scene follows in motion.js). */
@media (prefers-reduced-motion: reduce) {
  *,
  ::before,
  ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
