:root {
  --paper: #fdf3d8;
  --paper-2: #f5e4b8;
  --paper-3: #ead29a;
  --ink: #4a2f23;
  --ink-soft: #8a6a52;
  --wood: #7a4a2b;
  --wood-dark: #4f3224;
  --green: #6dbb4f;
  --green-dark: #3e7d3a;
  --green-light: #b5e878;
  --gold: #f5c93a;
  --gold-dark: #b8860b;
  --red: #d94a3d;
  --red-dark: #8f2a24;
  --blue: #57a8e0;
  --night: #1f3a26;
  --font: 'Mali', 'Leelawadee UI', 'Thonburi', 'Noto Sans Thai', 'Tahoma', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --gap: 10px;
}


* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #2a5a33;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

img.icon,
img.avatar {
  image-rendering: pixelated;
  vertical-align: middle;
  flex: none;
  pointer-events: none;
}

#game,
#labels,
#hud,
#title,
#offline,
#modal {
  position: fixed;
  inset: 0;
}

#game canvas {
  display: block;
  image-rendering: pixelated;
}

/* ---------------------------------------------------------------- labels */

#labels {
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.label {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}

.label > div {
  position: absolute;
  left: 0;
  bottom: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.nametag {
  padding: 0 7px 0 2px;
  height: 19px;
  border-radius: 10px;
  background: rgba(31, 22, 28, 0.62);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

.nametag.self {
  background: rgba(46, 110, 52, 0.85);
}

.lv {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--gold);
  color: var(--wood-dark);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-shadow: none;
}

.farmtag,
.placetag {
  padding: 1px 8px 1px 5px;
  border: 2px solid var(--wood);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

.farmtag.mine {
  background: var(--green-light);
  border-color: var(--green-dark);
}

.placetag {
  background: var(--gold);
  border-color: var(--gold-dark);
}

.bubble {
  max-width: 220px;
  padding: 4px 10px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  white-space: normal !important;
  width: max-content;
  overflow-wrap: anywhere;
  animation: pop 0.18s ease-out;
}

.bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 8px;
  height: 8px;
  margin-left: -5px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  background: #fff;
  transform: rotate(45deg);
}

.tip {
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(31, 22, 28, 0.85);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.float {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-shadow:
    0 1px 0 #2b1f2e,
    1px 0 0 #2b1f2e,
    -1px 0 0 #2b1f2e,
    0 -1px 0 #2b1f2e,
    0 2px 0 rgba(0, 0, 0, 0.35);
  animation: rise 1.2s ease-out forwards;
}

.float.xp {
  color: #ffe36e;
  font-size: 12px;
}

.float.loss {
  color: #ffb3a8;
}

.float.skillhit {
  color: #ff5a4a;
  font-size: 16px;
  font-weight: 800;
  animation: rise-slow 1.6s ease-out forwards;
}

.float.info {
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(31, 22, 28, 0.85);
  font-size: 12px;
  font-weight: 600;
  text-shadow: none;
  animation: rise-slow 1.8s ease-out forwards;
}

@keyframes rise {
  0% {
    opacity: 0;
    transform: translate(-50%, 6px) scale(0.7);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.1);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -34px) scale(1);
  }
}

@keyframes rise-slow {
  0% {
    opacity: 0;
    transform: translate(-50%, 4px);
  }
  10%,
  80% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateX(-50%) scale(0.6);
  }
}

/* ------------------------------------------------------------------- HUD */

#hud {
  z-index: 2;
  pointer-events: none;
  padding: calc(var(--gap) + var(--safe-t)) calc(var(--gap) + var(--safe-r)) calc(var(--gap) + var(--safe-b))
    calc(var(--gap) + var(--safe-l));
}

#hud > * {
  position: absolute;
  pointer-events: auto;
}

.card {
  border: 3px solid var(--wood);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 4px 0 rgba(43, 31, 46, 0.35);
}

.me {
  top: calc(var(--gap) + var(--safe-t));
  left: calc(var(--gap) + var(--safe-l));
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  padding: 6px 12px 6px 6px;
  min-width: 190px;
  max-width: 260px;
}

.me .face {
  grid-row: span 2;
  width: 52px;
  height: 58px;
  padding: 0;
  border: 2px solid var(--wood);
  border-radius: 10px;
  background: linear-gradient(#bfe7ff, #e9f8d8 70%, #b5e878 70%);
  display: grid;
  place-items: end center;
  overflow: hidden;
}

.me .face img {
  margin-bottom: 1px;
}

.me .row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.me .name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar {
  position: relative;
  height: 14px;
  margin-top: 3px;
  border: 2px solid var(--wood);
  border-radius: 8px;
  background: var(--paper-3);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(#8fd460, #52a045);
  transition: width 0.4s ease;
}

.bar span {
  position: absolute;
  inset: 0;
  font-size: 10px;
  font-weight: 700;
  line-height: 10px;
  text-align: center;
  color: var(--wood-dark);
}

.coins {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 16px;
}

.coins b.bump {
  animation: bump 0.35s ease-out;
}

@keyframes bump {
  40% {
    transform: scale(1.35);
    color: var(--gold-dark);
  }
}

.quest {
  top: calc(var(--gap) + var(--safe-t) + var(--me-h, 78px) + 6px);
  left: calc(var(--gap) + var(--safe-l));
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  padding: 6px 10px;
  background: #fff8e1;
  border-color: var(--gold-dark);
  font-size: 13px;
}

.quest b {
  display: block;
}

.quest small {
  display: block;
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.25;
}

.quest .reward {
  display: flex;
  align-items: center;
  gap: 2px;
  font-weight: 700;
  color: var(--gold-dark);
}

.quest.done {
  animation: quest-done 0.6s ease-out;
}

@keyframes quest-done {
  30% {
    transform: scale(1.06);
    background: var(--green-light);
  }
}

.place {
  top: calc(var(--gap) + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 16px;
  border: 3px solid var(--wood);
  border-radius: 20px;
  background: var(--paper);
  font-weight: 700;
  box-shadow: 0 3px 0 rgba(43, 31, 46, 0.35);
  animation: drop 0.3s ease-out;
  pointer-events: none !important;
  white-space: nowrap;
}

.place.home {
  background: var(--green-light);
  border-color: var(--green-dark);
}

.place.plaza {
  background: var(--gold);
  border-color: var(--gold-dark);
}

@keyframes drop {
  from {
    opacity: 0;
    transform: translate(-50%, -14px);
  }
}

.menu {
  top: calc(var(--gap) + var(--safe-t));
  right: calc(var(--gap) + var(--safe-r));
  display: flex;
  gap: 6px;
}

.menu button {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0;
  width: 58px;
  padding: 5px 0 2px;
  border: 3px solid var(--wood);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 4px 0 rgba(43, 31, 46, 0.35);
  font-size: 11px;
  font-weight: 700;
  transition: transform 0.08s;
}

.menu button:hover {
  background: #fff;
}

.menu button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(43, 31, 46, 0.35);
}

.badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 10px;
  background: var(--green-dark);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

/* chat */

.chat {
  left: calc(var(--gap) + var(--safe-l));
  bottom: calc(var(--gap) + var(--safe-b));
  width: min(320px, 46vw);
  pointer-events: none !important;
}

.chat .log {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  max-height: 150px;
  margin-bottom: 6px;
  overflow: hidden;
  font-size: 13px;
  mask-image: linear-gradient(transparent, #000 30%);
}

.chat .log p {
  align-self: flex-start;
  max-width: 100%;
  margin: 0;
  padding: 2px 8px;
  border-radius: 9px;
  background: rgba(31, 22, 28, 0.58);
  color: #fff;
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
  animation: fade-in 0.2s;
}

.chat .log p.old {
  opacity: 0;
  transition: opacity 1.2s;
}

.chat.open .log p.old {
  opacity: 1;
  transition: none;
}

.chat .log p b {
  color: #ffe36e;
}

.chat .log p.sys {
  color: #c9f2a8;
  font-style: italic;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.chat form {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.chat form button {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 3px solid var(--wood);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(43, 31, 46, 0.35);
}

.chat input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 3px solid var(--wood);
  border-radius: 12px;
  background: var(--paper);
  outline: none;
  display: none;
  user-select: text;
  -webkit-user-select: text;
}

.chat.open input {
  display: block;
}

.chat input:focus {
  background: #fff;
  border-color: var(--green-dark);
}

/* hotbar */

.hotbar {
  left: 50%;
  bottom: calc(var(--gap) + var(--safe-b));
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  max-width: min(560px, calc(100vw - 2 * var(--gap)));
  padding: 6px;
  border: 3px solid var(--wood);
  border-radius: 16px;
  background: rgba(79, 50, 36, 0.88);
  box-shadow: 0 4px 0 rgba(43, 31, 46, 0.35);
  overflow-x: auto;
  scrollbar-width: none;
  touch-action: pan-x;
}

.hotbar::-webkit-scrollbar {
  display: none;
}

.slot {
  position: relative;
  flex: none;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 3px solid var(--wood-dark);
  border-radius: 11px;
  background: var(--paper-2);
  display: grid;
  place-items: center;
}

.slot.on {
  border-color: var(--gold);
  background: #fff;
  box-shadow: 0 0 0 2px var(--gold-dark);
  transform: translateY(-3px);
}

.slot .n {
  position: absolute;
  right: 3px;
  bottom: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  text-shadow:
    0 1px 0 #fff,
    1px 0 0 #fff,
    -1px 0 0 #fff,
    0 -1px 0 #fff;
}

.slot .key {
  position: absolute;
  left: 4px;
  top: 0;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-soft);
}

.hotbar .empty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px;
  color: var(--paper);
  font-size: 13px;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 4px 16px;
  border: 3px solid var(--wood);
  border-radius: 12px;
  background: var(--paper-2);
  font-weight: 700;
  box-shadow: 0 4px 0 rgba(43, 31, 46, 0.3);
  transition: transform 0.08s;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(43, 31, 46, 0.3);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.green {
  border-color: var(--green-dark);
  background: linear-gradient(#8fd460, #6dbb4f);
  color: #173d1c;
}

.btn.gold {
  border-color: var(--gold-dark);
  background: linear-gradient(#ffe36e, #f5c93a);
}

.btn.red {
  border-color: var(--red-dark);
  background: linear-gradient(#f2765a, #d94a3d);
  color: #fff;
}

.btn.big {
  min-height: 52px;
  width: 100%;
  font-size: 19px;
}

.btn.small {
  min-height: 30px;
  padding: 2px 10px;
  border-width: 2px;
  border-radius: 9px;
  font-size: 13px;
  box-shadow: 0 3px 0 rgba(43, 31, 46, 0.3);
}

.link {
  padding: 4px;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 13px;
  text-decoration: underline;
}

/* ----------------------------------------------------------------- toasts */

#toasts {
  position: fixed;
  top: calc(64px + var(--safe-t));
  left: 50%;
  z-index: 6;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(92vw, 420px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 3px solid var(--wood);
  border-radius: 14px;
  background: var(--paper);
  font-weight: 600;
  box-shadow: 0 4px 0 rgba(43, 31, 46, 0.3);
  animation: toast-in 0.25s ease-out;
}

.toast.out {
  opacity: 0;
  transform: translateY(-8px);
  transition: 0.3s;
}

.toast.good {
  background: #e4f7c8;
  border-color: var(--green-dark);
}

.toast.warn {
  background: #ffe2dc;
  border-color: var(--red-dark);
}

.toast.gold {
  background: #fff2b8;
  border-color: var(--gold-dark);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.95);
  }
}

/* ------------------------------------------------------------------ modal */

#modal {
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(20, 30, 22, 0.55);
  touch-action: pan-x pan-y; /* scroll, never zoom (double tap) */
  animation: fade-in 0.15s;
}

.panel {
  display: flex;
  flex-direction: column;
  width: min(100%, 520px);
  max-height: min(100%, 640px);
  border: 4px solid var(--wood);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 8px 0 rgba(43, 31, 46, 0.4);
  animation: panel-in 0.2s ease-out;
  overflow: hidden;
}

.panel.narrow {
  width: min(100%, 380px);
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
}

.panel > header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  background: var(--wood);
  color: var(--paper);
}

.panel > header h2 {
  flex: 1;
  margin: 0;
  font-size: 18px;
}

.panel > header .purse {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 1px 10px 1px 6px;
  border-radius: 12px;
  background: var(--wood-dark);
  font-weight: 700;
}

.panel .close {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid var(--wood-dark);
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 8px 10px 0;
  background: var(--paper-2);
  border-bottom: 3px solid var(--wood);
}

.tabs button {
  flex: 1;
  padding: 6px 4px;
  border: 3px solid var(--wood);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: var(--paper-3);
  font-weight: 700;
  opacity: 0.75;
}

.tabs button.on {
  background: var(--paper);
  opacity: 1;
  margin-bottom: -3px;
  padding-bottom: 9px;
}

.panel .body {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.panel footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px;
  border-top: 3px solid var(--paper-3);
  background: var(--paper-2);
}

.panel p {
  margin: 0 0 8px;
}

.hint {
  color: var(--ink-soft);
  font-size: 13px;
  text-align: center;
}

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

.item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px 10px;
  padding: 6px 8px;
  border: 2px solid var(--paper-3);
  border-radius: 12px;
  background: #fffaf0;
}

.item.locked {
  opacity: 0.6;
  background: var(--paper-2);
}

.item .pic {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--paper-2);
}

.item .title {
  font-weight: 700;
}

.item .sub {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  color: var(--ink-soft);
  font-size: 12.5px;
}

.item .sub span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.item .acts {
  display: flex;
  gap: 5px;
}

.price {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
}

.rank {
  display: grid;
  place-items: center;
  width: 28px;
  font-weight: 700;
  color: var(--ink-soft);
}

.rank.top {
  color: var(--gold-dark);
  font-size: 18px;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b9b09a;
}

.dot.on {
  background: #4caf50;
  box-shadow: 0 0 0 2px #c9f2a8;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}

.cell {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 4px 6px;
  border: 2px solid var(--paper-3);
  border-radius: 12px;
  background: #fffaf0;
  font-size: 12.5px;
  text-align: center;
}

.cell b {
  font-size: 15px;
}

.panel h3 {
  margin: 10px 2px 6px;
  font-size: 14px;
  color: var(--ink-soft);
}

.panel h3:first-child {
  margin-top: 0;
}

.field {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.field label,
#join label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

.field input,
#join input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 3px solid var(--wood);
  border-radius: 12px;
  background: #fff;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.field input:focus,
#join input:focus {
  border-color: var(--green-dark);
}

.field .inline {
  display: flex;
  gap: 6px;
}

.looks {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.looks button {
  display: grid;
  place-items: end center;
  height: 78px;
  padding: 0 0 3px;
  border: 3px solid var(--paper-3);
  border-radius: 12px;
  background: linear-gradient(#d9f1ff, #eefae0 72%, #b5e878 72%);
}

.looks button.on {
  border-color: var(--green-dark);
  box-shadow: 0 0 0 2px var(--green-light);
  transform: translateY(-2px);
}

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 2px;
  font-weight: 600;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  font-size: 13px;
}

.stats div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed var(--paper-3);
}

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

.news li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 10px;
  background: #fffaf0;
}

/* ------------------------------------------------------------------ title */

#title,
#offline {
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(ellipse at center, rgba(20, 40, 24, 0.25), rgba(20, 40, 24, 0.7));
  overflow-y: auto;
  touch-action: pan-x pan-y; /* scroll, never zoom (double tap) */
}

#title.leaving {
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}

.sheet {
  width: min(100%, 400px);
  padding: 20px 22px 16px;
  border: 4px solid var(--wood);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 10px 0 rgba(43, 31, 46, 0.4);
  text-align: center;
}

.sheet.small {
  width: min(100%, 320px);
}

.sheet h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.1;
  color: var(--green-dark);
  text-shadow:
    0 3px 0 #fff,
    0 5px 0 rgba(43, 31, 46, 0.15);
}

.sheet h1 em {
  display: inline-block;
  margin-left: 6px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--gold);
  color: var(--wood-dark);
  font-size: 22px;
  font-style: normal;
  vertical-align: middle;
  text-shadow: none;
  transform: rotate(-4deg);
}

.sheet .tag {
  margin: 6px 0 14px;
  color: var(--ink-soft);
  font-size: 14px;
}

#join {
  display: grid;
  gap: 8px;
  text-align: left;
}

#join .welcome {
  margin: 4px 0 8px;
  font-size: 17px;
  text-align: center;
}

#join .alt {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 0;
}

.error {
  margin: 0;
  padding: 6px 10px;
  border-radius: 10px;
  background: #ffe2dc;
  color: var(--red-dark);
  font-weight: 600;
  text-align: center;
}

.loading .bar {
  height: 18px;
}

.loading small {
  display: block;
  margin-top: 6px;
  color: var(--ink-soft);
}

.world {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

/* ----------------------------------------------------------------- mobile */

@media (max-width: 760px) {
  :root {
    --gap: 6px;
  }

  html,
  body {
    font-size: 14px;
  }

  .me {
    min-width: min(190px, 56vw);
    max-width: 58vw;
    padding: 4px 8px 4px 4px;
  }

  .me .face {
    width: 42px;
    height: 50px;
  }

  .quest {
    top: calc(var(--gap) + var(--safe-t) + var(--me-h, 64px) + 6px);
    max-width: 62vw;
  }

  .quest small {
    display: none;
  }

  .menu {
    flex-direction: column;
    gap: 5px;
  }

  .menu button {
    width: 48px;
    padding: 4px 0;
  }

  .menu button span {
    display: none;
  }

  .place {
    top: auto;
    bottom: calc(var(--gap) + var(--safe-b) + 76px);
    font-size: 12px;
    padding: 1px 12px;
    border-width: 2px;
  }

  .chat {
    bottom: calc(var(--gap) + var(--safe-b) + 76px);
    width: min(300px, 70vw);
  }

  .chat .log {
    max-height: 90px;
  }

  .hotbar {
    padding: 4px;
  }

  .slot {
    width: 48px;
    height: 48px;
  }

  .slot .key {
    display: none;
  }

  /* below the player card and the quest, which fill the top of a phone screen */
  #toasts {
    top: calc(128px + var(--safe-t));
    width: min(78vw, 420px);
  }

  .sheet h1 {
    font-size: 34px;
  }
}

@media (max-height: 520px) {
  .quest {
    display: none;
  }

  .looks button {
    height: 64px;
  }
}

/* --------------------------------------------------------------- profiler */

#perf {
  position: fixed;
  right: calc(var(--gap) + var(--safe-r));
  bottom: calc(var(--gap) + var(--safe-b));
  z-index: 7;
  margin: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(20, 16, 24, 0.82);
  color: #c9f2a8;
  font: 11px/1.45 ui-monospace, 'Cascadia Mono', Consolas, monospace;
  pointer-events: none;
  white-space: pre;
}

/* ------------------------------------------------------ high-resolution art */

/* Icons are drawn at 32px. Smaller than that, smooth scaling looks better than dropped pixels. */
img.icon.small {
  image-rendering: auto;
}

.looks button {
  height: 108px;
}

@media (max-height: 620px) {
  .looks button {
    height: 60px;
  }

  .looks button img {
    width: 32px;
    height: 48px;
  }
}

/* ------------------------------------------------------------------ fishing */

.pull {
  left: 50%;
  bottom: calc(var(--gap) + var(--safe-b) + 84px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 190px;
  justify-content: center;
  padding: 8px 22px 8px 14px;
  border: 3px solid var(--wood);
  border-radius: 28px;
  background: var(--paper);
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 5px 0 rgba(43, 31, 46, 0.35);
  opacity: 0.85;
}

.pull.bite {
  border-color: var(--red-dark);
  background: linear-gradient(#ffe36e, #f5c93a);
  font-size: 22px;
  opacity: 1;
  animation: tug 0.28s ease-in-out infinite alternate;
}

@keyframes tug {
  from {
    transform: translateX(-50%) scale(1);
  }
  to {
    transform: translateX(-50%) scale(1.12) rotate(-2deg);
  }
}

.slot.bait {
  margin-left: 6px;
  border-style: dashed;
  background: #e6f3ff;
}

/* ------------------------------------------------------------- wild animals */

.wildtag {
  flex-direction: column;
  gap: 1px !important;
  padding: 1px 8px 2px;
  border-radius: 9px;
  background: rgba(31, 22, 28, 0.62);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.25;
}

.wildtag.r1 {
  color: #9fe0ff;
}

.wildtag.r2 {
  color: #e2b8ff;
}

.wildtag.r3 {
  color: #ffe36e;
  box-shadow: 0 0 0 2px rgba(245, 201, 58, 0.7);
}

.wildtag.r4 {
  color: #fff6c8;
  background: linear-gradient(90deg, rgba(120, 40, 140, 0.92), rgba(40, 90, 150, 0.92), rgba(30, 120, 90, 0.92));
  box-shadow: 0 0 0 2px #ffe36e, 0 0 10px rgba(255, 226, 122, 0.8);
}

.trust {
  display: none;
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
}

.wildtag.known .trust {
  display: block;
}

.trust i {
  display: block;
  height: 100%;
  background: #ff7a8a;
}

.animal {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border: 2px solid var(--paper-3);
  border-radius: 14px;
  background: linear-gradient(#d9f1ff, #eefae0 70%, #b5e878 70%);
}

.animal b {
  display: block;
  font-size: 19px;
}

.animal small,
.cell small {
  color: var(--ink-soft);
  font-size: 12px;
}

.animal.r2,
.cell.r2 {
  border-color: #ab84e3;
}

.animal.r3,
.cell.r3 {
  border-color: var(--gold-dark);
  box-shadow: 0 0 0 2px rgba(245, 201, 58, 0.45);
}

.animal.r4,
.cell.r4 {
  border-color: #b44fd6;
  background: linear-gradient(160deg, #fff8e0, #f3e4ff 55%, #e0fff6);
  box-shadow: 0 0 0 2px rgba(255, 226, 122, 0.8), 0 0 12px rgba(180, 79, 214, 0.45);
}

.animal.r1,
.cell.r1 {
  border-color: #57a8e0;
}

.trustbar {
  position: relative;
  height: 22px;
  margin: 10px 0;
  border: 2px solid var(--wood);
  border-radius: 12px;
  background: var(--paper-3);
  overflow: hidden;
}

.trustbar i {
  display: block;
  height: 100%;
  background: linear-gradient(#ffa3b0, #f2627a);
  transition: width 0.4s ease;
}

.trustbar span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
}

.like {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 0 5px;
  white-space: nowrap;
}

.item.liked {
  border-color: #f2627a;
  background: #fff1f3;
}

.grid.book {
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
}

.cell.unknown {
  background: var(--paper-2);
  border-style: dashed;
}

.cell.unknown img:first-child {
  filter: brightness(0) opacity(0.28);
}

.cell.on {
  background: var(--green-light);
  border-color: var(--green-dark);
}

.likes {
  display: flex;
  gap: 3px;
}

@media (max-width: 760px) {
  .pull {
    bottom: calc(var(--gap) + var(--safe-b) + 72px);
    min-width: 170px;
  }
}

/* --------------------------------------------------------------- the maps */

.placetag.exit {
  background: #e6f3ff;
  border-color: #3b82c4;
}

.placetag.exit.locked {
  background: var(--paper-2);
  border-color: var(--ink-soft);
  color: var(--ink-soft);
}

.place.lake {
  background: #cfeaff;
  border-color: #3b82c4;
}

.place.forest {
  background: #cdeac0;
  border-color: #2e7d3e;
}

.place.mountain {
  background: #e3e0da;
  border-color: #6b6b7d;
}

.item.zone.here {
  border-color: var(--green-dark);
  background: #eefae0;
}

.item.zone .here {
  color: var(--green-dark);
}

.finds {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  margin-top: 4px;
  font-size: 12px;
}

.find {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.tabs button {
  white-space: nowrap;
  font-size: 13.5px;
}

@media (max-width: 760px) {
  .menu button {
    width: 46px;
  }

  .tabs {
    padding: 8px 6px 0;
    gap: 2px;
  }

  .tabs button {
    padding: 6px 2px;
    font-size: 12.5px;
  }
}

/* -------------------------------------------------------------------- house */

.homebar {
  left: 50%;
  bottom: calc(var(--gap) + var(--safe-b));
  transform: translateX(-50%);
  max-width: min(720px, calc(100vw - 2 * var(--gap)));
  padding: 8px;
  border: 3px solid var(--wood);
  border-radius: 16px;
  background: rgba(79, 50, 36, 0.9);
  box-shadow: 0 4px 0 rgba(43, 31, 46, 0.35);
  color: var(--paper);
}

.homebar .btn,
.homebar .slot {
  color: var(--ink);
}

.homebar .row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.homebar .whose,
.homebar .likes {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  font-weight: 700;
  white-space: nowrap;
}

.homebar .hint {
  margin: 0 4px 6px;
  color: var(--paper-2);
  font-size: 13px;
  text-align: center;
}

.homebar .hint small {
  color: var(--paper-3);
}

.homebar .tray .row {
  flex-wrap: nowrap;
  align-items: stretch;
}

.homebar .store {
  display: flex;
  gap: 5px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  touch-action: pan-x;
  padding-top: 3px;
}

.homebar .store::-webkit-scrollbar {
  display: none;
}

.homebar .acts {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 55%;
}

.btn.pink {
  background: linear-gradient(#ffb3c4, #f58ca6);
  border-color: #a8405c;
}

img.furn {
  display: block;
  width: auto;
  height: auto;
  image-rendering: pixelated;
  -webkit-user-drag: none;
}

.item .pic.furn {
  width: 64px;
  height: 64px;
}

.need {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-variant-numeric: tabular-nums;
}

.need.short {
  color: var(--red-dark);
  font-weight: 700;
}

.house {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 2px solid var(--paper-3);
  border-radius: 12px;
  background: #fff8e6;
}

.house .title {
  font-size: 16px;
}

.house .sub {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: center;
  color: var(--ink-soft);
  font-size: 13px;
}

.house .sub span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.house .cost {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px dashed var(--paper-3);
}

.pic.swatch {
  border: 2px solid var(--wood);
  border-radius: 8px;
}

.swatch.floor-wood {
  background: repeating-linear-gradient(0deg, #c08a55 0 7px, #a87444 7px 8px);
}

.swatch.floor-tile {
  background: repeating-conic-gradient(#f3e6c8 0 25%, #e0cda2 0 50%) 0 0 / 16px 16px;
}

.swatch.floor-mat {
  background: repeating-linear-gradient(90deg, #d9bf72 0 3px, #c4a755 3px 6px);
}

.swatch.wall-plaster {
  background: linear-gradient(#fbf1d8 70%, #9a6a42 70%);
}

.swatch.wall-wood {
  background: repeating-linear-gradient(90deg, #b9814d 0 6px, #94633a 6px 7px);
}

.swatch.wall-brick {
  background:
    linear-gradient(#0000 0 6px, #a8623f 6px 7px) 0 0 / 100% 7px,
    repeating-linear-gradient(90deg, #d98a5c 0 12px, #a8623f 12px 13px);
}

@media (max-width: 560px) {
  .homebar {
    padding: 6px;
  }

  .homebar .tray .row {
    flex-direction: column;
  }

  .homebar .acts {
    max-width: none;
    justify-content: center;
  }

  .homebar .btn {
    min-height: 34px;
    padding: 2px 10px;
    font-size: 13px;
  }
}

/* ------------------------------------------------------------------ sign in */

.signin {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

#signin {
  padding-top: 12px;
  border-top: 2px dashed var(--paper-3);
}

/* the only way in: no line above, and the words stand out */
#signin.only {
  padding-top: 4px;
  border-top: 0;
}

#signin.only p {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

#signin p,
.signed {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  text-align: center;
}

.signed {
  margin-bottom: 8px;
  color: var(--green-dark);
  font-weight: 700;
}

#signin-buttons {
  display: grid;
  gap: 8px;
}

.btn.signin {
  width: 100%;
  min-height: 44px;
}

.btn.signin.line {
  border-color: #04773a;
  background: #06c755;
  color: #fff;
}

.btn.signin.google {
  border-color: #6b7280;
  background: #fff;
  color: #1f2937;
}

/* ----------------------------------------------------------------- fighting */

.bar.hp {
  height: 12px;
  margin-top: 2px;
}

.bar.hp i {
  background: linear-gradient(#ff8a80, #d94a3d);
}

.bar.hp.low i {
  animation: blink 0.6s ease-in-out infinite alternate;
}

@keyframes blink {
  to {
    opacity: 0.45;
  }
}

.bar span {
  font-variant-numeric: tabular-nums;
}

.float.dmg {
  font-size: 15px;
}

.float.crit {
  color: #ffe36e;
  font-size: 20px;
}

.mobtag {
  display: grid;
  justify-items: center;
  gap: 1px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-shadow:
    0 1px 0 #2b1f2e,
    1px 0 0 #2b1f2e,
    -1px 0 0 #2b1f2e,
    0 -1px 0 #2b1f2e;
}

.mobtag .hp {
  display: block;
  width: 40px;
  height: 6px;
  border: 1px solid #2b1f2e;
  border-radius: 3px;
  background: #5a2b2b;
  overflow: hidden;
}

.mobtag .hp i {
  display: block;
  height: 100%;
  background: #ff6b5b;
  transition: width 0.15s;
}

.mobtag.bosstag {
  font-size: 13px;
}

.mobtag.bosstag .hp {
  width: 72px;
}

.mobtag .bossmark {
  padding: 0 5px;
  border: 1px solid #2b1f2e;
  border-radius: 6px;
  background: #d8342c;
  color: #fff;
  text-shadow: none;
}

.bossbar {
  left: 50%;
  top: calc(var(--gap) + var(--safe-t) + 42px);
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 2 * var(--gap)));
  padding: 6px 10px 8px;
  border: 3px solid var(--gold-dark);
  border-radius: 12px;
  background: rgba(43, 31, 46, 0.88);
  color: var(--gold);
  text-align: center;
}

.bossbar b {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bossbar .bar {
  height: 16px;
  border-color: var(--gold-dark);
  background: #3d1d1d;
}

.bossbar .bar i {
  background: linear-gradient(#ff6b5b, #b3261e);
  transition: width 0.2s;
}

.bossbar .bar span {
  color: #fff;
}

.item .sub span.short,
.need.short {
  color: var(--red-dark);
  font-weight: 700;
}

.chest {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 2px solid var(--gold-dark);
  border-radius: 12px;
  background: #fff4c7;
}

.chest small {
  display: block;
  color: var(--ink-soft);
}

.loot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 10px 0;
  padding: 0;
  list-style: none;
  font-weight: 700;
}

.loot li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lucky {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--green-dark);
  font-weight: 700;
}

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

.ranking li {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #fffaf0;
  font-variant-numeric: tabular-nums;
}

.ranking li.me {
  background: var(--green-light);
}

.ranking .n {
  text-align: center;
  color: var(--ink-soft);
  font-weight: 700;
}

/* ------------------------------------------------ weapons, gear and potions */

.float.heal {
  color: #b5ffb0;
  font-size: 16px;
}

.float.rare {
  color: #ffe36e;
  font-size: 15px;
  animation-duration: 2.2s;
}

.slot.arm .dur,
span.dur {
  display: block;
  height: 5px;
  border: 1px solid #2b1f2e;
  border-radius: 3px;
  background: #5a2b2b;
  overflow: hidden;
}

.slot.arm .dur {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 4px;
}

span.dur {
  width: 56px;
  margin-top: 3px;
}

.dur i {
  display: block;
  height: 100%;
  background: #6dbb4f;
}

.dur.mid i {
  background: #f5c93a;
}

.dur.low i,
.dur.broken i {
  background: #d94a3d;
}

.slot.arm.broken img,
.item.broken .pic img {
  filter: grayscale(1) brightness(0.8);
}

.slot.arm.broken,
.slot.arm.none {
  border-color: var(--red-dark);
}

.slot.arm.none .n {
  color: var(--red-dark);
}

/* worn thin: a hammer badge that pulses, until mended */
.slot.arm.worn,
.slot.arm.broken {
  animation: worn 1s ease-in-out infinite alternate;
}

.slot.arm.worn::after,
.slot.arm.broken::after {
  content: '🔨';
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid var(--red-dark);
  border-radius: 50%;
  background: #fff4c7;
  font-size: 12px;
}

@keyframes worn {
  to {
    box-shadow: 0 0 0 3px rgba(217, 74, 61, 0.45);
  }
}

.slot.potion.none img {
  opacity: 0.35;
}

.item .bad,
.bad {
  color: var(--red-dark);
  font-weight: 700;
}

.item.here {
  border-color: var(--green-dark);
  background: #eef8e0;
}

.hero {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 2px solid var(--paper-3);
  border-radius: 12px;
  background: #fffaf0;
}

.hero > div {
  flex: 1;
}

.hero .bar {
  margin-top: 4px;
}

.slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.slot-card {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px;
  border: 2px dashed var(--paper-3);
  border-radius: 10px;
  background: #fffaf0;
  font-size: 12px;
  text-align: center;
}

.slot-card small {
  color: var(--ink-soft);
}

.slot-card .none {
  height: 32px;
  line-height: 32px;
  color: var(--paper-3);
}

.loot li.rare {
  color: var(--gold-dark);
}

.mobtag em {
  color: #ffe36e;
  font-style: normal;
}

.clock {
  right: calc(var(--gap) + var(--safe-r));
  top: calc(var(--gap) + var(--safe-t) + 66px);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border: 2px solid var(--wood);
  border-radius: 12px;
  background: rgba(253, 243, 216, 0.92);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none !important;
}

/* ------------------------------------------------ the monster book, the target */

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

.mob {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 8px 10px;
  border: 2px solid var(--paper-3);
  border-radius: 12px;
  background: #fffaf0;
}

.mob.boss {
  border-color: var(--gold-dark);
  background: #fff4c7;
}

.mobpic {
  image-rendering: pixelated;
  object-fit: contain;
}

.mob .title em,
.target em {
  color: var(--gold-dark);
  font-style: normal;
}

.mob .sub {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  color: var(--ink-soft);
  font-size: 12.5px;
}

.mob .sub span,
.finds .find,
.finds .chestname {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.finds {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  margin-top: 4px;
  font-size: 12.5px;
}

.finds .find b {
  font-variant-numeric: tabular-nums;
  color: var(--green-dark);
}

.finds .find.epic,
.finds .find.epic b {
  color: #7a3fd1;
  font-weight: 700;
}

.finds .find.legend,
.finds .find.legend b {
  color: #b8860b;
  font-weight: 700;
  text-shadow: 0 0 6px rgba(245, 201, 58, 0.8);
}

.finds .chestname {
  font-weight: 700;
  color: var(--wood);
}

.target {
  left: 50%;
  top: calc(var(--gap) + var(--safe-t) + 42px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(420px, calc(100vw - 2 * var(--gap)));
  padding: 5px 10px;
  border: 2px solid var(--wood);
  border-radius: 12px;
  background: rgba(253, 243, 216, 0.95);
  font-size: 13px;
  pointer-events: none !important;
}

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

.target .bar {
  height: 8px;
  margin: 2px 0;
}

.target .finds {
  margin-top: 0;
  font-size: 11.5px;
}

/* ------------------------------------------------------------------ quests */

#quest {
  cursor: pointer;
}

#quest:active {
  transform: scale(0.97);
}

.item.done {
  opacity: 0.75;
}

.item .bar {
  margin: 3px 0;
}

.bonus {
  margin-top: 8px;
  padding: 8px 10px;
  border: 2px dashed var(--gold-dark);
  border-radius: 12px;
  background: #fff8e1;
}

.bonus.got {
  border-style: solid;
  background: #eef8e0;
}

.bonus .sub,
.gifts .sub {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  font-size: 12.5px;
}

.bonus .sub span,
.gifts .sub span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.gifts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gifts li {
  padding: 8px;
  border: 2px solid var(--paper-3);
  border-radius: 12px;
  background: #fffaf0;
}

.gifts li.got {
  opacity: 0.55;
}

.gifts li.today {
  border-color: var(--gold-dark);
  background: #fff4c7;
}

.gifts small {
  color: var(--green-dark);
  font-weight: 700;
}

.live {
  color: var(--red-dark);
  font-weight: 700;
}

/* on a phone the top is full: the target and the boss go just above the hotbar */
@media (max-width: 560px) {
  .target,
  .bossbar {
    top: auto;
    bottom: calc(var(--gap) + var(--safe-b) + 84px);
    left: calc(var(--gap) + var(--safe-l));
    transform: none;
    width: calc(100vw - 2 * var(--gap) - 76px);
  }
}

/* ------------------------------------------------------ parties, world boss */

.worldboss {
  left: 50%;
  top: calc(var(--gap) + var(--safe-t) + 42px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(520px, calc(100vw - 2 * var(--gap)));
  padding: 5px 6px 5px 12px;
  border: 3px solid var(--gold-dark);
  border-radius: 14px;
  background: rgba(43, 31, 46, 0.9);
  color: #fff4c7;
  font-size: 13px;
  text-align: left;
}

.worldboss.on {
  border-color: #d94a3d;
  animation: callout 1.2s ease-in-out infinite alternate;
}

@keyframes callout {
  to {
    box-shadow: 0 0 0 4px rgba(217, 74, 61, 0.35);
  }
}

.worldboss b {
  color: var(--gold);
}

.worldboss .go {
  flex: none;
  padding: 3px 12px;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
}

.party {
  top: calc(var(--gap) + var(--safe-t) + var(--me-h, 78px) + var(--quest-h, 0px) + 12px);
  left: calc(var(--gap) + var(--safe-l));
  display: grid;
  gap: 4px;
  width: 150px;
}

.party .member {
  display: grid;
  gap: 1px;
  padding: 4px 8px;
  border: 2px solid var(--wood);
  border-radius: 10px;
  background: rgba(253, 243, 216, 0.94);
  text-align: left;
  font-size: 12px;
}

.party .member small {
  color: var(--ink-soft);
}

.party .bar {
  height: 7px;
  margin: 0;
}

.partybox {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 2px solid var(--green-dark);
  border-radius: 12px;
  background: #eef8e0;
}

.partybox small {
  flex: 1;
  color: var(--ink-soft);
}

.chat p.party b,
.chat .tag {
  color: #2f7fb8;
}

.chat .tag {
  margin-right: 4px;
  padding: 0 5px;
  border-radius: 6px;
  background: #d8ecfa;
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 560px) {
  .worldboss {
    top: auto;
    bottom: calc(var(--gap) + var(--safe-b) + 84px);
    left: calc(var(--gap) + var(--safe-l));
    transform: none;
    max-width: calc(100vw - 2 * var(--gap) - 76px);
    font-size: 12px;
  }

  .party {
    top: calc(var(--gap) + var(--safe-t) + var(--me-h, 64px) + var(--quest-h, 0px) + 12px);
    width: 120px;
  }
}

/* settings: leaving this device */
.signout {
  display: flex;
  justify-content: center;
  margin: 14px 0 4px;
}

/* ------------------------------------------------------------------- skills */

/* the fighting level, beside the farming one */
.bar.adv i {
  background: linear-gradient(#c9a8ff, #7a52d6);
}

.bar span .icon.small {
  width: 10px;
  height: 10px;
  vertical-align: -1px;
}

.float.xp.fight {
  color: #dcc6ff;
}

.float.skill {
  padding: 1px 8px;
  border-radius: 8px;
  background: rgba(43, 31, 46, 0.78);
  color: #fff4c7;
  font-size: 13px;
}

/* bottom right: the attack button, and the skills in an arc from its left to above it */
.skills {
  right: calc(var(--gap) + var(--safe-r));
  bottom: calc(var(--gap) + var(--safe-b));
  width: 180px;
  height: 180px;
  pointer-events: none;
}

.skills button {
  position: absolute;
  display: grid;
  place-items: center;
  padding: 0;
  border: 3px solid var(--wood-dark);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffaf0, var(--paper-2) 60%, var(--paper-3));
  box-shadow: 0 3px 0 rgba(43, 31, 46, 0.45);
  pointer-events: auto;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.skills button img {
  pointer-events: none;
}

.skills .attack {
  right: 0;
  bottom: 0;
  width: 80px;
  height: 80px;
  border-color: #7d1a15;
  background: radial-gradient(circle at 35% 30%, #ffc2b0, #e0533d 60%, #a8321f);
}

.skills .attack img {
  width: 44px;
  height: 44px;
  filter: drop-shadow(0 2px 0 rgba(43, 31, 46, 0.5));
}

.skills .skill {
  width: 56px;
  height: 56px;
  overflow: hidden;
}

.skills .skill.ult {
  border-color: var(--gold-dark);
  box-shadow:
    0 3px 0 rgba(43, 31, 46, 0.45),
    0 0 10px rgba(245, 201, 58, 0.7);
}

.skills .s0 {
  right: 124px;
  bottom: 12px;
}

.skills .s1 {
  right: 109px;
  bottom: 68px;
}

.skills .s2 {
  right: 68px;
  bottom: 109px;
}

.skills .s3 {
  right: 12px;
  bottom: 124px;
}

/* recovering: a shadow sweeps round, with the seconds left */
.skills .skill .cd {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(rgba(20, 12, 18, 0.66) calc(var(--cd, 0) * 360deg), transparent 0);
  pointer-events: none;
}

.skills .skill .t {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  text-shadow:
    0 1px 0 #2b1f2e,
    1px 0 0 #2b1f2e,
    -1px 0 0 #2b1f2e,
    0 -1px 0 #2b1f2e;
  pointer-events: none;
}

.skills .skill small {
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 4px;
  border-radius: 6px;
  background: rgba(43, 31, 46, 0.78);
  color: #fff4c7;
  font-size: 9px;
  font-weight: 700;
  line-height: 13px;
  white-space: nowrap;
  pointer-events: none;
}

/* the ultimate's and the swap's gauge: a ring inside the button's edge; full = it shines (owner 4 Oct: "อันติใช้ไม่ได้") */
.skills .skill .gauge {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(#ffcf3a calc(var(--g, 0) * 360deg), rgba(43, 31, 46, 0.28) 0);
  -webkit-mask: radial-gradient(circle, transparent calc(50% - 5px), #000 calc(50% - 4px));
  mask: radial-gradient(circle, transparent calc(50% - 5px), #000 calc(50% - 4px));
  pointer-events: none;
}

.skills .skill.ult:not(.ready) img {
  opacity: 0.6;
  filter: grayscale(0.5);
}

.skills .skill.ult.ready {
  animation: ult-ready 1.1s ease-in-out infinite;
}

@keyframes ult-ready {
  50% {
    box-shadow:
      0 3px 0 rgba(43, 31, 46, 0.45),
      0 0 18px rgba(255, 207, 58, 0.95);
  }
}

/* swap weapons (R): inside the arc, between the attack button and the skills, so nothing overlaps */
.skills .skill-swap {
  right: 64px;
  bottom: 64px;
  width: 40px;
  height: 40px;
  color: var(--wood-dark);
  font-size: 18px;
  font-weight: 800;
}

.skills .skill-swap.ready {
  border-color: var(--gold-dark);
  box-shadow:
    0 3px 0 rgba(43, 31, 46, 0.45),
    0 0 12px rgba(255, 207, 58, 0.85);
}

.skills .skill.locked img {
  filter: grayscale(1) brightness(0.75);
  opacity: 0.7;
}

.skills .skill.locked {
  border-color: #8a7a6a;
  box-shadow: 0 3px 0 rgba(43, 31, 46, 0.3);
}

.skills button.pressed {
  animation: press 0.18s ease-out;
}

@keyframes press {
  40% {
    transform: scale(0.88);
  }
}

/* the smithy's promotion box and the list of skills */
.promote {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 2px solid var(--gold-dark);
  border-radius: 12px;
  background: #fff4c7;
}

.promote .title {
  font-weight: 800;
  color: var(--wood-dark);
}

.promote .btn {
  justify-self: start;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.skilllist .item.locked {
  opacity: 0.62;
}

small.gold {
  color: var(--gold-dark);
  font-weight: 800;
}

@media (max-width: 560px) {
  .skills {
    width: 156px;
    height: 156px;
  }

  .skills .attack {
    width: 70px;
    height: 70px;
  }

  .skills .attack img {
    width: 38px;
    height: 38px;
  }

  .skills .skill {
    width: 50px;
    height: 50px;
  }

  .skills .skill img {
    width: 28px;
    height: 28px;
  }

  .skills .s0 {
    right: 106px;
    bottom: 10px;
  }

  .skills .s1 {
    right: 93px;
    bottom: 58px;
  }

  .skills .s2 {
    right: 58px;
    bottom: 93px;
  }

  .skills .s3 {
    right: 10px;
    bottom: 106px;
  }

  .skills .skill-swap {
    right: 55px;
    bottom: 55px;
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  /* while fighting the hotbar and the cards make room on the left */
  body.fighting .hotbar {
    left: calc(var(--gap) + var(--safe-l));
    transform: none;
    max-width: calc(100vw - 2 * var(--gap) - 160px);
  }

  body.fighting .target,
  body.fighting .bossbar,
  body.fighting .worldboss {
    width: calc(100vw - 2 * var(--gap) - 166px);
    max-width: none;
  }
}

/* --------------------------------------------------------------------- yard */

/* on one's own farm: the button to arrange the yard; while placing, what to do */
.yardbar {
  left: 50%;
  bottom: calc(var(--gap) + var(--safe-b) + 84px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 2 * var(--gap));
  padding: 4px;
  border-radius: 14px;
}

.yardbar .hint {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 2px solid var(--wood);
  border-radius: 12px;
  background: rgba(253, 243, 216, 0.95);
  font-size: 13px;
  font-weight: 700;
}

b.good {
  color: var(--green-dark);
}

/* ---------------------------------------------------------- sign up / sign in */

.acct-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 2px solid var(--wood);
  border-radius: 14px;
  background: var(--paper-2);
}

.acct-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 800;
}

.acct-tabs button.on {
  background: #fff;
  color: var(--green-dark);
  box-shadow: 0 2px 0 rgba(43, 31, 46, 0.2);
}

#acct,
#newcomer,
#invite-box {
  display: grid;
  gap: 6px;
}

#acct[hidden],
#newcomer[hidden],
#invite-box[hidden],
#acct [hidden] {
  display: none;
}

#join .alt {
  flex-wrap: wrap;
  gap: 4px 14px;
}

.acctbox {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 2px solid var(--green-dark);
  border-radius: 12px;
  background: #eef8e0;
}

/* ------------------------------------------------ tabs on a phone, and picking what to sell */

/* tabs wrap onto a second row instead of pushing the last ones out of sight */
.tabs {
  flex-wrap: wrap;
}

.tabs button {
  flex: 1 1 auto;
}

@media (max-width: 560px) {
  .tabs {
    row-gap: 4px;
  }

  .tabs button {
    border-bottom: 3px solid var(--wood);
    border-radius: 10px;
  }

  .tabs button.on {
    margin-bottom: 0;
    padding-bottom: 6px;
    background: #fff;
    border-color: var(--green-dark);
    color: var(--green-dark);
  }
}

.picklist .item.pick {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.picklist .item.pick.on {
  border-color: var(--gold-dark);
  background: #fff4c7;
}

.picklist .tick {
  display: grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--wood);
  border-radius: 6px;
  background: #fff;
  color: var(--green-dark);
  font-weight: 900;
}

.picklist .item.pick.on .tick {
  border-color: var(--green-dark);
  background: var(--green-light);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stepper b {
  min-width: 26px;
  text-align: center;
  font-size: 14px;
}

.stepper .btn.small {
  min-width: 32px;
}

footer.sellbar {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
}

footer.sellbar .btn.gold {
  flex: 1;
}

/* -------------------------------------------------------------- phone play */

/* the thumb stick, bottom left */
.joystick {
  left: calc(var(--gap) + var(--safe-l) + 6px);
  bottom: calc(var(--gap) + var(--safe-b) + 6px);
  width: 124px;
  height: 124px;
  border: 3px solid rgba(253, 243, 216, 0.75);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(43, 31, 46, 0.15), rgba(43, 31, 46, 0.4));
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.joystick i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border: 3px solid var(--wood-dark);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffaf0, var(--paper-2) 60%, var(--paper-3));
  box-shadow: 0 3px 0 rgba(43, 31, 46, 0.45);
  pointer-events: none;
}

.joystick.held {
  border-color: #fff;
}

.joystick:not(.held) i {
  transition: transform 0.12s ease-out;
}

/* with the stick there, the chat goes above it */
body.touch .chat {
  bottom: calc(var(--gap) + var(--safe-b) + 142px);
}

/* the minimap, under the clock on the right */
.minimap {
  top: calc(var(--gap) + var(--safe-t) + 96px);
  right: calc(var(--gap) + var(--safe-r));
  width: 168px;
  height: 116px;
  padding: 0;
  border: 3px solid var(--wood);
  border-radius: 12px;
  background: #23331f;
  box-shadow: 0 3px 0 rgba(43, 31, 46, 0.35);
  overflow: hidden;
  cursor: zoom-in;
}

.minimap canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

@media (max-height: 520px), (max-width: 560px) {
  .minimap {
    top: calc(var(--gap) + var(--safe-t) + 74px);
    width: 128px;
    height: 88px;
  }
}

/* the large map */
#bigmap {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(20, 12, 18, 0.55);
}

#bigmap[hidden] {
  display: none;
}

.bigmap {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  width: min(900px, 96vw);
  height: min(640px, 92vh);
  padding: 10px 12px;
  border: 3px solid var(--wood);
  border-radius: 16px;
  background: var(--paper);
}

.bigmap header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bigmap header small {
  flex: 1;
  color: var(--ink-soft);
}

.bigmap canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 10px;
  image-rendering: pixelated;
  cursor: crosshair;
}

.bigmap .legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0;
  font-size: 12px;
}

.bigmap .legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 4px;
  border: 2px solid #2b1f2e;
  border-radius: 50%;
  vertical-align: -1px;
}

.bigmap .legend i.square {
  border-radius: 2px;
}

/* a phone held upright is asked to turn */
#rotate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 12, 18, 0.88);
  text-align: center;
}

#rotate[hidden] {
  display: none;
}

#rotate .sheet {
  display: grid;
  gap: 8px;
  justify-items: center;
  max-width: 320px;
}

#rotate p {
  margin: 0;
  color: var(--ink-soft);
}

.phone-turn {
  width: 46px;
  height: 78px;
  border: 5px solid var(--wood-dark);
  border-radius: 10px;
  background: var(--green-light);
  animation: turn 1.8s ease-in-out infinite;
}

@keyframes turn {
  0%,
  25% {
    transform: rotate(0deg);
  }

  60%,
  100% {
    transform: rotate(-90deg);
  }
}

/* --------------------------------------------------- a phone held sideways */

@media (max-height: 520px) {
  /* toasts: smaller, and while a window is open they wait at the bottom instead of over its tabs */
  #toasts {
    top: calc(var(--gap) + var(--safe-t) + 60px);
    width: min(60vw, 380px);
  }

  .toast {
    padding: 3px 10px;
    font-size: 12px;
    border-width: 2px;
  }

  body.panel-open #toasts {
    top: auto;
    bottom: calc(var(--gap) + var(--safe-b));
    z-index: 70;
  }

  /* the world boss: a small chip beside the player card, with just who and when */
  .worldboss {
    top: calc(var(--gap) + var(--safe-t));
    left: calc(var(--gap) + var(--safe-l) + 216px);
    transform: none;
    max-width: min(200px, calc(100vw - 216px - 460px));
    min-width: 150px;
    padding: 3px 4px 3px 8px;
    font-size: 11px;
  }

  .worldboss .where {
    display: none;
  }

  .worldboss .go {
    padding: 2px 8px;
  }

  /* where one is: the minimap says it; the name would sit under the menu */
  .place {
    display: none;
  }
}

/* ------------------------------------------------------------ upright phone */

/* the stick bottom left and the skills bottom right: the hotbar and the cards go above them */
body.touch.upright .hotbar,
body.touch.upright.fighting .hotbar {
  left: 50%;
  bottom: calc(var(--gap) + var(--safe-b) + 138px);
  transform: translateX(-50%);
  max-width: calc(100vw - 2 * var(--gap));
}

body.touch.upright .target,
body.touch.upright .bossbar,
body.touch.upright.fighting .target,
body.touch.upright.fighting .bossbar {
  top: auto;
  bottom: calc(var(--gap) + var(--safe-b) + 210px);
  left: calc(var(--gap) + var(--safe-l));
  transform: none;
  width: calc(100vw - 2 * var(--gap));
}

body.touch.upright .worldboss,
body.touch.upright.fighting .worldboss {
  top: auto;
  bottom: calc(var(--gap) + var(--safe-b) + 268px);
  left: calc(var(--gap) + var(--safe-l));
  transform: none;
  width: auto;
  max-width: calc(100vw - 2 * var(--gap));
}

body.touch.upright .yardbar {
  bottom: calc(var(--gap) + var(--safe-b) + 204px);
}

body.touch.upright .pull {
  bottom: calc(var(--gap) + var(--safe-b) + 204px);
}

body.touch.upright .place {
  display: none;
}

/* the minimap above the skill buttons */
body.touch.upright .minimap {
  top: auto;
  bottom: calc(var(--gap) + var(--safe-b) + 170px);
  width: 116px;
  height: 80px;
}

body.touch.upright .chat {
  bottom: calc(var(--gap) + var(--safe-b) + 142px);
}

/* the minimap can be closed, and opened again from a small map button */
.minimap .mm-close {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid var(--wood-dark);
  border-radius: 50%;
  background: rgba(253, 243, 216, 0.92);
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.mm-open {
  top: calc(var(--gap) + var(--safe-t) + 96px);
  right: calc(var(--gap) + var(--safe-r));
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 3px solid var(--wood);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(43, 31, 46, 0.35);
}

@media (max-height: 520px), (max-width: 560px) {
  .mm-open {
    top: calc(var(--gap) + var(--safe-t) + 74px);
  }
}

/* upright phone: clear of the hotbar */
body.touch.upright .minimap {
  bottom: calc(var(--gap) + var(--safe-b) + 214px);
}

body.touch.upright .mm-open {
  top: auto;
  bottom: calc(var(--gap) + var(--safe-b) + 214px);
}

/* ------------------------------------------------ the big map, from above */

body.overview #labels {
  visibility: hidden;
}

#bigmap {
  background: transparent;
}

.bigmap {
  background: transparent;
  border: 0;
  padding: 0;
  gap: 0;
  box-shadow: 0 0 0 100vmax rgba(20, 12, 18, 0.55);
  border-radius: 16px;
  overflow: hidden;
  grid-template-rows: auto 1fr;
}

.bigmap header {
  padding: 8px 12px;
  border: 3px solid var(--wood);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: var(--paper);
}

.bigmap .frame {
  position: relative;
  min-height: 0;
  border: 3px solid var(--wood);
  border-radius: 0 0 16px 16px;
}

/* the game shows through here */
.bigmap .area {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}

.bigmap .marks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bigmap .exit {
  position: absolute;
  padding: 1px 8px;
  border-radius: 8px;
  background: rgba(43, 31, 46, 0.8);
  color: #fff4c7;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* ---------------------------------------- the stick on the right, skills left */

body.stick-right .joystick {
  left: auto;
  right: calc(var(--gap) + var(--safe-r) + 6px);
}

body.stick-right .skills {
  right: auto;
  left: calc(var(--gap) + var(--safe-l));
}

body.stick-right .skills .attack {
  right: auto;
  left: 0;
}

body.stick-right .skills .s0 {
  right: auto;
  left: 124px;
}

body.stick-right .skills .s1 {
  right: auto;
  left: 109px;
}

body.stick-right .skills .s2 {
  right: auto;
  left: 68px;
}

body.stick-right .skills .s3 {
  right: auto;
  left: 12px;
}

body.stick-right .skills .skill-swap {
  right: auto;
  left: 64px;
}

@media (max-width: 560px) {
  body.stick-right .skills .s0 {
    left: 106px;
  }

  body.stick-right .skills .s1 {
    left: 93px;
  }

  body.stick-right .skills .s2 {
    left: 58px;
  }

  body.stick-right .skills .s3 {
    left: 10px;
  }

  body.stick-right .skills .skill-swap {
    left: 55px;
  }
}

/* the chat button goes above whatever is at the bottom left */
body.touch .chat,
body.touch.upright .chat {
  bottom: calc(var(--gap) + var(--safe-b) + 176px);
}

/* the big map is on its own while open */
body.overview #hud {
  visibility: hidden;
}

/* the yard button, as small as a hotbar slot, beside the hotbar */
.yardbar.slotlike {
  transform: none;
  padding: 0;
}

.yardslot {
  width: 58px;
  height: 62px;
  border-color: var(--green-dark);
  background: #eef8e0;
  box-shadow: 0 3px 0 rgba(43, 31, 46, 0.35);
}

.yardslot small {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1px;
  font-size: 10px;
  font-weight: 800;
  color: var(--green-dark);
  text-align: center;
}

.yardslot img {
  margin-bottom: 10px;
}

/* upright phone: the world boss chip is short, and stays at the left */
body.touch.upright .worldboss,
body.touch.upright.fighting .worldboss {
  right: auto;
  max-width: 72vw;
  padding: 3px 4px 3px 8px;
  font-size: 11px;
}

body.touch.upright .worldboss .where {
  display: none;
}

/* ------------------------------------------------ the house builder: pictures of the houses */

.house .housepic {
  float: right;
  max-width: 96px;
  max-height: 88px;
  margin: 0 0 4px 8px;
  image-rendering: pixelated;
}

.house .sub.short {
  color: var(--red, #c0392b);
  font-weight: 700;
}

.houseladder {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 6px;
}

.houseladder .rung {
  display: grid;
  justify-items: center;
  align-content: end;
  gap: 2px;
  padding: 6px 4px;
  border: 2px solid var(--line, #d8c8a8);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
  text-align: center;
  opacity: 0.75;
}

.houseladder .rung.done {
  opacity: 1;
}

.houseladder .rung.now {
  opacity: 1;
  border-color: var(--green-dark, #3d7a2a);
  background: #eef8e0;
}

.houseladder .housepic {
  max-width: 80px;
  max-height: 72px;
  image-rendering: pixelated;
}

.houseladder small {
  font-size: 11px;
  opacity: 0.8;
}

/* the house, at the top of the yard window, with the way to a bigger one */
.houseline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  margin-bottom: 6px;
  border: 2px solid var(--line, #d8c8a8);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
}

.houseline > div {
  flex: 1;
  display: grid;
}

.houseline small {
  opacity: 0.8;
}

.houseline .housepic {
  max-width: 56px;
  max-height: 52px;
  image-rendering: pixelated;
}

/* ------------------------------------------------------ raids: the banner under the world boss's */

.raidbar {
  top: calc(var(--gap) + var(--safe-t) + 84px);
}

.raidbar.on {
  background: rgba(96, 22, 18, 0.92);
}

.raidbar .boss {
  color: #ffb4a8;
  font-weight: 700;
}

.raidbar .mvp {
  color: #ffe27a;
}

/* the ranking of a raid, under the map */
.raidtop {
  top: calc(var(--gap) + var(--safe-t) + 222px);
  right: calc(var(--gap) + var(--safe-r));
  width: 168px;
  padding: 6px 8px 7px;
  border: 3px solid #d94a3d;
  border-radius: 12px;
  background: rgba(43, 31, 46, 0.88);
  color: #fff4c7;
  font-size: 12px;
  pointer-events: none;
}

.raidtop .head {
  font-family: var(--font-display, inherit);
  font-weight: 700;
  color: #ffd27a;
  margin-bottom: 2px;
}

.raidtop .sub {
  margin-top: 3px;
  color: #ffb4a8;
  font-size: 11px;
}

.raidtop ol {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.raidtop li {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
}

.raidtop li.me {
  color: #b6ff9a;
}

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

.raidtop .n {
  text-align: center;
  opacity: 0.8;
}

@media (max-height: 520px), (max-width: 560px) {
  .raidtop {
    top: calc(var(--gap) + var(--safe-t) + 168px);
    width: 128px;
    font-size: 11px;
  }
}

/* on a phone the banner names the best, and the ranking comes at the end */
body.touch .raidtop {
  display: none;
}

/* in a raid, the boss bar goes under the raid's banner */
body.raiding:not(.touch) .bossbar {
  top: calc(var(--gap) + var(--safe-t) + 132px);
}

.float.armor {
  color: #c9d4e8;
}

/* a helper's wardrobe: everything to put on */
.wardrobe {
  margin: 6px 0 10px;
  padding: 6px 10px;
  border: 2px dashed var(--gold-dark, #b8860b);
  border-radius: 12px;
  background: rgba(255, 238, 180, 0.35);
}

.wardrobe summary {
  cursor: pointer;
}

.wardrobe .cell.on {
  border-color: var(--green, #3e7d3a);
}

@media (max-width: 560px) {
  .raidbar {
    top: auto;
    bottom: calc(var(--gap) + var(--safe-b) + 124px);
  }
}

/* ------------------------------------------------------ falling ill: the chip under the strength bar */

#me-sick {
  display: flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  margin-top: 2px;
  padding: 1px 8px 1px 5px;
  border-radius: 8px;
  background: #6a2a5a;
  color: #ffd9f4;
  font-size: 11px;
  font-weight: 700;
}

/* ------------------------------------------------------ the market between players */

.tradeform {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 2px dashed var(--line, #d8c8a8);
  border-radius: 10px;
}

.tradeform label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
}

.tradeform .field {
  padding: 4px 6px;
  border: 2px solid var(--line, #d8c8a8);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.tradeform input.field {
  width: 74px;
}

/* ------------------------------------------------ phones: the red banners are chips above the hotbar */
/* (the owner: "ในมือถือมันบัง ต้องมาอยู่ข้างล่าง") never over the middle of the screen; the raid chip
   sits just above the hotbar and the world boss chip just above that */

body.touch .worldboss,
body.touch.upright .worldboss,
body.touch.upright.fighting .worldboss,
body.touch.fighting .worldboss {
  --chip-b: calc(var(--gap) + var(--safe-b) + 88px);
  top: auto;
  left: 50%;
  right: auto;
  bottom: calc(var(--chip-b) + 30px);
  transform: translateX(-50%);
  width: max-content;
  min-width: 0;
  max-width: calc(100vw - 2 * var(--gap) - var(--safe-l) - var(--safe-r));
  padding: 2px 3px 2px 8px;
  border-width: 2px;
  border-radius: 12px;
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
}

body.touch .raidbar,
body.touch.upright .raidbar,
body.touch.upright.fighting .raidbar,
body.touch.fighting .raidbar {
  bottom: var(--chip-b);
}

/* the boss chip drops to the hotbar when there is no raid chip under it */
body.touch:not(.raiding) .worldboss:not(.raidbar) {
  bottom: var(--chip-b);
}

body.touch .worldboss .where,
body.touch .worldboss .long {
  display: none;
}

body.touch .worldboss .go {
  padding: 1px 8px;
  border-radius: 8px;
}

/* upright: the hotbar stands higher, above the stick */
body.touch.upright .worldboss,
body.touch.upright.fighting .worldboss {
  --chip-b: calc(var(--gap) + var(--safe-b) + 206px);
}

/* a phone in a fight (a raid in the village): the skills need the corner the yard button stands in */
body.touch.fighting .yardbar {
  display: none;
}

/* ------------------------------------------------------ dungeons */

.dgbar {
  top: calc(var(--gap) + var(--safe-t) + 42px);
  background: rgba(30, 18, 52, 0.92);
  border-color: #8a6aff;
}

.dgbar.on {
  border-color: #ff5a4a;
  background: rgba(70, 16, 22, 0.94);
}

.dgbar .go {
  background: #6b5aa8;
}

body.touch .dgbar {
  bottom: var(--chip-b);
}

.placetag.dgtag {
  background: rgba(30, 18, 52, 0.88);
  color: #efe4ff;
  border-color: #8a6aff;
}

.dgfacts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 6px 0;
  font-size: 13px;
  font-weight: 700;
}

.dgfacts span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* in a dungeon: its own bar where the world boss's would be (that one is hidden), the boss bar under it */
body.indungeon .worldboss:not(.dgbar) {
  display: none;
}

body.indungeon .bossbar {
  top: calc(var(--gap) + var(--safe-t) + 84px);
}

body.touch.indungeon .bossbar {
  top: auto;
}

/* ------------------------------------------------------- hits that land: taps */
/* a button gives under the finger (to 0.92 in 90 ms) and springs back (420 ms); a browser
   without linear() keeps the cubic-bezier before it */
.btn {
  transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: transform 0.42s linear(0, 0.163 5%, 0.509 10%, 0.859 15%, 1.108 20%, 1.222 25%, 1.223 30%, 1.157 35%, 1.071 40%, 0.999 45%, 0.957 50%, 0.945 55%, 0.955 60%, 0.974 65%, 0.993 70%, 1.006 75%, 1.012 80%, 1.012 85%, 1.008 90%, 1.004 95%, 1);
}

.btn:active:not(:disabled) {
  transform: translateY(2px) scale(0.92);
  transition: transform 0.09s ease-out;
}

/* ...but where it can be pressed stays where it was: a transform moves the hit area too, and a
   finger or mouse let go near the edge of a shrunken wide button would miss it, losing the
   click. While pressed, an invisible layer reaches out past the shrink (the transform makes
   the button the box it is placed in, so no position is needed). */
.btn:active:not(:disabled)::after {
  content: '';
  position: absolute;
  inset: calc(-5% - 6px);
}

/* ---------------------------------------------- hits that land: damage numbers */
/* my own blow: a thick outline; it pops 0.35 -> 1.45 -> 1 as the blow lands, then drifts
   up and away from me (--away: 1 to the right, -1 to the left), 900 ms in all.
   Sizes follow the world's scale (--wz, set by Labels: 1 on a PC, less where the world is
   drawn smaller, as on a phone) but never below what reads; distances are in em, so they
   shrink with the number */
.float.mine {
  font-size: max(13px, calc(20px * var(--wz, 1)));
  letter-spacing: 0.5px;
  transform-origin: 50% 85%;
  text-shadow:
    2px 0 0 #2b1f2e,
    -2px 0 0 #2b1f2e,
    0 2px 0 #2b1f2e,
    0 -2px 0 #2b1f2e,
    2px 2px 0 #2b1f2e,
    -2px -2px 0 #2b1f2e,
    2px -2px 0 #2b1f2e,
    -2px 2px 0 #2b1f2e,
    0 4px 0 rgba(0, 0, 0, 0.4);
  animation: hit-pop 0.9s both;
}

.float.armor.mine {
  color: #c9d4e8;
}

/* my critical blow: big gold with a dark outline and an orange glow, its tag above, a wobble */
.float.crit.mine {
  flex-direction: column;
  gap: 0;
  font-size: max(18px, calc(30px * var(--wz, 1)));
  color: #ffe14d;
  text-shadow:
    2px 0 0 #6b1d0c,
    -2px 0 0 #6b1d0c,
    0 2px 0 #6b1d0c,
    0 -2px 0 #6b1d0c,
    2px 2px 0 #6b1d0c,
    -2px -2px 0 #6b1d0c,
    2px -2px 0 #6b1d0c,
    -2px 2px 0 #6b1d0c,
    0 4px 0 rgba(0, 0, 0, 0.4),
    0 0 14px rgba(255, 120, 20, 0.9);
  animation: crit-pop 1.15s both;
}

.float.crit.mine small {
  margin-bottom: -0.25em;
  padding: 0 0.58em;
  border-radius: 0.58em;
  background: #ff5a36;
  color: #fff;
  font-size: max(9px, calc(12px * var(--wz, 1)));
  line-height: 1.42;
  letter-spacing: 0;
  text-shadow: none;
  box-shadow: 0 2px 0 #6b1d0c;
}

/* someone else's blow, or a pet's bite: small and faint (and none at all in a raid) */
.float.other {
  font-size: max(10px, calc(13px * var(--wz, 1)));
  animation: rise-faint 1s ease-out forwards;
}

.float.crit.other {
  color: #ffe36e;
}

/* (in em of the number: at 20px, 0.1em = 2px ... -1.6em = -32px, as approved) */
@keyframes hit-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, 0.1em) scale(0.35);
    animation-timing-function: cubic-bezier(0.2, 1.6, 0.4, 1);
  }
  9% {
    opacity: 1;
    transform: translate(-50%, -0.3em) scale(1.45);
    animation-timing-function: ease-out;
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -0.5em) scale(1);
    animation-timing-function: ease-in-out;
  }
  70% {
    opacity: 1;
    transform: translate(calc(-50% + 0.25em * var(--away, 1)), -1.2em) scale(1);
    animation-timing-function: ease-in;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + 0.35em * var(--away, 1)), -1.6em) scale(0.8);
  }
}

/* (at 30px: 0.1333em = 4px ... -1.3333em = -40px) */
@keyframes crit-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, 0.1333em) scale(0.3) rotate(-14deg);
    animation-timing-function: cubic-bezier(0.2, 1.7, 0.4, 1);
  }
  7% {
    opacity: 1;
    transform: translate(-50%, -0.2667em) scale(1.75) rotate(6deg);
    animation-timing-function: ease-out;
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -0.3333em) scale(1.12) rotate(-3deg);
    animation-timing-function: ease-out;
  }
  23% {
    opacity: 1;
    transform: translate(-50%, -0.4em) scale(1.25) rotate(0deg);
    animation-timing-function: ease-in-out;
  }
  75% {
    opacity: 1;
    transform: translate(calc(-50% + 0.2em * var(--away, 1)), -1em) scale(1.2);
    animation-timing-function: ease-in;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + 0.2667em * var(--away, 1)), -1.3333em) scale(1);
  }
}

@keyframes rise-faint {
  0% {
    opacity: 0;
    transform: translate(-50%, 6px) scale(0.7);
  }
  15% {
    opacity: 0.6;
    transform: translate(-50%, 0) scale(1.05);
  }
  70% {
    opacity: 0.6;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -26px) scale(1);
  }
}

/* less motion asked for: no springs or wobbles, the numbers just rise */
@media (prefers-reduced-motion: reduce) {
  .btn,
  .btn:active:not(:disabled) {
    transition: transform 0.08s ease-out;
  }

  .float.mine,
  .float.crit.mine {
    animation: rise 1s ease-out forwards;
  }
}

/* ------------------------------------------------- farm gates in a raid (game/fences.js) */

.gatetag {
  flex-direction: column;
  gap: 2px;
}

.gatetag .hp {
  width: 64px;
  height: 7px;
  visibility: visible;
}

.gatetag .hp i {
  transition: width 0.25s ease-out, background-color 0.25s;
}

.gatetag .gatefix {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  padding: 4px 10px;
  border: 3px solid var(--wood-dark);
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, #fffaf0, var(--paper-2) 60%, var(--paper-3));
  box-shadow: 0 3px 0 rgba(43, 31, 46, 0.45);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  animation: gatefix-bob 1s ease-in-out infinite;
}

.gatetag .gatefix:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(43, 31, 46, 0.45);
}

.gatetag .gatefix[hidden] {
  display: none;
}

@keyframes gatefix-bob {
  50% {
    transform: translateY(-2px);
  }
}

/* --------------------------------- arranging the controls on the screen (ui/layout.js) */

.hudedit {
  position: fixed;
  inset: 0;
  z-index: 50;
  background:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px) 0 0 / 5% 5%,
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px) 0 0 / 5% 5%,
    rgba(20, 12, 18, 0.35);
  touch-action: none;
}

.hudframe {
  position: fixed;
  border: 2px dashed #fff3c4;
  border-radius: 12px;
  background: rgba(255, 243, 196, 0.12);
  cursor: grab;
  touch-action: none;
}

.hudframe span {
  position: absolute;
  left: 50%;
  top: -22px;
  transform: translateX(-50%);
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(43, 31, 46, 0.85);
  color: #fff3c4;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}

.hudframe.picked {
  border-style: solid;
  border-color: #f5c93a;
  background: rgba(245, 201, 58, 0.18);
  box-shadow: 0 0 0 3px rgba(245, 201, 58, 0.35);
}

.hudframe.held {
  cursor: grabbing;
}

.hudbar {
  position: fixed;
  left: 50%;
  top: calc(var(--gap) + var(--safe-t));
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 12px;
  width: min(560px, calc(100vw - 24px));
  padding: 8px 12px;
  border: 3px solid var(--wood);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(43, 31, 46, 0.35);
  font-weight: 700;
}

.hudbar .hudtitle {
  flex-basis: 100%;
  text-align: center;
  color: var(--wood-dark);
}

.hudbar label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.hudbar input[type='range'] {
  width: 110px;
}

.hudbar input:disabled {
  opacity: 0.4;
}

.hudbar .hudbtns {
  display: flex;
  gap: 6px;
  flex-basis: 100%;
  justify-content: center;
}

/* while arranging, a control does nothing when touched: only its frame moves it */
body.hud-editing #hud > *:not(.hudedit) {
  pointer-events: none !important;
}

body.hud-editing .skills button {
  pointer-events: none !important;
}

/* ------------------------------------- nothing on top of anything else (owner, 1 Oct 2026) */

/* a phone: the chat button goes above the skill buttons when they are on its side */
body.touch.stick-right.fighting .chat {
  bottom: calc(var(--gap) + var(--safe-b) + 200px);
}

/* a PC: the world boss and raid bars sit between the player card and the menu,
   and while one is up the toasts come in below it */
@media (min-width: 561px) and (min-height: 521px) {
  .worldboss {
    left: calc(50% - 90px);
    max-width: max(300px, min(520px, calc(100vw - 760px)));
  }

  #hud:has(#worldboss:not([hidden])) ~ #toasts {
    top: calc(var(--safe-t) + 100px);
  }

  #hud:has(#raidbar:not([hidden])) ~ #toasts {
    top: calc(var(--safe-t) + 140px);
  }
}

/* a phone held upright: toasts and the clock keep clear of the menu down the right edge */
@media (max-width: 560px) {
  #toasts {
    top: calc(176px + var(--safe-t)); /* below the player card and the quest */
    left: calc(var(--gap) + var(--safe-l));
    transform: none;
    width: calc(100vw - 2 * var(--gap) - var(--safe-l) - var(--safe-r) - 60px);
    align-items: stretch;
  }

  .toast {
    padding: 4px 10px;
    font-size: 13px;
    border-width: 2px;
  }

  .toast img.icon:not(.small) {
    width: 24px;
    height: 24px;
  }

  .clock {
    right: calc(var(--gap) + var(--safe-r) + 56px);
  }
}

/* ----------------------------------------------- a reward chest, opened by hand (ui/chest.js) */

.chestbox {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 6px auto 10px;
  padding: 18px 8px 10px;
  border-radius: 16px;
  background: radial-gradient(ellipse at 50% 35%, rgba(255, 236, 170, 0.55), rgba(255, 236, 170, 0) 70%);
  cursor: pointer;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.chestbox .chestpic {
  position: relative;
  z-index: 2;
  width: 128px;
  height: 128px;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 0 rgba(43, 31, 46, 0.35));
}

.chestbox.closed .chestpic {
  animation: chest-wobble 1.6s ease-in-out infinite;
}

.chestbox.shaking .chestpic {
  animation: chest-shake 0.13s linear infinite;
}

.chestbox.open .chestpic {
  animation: chest-pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.chestbox .chesthint {
  z-index: 2;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  animation: chest-hint 1s ease-in-out infinite alternate;
}

.chestbox .chesthint:empty {
  display: none;
}

/* the light that bursts out when it opens */
.chestbox .chestrays {
  position: absolute;
  left: 50%;
  top: 70px;
  z-index: 1;
  width: 420px;
  height: 420px;
  margin: -210px 0 0 -210px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 230, 140, 0.55) 0 10deg, rgba(255, 230, 140, 0) 10deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 62%);
  mask: radial-gradient(circle, #000 18%, transparent 62%);
  opacity: 0;
  transform: scale(0.3);
  pointer-events: none;
}

.chestbox.open .chestrays {
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.3s, transform 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
  animation: chest-spin 9s linear infinite;
}

.chestbox.gold.open .chestrays {
  background: repeating-conic-gradient(rgba(255, 214, 90, 0.7) 0 10deg, rgba(255, 214, 90, 0) 10deg 20deg);
}

.chestbox.silver.open .chestrays {
  background: repeating-conic-gradient(rgba(170, 225, 255, 0.6) 0 10deg, rgba(170, 225, 255, 0) 10deg 20deg);
}

.chestbox .chestloot {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.chestbox .lootcard {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 84px;
  padding: 8px 8px 6px;
  border: 3px solid var(--wood);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(43, 31, 46, 0.3);
  animation: loot-in 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.chestbox .lootcard b {
  font-size: 13px;
}

.chestbox .lootcard small {
  color: var(--ink-soft, #85684f);
  font-size: 11px;
}

.chestbox .lootcard.rare {
  border-color: var(--gold-dark, #b8860b);
  background: linear-gradient(#fff6c8, #ffe58a);
  box-shadow:
    0 3px 0 rgba(43, 31, 46, 0.3),
    0 0 14px rgba(255, 200, 40, 0.9);
}

@keyframes chest-wobble {
  0%, 70%, 100% { transform: rotate(0deg) translateY(0); }
  75% { transform: rotate(-6deg) translateY(-3px); }
  82% { transform: rotate(6deg) translateY(-3px); }
  89% { transform: rotate(-3deg) translateY(0); }
}

@keyframes chest-shake {
  0% { transform: translate(-3px, 0) rotate(-3deg); }
  50% { transform: translate(3px, -2px) rotate(3deg); }
  100% { transform: translate(-3px, 0) rotate(-3deg); }
}

@keyframes chest-pop {
  0% { transform: scale(0.7) translateY(10px); }
  100% { transform: scale(1) translateY(0); }
}

@keyframes chest-hint {
  to { transform: translateY(-3px); }
}

@keyframes chest-spin {
  to { transform: scale(1) rotate(360deg); }
}

@keyframes loot-in {
  0% { opacity: 0; transform: translateY(-40px) scale(0.4); }
  100% { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .chestbox .chestpic,
  .chestbox .chestrays,
  .chestbox .lootcard,
  .chestbox .chesthint {
    animation: none !important;
  }
}

/* ---------------------------------------------- names on the big map, like wooden signboards */

.bigmap .place {
  position: absolute;
  /* not the HUD's place banner (.place above): the label stands where placeMarks puts it, centred on its place */
  transform: none;
  animation: none;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border: 2px solid #3d2519;
  border-radius: 7px;
  background: linear-gradient(#7a4a2b, #5a3420);
  box-shadow: 0 2px 0 rgba(20, 12, 18, 0.45);
  color: #fff4c7;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.bigmap .place img.icon {
  width: 14px;
  height: 14px;
}

.bigmap .place.exit {
  background: linear-gradient(#3e7d3a, #2a5a33);
  border-color: #1d3d22;
}

.bigmap .place.shop {
  background: linear-gradient(#d26b1f, #a8501a);
  border-color: #6b2f0e;
}

.bigmap .place.dg {
  background: linear-gradient(#5e3f91, #3f2a63);
  border-color: #241640;
}

.bigmap .place.mine {
  background: linear-gradient(#f5c93a, #d19a1e);
  border-color: #7d4a0e;
  color: #3d2519;
  font-size: 12px;
}

.bigmap .place.farm {
  padding: 0 5px;
  border-width: 1px;
  background: rgba(253, 243, 216, 0.88);
  border-color: rgba(122, 74, 43, 0.6);
  color: #4a2f23;
  font-size: 10px;
  font-weight: 600;
}

/* other players' blows: seen, but never mistaken for mine: smaller, sky blue, a thin outline
   (mine are big and white, my criticals gold); they can be turned off in the settings */
.float.other {
  font-size: max(10px, calc(13px * var(--wz, 1)));
  color: #9fd6ff;
  text-shadow:
    0 1px 0 #1d2a3a,
    1px 0 0 #1d2a3a,
    -1px 0 0 #1d2a3a,
    0 -1px 0 #1d2a3a;
  animation: rise-other 1s ease-out forwards;
}

.float.crit.other {
  color: #ffc98a;
}

@keyframes rise-other {
  0% {
    opacity: 0;
    transform: translate(-50%, 6px) scale(0.7);
  }
  15% {
    opacity: 0.85;
    transform: translate(-50%, 0) scale(1.05);
  }
  70% {
    opacity: 0.8;
    transform: translate(-50%, -14px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -22px) scale(1);
  }
}

/* inventory v2 — opt-in styles, adapted from the approved design/bag.html. */
.inventory-v2 {
  --ink: #3b2a20;
  --ink-2: #7f6553;
  --ink-3: #b39b85;
  --cream: #fff8ea;
  --cream-2: #f8ecd3;
  --line: rgba(122, 74, 43, 0.16);
  --line-2: rgba(122, 74, 43, 0.26);
  --forest: #1f5d45;
  --forest-2: #2d7a58;
  --leaf: #4cb84a;
  --gold: #ffc83d;
  --gold-d: #c98a12;
  --red: #ff4b3e;
  --up: #1f9d45;
  --down: #df4638;
  --f-ui: 'Mitr', 'Mali', 'Leelawadee UI', 'Noto Sans Thai', sans-serif;
  --f-body: 'Mali', 'Leelawadee UI', 'Noto Sans Thai', sans-serif;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --out: cubic-bezier(0.2, 0.9, 0.25, 1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  
  --cols: 6;
  --ic-card: 64px;
  --ic-slot: 64px;
  --ic-big: 128px;
  --ic-chip: 32px;
  --ic-stat: 32px;
  --s-target: 4;    
  --s: var(--s-target);
  --slot: 66px;
  --gap: 8px;
}
@supports (transition-timing-function: linear(0, 1)) {
.inventory-v2 {
    --spring: linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%, 1.017, 1.077, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%, 0.974 53.8%, 0.975 57.1%, 0.997 69.8%, 1.003 76.9%, 1);
  }
}
.inventory-v2 * { box-sizing: border-box; }
.inventory-v2, .inventory-v2 {
  margin: 0; height: 100%; overflow: hidden;
  background: #2a5a33; color: var(--ink);
  font-family: var(--f-body); font-size: 15px; line-height: 1.4;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}
.inventory-v2 button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
.inventory-v2 img.px { image-rendering: pixelated; display: block; pointer-events: none; flex: none; }
.inventory-v2 [hidden] { display: none !important; }
.inventory-v2 svg { display: block; }
@keyframes bag-v2-fade { from { opacity: 0; } }
.inventory-v2.win {
  position: fixed; inset: 24px 40px;
  display: grid; grid-template-rows: 66px minmax(0, 1fr);
  border-radius: 26px; overflow: hidden;
  background:
    radial-gradient(rgba(122, 74, 43, 0.07) 1px, transparent 1.4px) 0 0 / 16px 16px,
    linear-gradient(180deg, #fffaf0, #fbf0da);
  box-shadow: 0 0 0 1.5px rgba(40, 24, 14, 0.35), 0 26px 60px rgba(0, 0, 0, 0.45), 0 4px 0 rgba(40, 24, 14, 0.25);
  animation: bag-v2-win-in 0.42s var(--spring) both;
}
@keyframes bag-v2-win-in { from { opacity: 0; transform: translateY(18px) scale(0.955); } to { opacity: 1; transform: none; } }
.inventory-v2 .top {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 0 12px 0 14px;
  color: #fff8ea;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 12px, transparent 12px 26px, rgba(0, 0, 0, 0.07) 26px 32px, transparent 32px 46px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 12px, transparent 12px 26px, rgba(0, 0, 0, 0.06) 26px 32px, transparent 32px 46px),
    linear-gradient(180deg, #2f7d5b, #215f47);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}
.inventory-v2 .top::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; z-index: 2;
  background: repeating-linear-gradient(90deg, #e9574a 0 14px, #ffcf4d 14px 18px, #3f93d8 18px 32px, #ffcf4d 32px 36px);
  opacity: 0.9;
}
.inventory-v2 .brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.inventory-v2 .brand-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; background: radial-gradient(circle at 40% 35%, #fff3c4, #ffc83d 70%); box-shadow: inset 0 -3px 0 rgba(150, 90, 10, 0.35), 0 2px 0 rgba(0, 0, 0, 0.2); }
.inventory-v2 .brand-ic img { width: var(--icb2, 32px); height: var(--icb2, 32px); }
.inventory-v2 .brand h1 { margin: 0; font: 600 22px/1.2 var(--f-ui); letter-spacing: 0.2px; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18); white-space: nowrap; }
.inventory-v2 .back { display: none; }
.inventory-v2 .tabs { display: flex; gap: 4px; margin: 0 auto; padding: 4px; border-radius: 17px; background: rgba(0, 0, 0, 0.2); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25); }
.inventory-v2 .tab {
  position: relative; display: flex; align-items: center; gap: 4px; height: 46px; padding: 0 12px 0 6px;
  border-radius: 13px; color: rgba(255, 248, 234, 0.85); font: 500 15px/1.2 var(--f-ui); white-space: nowrap;
  transition: transform .25s, opacity .25s;
}
.inventory-v2 .tab img { width: var(--ict, 32px); height: var(--ict, 32px); }
.inventory-v2 .tab:hover { background: rgba(255, 255, 255, 0.08); }
.inventory-v2 .tab.on { background: var(--cream); color: var(--forest); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.22); }
.inventory-v2 .tab .n { margin-left: 2px; padding: 0 6px; border-radius: 8px; background: rgba(255, 255, 255, 0.16); font-size: 12px; line-height: 18px; }
.inventory-v2 .tab.on .n { background: rgba(31, 93, 69, 0.12); }
.inventory-v2 .dot { position: absolute; width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff9a8c, var(--red) 70%); box-shadow: 0 0 0 2px #24624a; animation: bag-v2-dot 1.8s ease-in-out infinite; }
.inventory-v2 .tab .dot { top: 5px; left: 31px; }
@keyframes bag-v2-dot { 50% { transform: scale(1.2); } }
.inventory-v2 .money { display: flex; align-items: center; gap: 4px; height: 40px; padding: 0 14px 0 4px; border-radius: 20px; background: rgba(0, 0, 0, 0.24); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3); font: 600 17px/1 var(--f-ui); color: #fff1bd; }
.inventory-v2 .money img { width: var(--ict, 32px); height: var(--ict, 32px); }
.inventory-v2 .x { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: rgba(255, 255, 255, 0.14); color: #fff8ea; }
.inventory-v2 .x:hover { background: rgba(255, 255, 255, 0.24); }
.inventory-v2 .body { display: grid; grid-template-columns: 350px minmax(0, 1fr) 292px; gap: 14px; padding: 14px; min-height: 0; }
.inventory-v2 .surface { border-radius: 22px; background: rgba(255, 255, 255, 0.62); box-shadow: inset 0 0 0 1.5px var(--line), 0 2px 0 rgba(122, 74, 43, 0.06); }
.inventory-v2 .doll { display: flex; flex-direction: column; gap: 10px; padding: 12px; min-height: 0; }
.inventory-v2 .hero { display: flex; align-items: center; gap: 8px; }
.inventory-v2 .lv { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 12px; background: linear-gradient(#ffe27a, #ffbe2e); box-shadow: inset 0 -2px 0 rgba(160, 100, 10, 0.35); font: 600 16px/1 var(--f-ui); color: #6b3d06; }
.inventory-v2 .who { display: grid; min-width: 0; line-height: 1.15; }
.inventory-v2 .pname { font: 600 17px/1.25 var(--f-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inventory-v2 .cls { display: flex; align-items: center; gap: 2px; font: 400 12.5px/1.2 var(--f-ui); color: var(--ink-2); }
.inventory-v2 .cls img { width: 16px; height: 16px; image-rendering: auto; }
.inventory-v2 .cp { margin-left: auto; display: flex; align-items: center; gap: 3px; height: 34px; padding: 0 10px 0 4px; border-radius: 12px; background: linear-gradient(180deg, #4a2f6e, #362151); color: #ffe9a8; box-shadow: inset 0 0 0 1.5px rgba(255, 220, 120, 0.35), 0 2px 0 rgba(0, 0, 0, 0.18); }
.inventory-v2 .cp img { width: var(--ics2, 32px); height: var(--ics2, 32px); margin: -4px 0; }
.inventory-v2 .cp span { font: 400 12px/1 var(--f-ui); opacity: 0.85; }
.inventory-v2 .cp b { font: 600 18px/1 var(--f-ui); color: #fff; font-variant-numeric: tabular-nums; }
.inventory-v2 .cp .pd { font: 600 12.5px/1 var(--f-ui); font-style: normal; color: #7dff9c; }
.inventory-v2 .cp .pd:empty { display: none; }
.inventory-v2 .xp { position: relative; height: 16px; border-radius: 8px; background: rgba(122, 74, 43, 0.12); overflow: hidden; }
.inventory-v2 .xp i { position: absolute; inset: 0 auto 0 0; border-radius: 8px; background: linear-gradient(180deg, #c9a5ff, #8c5fe6); box-shadow: inset 0 -2px 0 rgba(60, 20, 120, 0.25); }
.inventory-v2 .xp span { position: relative; display: block; text-align: center; font: 500 11px/16px var(--f-ui); color: #4a2f6e; }
.inventory-v2 .rig { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--slot) minmax(0, 1fr) var(--slot); gap: 10px; align-items: stretch; }
.inventory-v2 .slots { display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.inventory-v2 .slot { position: relative; display: grid; justify-items: center; gap: 2px; }
.inventory-v2 .slot .box {
  position: relative; display: grid; place-items: center; width: var(--slot); height: var(--slot); border-radius: 16px;
  background: radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.6), transparent 60%), linear-gradient(155deg, var(--a), var(--b));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55), inset 0 -3px 0 rgba(0, 0, 0, 0.12), 0 0 0 1.5px var(--e), 0 3px 0 rgba(60, 35, 15, 0.18);
  transition: transform .25s, opacity .25s;
}
.inventory-v2 .slot .box img { width: var(--ics, 64px); height: var(--ics, 64px); }
.inventory-v2 .slot.empty .box { background: rgba(255, 255, 255, 0.55); box-shadow: inset 0 0 0 2px rgba(122, 74, 43, 0.22); outline: 2px dashed rgba(122, 74, 43, 0.25); outline-offset: -6px; }
.inventory-v2 .slot.empty .box img { opacity: 0.22; filter: grayscale(1) brightness(0.6); }
.inventory-v2 .slot .lbl { font: 500 11.5px/1.2 var(--f-ui); color: var(--ink-2); white-space: nowrap; }
.inventory-v2 .slot.hot .box { box-shadow: inset 0 0 0 2px #fff, 0 0 0 3px #7ee08a, 0 0 18px rgba(80, 220, 110, 0.75);  }
@keyframes bag-v2-hot { to { box-shadow: inset 0 0 0 2px #fff, 0 0 0 4px #7ee08a, 0 0 26px rgba(80, 220, 110, 0.95); } }
.inventory-v2 .slot.trying .box { box-shadow: inset 0 0 0 2px #fff, 0 0 0 3px #ffc83d, 0 0 16px rgba(255, 200, 61, 0.8); }
.inventory-v2 .slot.pulse .box::after { content: ''; position: absolute; inset: -3px; border-radius: 18px; border: 3px solid #fff; animation: bag-v2-ring 0.6s ease-out forwards; }
@keyframes bag-v2-ring { to { transform: scale(1.3); opacity: 0; } }
.inventory-v2 .slot .up, .inventory-v2 .card .up {
  position: absolute; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 7px; z-index: 2;
  background: linear-gradient(#47d066, #1f9d45); box-shadow: 0 2px 0 #12672b, 0 0 0 1.5px #fff; color: #fff;
}
.inventory-v2 .slot .up { right: -5px; top: -5px; }
.inventory-v2 .up svg { width: 12px; height: 12px; }
.inventory-v2 .stage {
  --ped: 12%; position: relative; min-height: 0; border-radius: 20px; overflow: hidden;
  background:
    radial-gradient(52px 18px at 24% 20%, rgba(255, 255, 255, 0.95), transparent 70%),
    radial-gradient(64px 20px at 80% 11%, rgba(255, 255, 255, 0.9), transparent 70%),
    linear-gradient(180deg, #b9e3ff 0%, #def3ff 44%, #f5fbe8 66%, #d5f0ae 66.1%, #b7e08a 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7), inset 0 0 0 3.5px rgba(122, 74, 43, 0.14);
}
.inventory-v2 .stage .rays {
  position: absolute; left: 50%; top: 58%; width: 520px; height: 520px; margin: -260px 0 0 -260px;
  background: repeating-conic-gradient(from var(--spin), rgba(255, 255, 255, 0.5) 0deg 7deg, transparent 7deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 0%, rgba(0, 0, 0, 0.6) 22%, transparent 48%); mask: radial-gradient(circle, #000 0%, rgba(0, 0, 0, 0.6) 22%, transparent 48%);
   opacity: 0.75;
}
@keyframes bag-v2-spin { to { --spin: 360deg; } }
.inventory-v2 .stage .aura { position: absolute; left: 50%; bottom: calc(var(--ped) - 4px); width: 170px; height: 170px; margin-left: -85px; border-radius: 50%; background: radial-gradient(circle, var(--glow, transparent) 0%, transparent 65%); opacity: 0; transition: transform .25s, opacity .25s; mix-blend-mode: screen; }
.inventory-v2 .stage.glowing .aura { opacity: 0.9; animation: bag-v2-breathe 2.2s ease-in-out infinite; }
@keyframes bag-v2-breathe { 50% { transform: scale(1.08); opacity: 0.65; } }
.inventory-v2 .pedestal {
  position: absolute; left: 50%; bottom: var(--ped); width: 140px; height: 32px; margin-left: -70px; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 30%, #d8f7a6 0%, #9ad968 50%, #6fbe4e 100%);
  box-shadow: 0 7px 0 #b07a44, 0 9px 0 #8a5a30, 0 16px 16px rgba(60, 40, 20, 0.28);
}
.inventory-v2 .halo { position: absolute; left: 50%; top: 50%; width: 176px; height: 176px; margin: -88px 0 0 -88px; transform: scaleY(0.22); opacity: 0; transition: transform .25s, opacity .25s; pointer-events: none; }
.inventory-v2 .halo i { position: absolute; inset: 0; border-radius: 50%; border: 5px dashed rgba(255, 205, 70, 0.95); box-shadow: 0 0 14px rgba(255, 220, 110, 0.6);  }
.inventory-v2 .stage.glowing .halo { opacity: 1; }
@keyframes bag-v2-spinz { to { transform: rotate(360deg); } }
.inventory-v2 .pedestal::after { content: ''; position: absolute; left: 50%; top: 9px; width: 64px; height: 12px; margin-left: -32px; border-radius: 50%; background: rgba(40, 70, 25, 0.28); }
.inventory-v2 .char { position: absolute; bottom: calc(var(--ped) + 14px); z-index: 2; width: calc(32px * var(--s)); height: calc(48px * var(--s)); }
.inventory-v2 .char .layer { position: absolute; inset: 0; background-repeat: no-repeat; image-rendering: pixelated; }
.inventory-v2 .char .layer.new {  }
@keyframes bag-v2-flash { 0% { filter: brightness(2.2) drop-shadow(0 0 6px #fff); } 100% { filter: none; } }
.inventory-v2 .char .wpn { position: absolute; image-rendering: pixelated; }
.inventory-v2 .char.idle {  }
@keyframes bag-v2-idle { 50% { translate: 0 calc(1px * var(--s)); } }
.inventory-v2 .spark { position: absolute; width: 14px; height: 14px; pointer-events: none; background: #fff; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);  filter: drop-shadow(0 0 3px var(--glow, #fff)); }
@keyframes bag-v2-twinkle { 0%, 100% { transform: scale(0) rotate(0deg); opacity: 0; } 45% { transform: scale(1) rotate(45deg); opacity: 1; } }
.inventory-v2 .tryon { position: absolute; z-index: 3; left: 50%; top: 8px; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 3px 10px 3px 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.92); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12), 0 0 0 1.5px rgba(255, 200, 61, 0.9); font: 500 12px/1.2 var(--f-ui); color: #8a5a0a; white-space: nowrap; animation: bag-v2-pop 0.4s var(--spring) both; }
.inventory-v2 .tryon svg { width: 14px; height: 14px; }
@keyframes bag-v2-pop { from { opacity: 0; transform: translateX(-50%) scale(0.7); } }
@keyframes bag-v2-pop2 { from { opacity: 0; transform: scale(0.7); } }
.inventory-v2 .spin { position: absolute; right: 8px; bottom: 8px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; background: rgba(255, 255, 255, 0.85); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12), inset 0 0 0 1.5px var(--line); color: var(--forest); }
.inventory-v2 .spin svg { width: 18px; height: 18px; }
.inventory-v2 .buffs { display: flex; gap: 6px; flex-wrap: wrap; }
.inventory-v2 .buff { display: flex; align-items: center; gap: 2px; height: 32px; padding: 0 10px 0 2px; border-radius: 11px; background: #eef8e6; box-shadow: inset 0 0 0 1.5px rgba(63, 160, 70, 0.25); font: 400 12.5px/1 var(--f-ui); color: #2f6b33; white-space: nowrap; }
.inventory-v2 .buff img { width: 32px; height: 32px; }
.inventory-v2 .buff b { font-weight: 500; }
.inventory-v2 .buff.warn { background: #fff1e6; box-shadow: inset 0 0 0 1.5px rgba(224, 120, 40, 0.3); color: #9a4a12; }
.inventory-v2 .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.inventory-v2 .stat { position: relative; display: grid; justify-items: center; gap: 0; padding: 6px 2px 5px; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--line), 0 2px 0 rgba(122, 74, 43, 0.07); }
.inventory-v2 .stat img { width: var(--icst, 32px); height: var(--icst, 32px); }
.inventory-v2 .stat b { font: 600 17px/1.15 var(--f-ui); font-variant-numeric: tabular-nums; }
.inventory-v2 .stat small { font: 400 11px/1.2 var(--f-ui); color: var(--ink-2); }
.inventory-v2 .stat .d { position: absolute; top: 3px; right: 5px; font: 600 11.5px/1 var(--f-ui); font-style: normal; color: var(--up); }
.inventory-v2 .stat .d.neg { color: var(--down); }
.inventory-v2 .stat .d:empty { display: none; }
.inventory-v2 .stat.changed b { color: var(--up); }
.inventory-v2 .stat.changed.neg b { color: var(--down); }
.inventory-v2 .bag { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; }
.inventory-v2 .toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 10px 6px 10px; min-width: 0; }
.inventory-v2 .chips { display: flex; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.inventory-v2 .chips::-webkit-scrollbar { display: none; }
.inventory-v2 .chip {
  flex: none; display: flex; align-items: center; gap: 2px; height: 40px; padding: 0 4px; border-radius: 14px;
  background: #fff; box-shadow: inset 0 0 0 1.5px var(--line), 0 2px 0 rgba(122, 74, 43, 0.1);
  font: 500 14px/1 var(--f-ui); color: var(--ink); transition: transform .25s, opacity .25s;
}
.inventory-v2 .chip img { width: var(--icp, 32px); height: var(--icp, 32px); }
.inventory-v2 .chip .t { display: none; padding-right: 6px; white-space: nowrap; }
.inventory-v2 .chip.on { background: var(--forest); color: #fff8ea; box-shadow: 0 3px 0 #123a2b; padding-right: 6px; }
.inventory-v2 .chip.on .t { display: inline; }
.inventory-v2 .chip .dot { position: static; width: 8px; height: 8px; margin: -18px 0 0 -6px; box-shadow: 0 0 0 2px #fff; }
.inventory-v2 .sort.mob { display: none; }
.inventory-v2 .sort.desk { margin-left: 0; height: 34px; border-radius: 12px; }
.inventory-v2 .sort { flex: none; margin-left: auto; display: flex; align-items: center; gap: 4px; height: 40px; padding: 0 12px 0 10px; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--line), 0 2px 0 rgba(122, 74, 43, 0.1); font: 500 13.5px/1 var(--f-ui); color: var(--ink-2); white-space: nowrap; }
.inventory-v2 .sort svg { width: 18px; height: 18px; color: var(--forest); }
.inventory-v2 .sort b { color: var(--ink); font-weight: 500; }
.inventory-v2 .grid {
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: var(--gap);
  align-content: start; padding: 8px 10px 26px; overflow-y: auto; overscroll-behavior: contain; -webkit-mask-image: linear-gradient(#000 calc(100% - 28px), transparent); mask-image: linear-gradient(#000 calc(100% - 28px), transparent); scrollbar-width: thin; scrollbar-color: rgba(122, 74, 43, 0.3) transparent;
}
.inventory-v2 .card {
  --i: 0; position: relative; display: grid; grid-template-rows: auto 22px; border-radius: 14px;
  background: #fffaf2; box-shadow: 0 0 0 1.5px rgba(80, 50, 30, 0.2), 0 3px 0 rgba(80, 50, 30, 0.16);
  transition: transform .25s, opacity .25s;
  animation: bag-v2-card-in 0.36s var(--spring) both; animation-delay: calc(var(--i) * 16ms + 120ms);
}
@keyframes bag-v2-card-in { from { opacity: 0; scale: 0.82; } }
.inventory-v2 .card .art {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; border-radius: 14px 14px 6px 6px; overflow: hidden;
  background: radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.62) 0, rgba(255, 255, 255, 0) 58%), linear-gradient(155deg, var(--a), var(--b));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.4), inset 0 -3px 0 rgba(0, 0, 0, 0.1);
}
.inventory-v2 .card .art::before { content: ''; position: absolute; inset: 0 0 58% 0; background: linear-gradient(rgba(255, 255, 255, 0.36), transparent); pointer-events: none; }
.inventory-v2 .card .art img { position: relative; width: var(--icc, 64px); height: var(--icc, 64px); }
.inventory-v2 .card .foot { display: flex; align-items: center; justify-content: center; gap: 1px; font: 500 13px/1 var(--f-ui); color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.inventory-v2 .card .foot img { width: 16px; height: 16px; image-rendering: auto; }
@media (hover: hover) {
.inventory-v2 .card:hover { translate: 0 -2px; box-shadow: 0 0 0 1.5px rgba(80, 50, 30, 0.28), 0 5px 0 rgba(80, 50, 30, 0.16), 0 8px 14px rgba(80, 50, 30, 0.14); }
}
.inventory-v2 .card.sel { translate: 0 -3px; z-index: 1; box-shadow: 0 0 0 2.5px #fff, 0 0 0 5.5px #ffbf2a, 0 0 18px 4px rgba(255, 190, 40, 0.55), 0 6px 0 rgba(80, 50, 30, 0.14); }
.inventory-v2 .card.sel .art img { animation: bag-v2-bob 1.2s ease-in-out infinite; }
@keyframes bag-v2-bob { 50% { translate: 0 -3px; } }
.inventory-v2 .card.dim { opacity: 0.35; filter: grayscale(0.6); }
.inventory-v2 .card .new { position: absolute; top: -5px; right: -5px; z-index: 3; width: 15px; height: 15px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff9c8e, var(--red) 70%); box-shadow: 0 0 0 2.5px #fffaf2, 0 2px 3px rgba(0, 0, 0, 0.3); animation: bag-v2-dot 1.6s ease-in-out infinite; }
.inventory-v2 .card .up { left: 4px; top: 4px; }
.inventory-v2 .card .lockb { position: absolute; right: 4px; top: 4px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 7px; background: rgba(40, 26, 18, 0.55); }
.inventory-v2 .card .lockb img { width: 16px; height: 16px; image-rendering: auto; }
.inventory-v2 .card .durbar { position: absolute; left: 7px; right: 7px; bottom: 6px; height: 6px; border-radius: 4px; background: rgba(30, 20, 15, 0.45); overflow: hidden; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4); }
.inventory-v2 .durbar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(#a6f27e, #3dbb46); }
.inventory-v2 .durbar.mid i { background: linear-gradient(#ffe48a, #f2b322); }
.inventory-v2 .durbar.low i { background: linear-gradient(#ff9c8a, #e0433a); }
.inventory-v2 .card.broken .art img { filter: grayscale(1) brightness(0.85); }
.inventory-v2 .card.broken .art::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(223, 70, 56, 0.16) 0 6px, transparent 6px 12px); }
.inventory-v2 .card .tag { position: absolute; left: 50%; bottom: 5px; transform: translateX(-50%); z-index: 2; padding: 1px 7px; border-radius: 8px; background: var(--down); color: #fff; font: 500 11px/1.35 var(--f-ui); white-space: nowrap; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
.inventory-v2 .card .tag.class { background: rgba(60, 40, 30, 0.72); }
.inventory-v2 .card.nouse .art img { filter: grayscale(0.7) opacity(0.75); }
.inventory-v2 .card.gone { animation: bag-v2-gone 0.3s ease-in forwards; }
@keyframes bag-v2-gone { to { opacity: 0; scale: 0.6; } }
.inventory-v2 .r0, .rarity-art.r0 { --a: #f4efe6; --b: #cdc3b1; --e: #a89a85; }
.inventory-v2 .r1, .rarity-art.r1 { --a: #a9ddff; --b: #4d99de; --e: #2d6fb2; }
.inventory-v2 .r2, .rarity-art.r2 { --a: #dcc3ff; --b: #8d64e3; --e: #6140bf; }
.inventory-v2 .r3, .rarity-art.r3 { --a: #ffe68c; --b: #f59a2b; --e: #c4680b; }
.inventory-v2 .r4, .rarity-art.r4 { --a: #ffc9ee; --b: #94e6ff; --e: #c2459c; }
.inventory-v2 .r3 .art::after, .inventory-v2 .r3 .box::after, .inventory-v2 .dhead.r3::after {
  content: ''; position: absolute; inset: -30%; pointer-events: none;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, 0.65) 50%, transparent 58%);
   translate: -70% 0;
}
@keyframes bag-v2-sweep { 0%, 55% { translate: -70% 0; } 100% { translate: 70% 0; } }
.inventory-v2 .r4 .art, .inventory-v2 .r4 .box, .inventory-v2 .dhead.r4 {
  background: radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.7), transparent 58%), conic-gradient(from var(--spin), #ffb3e6, #ffe9a3, #a8f0ff, #c9b3ff, #ffb3e6) !important;
  
}
.inventory-v2 .bagfoot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px 10px; border-top: 1.5px dashed var(--line-2); font: 400 13px/1.2 var(--f-ui); color: var(--ink-2); }
.inventory-v2 .cap { display: flex; align-items: center; gap: 6px; }
.inventory-v2 .cap img { width: 16px; height: 16px; image-rendering: auto; }
.inventory-v2 .capbar { display: inline-block; width: 74px; height: 8px; border-radius: 4px; background: rgba(122, 74, 43, 0.14); overflow: hidden; }
.inventory-v2 .capbar i { display: block; height: 100%; background: linear-gradient(#7fd66a, #3fae3f); border-radius: 4px; }
.inventory-v2 .keys { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.inventory-v2 kbd { display: inline-grid; place-items: center; min-width: 24px; height: 22px; margin-right: 3px; padding: 0 5px; border-radius: 7px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--line-2), 0 2px 0 var(--line-2); font: 500 12px/1 var(--f-ui); color: var(--ink); }
.inventory-v2 .empty-state { grid-column: 1 / -1; display: grid; justify-items: center; gap: 8px; padding: 34px 12px; text-align: center; color: var(--ink-2); font: 400 14px/1.45 var(--f-ui); }
.inventory-v2 .empty-state .ring { display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; border: 2.5px dashed var(--line-2); background: rgba(255, 255, 255, 0.6); }
.inventory-v2 .empty-state .ring img { width: 64px; height: 64px; opacity: 0.85; }
.inventory-v2 .detail { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; overflow: hidden; background: #fff; }
.inventory-v2 .grab { display: none; }
.inventory-v2 .dhead {
  position: relative; display: grid; place-items: center; height: 140px; overflow: hidden;
  background: radial-gradient(circle at 50% 52%, rgba(255, 255, 255, 0.75), transparent 52%), linear-gradient(155deg, var(--a), var(--b));
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.08);
}
.inventory-v2 .dhead .rays { position: absolute; left: 50%; top: 52%; width: 460px; height: 460px; margin: -230px 0 0 -230px; background: repeating-conic-gradient(from var(--spin), rgba(255, 255, 255, 0.4) 0deg 8deg, transparent 8deg 22deg); -webkit-mask: radial-gradient(circle, #000 8%, transparent 46%); mask: radial-gradient(circle, #000 8%, transparent 46%);  }
.inventory-v2 .dhead .bigic { position: relative; z-index: 1; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.13)); animation: bag-v2-bob 2.4s ease-in-out infinite; }
.inventory-v2 .dhead .bigic img { width: var(--icb, 128px); height: var(--icb, 128px); }
.inventory-v2 .rpill { position: absolute; left: 10px; top: 10px; z-index: 2; display: flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px; border-radius: 11px; background: rgba(255, 255, 255, 0.9); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1); font: 500 12.5px/1.2 var(--f-ui); color: var(--e); }
.inventory-v2 .stars { display: inline-flex; gap: 0; color: #ffbf1f; font-size: 12px; letter-spacing: -1px; -webkit-text-stroke: 0.6px #a86a00; }
.inventory-v2 .newtag { position: absolute; right: 10px; top: 10px; z-index: 2; padding: 2px 9px; border-radius: 10px; background: var(--red); color: #fff; font: 500 12px/1.3 var(--f-ui); box-shadow: 0 2px 0 rgba(120, 20, 10, 0.35); }
.inventory-v2 .dscroll { min-height: 0; overflow-y: auto; padding: 12px 14px 8px; display: grid; gap: 8px; align-content: start; scrollbar-width: thin; }
.inventory-v2 .dtitle h2 { margin: 0; font: 600 21px/1.25 var(--f-ui); }
.inventory-v2 .dtype { margin-top: 1px; font: 400 13px/1.3 var(--f-ui); color: var(--ink-2); }
.inventory-v2 .compare { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 12px; background: #f6f1e6; font: 400 12.5px/1.3 var(--f-ui); color: var(--ink-2); }
.inventory-v2 .compare img { width: 32px; height: 32px; margin: -6px 0; }
.inventory-v2 .compare b { color: var(--ink); font-weight: 500; }
.inventory-v2 .rows { display: grid; gap: 5px; }
.inventory-v2 .row { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 6px; border-radius: 12px; background: #fbf6ec; font: 400 14px/1.2 var(--f-ui); }
.inventory-v2 .row img { width: var(--icr, 32px); height: var(--icr, 32px); }
.inventory-v2 .row .k { flex: 1; color: var(--ink-2); }
.inventory-v2 .row .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.inventory-v2 .delta { display: inline-flex; align-items: center; gap: 2px; min-width: 52px; justify-content: center; padding: 2px 7px; border-radius: 9px; font: 600 12.5px/1.2 var(--f-ui); font-variant-numeric: tabular-nums; }
.inventory-v2 .delta.pos { background: #dcf6df; color: var(--up); }
.inventory-v2 .delta.neg { background: #ffe1dc; color: var(--down); }
.inventory-v2 .delta.zero { background: #f0ebe1; color: var(--ink-3); }
.inventory-v2 .delta svg { width: 10px; height: 10px; }
.inventory-v2 .row.pow { background: linear-gradient(90deg, #f3eaff, #fff6dc); }
.inventory-v2 .row.bar .durbar { position: relative; left: auto; right: auto; bottom: auto; flex: 1; height: 9px; background: rgba(122, 74, 43, 0.15); box-shadow: none; }
.inventory-v2 .about { margin: 0; font: 400 13px/1.5 var(--f-body); color: var(--ink); }
.inventory-v2 .src { display: flex; align-items: flex-start; gap: 6px; font: 400 12.5px/1.45 var(--f-ui); color: var(--ink-2); }
.inventory-v2 .src img { width: 16px; height: 16px; margin-top: 2px; image-rendering: auto; }
.inventory-v2 .dact { display: flex; gap: 8px; padding: 10px 12px 12px; background: linear-gradient(#fff, #fff8ea); box-shadow: 0 -1.5px 0 var(--line); }
.inventory-v2 .btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: 54px; border-radius: 17px;
  font: 600 19px/1 var(--f-ui); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
  background: linear-gradient(180deg, #82dd60 0%, #3fb04a 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.1), 0 4px 0 #237a33, 0 6px 10px rgba(35, 122, 51, 0.3);
}
.inventory-v2 .btn img { width: 32px; height: 32px; margin-left: -6px; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.2)); }
.inventory-v2 .btn.gold { color: #5a3300; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); background: linear-gradient(180deg, #ffe783, #ffbc2c); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.6), 0 4px 0 #b0730a, 0 6px 10px rgba(176, 115, 10, 0.3); }
.inventory-v2 .btn.soft { color: var(--ink); text-shadow: none; background: #fff; box-shadow: inset 0 0 0 1.5px var(--line-2), 0 4px 0 var(--line-2); }
.inventory-v2 .btn[disabled] { filter: grayscale(0.9); opacity: 0.55; cursor: not-allowed; }
.inventory-v2 .ibtn { flex: none; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 17px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--line-2), 0 4px 0 var(--line-2); color: var(--ink-2); }
.inventory-v2 .ibtn img { width: 32px; height: 32px; }
.inventory-v2 .ibtn.lk:not(.on) img { opacity: 0.4; filter: grayscale(0.5); }
.inventory-v2 .ibtn.on { background: #fff3cf; box-shadow: inset 0 0 0 1.5px #e3b23c, 0 4px 0 #d39b1d; }
.inventory-v2 .ibtn svg { width: 22px; height: 22px; }
.inventory-v2 .dempty { display: grid; place-items: center; align-content: center; gap: 12px; height: 100%; padding: 20px; text-align: center; font: 400 14px/1.5 var(--f-ui); color: var(--ink-2); }
.inventory-v2 .dempty .ring { display: grid; place-items: center; width: 110px; height: 110px; border-radius: 50%; border: 2.5px dashed var(--line-2); background: #fbf6ec; }
.inventory-v2 .dempty .ring img { width: 64px; height: 64px; }
.inventory-v2 .tips { display: grid; gap: 6px; margin-top: 4px; text-align: left; font-size: 13px; }
.inventory-v2 .tips div { display: flex; align-items: center; gap: 8px; }
.inventory-v2 .dfade { animation: bag-v2-dfade 0.24s var(--out) both; }
@keyframes bag-v2-dfade { from { opacity: 0; translate: 0 8px; } }
.inventory-v2 .peek { position: fixed; z-index: 60; width: 236px; padding: 10px 12px; border-radius: 16px; background: rgba(32, 22, 16, 0.94); color: #fff6e6; box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35), inset 0 0 0 1.5px rgba(255, 255, 255, 0.08); pointer-events: none; font: 400 13px/1.45 var(--f-ui); animation: bag-v2-peek 0.2s var(--spring) both; }
@keyframes bag-v2-peek { from { opacity: 0; scale: 0.9; } }
.inventory-v2 .peek h4 { margin: 0 0 2px; font: 500 16px/1.25 var(--f-ui); }
.inventory-v2 .peek .rr { font-size: 12px; }
.inventory-v2 .peek .pr { display: flex; justify-content: space-between; gap: 8px; }
.inventory-v2 .peek .hint { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.14); color: #d9c7ad; font-size: 12px; }
.inventory-v2 .peek .pos { color: #8af59c; }
.inventory-v2 .peek .neg { color: #ff9d90; }
.inventory-v2 .flyer { position: fixed; z-index: 80; pointer-events: none; image-rendering: pixelated; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.3)); }
.inventory-v2 .drag { position: fixed; z-index: 80; pointer-events: none; image-rendering: pixelated; opacity: 0.92; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.35)); }
.inventory-v2 .floaty { position: fixed; z-index: 70; pointer-events: none; font: 600 18px/1 var(--f-ui); color: #3fe06a; text-shadow: 0 2px 0 #0e5a24, 0 0 6px rgba(0, 0, 0, 0.25); }
.inventory-v2 .toast { position: fixed; left: 50%; top: 18px; z-index: 90; transform: translateX(-50%); padding: 10px 16px; border-radius: 14px; background: rgba(32, 22, 16, 0.92); color: #fff6e6; font: 400 14px/1.4 var(--f-ui); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3); animation: bag-v2-peek 0.25s var(--spring) both; max-width: 90vw; text-align: center; }
.inventory-v2 .sheet-scrim { position: fixed; inset: 0; z-index: 35; background: linear-gradient(rgba(20, 14, 10, 0), rgba(20, 14, 10, 0.45) 45%); opacity: 0; pointer-events: none; transition: transform .25s, opacity .25s; }
.inventory-v2 .placeholder { grid-column: 1 / -1; display: grid; place-items: center; align-content: center; gap: 10px; text-align: center; color: var(--ink-2); font: 400 15px/1.5 var(--f-ui); }
.inventory-v2 .placeholder img { width: 96px; height: 96px; }
@media (max-width: 599px) {
.inventory-v2 { --cols: 5; --ic-card: 44px; --ic-slot: 44px; --ic-big: 96px; --ic-chip: 22px; --ic-stat: 22px; --s-target: 3; --slot: 52px; --gap: 8px; }
.inventory-v2.win { inset: 0; border-radius: 0; grid-template-rows: calc(54px + var(--safe-t)) minmax(0, 1fr); box-shadow: none; animation: none; }
.inventory-v2 .top { padding: var(--safe-t) 10px 0 8px; gap: 8px; }
.inventory-v2 .back { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; background: rgba(255, 255, 255, 0.14); color: #fff8ea; }
.inventory-v2 .back svg { width: 22px; height: 22px; }
.inventory-v2 .brand-ic { display: none; }
.inventory-v2 .brand h1 { font-size: 20px; }
.inventory-v2 .x { display: none; }
.inventory-v2 .money { margin-left: auto; height: 36px; font-size: 16px; }
.inventory-v2 .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; gap: 0; justify-content: space-around;
    padding: 6px 4px calc(6px + var(--safe-b)); border-radius: 20px 20px 0 0; background: #fffaf0;
    box-shadow: 0 -1.5px 0 var(--line), 0 -8px 20px rgba(80, 50, 30, 0.1);
  }
.inventory-v2 .tab { flex: 1; flex-direction: column; justify-content: center; gap: 1px; height: 58px; padding: 0; border-radius: 14px; color: var(--ink-2); font-size: 11.5px; }
.inventory-v2 .tab img { position: relative; z-index: 1; }
.inventory-v2 .tab::before { content: ''; position: absolute; top: 4px; left: 50%; width: 52px; height: 32px; margin-left: -26px; border-radius: 16px; background: #d9f2c9; transform: scaleX(0.4); opacity: 0; transition: transform .25s, opacity .25s; }
.inventory-v2 .tab.on { background: none; box-shadow: none; color: var(--forest); font-weight: 600; }
.inventory-v2 .tab.on::before { transform: none; opacity: 1; }
.inventory-v2 .tab .n { display: none; }
.inventory-v2 .tab img { width: 32px; height: 32px; }
.inventory-v2 .tab .dot { top: 4px; left: calc(50% + 10px); box-shadow: 0 0 0 2px #fffaf0; }
.inventory-v2 .tab:hover { background: none; }
.inventory-v2 .body { display: flex; flex-direction: column; gap: 8px; padding: 8px 8px calc(78px + var(--safe-b)); }
.inventory-v2 .doll { flex: none; gap: 7px; padding: 9px 10px 10px; position: relative; z-index: 36; }
.inventory-v2 .buffs { display: none; }
.inventory-v2 .rig { flex: none; }
.inventory-v2 .hero .lv { min-width: 30px; height: 30px; font-size: 15px; border-radius: 10px; }
.inventory-v2 .pname { font-size: 16px; }
.inventory-v2 .cp { height: 32px; }
.inventory-v2 .cp b { font-size: 17px; }
.inventory-v2 .xp { height: 12px; }
.inventory-v2 .xp span { display: none; }
.inventory-v2 .rig { gap: 8px; }
.inventory-v2 .slot .lbl { display: none; }
.inventory-v2 .slot.empty .lbl { display: block; position: absolute; bottom: 5px; font-size: 10px; }
.inventory-v2 .slot .box { border-radius: 14px; }
.inventory-v2 .stage { height: 178px; }
.inventory-v2 .pedestal { bottom: 14px; width: 116px; height: 26px; margin-left: -58px; }
.inventory-v2 .char { bottom: 27px; }
.inventory-v2 .stats { gap: 5px; }
.inventory-v2 .stat { display: flex; align-items: center; justify-content: center; gap: 3px; padding: 7px 2px; border-radius: 12px; }
.inventory-v2 .stat small { display: none; }
.inventory-v2 .stat b { font-size: 15px; }
.inventory-v2 .stat .d { top: -6px; right: 2px; padding: 1px 4px; border-radius: 6px; background: #dcf6df; font-size: 10.5px; }
.inventory-v2 .bag { flex: 1; }
.inventory-v2 .toolbar { padding: 8px 8px 4px; }
.inventory-v2 .chip { height: 38px; padding: 0 7px; border-radius: 13px; }
.inventory-v2 .chip.on { padding-right: 8px; }
.inventory-v2 .sort { width: 40px; padding: 0; justify-content: center; }
.inventory-v2 .sort.mob { display: flex; }
.inventory-v2 .tryon { left: 8px; transform: none; padding: 2px 8px 2px 6px; font-size: 11px; animation-name: bag-v2-pop2; }
.inventory-v2 .tryon .nm { display: none; }
.inventory-v2 .sort span { display: none; }
.inventory-v2 .grid { padding: 6px 8px 14px; }
.inventory-v2 .card { grid-template-rows: auto 20px; border-radius: 12px; }
.inventory-v2 .card .art { border-radius: 12px 12px 5px 5px; }
.inventory-v2 .card .foot { font-size: 12px; }
.inventory-v2 .card .durbar { left: 5px; right: 5px; bottom: 4px; height: 5px; }
.inventory-v2 .card .up { width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 6px; }
.inventory-v2 .bagfoot { display: none; }
.inventory-v2 .detail {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-height: calc(100% - 330px - var(--safe-t)); min-height: 0;
    border-radius: 26px 26px 0 0; box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.28);
    transform: translateY(110%); transition: transform .25s, opacity .25s;
  }
.inventory-v2.sheet-open .detail { transform: none; }
.inventory-v2.sheet-open .sheet-scrim { opacity: 1; pointer-events: auto; }
.inventory-v2 .grab { display: block; position: absolute; left: 50%; top: 7px; z-index: 3; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: rgba(255, 255, 255, 0.85); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.inventory-v2 .dhead { height: 118px; grid-template-columns: auto 1fr; justify-items: start; gap: 12px; padding: 14px 16px 10px; place-items: center start; }
.inventory-v2 .dhead .rays { left: 64px; top: 60%; }
.inventory-v2 .dhead .bigic { animation: none; }
.inventory-v2 .rpill { position: static; grid-column: 2; grid-row: 1; align-self: end; }
.inventory-v2 .dhead .dtitle { grid-column: 2; }
.inventory-v2 .newtag { right: 14px; top: 16px; }
.inventory-v2 .dscroll { padding: 10px 14px 6px; gap: 8px; }
.inventory-v2 .dact { padding: 10px 12px calc(12px + var(--safe-b)); }
}
.inventory-v2 .dhead .dtitle { display: none; }
@media (max-width: 599px) {
.inventory-v2 .dhead .dtitle { display: block; position: relative; z-index: 1; grid-row: 2; }
.inventory-v2 .dhead .dtitle h2 { font-size: 21px; color: #2a1b12; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6); }
.inventory-v2 .dhead .dtitle .dtype { color: rgba(42, 27, 18, 0.75); }
.inventory-v2 .dhead { grid-template-rows: auto auto; }
.inventory-v2 .dhead .bigic { grid-row: 1 / 3; }
.inventory-v2 .dscroll > .dtitle { display: none; }
}
@media (max-height: 499px) and (min-width: 600px) {
.inventory-v2 { --cols: 4; --ic-card: 56px; --ic-slot: 32px; --ic-big: 64px; --ic-chip: 22px; --ic-stat: 21px; --s-target: 2.67; --slot: 44px; --gap: 6px; }
.inventory-v2.win { inset: 0; border-radius: 0; grid-template-rows: 44px minmax(0, 1fr); box-shadow: none; animation: none; padding-left: calc(62px + var(--safe-l)); padding-right: var(--safe-r); }
.inventory-v2 .top { height: 44px; padding: 0 8px 0 12px; }
.inventory-v2 .top::after { height: 2px; bottom: -2px; }
.inventory-v2 .brand-ic { width: 34px; height: 34px; border-radius: 11px; }
.inventory-v2 .brand h1 { font-size: 17px; }
.inventory-v2 .money { margin-left: auto; height: 32px; font-size: 15px; }
.inventory-v2 .x { width: 36px; height: 34px; border-radius: 11px; }
.inventory-v2 .tabs {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 30; width: calc(62px + var(--safe-l)); margin: 0; flex-direction: column; justify-content: center; gap: 4px;
    padding: 8px 6px 8px calc(6px + var(--safe-l)); border-radius: 0;
    background: linear-gradient(180deg, #2f7d5b, #1d5640); box-shadow: inset -3px 0 0 rgba(0, 0, 0, 0.14);
  }
.inventory-v2 .tab { flex-direction: column; justify-content: center; gap: 0; height: 56px; padding: 0; font-size: 10px; border-radius: 13px; }
.inventory-v2 .tab .n { display: none; }
.inventory-v2 .tab img { width: 32px; height: 32px; }
.inventory-v2 .tab .dot { top: 4px; left: 33px; }
.inventory-v2 .body { grid-template-columns: 220px minmax(0, 1fr) 236px; gap: 8px; padding: 8px; }
.inventory-v2 .who, .inventory-v2 .compare, .inventory-v2 .buffs { display: none; }
.inventory-v2 .sort.mob { display: flex; }
.inventory-v2 .surface { border-radius: 18px; }
.inventory-v2 .doll { gap: 6px; padding: 8px; }
.inventory-v2 .lv { min-width: 26px; height: 26px; font-size: 13px; border-radius: 9px; }
.inventory-v2 .pname { font-size: 14px; }
.inventory-v2 .cls { display: none; }
.inventory-v2 .cp { height: 28px; padding: 0 7px 0 2px; border-radius: 10px; }
.inventory-v2 .cp span { display: none; }
.inventory-v2 .cp b { font-size: 15px; }
.inventory-v2 .xp { display: none; }
.inventory-v2 .rig { gap: 6px; flex: 1; min-height: 0; }
.inventory-v2 .slots { justify-content: center; gap: 8px; }
.inventory-v2 .slot .lbl { display: none; }
.inventory-v2 .slot .box { border-radius: 12px; }
.inventory-v2 .slot .up { width: 17px; height: 17px; right: -4px; top: -4px; border-radius: 6px; }
.inventory-v2 .stage { border-radius: 14px; }
.inventory-v2 .pedestal { bottom: 10px; width: 92px; height: 22px; margin-left: -46px; }
.inventory-v2 .pedestal::after { width: 50px; height: 10px; margin-left: -25px; top: 6px; }
.inventory-v2 .char { bottom: 21px; }
.inventory-v2 .spin { width: 28px; height: 28px; right: 5px; bottom: 5px; border-radius: 9px; }
.inventory-v2 .tryon { display: none !important; }
.inventory-v2 .stats { grid-template-columns: repeat(2, 1fr); gap: 4px; }
.inventory-v2 .stat { display: flex; align-items: center; justify-content: flex-start; gap: 4px; padding: 3px 6px; border-radius: 10px; }
.inventory-v2 .stat small { display: none; }
.inventory-v2 .stat b { font-size: 13.5px; }
.inventory-v2 .stat .d { position: static; margin-left: auto; font-size: 10.5px; }
.inventory-v2 .toolbar { padding: 6px 6px 3px; gap: 6px; }
.inventory-v2 .chip { height: 32px; padding: 0 5px; border-radius: 11px; font-size: 12.5px; }
.inventory-v2 .sort { width: 34px; height: 32px; padding: 0; justify-content: center; border-radius: 11px; }
.inventory-v2 .sort span { display: none; }
.inventory-v2 .grid { padding: 6px 6px 10px; }
.inventory-v2 .card { grid-template-rows: auto 17px; border-radius: 10px; }
.inventory-v2 .card .art { border-radius: 10px 10px 4px 4px; }
.inventory-v2 .card .foot { font-size: 11px; }
.inventory-v2 .card .foot img { width: 12px; height: 12px; }
.inventory-v2 .card .up { width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 5px; }
.inventory-v2 .up svg { width: 10px; height: 10px; }
.inventory-v2 .card .new { width: 12px; height: 12px; top: -4px; right: -4px; }
.inventory-v2 .card .durbar { left: 4px; right: 4px; bottom: 3px; height: 4px; }
.inventory-v2 .card .tag { font-size: 9.5px; padding: 0 5px; bottom: 3px; }
.inventory-v2 .bagfoot { display: none; }
.inventory-v2 .detail { border-radius: 18px; }
.inventory-v2 .dhead { height: 88px; }
.inventory-v2 .dhead .rays { width: 300px; height: 300px; margin: -150px 0 0 -150px; }
.inventory-v2 .rpill { left: 6px; top: 6px; padding: 2px 7px 2px 6px; font-size: 11px; border-radius: 9px; }
.inventory-v2 .stars { font-size: 10px; }
.inventory-v2 .newtag { right: 6px; top: 6px; font-size: 10.5px; padding: 1px 7px; }
.inventory-v2 .dscroll { padding: 7px 9px 4px; gap: 6px; }
.inventory-v2 .dtitle h2 { font-size: 16px; }
.inventory-v2 .dtype { font-size: 11.5px; }
.inventory-v2 .compare { padding: 3px 6px; font-size: 11px; border-radius: 9px; }
.inventory-v2 .compare img { width: 21.33px; height: 21.33px; margin: -3px 0; }
.inventory-v2 .row { padding: 2px 7px 2px 4px; gap: 5px; font-size: 12.5px; border-radius: 9px; }
.inventory-v2 .row img { width: 21.33px; height: 21.33px; }
.inventory-v2 .delta { min-width: 40px; padding: 1px 5px; font-size: 11px; }
.inventory-v2 .about, .inventory-v2 .src { display: none; }
.inventory-v2 .dact { padding: 6px 8px 8px; gap: 6px; }
.inventory-v2 .btn { height: 40px; font-size: 16px; border-radius: 13px; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 3px 0 #237a33; }
.inventory-v2 .btn.gold { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.6), 0 3px 0 #b0730a; }
.inventory-v2 .btn img { width: 21.33px; height: 21.33px; margin-left: -2px; }
.inventory-v2 .ibtn { width: 40px; height: 40px; border-radius: 13px; box-shadow: inset 0 0 0 1.5px var(--line-2), 0 3px 0 var(--line-2); }
.inventory-v2 .ibtn img { width: 21.33px; height: 21.33px; }
.inventory-v2 .dempty { font-size: 12px; gap: 6px; }
.inventory-v2 .dempty .ring { width: 70px; height: 70px; }
.inventory-v2 .dempty .ring img { width: 42.67px; height: 42.67px; }
.inventory-v2 .tips { display: none; }
}
@media (prefers-reduced-motion: reduce) {
.inventory-v2 *, .inventory-v2 *::before, .inventory-v2 *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

.inventory-v2.win { max-width: none; width: auto; max-height: none; height: auto; margin: 0; color: var(--ink); font: 15px/1.4 var(--f-body); z-index: 1; padding: 0; }
.inventory-v2 .body { overflow: hidden; }
.inventory-v2 .top { border-radius: 0; }
.inventory-v2 .card { padding: 0; border: 0; min-width: 0; }
.inventory-v2 .grid { margin: 0; }
.inventory-v2 .slot { background: none; padding: 0; border: 0; }
.inventory-v2 .stats { margin: 0; }
.inventory-v2 .doll { overflow: auto; }
.inventory-v2 .rig { min-height: 180px; }
.inventory-v2 .inventory-extras { display: flex; flex-wrap: wrap; gap: 4px; font-size: 11px; }
.inventory-v2 .inventory-extras .chip { height: 26px; font-size: 11px; padding: 4px 8px; }
.inventory-v2 .inventory-extras details[open] { position: absolute; inset: 70px 20px 20px; z-index: 45; background: var(--cream); padding: 12px; overflow: auto; border-radius: 18px; }
.inventory-v2 .inventory-library { grid-column: 1 / -1; overflow-y: auto; min-height: 0; padding: 16px; width: 100%; }
.inventory-v2 .inventory-library .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); mask-image: none; }
.inventory-v2 .inventory-library .btn { font-size: 14px; height: 38px; }
.inventory-v2 .equipped { position: absolute; right: 2px; top: 2px; color: #195d39; background: #fff; border-radius: 6px; padding: 2px; }
.inventory-v2 img.px { image-rendering: pixelated; }
@media (max-width: 599px) {
  .inventory-v2 .body { overflow: hidden; }
  .inventory-v2 .doll { flex: none; height: 302px; }
  .inventory-v2 .rig { min-height: 160px; }
  .inventory-v2 .bag { flex: 1; }
  .inventory-v2 .xp span { display: none; }
  .inventory-v2 .stats .stat { display: flex; justify-content: center; font-size: 12px; }
  .inventory-v2 .stats .stat img { width: 21.333333px; height: 21.333333px; }
  .inventory-v2 .stats .stat b { font-size: 13px; }
  .inventory-v2 .stats .stat small { display: none; }
  .inventory-v2 .buffs { display: none; }
}
@media (max-height: 499px) and (min-width: 600px) {
  .inventory-v2.win { padding-left: calc(62px + var(--safe-l)); padding-right: var(--safe-r); }
  .inventory-v2 .rig { min-height: 140px; }
  .inventory-v2 .inventory-extras { display: flex; }
}
.rarity-art { display: inline-grid; place-items: center; border-radius: 8px; padding: 2px; background: linear-gradient(155deg, var(--a), var(--b)); box-shadow: inset 0 0 0 1px var(--e); }
[data-act="bag"] { position: relative; }
.bag-new-dot { position: absolute; right: 5px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: #ff4b3e; box-shadow: 0 0 0 2px #fff8ea; pointer-events: none; }
.inventory-v2.win { display: grid; border: 0; }
.inventory-v2 .tabs { border: 0; }
.inventory-v2 .tab { flex: none; }
.inventory-v2 .body { padding: 14px; }
.inventory-v2 .bag .sort { margin-left: 0; }
.inventory-v2 .inventory-extras { display: flex; flex: none; margin-left: auto; gap: 4px; }
.inventory-v2 .inventory-extras .chip { height: 34px; padding: 4px 8px; font-size: 12px; }
.inventory-v2 .chips { flex: 1; }
.inventory-v2 .options { font: 600 20px/1 var(--f-ui); }
.inventory-v2 .inventory-popover { position: absolute; inset: 78px 24px 24px; z-index: 50; border-radius: 20px; padding: 20px; overflow-y: auto; background: var(--cream); box-shadow: 0 10px 40px #34281f66; }
.inventory-v2 .inventory-popover .grid { mask-image: none; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.inventory-v2 .inventory-popover .btn { font-size: 14px; height: 36px; }
.inventory-v2 .inventory-popover .close-popover { position: sticky; top: 0; float: right; padding: 10px; background: #fff; border-radius: 10px; }
.inventory-v2 .inventory-popover .stats { grid-template-columns: repeat(2, 1fr); gap: 16px; }
.inventory-v2 .grab-area { display: none; }
.inventory-v2 .tab .n:empty { display: none; }
.inventory-v2 .top h1 { color: inherit; }
.inventory-v2 .card .art img, .inventory-v2 .slot .box img, .inventory-v2 .bigic img { max-width: 100%; object-fit: contain; }
.inventory-v2 .slot .box { overflow: hidden; }
.inventory-v2 .slot .up { right: 0; top: 0; }
.inventory-v2 .stats .stat b { white-space: nowrap; }
.inventory-v2 .detail .row { flex-wrap: wrap; }
@media (min-width: 600px) and (min-height: 500px) and (max-width: 1100px) {
  .inventory-v2.win { inset: 16px; }
  .inventory-v2 .body { grid-template-columns: 280px minmax(0, 1fr) 250px; gap: 10px; padding: 10px; }
  .inventory-v2 { --cols: 4; --slot: 52px; --ic-slot: 42px; --ic-card: 48px; }
  .inventory-v2 .tab { padding: 0 5px; font-size: 12px; }
  .inventory-v2 .tab img { width: 24px; height: 24px; }
  .inventory-v2 .brand h1 { font-size: 18px; }
}
@media (max-width: 599px) {
  #modal:has(.inventory-v2) { backdrop-filter: none; padding: 0; }
  .inventory-v2.win { padding: 0; }
  .inventory-v2 .body { padding: 8px 8px calc(78px + var(--safe-b)); }
  .inventory-v2 .toolbar { gap: 4px; }
  .inventory-v2 .inventory-extras .chip { width: 32px; padding: 0; }
  .inventory-v2 .inventory-extras .wardrobe-chip { width: 44px; font-size: 10px; }
  .inventory-v2 .inventory-popover { inset: calc(64px + var(--safe-t)) 8px calc(82px + var(--safe-b)); padding: 12px; }
  .inventory-v2 .detail { height: 50dvh; max-height: 50dvh; }
  .inventory-v2.sheet-tall .detail { height: 90dvh; max-height: 90dvh; }
  .inventory-v2 .grab-area { display: block; position: absolute; left: calc(50% - 32px); top: 0; width: 64px; height: 48px; z-index: 5; touch-action: none; }
  .inventory-v2 .grab { left: 50%; top: 8px; width: 32px; height: 4px; margin-left: -16px; }
  .inventory-v2 .dhead { padding-top: 22px; height: 128px; }
  .inventory-v2 .bag { min-height: 0; }
  .inventory-v2 .tab { flex: 1; }
}
@media (max-height: 499px) and (min-width: 600px) {
  #modal:has(.inventory-v2) { backdrop-filter: none; padding: 0; }
  .inventory-v2 .body { padding: 8px; }
  .inventory-v2 .doll { overflow: hidden; }
  .inventory-v2 .inventory-popover { inset: 50px 72px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .inventory-v2 *, .inventory-v2 *::before, .inventory-v2 *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Fix round 1: intrinsic text must not resize cards or toolbar controls. */
/* every row as tall as its cards: the grid scrolls, so rows must not shrink to fit its height */
.inventory-v2 .bag > .grid {
  grid-auto-rows: max-content;
}
.inventory-v2 .bag > .grid > .card {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  align-self: start;
}
.inventory-v2 .card .art {
  width: 100%;
  min-width: 0;
  min-height: 0;
}
.inventory-v2 .card .foot {
  min-width: 0;
  overflow: hidden;
}
.inventory-v2 .card .foot img { flex: none; }
.inventory-v2 .card .foot-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inventory-v2 .card .tag {
  box-sizing: border-box;
  max-width: calc(100% - 8px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.inventory-v2 .bag > .toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content max-content;
}
.inventory-v2 .toolbar > .chips {
  width: 100%;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
.inventory-v2 .toolbar > .sort {
  width: auto;
  min-width: 40px;
  padding: 0 8px;
  margin: 0;
}
.inventory-v2 .toolbar > .inventory-extras {
  flex-wrap: nowrap;
  margin: 0;
}
.inventory-v2 .toolbar > .inventory-extras .chip {
  flex: none;
  min-width: 32px;
}


/* Enhancement badges leave the bag's equipment tick and durability bar visible. */
.inventory-v2 .forge-badge {
  position: absolute;
  left: 3px;
  top: 3px;
  z-index: 4;
  padding: 1px 4px;
  border-radius: 5px;
  background: #412c12;
  color: #ffdf7c;
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.2;
  text-shadow: 0 1px #000;
  pointer-events: none;
}
.forge-view {
  display: grid;
  gap: 8px;
}
.inventory-v2 .card .forge-badge {
  top: 27px;
}
.forge-view p {
  margin: 0;
}
.forge-view select {
  width: 100%;
  min-width: 0;
  padding: 6px;
  font: inherit;
}
.forge-weapon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.forge-result {
  min-height: 2em;
  padding: 8px;
  border-radius: 8px;
  background: #fff0c4;
  color: #49311a;
  white-space: pre-line;
  overflow-wrap: anywhere;
  font-size: 14px;
}

/* Keep the forge action outside scrolling content, even on short phone screens. */
.forge-panel > header,
.forge-panel > .tabs,
.forge-panel > footer {
  flex-shrink: 0;
}
.forge-panel .body {
  min-height: 0;
}
.forge-panel .tabs {
  overflow-x: auto;
}
.forge-panel .tabs button {
  flex-shrink: 0;
}
.forge-select {
  display: grid;
  gap: 4px;
  font-size: 13px;
}
.forge-weapon > div {
  min-width: 0;
}
.forge-name {
  display: block;
  font-size: 19px;
  overflow-wrap: anywhere;
}
.forge-plus {
  display: block;
  font-size: 30px;
  line-height: 1.15;
  color: #8b5706;
}
.forge-power {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}
.forge-chance {
  display: grid;
  gap: 2px;
  text-align: center;
}
.forge-chance b {
  font-size: 19px;
}
.forge-chance span {
  font-size: 14px;
  color: var(--ink-soft);
}
.forge-price {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.forge-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid #ddcba4;
  border-radius: 10px;
  background: #fff8e8;
  font-size: 13px;
}
.forge-chip.short {
  color: #a12626;
  background: #ffe7df;
  border-color: #cc7373;
}
.forge-chip .icon {
  flex-shrink: 0;
}
.forge-panel footer.forge-footer {
  padding-bottom: max(10px, var(--safe-b));
}
.forge-attempt {
  width: 100%;
  min-height: 48px;
  font-size: 20px;
}
@media (max-width: 440px) {
  .forge-panel .tabs {
    gap: 3px;
    padding: 5px 5px 0;
  }
  .forge-panel .tabs button {
    font-size: 12px;
    padding: 5px 3px;
  }
  .forge-panel .body {
    padding: 8px;
  }
  .forge-view {
    gap: 6px;
  }
}
/* the bag header: both levels, labelled like the panel at the top left */
.inventory-v2 .cls { flex-wrap: wrap; column-gap: 8px; }
.inventory-v2 .cls .lvl { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
/* Skills step 1: HTML names and the caster's own cut-in. */
.float.skill {
  border: 1px solid var(--skill-color, #ffe36e);
  font-size: calc(15px * var(--wz, 1));
  font-weight: 600;
  animation: skill-name 900ms both;
  white-space: nowrap;
}
.float.skill.c-sword { --skill-color: #ffe36e; }
.float.skill.c-bow { --skill-color: #7fdcb8; }
.float.skill.c-gun { --skill-color: #8fd0f2; }
.float.skill.c-magic { --skill-color: #ab84e3; }
.float.skill.ult {
  color: #fff4b0;
  background: linear-gradient(90deg, #4b2936, #6b4727, #4b2936);
  border: 2px solid #f5c93a;
  border-radius: 2px;
  font-size: calc(18px * var(--wz, 1));
  box-shadow: 0 2px 0 #2a1824, inset 0 0 0 1px #9a6b14;
  padding: 3px 14px;
  animation-duration: 1200ms;
}
@keyframes skill-name {
  0% { opacity: 0; transform: translate(-50%, -100%) scale(1.3); }
  13% { opacity: 1; transform: translate(-50%, -100%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(1); }
}
.skilllist .acts { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.skilllist .locked .acts button { opacity: 1; }
.skill-cutin {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  overflow: hidden;
  --cutin-a: #9a3029;
  --cutin-b: #d19a1e;
}
.skill-cutin.c-magic { --cutin-a: #35234f; --cutin-b: #8459c2; }
.cutin-dim { position: absolute; inset: 0; background: #080611; opacity: 0; }
.cutin-band {
  position: absolute;
  left: -4%;
  top: 35%;
  width: 108%;
  height: 22%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: linear-gradient(100deg, #271824, var(--cutin-a) 40%, var(--cutin-b));
  border-top: 4px solid #f5c93a;
  border-bottom: 4px solid #9a6b14;
  box-shadow: 0 4px 0 #271824;
  will-change: transform, opacity;
}
.cutin-band::before, .cutin-band::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  background: repeating-linear-gradient(45deg, transparent 0 8px, #ffe36e 8px 10px, transparent 10px 18px);
}
.cutin-band::before { top: 2px; }
.cutin-band::after { bottom: 2px; }
.cutin-portrait {
  image-rendering: pixelated;
  object-fit: contain;
  position: relative;
  transform-origin: bottom;
}
.cutin-words { transform: skewY(12deg); position: relative; }
.cutin-words b {
  display: block;
  font: 600 40px Mitr, sans-serif;
  color: #ffe36e;
  background: linear-gradient(#fff4b0, #f5c93a);
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(2px 2px 0 #25152c);
}
.cutin-words small { display: block; color: #faf3e3; font-size: 14px; }
.cutin-lines {
  position: absolute;
  inset: 0;
  opacity: 0.3;
  background: repeating-linear-gradient(175deg, transparent 0 9px, #fff4b0 10px 11px, transparent 12px 24px);
}
.cutin-emblem {
  color: #fff4b0;
  font-size: 96px;
  opacity: 0.2;
  transform: skewY(12deg);
}
.skill-cutin.short .cutin-band { height: 12%; top: 16%; }
.skill-cutin.short .cutin-portrait, .skill-cutin.short .cutin-emblem { display: none; }
.skill-cutin.danger .cutin-band { top: 2%; height: 10%; }
.skill-cutin.reduced .cutin-lines { display: none; }
.skill-cutin.reduced .cutin-words, .skill-cutin.reduced .cutin-emblem { transform: none; }
.fx-reduced .float.skill { animation-name: skill-name-fade; }
@keyframes skill-name-fade {
  0% { opacity: 0; }
  10%, 80% { opacity: 1; }
  100% { opacity: 0; }
}
@media (max-width: 600px) {
  .cutin-band { height: 18%; gap: 10px; }
  .cutin-words b { font-size: 30px; }
  .cutin-words small { font-size: 11px; }
  .cutin-emblem { display: none; }
  .cutin-portrait { max-width: 100px; }
}

.cutin-emblem { width: 96px; height: 96px; image-rendering: pixelated; }
/* the ultimate's spirit (Effects v4, PixelLab art) standing up out of the band, crisp */
.cutin-spirit {
  position: relative; align-self: flex-end; height: 165%; width: auto; margin-bottom: -2%;
  image-rendering: pixelated; transform-origin: bottom; filter: drop-shadow(0 3px 0 #25152c);
}
.skill-cutin.short .cutin-spirit { display: none; }
@media (max-width: 600px) { .cutin-spirit { height: 130%; } }

/* someone's character card (ui/profile.js) */
.profile { display: grid; gap: 10px; }
.profile-head { display: flex; gap: 14px; align-items: center; }
.profile-head .skill-avatar { width: 96px; flex: none; }
.profile-who { display: grid; gap: 3px; min-width: 0; }
.profile-name { font-size: 20px; overflow-wrap: anywhere; }
.profile-line { display: flex; align-items: center; gap: 4px; font-size: 14px; flex-wrap: wrap; }
.profile-tag { padding: 0 8px; border-radius: 10px; background: #ffe27a; color: #6b4a10; font-style: normal; font-size: 12px; }
.profile-power { display: inline-flex; align-items: center; gap: 4px; width: fit-content; padding: 2px 10px; border-radius: 10px; background: #3f2c5c; color: #ffe27a; font-weight: 700; }
.profile-h { margin: 6px 0 0; font-size: 15px; }
.profile-gear { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.profile-thing { display: flex; gap: 8px; align-items: center; padding: 6px; border: 2px solid #d9c7a3; border-radius: 10px; background: #fffaf0; min-width: 0; }
.profile-thing img { image-rendering: pixelated; flex: none; }
.profile-thing div { display: grid; min-width: 0; }
.profile-thing small { color: var(--ink-soft); font-size: 11px; }
.profile-thing b { font-size: 13px; overflow-wrap: anywhere; }
.profile-thing.r1 { border-color: #4caf50; }
.profile-thing.r2 { border-color: #3f8fe0; }
.profile-thing.r3 { border-color: #9b59d6; }
.profile-thing.r4 { border-color: #e8a317; }
.profile-thing.empty { opacity: 0.6; }
.profile-none { display: grid; place-items: center; width: 40px; height: 40px; color: #b7a78a; }
.profile-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.profile-stat { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px; background: #fff6e2; text-align: center; }
.profile-stat b { font-size: 15px; }
.profile-stat small { font-size: 11px; color: var(--ink-soft); }
.profile-records { margin: 0; padding-left: 18px; display: grid; gap: 2px; font-size: 14px; }
.profile-acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* sell: the amount can be typed */
.stepper input.qty { width: 4.5em; padding: 4px 6px; border: 2px solid #d9c7a3; border-radius: 8px; font: inherit; font-weight: 700; text-align: center; background: #fff; }

/* a window drawn again keeps still (its opening animation is for the first time only) */
.panel.again {
  animation: none;
}

/* the title screen while the server is closed for maintenance (ui/title.js closed) */
.maintenance {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 2px solid #c0392b;
  border-radius: 12px;
  background: #fff1ec;
  color: #7a2416;
  text-align: center;
}

.maintenance b {
  font-size: 18px;
}
