* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #0d2b36;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: ui-rounded, "Nunito", "Segoe UI", system-ui, sans-serif;
  font-weight: 800;
  color: #fff;
}

/* Always a portrait frame, also on a wide computer screen. */
#stage {
  position: relative;
  height: 100dvh;
  width: min(100vw, calc(100dvh * 0.62));
  margin: 0 auto;
  overflow: hidden;
  overflow: clip; /* hidden still lets a focused button scroll the stage sideways; clip cannot be scrolled at all */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
/* Tablets held upright (iPad, Android tablets): the frame may widen up to 4:5, so a 3:4 screen is filled instead of showing a
   narrow strip between two dark bands. The camera (fitCamera in main.js) keeps the height of view it has at 0.62 and only
   gains view at the sides, so nothing gets closer or smaller. Phones (narrower than 0.62) do not change. */
@media (pointer: coarse) {
  #stage { width: min(100vw, calc(100dvh * 0.8)); }
  /* The backpack (Weapons: portrait 4:5 as wide as the middle column; Items: 5 squares a row) grows with its width: on a wide
     frame the weapon slots went off the bottom and the items became huge. Its sheet keeps a phone-like width, centred. */
  #inv .sheet { max-width: 520px; margin-left: auto; margin-right: auto; }
}

#view { display: block; width: 100%; height: 100%; }

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

.num {
  position: absolute;
  opacity: 0;
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 0 #1b3a4b, 0 -1px 0 #1b3a4b, 2px 0 0 #1b3a4b, -2px 0 0 #1b3a4b;
  transform: translate(-50%, -50%);
}
.num.crit { color: #ffe14d; font-size: 30px; }
.num.pop { animation: pop 0.6s ease-out forwards; }
@keyframes pop {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.4); }
  20% { opacity: 1; transform: translate(-50%, -90%) scale(1.25); }
  70% { opacity: 1; transform: translate(-50%, -150%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -190%) scale(0.9); }
}

#stick {
  position: absolute;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 3px solid rgba(255, 255, 255, 0.55);
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: none;
}
#stick.on { display: block; }
#knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 0 rgba(27, 58, 75, 0.35);
  transform: translate(-50%, -50%);
}

#brand, #stats, #hint {
  position: absolute;
  pointer-events: none;
  text-shadow: 0 2px 0 rgba(27, 58, 75, 0.55);
}
#brand { left: 14px; top: calc(12px + env(safe-area-inset-top)); line-height: 1.1; }
#brand b { display: block; font-size: 22px; font-weight: 900; letter-spacing: 1px; }
#brand span { font-size: 12px; opacity: 0.9; }

#stats {
  right: 12px;
  top: calc(12px + env(safe-area-inset-top));
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(13, 43, 54, 0.55);
  font-size: 12px;
  line-height: 1.45;
  text-align: right;
  text-shadow: none;
  font-variant-numeric: tabular-nums;
}
#stats b { font-size: 15px; color: #8ef7c8; }

#heroes {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(70px + env(safe-area-inset-bottom));
  display: flex;
  gap: 6px;
  justify-content: center;
}
#heroes button {
  flex: 1 1 0;
  min-height: 40px;
  padding: 6px 2px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  color: #17566b;
  font: inherit;
  font-size: 13px;
  box-shadow: 0 3px 0 rgba(27, 58, 75, 0.3);
  cursor: pointer;
}
#heroes button.on { background: #ffc93c; color: #5a3a00; }

#hint {
  left: 0;
  right: 0;
  bottom: calc(120px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 13px;
  opacity: 0.95;
}

#bar {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  justify-content: center;
}
#bar button {
  flex: 1 1 0;
  min-height: 46px;
  padding: 8px 6px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  color: #17566b;
  font: inherit;
  font-size: 13px;
  box-shadow: 0 4px 0 rgba(27, 58, 75, 0.35);
  cursor: pointer;
}
#bar button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(27, 58, 75, 0.35); }

/* Hero life, backpack buttons and loot captions */
#hp {
  position: absolute;
  left: 14px;
  top: calc(62px + env(safe-area-inset-top));
  width: 136px;
  height: 20px;
  border: 2px solid #fff;
  border-radius: 10px;
  background: rgba(13, 43, 54, 0.6);
  overflow: hidden;
  pointer-events: none;
}
#hp i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: linear-gradient(#ff8676, #ee4338); transition: width 0.15s; }
#hp span { position: relative; display: block; font-size: 11px; line-height: 16px; text-align: center; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45); font-variant-numeric: tabular-nums; }

#pack { position: absolute; left: 14px; top: calc(90px + env(safe-area-inset-top)); display: flex; gap: 8px; }
#pack button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 44px;
  height: 44px;
  padding: 4px 10px 4px 6px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  color: #17566b;
  font: inherit;
  font-size: 13px;
  box-shadow: 0 4px 0 rgba(27, 58, 75, 0.35);
  cursor: pointer;
}
#pack button:disabled { opacity: 0.6; }
#pack svg { width: 28px; height: 28px; }
#bag i {
  position: absolute;
  right: -6px;
  top: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #ee4338;
  color: #fff;
  font-style: normal;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
}

.num.label { font-size: 15px; white-space: nowrap; }
.num.label.pop { animation-duration: 0.95s; }
.num.label.coco { color: #ffe2b0; }
.num.label.comune { color: #c4f7b3; }
.num.label.raro { color: #a9d6ff; }
.num.label.epico { color: #f3bcff; }

/* Backpack sheet */
#inv { position: absolute; inset: 0; z-index: 5; display: none; align-items: flex-end; background: rgba(13, 43, 54, 0.5); }
#inv.open { display: flex; }
.sheet {
  width: 100%;
  max-height: 90%;
  overflow-y: auto;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: #fbf3e4;
  color: #3a2a22;
}
.sheet button { font: inherit; cursor: pointer; }
.sheet header { display: flex; align-items: center; justify-content: space-between; }
.sheet h2 { margin: 0; font-size: 22px; font-weight: 900; }
.sheet h3 { margin: 12px 0 6px; font-size: 13px; color: #8a6a55; }
.sheet header > button { width: 44px; height: 44px; border: 0; border-radius: 14px; background: #efe2cb; color: #3a2a22; font-size: 18px; }
.purse { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; }
.purse span, .purse button { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 4px 10px 4px 4px; border: 0; border-radius: 12px; background: #fff; color: #3a2a22; }
.purse svg { width: 26px; height: 26px; }
.purse button { min-height: 44px; margin-left: auto; background: #ffc93c; color: #5a3a00; }
.purse button:disabled { background: #efe2cb; color: #a89a88; }
.bonus { margin: 10px 0 0; font-size: 12px; font-weight: 700; color: #6a5244; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: #8a6a55; }
.slot .cell { width: 64px; }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.cell { position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 5px; border: 3px solid var(--rar, #e2d3ba); border-radius: 14px; background: #fff; }
.cell.empty { border-style: dashed; border-color: #e2d3ba; background: transparent; }
.cell.sel { box-shadow: 0 0 0 3px #3a2a22; }
.cell svg { display: block; width: 100%; height: 100%; }
.cell b { position: absolute; right: -5px; top: -5px; width: 20px; height: 20px; border-radius: 10px; background: #1fb5a8; color: #fff; font-size: 11px; line-height: 20px; text-align: center; }
.detail { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 76px; margin-top: 12px; padding: 10px; border-radius: 14px; background: #fff; }
.detail .about { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.detail strong { font-size: 15px; }
.detail em { font-style: normal; font-size: 12px; }
.detail .acts { display: flex; flex-direction: column; gap: 6px; }
.detail .acts button { min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: #efe2cb; color: #3a2a22; font-size: 13px; white-space: nowrap; }
.detail .acts .main { background: #1fb5a8; color: #fff; }
.muted { margin: 0; font-size: 13px; font-weight: 700; color: #8a6a55; }
.sheet footer { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; color: #8a6a55; }
.sheet footer span { margin-right: auto; }
.sheet footer button { min-height: 40px; padding: 0 12px; border: 1px dashed #c9b79c; border-radius: 12px; background: transparent; color: #6a5244; font-size: 12px; }

/* Backpack tabs and the weapons list */
.tabs { display: flex; gap: 6px; padding: 4px; border-radius: 16px; background: #efe2cb; }
.tabs button { min-height: 44px; padding: 0 18px; border: 0; border-radius: 12px; background: transparent; color: #6a5244; font-size: 17px; font-weight: 900; }
.tabs button.on { background: #fff; color: #3a2a22; box-shadow: 0 2px 0 rgba(58, 42, 34, 0.15); }
.weapons { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.weapon { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 8px; border: 3px solid transparent; border-radius: 16px; background: #fff; }
.weapon.on { border-color: #ffc93c; }
.weapon img, .weapon .nopic { flex: none; width: 72px; height: 72px; border-radius: 12px; background: #f4e8d2; }
.weapon .about { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; font-size: 12px; color: #6a5244; }
.weapon strong { font-size: 15px; color: #3a2a22; }
.weapon em { font-style: normal; color: #1f9a8f; }
.weapon button { flex: none; min-width: 64px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 12px; background: #efe2cb; color: #8a6a55; font-size: 13px; }
.weapon button.main { background: #1fb5a8; color: #fff; }

/* Phase 1 of the economy: wallet, chest, weapon levels, permanent upgrades */
#wallet { position: absolute; left: 14px; top: calc(142px + env(safe-area-inset-top)); display: flex; gap: 6px; pointer-events: none; }
#wallet span { display: inline-flex; align-items: center; gap: 3px; height: 26px; padding: 0 9px 0 3px; border-radius: 13px; background: rgba(13, 43, 54, 0.6); font-size: 13px; font-variant-numeric: tabular-nums; }
#wallet svg { width: 20px; height: 20px; }
.tabs button { padding: 0 13px; font-size: 16px; }
.purse > span { font-variant-numeric: tabular-nums; }
.chest { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 8px 10px 8px 8px; border-radius: 16px; background: #fff; }
.chest > svg { flex: none; width: 48px; height: 48px; }
.chest .about { display: flex; flex: 1; flex-direction: column; gap: 2px; font-size: 12px; color: #6a5244; }
.chest strong { font-size: 15px; color: #3a2a22; }
.chest button, .weapon .acts button, .uprow button { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 44px; padding: 4px 12px; border: 0; border-radius: 12px; background: #efe2cb; color: #8a6a55; font-size: 13px; line-height: 1.15; }
.chest button.main, .uprow button.main { background: #ffc93c; color: #5a3a00; }
.chest button small, .weapon .acts small { font-size: 10px; font-weight: 700; white-space: nowrap; }
.chest button:disabled, .uprow button:disabled, .weapon .acts button.up:disabled { background: #efe2cb; color: #a89a88; }
.weapon .acts { display: flex; flex: none; flex-direction: column; gap: 6px; }
.weapon .acts button.main { background: #1fb5a8; color: #fff; }
.weapon .acts button.up { background: #ffc93c; color: #5a3a00; }
.ups { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.uprow { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-radius: 16px; background: #fff; }
.uprow .about { display: flex; flex: 1; flex-direction: column; gap: 2px; font-size: 12px; color: #6a5244; }
.uprow strong { font-size: 15px; color: #3a2a22; }
.uprow strong small { margin-left: 4px; font-size: 11px; color: #1f9a8f; }
.uprow button { flex: none; flex-direction: row; gap: 3px; min-width: 84px; font-size: 15px; font-variant-numeric: tabular-nums; }
.uprow button svg { width: 22px; height: 22px; }

/* Weapon colours: five tiers per hero, three of one forge into the next */
.weapon { display: block; }
.weapon .top { display: flex; align-items: center; gap: 10px; }
.weapon .tiers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 8px; }
.weapon .tier { display: flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; min-height: 40px; padding: 0 4px; border: 3px solid transparent; border-radius: 12px; background: #f4e8d2; color: #3a2a22; font-size: 13px; font-variant-numeric: tabular-nums; }
.weapon .tier i { flex: none; width: 18px; height: 18px; border: 2px solid #3a2a22; border-radius: 50%; }
.weapon .tier.on { border-color: #3a2a22; background: #fff; }
.weapon .tier:disabled { opacity: 0.45; }
.weapon .forge { width: 100%; min-height: 44px; margin-top: 8px; border: 0; border-radius: 12px; background: #3a2a22; color: #fff; font-size: 14px; }
.num.label.verde { color: #b6ffbf; }

/* Equipment colours and fusion: the same five colours as weapons */
.cell.rainbow { border-color: transparent; background: linear-gradient(#fff, #fff) padding-box, linear-gradient(135deg, #ff4a40, #ffc531, #45d05a, #3a9bff, #b043ee) border-box; }
.cell u { position: absolute; left: -5px; top: -5px; width: 20px; height: 20px; border-radius: 10px; background: #3a2a22; color: #fff; font-size: 11px; line-height: 20px; text-align: center; text-decoration: none; }
.detail small { margin-top: 2px; font-size: 11px; font-weight: 700; color: #8a6a55; }
.detail .acts .fuse, .sheet h3 .fuse { background: #3a2a22; color: #fff; }
.sheet h3.row { display: flex; align-items: center; justify-content: space-between; }
.sheet h3 .fuse { min-height: 36px; padding: 0 14px; border: 0; border-radius: 12px; font-size: 13px; }
.num.label.blu { color: #a9d6ff; }
.num.label.rosso { color: #ffb3ae; }
.num.label.oro { color: #ffe08a; }
.num.label.arcobaleno { color: #f3bcff; }

/* Magnet pick-up: wider pick-up radius for a while */
#boost { position: absolute; left: 14px; top: calc(174px + env(safe-area-inset-top)); display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px 0 4px; border-radius: 14px; background: #e5383b; color: #fff; font-size: 13px; font-variant-numeric: tabular-nums; pointer-events: none; }
#boost[hidden] { display: none; }
#boost svg { width: 22px; height: 22px; }

/* Six weapon slots, the weapon card, six equipment slots, the boss bar */
#bar { flex-wrap: wrap; gap: 6px; }
#bar button { flex: 1 1 18%; min-height: 44px; padding: 6px 2px; font-size: 12px; }
#heroes { bottom: calc(68px + env(safe-area-inset-bottom)); }
#boss { position: absolute; left: 50%; top: calc(214px + env(safe-area-inset-top)); width: min(78%, 300px); transform: translateX(-50%); text-align: center; pointer-events: none; }
#boss[hidden] { display: none; }
#boss span { display: block; font-size: 13px; text-shadow: 0 2px 0 rgba(27, 58, 75, 0.6); }
#boss b { display: block; height: 16px; margin-top: 2px; border: 2px solid #fff; border-radius: 8px; background: rgba(13, 43, 54, 0.65); overflow: hidden; }
#boss i { display: block; width: 100%; height: 100%; background: linear-gradient(#ff7af5, #c21fd6); transition: width 0.15s; }
.herochips { display: flex; gap: 6px; margin-top: 10px; }
.herochips button { position: relative; flex: 1 1 0; min-height: 40px; padding: 0 2px; border: 0; border-radius: 12px; background: #efe2cb; color: #6a5244; font-size: 13px; }
.herochips button.on { background: #3a2a22; color: #fff; }
.herochips i { position: absolute; right: 5px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: #ffc93c; }
.sheet .play { width: 100%; min-height: 44px; margin-top: 8px; border: 0; border-radius: 12px; background: #1fb5a8; color: #fff; font-size: 14px; }
.sheet h3 .up { min-height: 36px; padding: 0 10px; border: 0; border-radius: 12px; background: #ffc93c; color: #5a3a00; font-size: 11px; }
.sheet h3 .up:disabled { background: #efe2cb; color: #a89a88; }
.wslots { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.wslot { position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 3px; border: 3px solid var(--rar, #e2d3ba); border-radius: 12px; background: #fff; }
.wslot.empty { border-style: dashed; background: transparent; }
.wslot.rainbow { border-color: transparent; background: linear-gradient(#fff, #fff) padding-box, linear-gradient(135deg, #ff4a40, #ffc531, #45d05a, #3a9bff, #b043ee) border-box; }
.wslot.sel { box-shadow: 0 0 0 3px #3a2a22; }
.wslot img, .cell img { display: block; width: 100%; height: 100%; }
.wslot small { position: absolute; left: 0; right: 0; bottom: -15px; font-size: 9px; font-weight: 800; color: #8a6a55; text-align: center; }
.wslots + .muted { margin-top: 18px; }
.muted.small { font-size: 11px; }
.cell.none { border-style: dashed; border-color: #e2d3ba; }
.cell.none img { opacity: 0.3; filter: grayscale(1); }
.wdetail { margin-top: 12px; padding: 10px; border-radius: 16px; background: #fff; }
.wdetail .top { display: flex; align-items: center; gap: 10px; }
.wdetail .top img { flex: none; width: 84px; height: 84px; border-radius: 12px; background: #f4e8d2; }
.wdetail .about { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: #6a5244; }
.wdetail strong { font-size: 16px; color: #3a2a22; }
.wdetail em { font-style: normal; color: #1f9a8f; }
.wdetail .traits { margin: 8px 0 0; font-size: 12px; font-weight: 700; color: #3a2a22; }
.wdetail .tiers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 8px; }
.wdetail .tier { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 40px; padding: 0 4px; border: 3px solid transparent; border-radius: 12px; background: #f4e8d2; color: #3a2a22; font-size: 13px; }
.wdetail .tier i { flex: none; width: 18px; height: 18px; border: 2px solid #3a2a22; border-radius: 50%; }
.wdetail .tier.on { border-color: #3a2a22; background: #fff; }
.wdetail .tier:disabled { opacity: 0.45; }
.wdetail .acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.wdetail .acts button { flex: 1 1 45%; min-height: 44px; padding: 0 10px; border: 0; border-radius: 12px; background: #efe2cb; color: #3a2a22; font-size: 13px; }
.wdetail .acts .main { background: #1fb5a8; color: #fff; }
.wdetail .acts .main:disabled { background: #efe2cb; color: #a89a88; }
.wdetail .acts .forge { background: #3a2a22; color: #fff; }
.slots { row-gap: 8px; }

/* Carry bar, the house arrow, area banner, maps */
#brand { pointer-events: auto; cursor: pointer; }
#stats[hidden] { display: none; }
#stats { top: auto; bottom: calc(190px + env(safe-area-inset-bottom)); right: 10px; }
#wallet { top: calc(138px + env(safe-area-inset-top)); }
#carry { position: absolute; left: 14px; top: calc(170px + env(safe-area-inset-top)); width: 148px; pointer-events: none; }
#carry .txt { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 15px; font-variant-numeric: tabular-nums; text-shadow: 0 2px 0 rgba(27, 58, 75, 0.6); }
#carry .txt svg { width: 22px; height: 22px; }
#carry .txt em { flex-basis: 100%; font-style: normal; font-size: 11px; text-shadow: none; }
#carry.full .txt em { display: inline-block; width: fit-content; padding: 1px 8px; border-radius: 9px; background: #e5383b; color: #fff; }
#carry b { display: block; height: 12px; margin-top: 3px; border: 2px solid #fff; border-radius: 7px; background: rgba(13, 43, 54, 0.6); overflow: hidden; }
#carry b i { display: block; width: 0; height: 100%; background: linear-gradient(#fff, #cfe8ff); transition: width 0.15s; }
#carry.full b i { background: linear-gradient(#ff8676, #ee4338); }
#carry svg#homeArrow { position: absolute; right: -34px; top: 0; width: 28px; height: 28px; transition: opacity 0.2s; filter: drop-shadow(0 2px 0 rgba(27, 58, 75, 0.45)); }
#carry.full svg#homeArrow { animation: nudge 0.8s ease-in-out infinite; }
@keyframes nudge { 50% { scale: 1.25; } }
#boost { top: calc(222px + env(safe-area-inset-top)); }
/* "Perle in viaggio": the pearls go straight to the bank for a while (economy.js PEARL_TRIP), under the magnet's pill */
#tripboost { position: absolute; left: 14px; top: calc(254px + env(safe-area-inset-top)); display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px 0 4px; border-radius: 14px; background: #1d8fc4; color: #fff; font-size: 13px; font-variant-numeric: tabular-nums; pointer-events: none; }
#tripboost[hidden] { display: none; }
#tripboost svg { width: 22px; height: 22px; }
#boss { top: calc(262px + env(safe-area-inset-top)); }
#mini { position: absolute; right: 10px; top: calc(8px + env(safe-area-inset-top)); width: 92px; height: 92px; padding: 0; border: 3px solid #fff; border-radius: 22px; background: #19b5d8; overflow: hidden; box-shadow: 0 4px 0 rgba(27, 58, 75, 0.35); cursor: pointer; }
#mini canvas { display: block; width: 100%; height: 100%; }
#mini span { position: absolute; left: 0; right: 0; bottom: 3px; font: 800 9px/1 ui-rounded, "Nunito", system-ui, sans-serif; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); text-align: center; pointer-events: none; }
#banner { position: absolute; left: 0; right: 0; top: 26%; text-align: center; pointer-events: none; opacity: 0; text-shadow: 0 3px 0 rgba(27, 58, 75, 0.7); }
#banner b { display: block; font-size: 34px; font-weight: 900; letter-spacing: 1px; }
#banner span { display: block; margin-top: 2px; font-size: 14px; }
#banner.show { animation: banner 2.8s ease-out forwards; }
@keyframes banner { 0% { opacity: 0; transform: translateY(8px) scale(0.92); } 12% { opacity: 1; transform: none; } 70% { opacity: 1; } 100% { opacity: 0; } }
#map { position: absolute; inset: 0; z-index: 6; display: none; align-items: flex-end; background: rgba(13, 43, 54, 0.55); }
#map.open { display: flex; }
#mapcanvas { display: block; width: min(100%, 52dvh); aspect-ratio: 1; margin: 6px auto 0; border-radius: 24px; }
#maphere { margin: 8px 0 0; text-align: center; font-size: 14px; color: #3a2a22; }
#maplegend { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
#maplegend li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; background: #fff; font-size: 12px; color: #6a5244; }
#maplegend li > i { flex: none; width: 14px; height: 30px; border-radius: 6px; }
#maplegend li > div { display: flex; flex: 1; flex-direction: column; min-width: 0; }
#maplegend li > div.boss { text-align: right; }
#maplegend strong { font-size: 13px; color: #3a2a22; }
#maplegend .sleeping { color: #8a6a55; }
#maplegend .fighting { color: #e5383b; font-weight: 800; }
#maplegend .defeated { color: #1f9a8f; }

/* Squares filled with the colour of their level, not just outlined */
.cell, .wslot { background: var(--fill, #fff); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55); }
.cell.sel, .wslot.sel { box-shadow: 0 0 0 3px #3a2a22; }
.cell.rainbow, .wslot.rainbow { border-color: transparent; background: linear-gradient(135deg, #ffb6b3, #ffe7a3, #bff3b8, #b0dcff, #e6c2ff) padding-box, linear-gradient(135deg, #ff4a40, #ffc531, #45d05a, #3a9bff, #b043ee) border-box; }
.cell.empty, .wslot.empty { background: transparent; box-shadow: none; }
.cell.none { background: #f1e8d6; box-shadow: none; }

/* The character sheet (Armi tab): the hero in the middle on a platform, three weapon slots on each side */
.equip { display: grid; grid-template-columns: 76px minmax(0, 1fr) 76px; gap: 6px; margin-top: 10px; padding: 10px 8px 8px; border-radius: 18px; background: linear-gradient(#fff7e6, #f1dfbb); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6); }
.equip .col { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.equip .mid { display: flex; flex-direction: column; align-items: center; min-width: 0; gap: 4px; }
.equip .power { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 6px; border-radius: 14px; background: #3a2a22; color: #ffe08a; font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; }
.equip .power svg { width: 20px; height: 20px; }
.equip .portrait { position: relative; display: flex; align-items: flex-end; justify-content: center; width: 100%; aspect-ratio: 4 / 5; }
.equip .portrait::before { content: ''; position: absolute; left: 2%; right: 2%; bottom: 0; height: 24%; border-radius: 50%; background: radial-gradient(ellipse at 50% 45%, #cdeec2 0 34%, #8fd68a 36% 50%, #d9cdb2 52% 100%); box-shadow: 0 5px 0 #b9a98c; }
.equip .portrait img { position: relative; z-index: 1; max-width: 100%; max-height: 100%; margin-bottom: 7%; }
.equip .chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-height: 22px; }
.equip .chips span { padding: 2px 8px; border-radius: 10px; background: #fff; color: #6a5244; font-size: 11px; font-weight: 800; }
.equip .chips span.none { background: transparent; color: #a89a88; font-weight: 700; }
.equip .wslot[data-slot="0"] { outline: 3px solid #ffc93c; outline-offset: 2px; }
.equip .wslot small { bottom: 0; left: 0; right: 0; padding: 1px 0 2px; border-radius: 0 0 8px 8px; background: rgba(58, 42, 34, 0.74); color: #fff; font-size: 9px; letter-spacing: 0.02em; }
.equip .wslot em { position: absolute; left: 3px; top: 2px; padding: 0 5px; border-radius: 8px; background: rgba(58, 42, 34, 0.78); color: #fff; font-style: normal; font-size: 10px; font-weight: 900; }
.sheet .up.wide { width: 100%; min-height: 44px; margin-top: 10px; padding: 0 10px; border: 0; border-radius: 12px; background: #ffc93c; color: #5a3a00; font-size: 13px; font-weight: 900; }
.sheet .up.wide:disabled { background: #efe2cb; color: #a89a88; }
.sheet h3 .pair { display: flex; gap: 6px; }
.sheet h3 .best { min-height: 36px; padding: 0 14px; border: 0; border-radius: 12px; background: #ffc93c; color: #5a3a00; font-size: 13px; }
.sheet h3 .fuse:disabled { background: #efe2cb; color: #a89a88; }
.cell i.use { position: absolute; left: 0; right: 0; bottom: 0; padding: 1px 0 2px; border-radius: 0 0 9px 9px; background: rgba(58, 42, 34, 0.74); color: #fff; font-style: normal; font-size: 8px; text-align: center; letter-spacing: 0.03em; pointer-events: none; }
/* Levels: the map button in the island map, the map of the levels, the "level completed" card */
.sheet header .hdr { display: flex; align-items: center; gap: 8px; }
.sheet header .hdr button { height: 44px; border: 0; border-radius: 14px; background: #efe2cb; color: #3a2a22; font-size: 18px; }
.sheet header .hdr #mapclose { width: 44px; }
.sheet header .hdr .worldbtn { padding: 0 16px; background: #1fb5a8; color: #fff; font-size: 14px; font-weight: 900; }
#levels { position: absolute; inset: 0; z-index: 7; display: none; align-items: flex-end; background: rgba(13, 43, 54, 0.55); }
#levels.open { display: flex; }
#levelmap { margin-top: 8px; }
#levelmap svg { display: block; width: min(100%, 52dvh); height: auto; margin: 0 auto; }
#levelmap .node { cursor: pointer; outline: none; }
#levelmap .node:focus-visible ellipse:first-of-type { stroke: #fff; }
#levelmap .node.locked { cursor: pointer; }
#levelmap .pulse { transform-origin: 0 6px; animation: levelpulse 1.6s ease-in-out infinite; }
@keyframes levelpulse { 0%, 100% { opacity: 0.25; transform: scale(0.96); } 50% { opacity: 1; transform: scale(1.06); } }
#leveldetail { margin-top: 10px; padding: 10px 12px; border-radius: 16px; background: #fff; color: #6a5244; font-size: 13px; }
#leveldetail p { margin: 6px 0 0; }
#leveldetail .leveltop { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#leveldetail .leveltop strong { font-size: 16px; color: #3a2a22; }
#leveldetail .leveltop em { flex: none; padding: 2px 10px; border-radius: 10px; font-style: normal; font-size: 12px; font-weight: 900; background: #efe2cb; color: #6a5244; }
#leveldetail .leveltop em.open { background: #ffe08a; color: #5a3a00; }
#leveldetail .leveltop em.done { background: #a3e9ad; color: #1d6b2e; }
#leveldetail .count b { color: #3a2a22; }
.bosslist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 5px; }
.bosslist li { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 10px; background: #fbf3e4; font-size: 12px; }
.bosslist li > i { flex: none; width: 12px; height: 26px; border-radius: 5px; }
.bosslist li > span { display: flex; flex: 1; flex-direction: column; min-width: 0; font-weight: 900; color: #3a2a22; }
.bosslist li > span small { font-weight: 700; color: #8a6a55; }
.bosslist li > b { font-size: 11px; color: #8a6a55; }
.bosslist li.on > b { color: #1f9a8f; }
#win { position: absolute; inset: 0; z-index: 9; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(13, 43, 54, 0.6); }
#win[hidden] { display: none; }
#win .card { width: min(100%, 320px); padding: 22px 18px 16px; border-radius: 24px; background: #fbf3e4; color: #3a2a22; text-align: center; box-shadow: 0 8px 0 rgba(27, 58, 75, 0.35); animation: wincard 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes wincard { 0% { opacity: 0; transform: scale(0.7); } 100% { opacity: 1; transform: none; } }
#win small { display: inline-block; padding: 3px 12px; border-radius: 12px; background: #ffc93c; color: #5a3a00; font-size: 12px; font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; }
#win h2 { margin: 10px 0 0; font-size: 26px; font-weight: 900; }
#win p { margin: 8px 0 14px; font-size: 14px; color: #6a5244; }
#win button { display: block; width: 100%; min-height: 46px; margin-top: 8px; border: 0; border-radius: 14px; background: #efe2cb; color: #6a5244; font: inherit; font-size: 15px; cursor: pointer; }
#win button.main { background: #1fb5a8; color: #fff; font-weight: 900; }
/* Rank: the card of the hero now and next, the stars, the bar of the upgrades done, the Evolve button */
.rankcard { display: grid; grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr); align-items: center; gap: 6px; margin-top: 10px; padding: 10px 8px; border-radius: 18px; background: linear-gradient(#fff7e6, #f1dfbb); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6); }
.rankcard.max { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.rankcard.max .rankface { width: 58%; }
.rankface { position: relative; display: flex; flex-direction: column; align-items: center; overflow: hidden; border-radius: 16px; background: radial-gradient(circle at 50% 52%, var(--soft) 0 24%, var(--aura) 25% 52%, rgba(58, 42, 34, 0.92) 74%); }
.rankface.rainbow { background: radial-gradient(circle at 50% 52%, #fff 0 22%, transparent 23%), conic-gradient(#ff4a40, #ffc531, #45d05a, #3a9bff, #b043ee, #ff4a40); }
.rankface img { display: block; width: 92%; aspect-ratio: 4 / 5; object-fit: contain; padding-top: 4px; }
.rankface em { position: absolute; left: 6px; top: 6px; padding: 1px 8px; border-radius: 9px; background: rgba(58, 42, 34, 0.78); color: #fff; font-style: normal; font-size: 11px; font-weight: 900; }
.rankface .stars { width: 100%; padding: 2px 0 3px; background: rgba(58, 42, 34, 0.82); color: #ffd85a; text-align: center; font-size: 15px; letter-spacing: 2px; }
.rankface .stars span { color: rgba(255, 255, 255, 0.28); }
.rankmid { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; color: #6a5244; font-size: 10px; font-weight: 900; line-height: 1.15; }
.rankmid i { font-style: normal; font-size: 26px; letter-spacing: -4px; color: #c9b79c; }
.rankmid span:first-of-type { color: #1f9a8f; }
.rankbar { position: relative; height: 26px; margin-top: 10px; overflow: hidden; border-radius: 13px; background: #3a2a22; }
.rankbar i { display: block; height: 100%; background: repeating-linear-gradient(135deg, #3fd1b8 0 10px, #2fbfa6 10px 20px); transition: width 0.3s; }
.rankbar span { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 900; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }
.rankbar.full i { background: linear-gradient(#ffe27a, #ffb400); }
.sheet .evolve { width: 100%; min-height: 46px; margin-top: 8px; padding: 0 10px; border: 0; border-radius: 14px; background: #ffc93c; color: #5a3a00; font-size: 15px; font-weight: 900; }
.sheet .evolve:disabled { background: #efe2cb; color: #a89a88; font-size: 13px; }
.sheet .evolve:not(:disabled) { animation: evolvepulse 1.2s ease-in-out infinite; }
@keyframes evolvepulse { 0%, 100% { transform: none; } 50% { transform: scale(1.025); } }
.equip .rankline { color: #ffb400; font-size: 13px; letter-spacing: 2px; text-shadow: 0 1px 0 rgba(58, 42, 34, 0.35); }
.equip .rankline span { color: rgba(58, 42, 34, 0.2); text-shadow: none; }
.equip .portrait::before { background: radial-gradient(ellipse at 50% 45%, var(--soft, #cdeec2) 0 34%, var(--aura, #8fd68a) 36% 50%, #d9cdb2 52% 100%); }
/* Treasure chests: the button, the chip of the chest being carried, the shelf sheet, the loot card */
#chestbtn i { position: absolute; right: -6px; top: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #e5383b; color: #fff; font-style: normal; font-size: 12px; line-height: 20px; text-align: center; }
#chestbtn i.ready { background: #1f9a8f; animation: evolvepulse 1s ease-in-out infinite; }
#chestchip { position: absolute; left: 14px; top: calc(208px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px 0 6px; border-radius: 16px; background: rgba(13, 43, 54, 0.7); font-size: 15px; font-variant-numeric: tabular-nums; pointer-events: none; }
#chestchip[hidden] { display: none; }
#chestchip svg.chest { width: 26px; height: 24px; }
#chestchip svg.dir { width: 22px; height: 22px; filter: drop-shadow(0 2px 0 rgba(27, 58, 75, 0.45)); }
#chestchip.low { background: rgba(229, 56, 59, 0.85); }
#shelf { position: absolute; inset: 0; z-index: 7; display: none; align-items: flex-end; background: rgba(13, 43, 54, 0.55); }
#shelf.open { display: flex; }
.shelfrow { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 8px 10px; border-radius: 14px; background: #fff; color: #6a5244; font-size: 13px; }
.shelfrow svg { flex: none; width: 44px; height: 40px; }
.shelfrow .about { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.shelfrow .about strong { font-size: 15px; color: #3a2a22; }
.shelfrow.empty { background: transparent; box-shadow: inset 0 0 0 2px #e2d3ba; color: #a89a88; }
.shelfrow.empty svg { opacity: 0.25; filter: grayscale(1); }
.shelfrow.ready { box-shadow: inset 0 0 0 3px #ffc93c; }
.shelfrow button { flex: none; min-height: 40px; padding: 0 14px; border: 0; border-radius: 12px; background: #1fb5a8; color: #fff; font: inherit; font-size: 14px; font-weight: 900; cursor: pointer; }
.shelfrow .count { flex: none; font-size: 18px; font-weight: 900; font-variant-numeric: tabular-nums; color: #3a2a22; }
.carryrow { margin-top: 10px; padding: 8px 10px; border-radius: 14px; background: #fff7e6; color: #6a5244; font-size: 13px; font-weight: 700; }
.worldchests { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 5px; }
.worldchests li { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 10px; background: #fff; font-size: 12px; color: #6a5244; }
.worldchests li > i { flex: none; width: 12px; height: 26px; border-radius: 5px; }
.worldchests li > span { flex: 1; font-weight: 900; color: #3a2a22; }
.worldchests li > b { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.worldchests li > b svg { width: 22px; height: 20px; }
#loot { position: absolute; inset: 0; z-index: 9; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(13, 43, 54, 0.6); }
#loot[hidden] { display: none; }
#loot .card { width: min(100%, 330px); max-height: 90%; overflow-y: auto; padding: 18px 16px 14px; border-radius: 24px; background: #fbf3e4; color: #3a2a22; text-align: center; box-shadow: 0 8px 0 rgba(27, 58, 75, 0.35); animation: wincard 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
#loot .card > svg { width: 84px; height: 76px; }
#loot small { display: inline-block; padding: 3px 12px; border-radius: 12px; background: #ffc93c; color: #5a3a00; font-size: 12px; font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; }
#loot h2 { margin: 6px 0 8px; font-size: 24px; font-weight: 900; }
.lootlist { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 5px; text-align: left; }
.lootlist li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; background: #fff; font-size: 13px; }
.lootlist li > i { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--fill, #efe2cb); box-shadow: inset 0 0 0 2px var(--rar, rgba(255, 255, 255, 0.55)); }
.lootlist li > i svg { width: 24px; height: 24px; }
.lootlist li > span { display: flex; flex-direction: column; min-width: 0; font-weight: 900; }
.lootlist li > span small { padding: 0; background: none; color: #8a6a55; font-size: 11px; font-weight: 700; letter-spacing: 0; text-transform: none; }
#loot button { display: block; width: 100%; min-height: 46px; border: 0; border-radius: 14px; background: #1fb5a8; color: #fff; font: inherit; font-size: 15px; font-weight: 900; cursor: pointer; }
#chestbtn svg { width: 36px; height: 32px; }
#loot .lootlist small { display: block; padding: 0; border-radius: 0; background: none; color: #8a6a55; font-size: 11px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.carryrow { display: flex; align-items: center; gap: 8px; }
.carryrow svg { flex: none; width: 36px; height: 32px; }

/* Level and experience, next to the life bar. The fill runs from the left edge to the right over the whole pill (2026-11-13,
   the owner: "falla aumentare da sinistra a destra"): the bar sits under the text, which stays readable on it. */
#lvl { position: absolute; left: 158px; top: calc(60px + env(safe-area-inset-top)); width: 66px; height: 24px; padding: 0; overflow: hidden; isolation: isolate; border: 2px solid #fff; border-radius: 12px; background: rgba(13, 43, 54, 0.7); color: #fff; font: inherit; font-size: 12px; font-weight: 900; line-height: 20px; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55); cursor: pointer; }
#lvl b { font-size: 14px; }
#lvl i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; z-index: -1; background: linear-gradient(90deg, #7af0ff, #2fb9d8); transition: width 0.25s ease-out; }

/* Missions: the tracker with its arrow, the "Talk" prompt, the dialogue, the diary */
#quest { position: absolute; right: 10px; top: calc(172px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 6px; max-width: 182px; padding: 5px 9px 5px 6px; border: 0; border-radius: 14px; background: rgba(13, 43, 54, 0.74); color: #fff; font: inherit; text-align: left; cursor: pointer; }
#quest[hidden] { display: none; }
#quest > i { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #ffd23a; color: #5a3a00; font-style: normal; font-size: 15px; font-weight: 900; }
#quest.ready > i { background: #3fe07a; color: #0f4a28; }
#quest div { display: flex; min-width: 0; flex-direction: column; line-height: 1.15; }
#quest b { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
#quest span { overflow: hidden; font-size: 10px; opacity: 0.9; text-overflow: ellipsis; white-space: nowrap; }
#quest svg.dir { flex: none; width: 22px; height: 22px; filter: drop-shadow(0 2px 0 rgba(27, 58, 75, 0.45)); }
#quest small { flex: none; font-size: 11px; font-variant-numeric: tabular-nums; }
#talkbtn { position: absolute; left: 50%; bottom: calc(196px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px 0 10px; transform: translateX(-50%); border: 0; border-radius: 23px; background: #fff; color: #17566b; font: inherit; font-size: 15px; font-weight: 900; box-shadow: 0 4px 0 rgba(27, 58, 75, 0.35); cursor: pointer; white-space: nowrap; animation: talkpop 0.25s ease-out; }
#talkbtn[hidden] { display: none; }
@keyframes talkpop { 0% { transform: translateX(-50%) scale(0.7); opacity: 0; } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }
#talkbtn i { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #ffd23a; color: #5a3a00; font-style: normal; font-size: 17px; }
#talkbtn i.ready { background: #3fe07a; color: #0f4a28; }
#talk, #diary { position: absolute; inset: 0; z-index: 8; display: none; align-items: flex-end; background: rgba(13, 43, 54, 0.5); }
#talk.open, #diary.open { display: flex; }
.talkhead { display: flex; align-items: center; gap: 10px; }
.talkhead .face { flex: none; width: 58px; height: 58px; }
.talkhead .face svg { width: 100%; height: 100%; }
.talkhead .who { flex: 1; min-width: 0; }
.talkhead h2 { margin: 0; font-size: 20px; }
.talkhead small { color: #8a6a55; font-size: 12px; }
.say { margin: 12px 0 0; padding: 10px 12px; border-radius: 16px; background: #fff; color: #3a2a22; font-size: 15px; font-weight: 700; line-height: 1.35; }
.mcard { display: flex; flex-direction: column; gap: 3px; margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: #fff7e6; box-shadow: inset 0 0 0 2px #ffe08a; color: #6a5244; font-size: 13px; }
.mcard strong { font-size: 16px; color: #3a2a22; }
.mcard em { font-style: normal; font-size: 12px; font-weight: 900; color: #1f9a8f; }
.mcard .prog { font-size: 15px; color: #3a2a22; }
#talk .acts { display: flex; gap: 8px; margin-top: 12px; }
#talk .acts button { flex: 1; min-height: 46px; border: 0; border-radius: 14px; background: #efe2cb; color: #6a5244; font: inherit; font-size: 15px; font-weight: 900; cursor: pointer; }
#talk .acts button.main { background: #1fb5a8; color: #fff; }
.levelcard { margin-top: 10px; padding: 12px; border-radius: 16px; background: linear-gradient(#fff7e6, #f1dfbb); color: #6a5244; font-size: 12px; }
.levelcard .big { font-size: 18px; font-weight: 900; color: #3a2a22; }
.levelcard .big b { font-size: 30px; color: #1f9a8f; }
.levelcard p { margin: 8px 0 0; line-height: 1.35; }
.xpbar, .qbar { position: relative; display: block; height: 20px; margin-top: 6px; overflow: hidden; border-radius: 10px; background: #3a2a22; }
.xpbar i, .qbar i { display: block; height: 100%; background: repeating-linear-gradient(135deg, #3fd1b8 0 10px, #2fbfa6 10px 20px); }
.xpbar u, .qbar u { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 12px; text-decoration: none; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }
.qrow { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 10px; border-radius: 14px; background: #fff; }
.qrow.track { box-shadow: inset 0 0 0 3px #ffc93c; }
.qrow.ready { background: #eafff0; }
.qrow .about { display: flex; flex: 1; flex-direction: column; min-width: 0; gap: 1px; font-size: 12px; color: #6a5244; }
.qrow .about strong { font-size: 14px; color: #3a2a22; }
.qrow .about .who { color: #1f9a8f; font-weight: 800; }
.qrow button { flex: none; min-height: 36px; padding: 0 12px; border: 0; border-radius: 12px; background: #ffc93c; color: #5a3a00; font: inherit; font-size: 13px; font-weight: 900; cursor: pointer; }

/* Pets: the tab of the backpack */
.tabs button { padding: 0 10px; font-size: 14px; }
.pets { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.petrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: #fff; color: #6a5244; font-size: 12px; }
.petrow.on { box-shadow: inset 0 0 0 3px #ffc93c; }
.petrow.locked { background: transparent; box-shadow: inset 0 0 0 2px #e2d3ba; color: #a89a88; }
.pface { flex: none; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 14px; background: color-mix(in srgb, var(--pc) 25%, #fff); }
.pface svg { width: 46px; height: 46px; }
.pface span { font-size: 26px; font-weight: 900; color: #c9b79c; }
.petrow .about { display: flex; flex: 1; flex-direction: column; gap: 1px; min-width: 0; }
.petrow .about strong { font-size: 15px; color: #3a2a22; }
.petrow.locked .about strong { color: #a89a88; }
.petrow .about em { font-style: normal; font-weight: 900; color: #1f9a8f; }
.petrow.locked .about em { color: #a89a88; font-weight: 700; }
.petrow button { flex: none; min-height: 40px; padding: 0 14px; border: 0; border-radius: 12px; background: #1fb5a8; color: #fff; font: inherit; font-size: 14px; font-weight: 900; cursor: pointer; }
.petrow.on button { background: #3a2a22; }
.petrow button:disabled { background: #efe2cb; color: #a89a88; }

/* Weapon powers: the full-screen flash, the charge rings above the hint, the "Potere" line of the weapon card */
#flash { position: absolute; inset: 0; opacity: 0; pointer-events: none; background: #fff; }
#powers { position: absolute; left: 0; right: 0; bottom: calc(146px + env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 8px; pointer-events: none; }
#powers[hidden] { display: none; }
#powers .pw { --k: 0; position: relative; display: block; width: 48px; height: 48px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--k) * 1turn), rgba(13, 43, 54, 0.55) 0); box-shadow: 0 3px 0 rgba(27, 58, 75, 0.35); }
#powers .pw.sub { width: 40px; height: 40px; margin-top: 8px; }
#powers .pw::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: #fff; }
#powers .pw img { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); object-fit: contain; filter: grayscale(0.7) brightness(0.9); opacity: 0.75; }
#powers .pw.ready img { filter: none; opacity: 1; }
#powers .pw.ready { animation: pwglow 1s ease-in-out infinite; }
#powers .pw.fire { animation: pwfire 0.45s ease-out; }
@keyframes pwglow { 50% { box-shadow: 0 3px 0 rgba(27, 58, 75, 0.35), 0 0 0 3px #fff, 0 0 14px 5px var(--g); } }
@keyframes pwfire { 0% { scale: 1.35; box-shadow: 0 0 0 4px #fff, 0 0 22px 8px var(--g); } 100% { scale: 1; } }
#bar button { flex-basis: 14%; }
.wdetail .powerline { margin: 8px 0 0; padding: 8px 10px; border-radius: 12px; background: #fff4dc; font-size: 12px; line-height: 1.35; color: #6a5244; }
.wdetail .powerline b { color: #c2410c; }
.wdetail .powerline.off { background: #f3ede2; color: #a89a88; }
.wdetail .powerline.off b { color: #8a7b68; }

/* Dungeons: the button to go in, up and down, and the chip with the floor's goal (where #quest is on the island) */
#cavebtn { position: absolute; left: 50%; bottom: calc(250px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px 0 10px; transform: translateX(-50%); border: 0; border-radius: 23px; background: #2b1846; color: #fff; font: inherit; font-size: 15px; font-weight: 900; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45), 0 0 0 2px #ff7af5; cursor: pointer; white-space: nowrap; animation: talkpop 0.25s ease-out; }
#cavebtn[hidden] { display: none; }
#cavebtn i { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #ff7af5; color: #2b1846; font-style: normal; font-size: 15px; }
#cavechip { position: absolute; right: 10px; top: calc(172px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 6px; max-width: 196px; padding: 5px 9px 5px 6px; border-radius: 14px; background: rgba(20, 10, 30, 0.78); color: #fff; pointer-events: none; }
#cavechip[hidden] { display: none; }
#cavechip > i { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #ff7af5; color: #2b1846; font-style: normal; font-size: 13px; font-weight: 900; }
#cavechip div { display: flex; min-width: 0; flex-direction: column; line-height: 1.15; }
#cavechip b { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
#cavechip span { overflow: hidden; font-size: 10px; opacity: 0.9; text-overflow: ellipsis; white-space: nowrap; }
#cavechip svg.dir { flex: none; width: 22px; height: 22px; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.45)); }
#cavechip small { flex: none; font-size: 11px; font-variant-numeric: tabular-nums; }

/* The test bar has eight buttons now (sound, music, language): a compact grid of two rows, and what sits above it moves up */
#bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
#bar button { min-height: 34px; padding: 4px 2px; font-size: 11px; line-height: 1.1; }
#heroes { bottom: calc(96px + env(safe-area-inset-bottom)); }
#hint { bottom: calc(144px + env(safe-area-inset-bottom)); }
#powers { bottom: calc(168px + env(safe-area-inset-bottom)); }
#talkbtn { bottom: calc(226px + env(safe-area-inset-bottom)); }
#cavebtn { bottom: calc(280px + env(safe-area-inset-bottom)); }

/* The smithy: the button in its white circle and the blacksmith's sheet */
#smithbtn { position: absolute; left: 50%; bottom: calc(226px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px 0 8px; transform: translateX(-50%); border: 0; border-radius: 23px; background: #fff; color: #17566b; font: inherit; font-size: 15px; font-weight: 900; box-shadow: 0 4px 0 rgba(27, 58, 75, 0.35), 0 0 0 2px #1fbf6a; cursor: pointer; white-space: nowrap; animation: talkpop 0.25s ease-out; }
#smithbtn[hidden] { display: none; }
#smithbtn.poor { color: #8a7b68; box-shadow: 0 4px 0 rgba(27, 58, 75, 0.35); }
#smithbtn i { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #eafff0; }
#smithbtn i svg { width: 24px; height: 24px; }
#smith { position: absolute; inset: 0; z-index: 7; display: none; align-items: flex-end; background: rgba(13, 43, 54, 0.55); }
#smith.open { display: flex; }
#smith .herochips { flex-wrap: wrap; }
#smith .herochips button { flex: 1 1 30%; }
.smithpurse { display: flex; gap: 14px; margin: 6px 0 0; font-size: 15px; font-weight: 900; }
.smithpurse span { display: inline-flex; align-items: center; gap: 4px; }
.smithpurse svg { width: 22px; height: 22px; }
.smithtabs { display: flex; gap: 6px; margin-top: 10px; }
.smithtabs button { flex: 1; min-height: 40px; border: 0; border-radius: 12px; background: #efe2cb; color: #6a5244; font-weight: 900; }
.smithtabs button.on { background: #1fb5a8; color: #fff; }
.smithrows { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.smithrow { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 14px; background: #fff; }
.smithrow > i { flex: none; width: 26px; height: 26px; border-radius: 8px; }
.smithrow span { display: flex; flex: 1; flex-direction: column; }
.smithrow small { font-size: 11px; color: #8a7b68; }
.smithrow button { display: inline-flex; align-items: center; gap: 4px; min-height: 38px; padding: 0 12px; border: 0; border-radius: 12px; background: #1fbf6a; color: #fff; font-weight: 900; }
.smithrow button:disabled { background: #efe2cb; color: #a89a88; }
.smithrow button svg { width: 20px; height: 20px; }
.smithmade { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px; border-radius: 14px; background: #eafff0; box-shadow: inset 0 0 0 2px #1fbf6a; }
.smithmade > i { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border: 3px solid var(--rar); border-radius: 14px; background: var(--fill); }
.smithmade > i img, .smithmade > i svg { width: 46px; height: 46px; }
.smithmade div { display: flex; flex-direction: column; }
.smithmade small { font-weight: 900; color: #1f9a6a; }
.smithmade b { font-size: 16px; }
.smithmade span { font-size: 12px; color: #6a5244; }
#smithbtn { bottom: calc(280px + env(safe-area-inset-bottom)); } /* above "Parla con": Nonno Tiki stands close to the circle */

/* Settings: the gear left of the minimap and its sheet */
#gear { position: absolute; right: 110px; top: calc(12px + env(safe-area-inset-top)); display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 3px solid #fff; border-radius: 50%; background: #e6f6fa; box-shadow: 0 3px 0 rgba(27, 58, 75, 0.35); cursor: pointer; }
#gear svg { width: 26px; height: 26px; }
#settings { position: absolute; inset: 0; z-index: 9; display: none; align-items: flex-end; background: rgba(13, 43, 54, 0.55); }
#settings.open { display: flex; }
#settings h3 { margin: 14px 0 6px; font-size: 13px; font-weight: 900; letter-spacing: 0.5px; text-transform: uppercase; color: #8a7b68; }
#settings .langs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
#settings .langs button { min-height: 42px; border: 0; border-radius: 12px; background: #efe2cb; color: #6a5244; font-size: 14px; font-weight: 800; }
#settings .langs button.on { background: #1fb5a8; color: #fff; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; padding: 8px 10px; border-radius: 14px; background: #fff; }
.setrow div { display: flex; min-width: 0; flex-direction: column; }
.setrow b { font-size: 15px; }
.setrow small { font-size: 11px; color: #8a7b68; }
.switch { flex: none; display: inline-flex; align-items: center; gap: 6px; min-width: 76px; height: 36px; padding: 0 10px 0 4px; border: 0; border-radius: 18px; background: #efe2cb; color: #8a7b68; font-weight: 900; }
.switch i { width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.switch.on { flex-direction: row-reverse; padding: 0 4px 0 10px; background: #1fbf6a; color: #fff; }

/* Test tools: with four test buttons the bar is one row; switched off, the bar and the test bits go and everything comes down */
#heroes { bottom: calc(56px + env(safe-area-inset-bottom)); }
#hint { bottom: calc(104px + env(safe-area-inset-bottom)); }
#powers { bottom: calc(128px + env(safe-area-inset-bottom)); }
#talkbtn { bottom: calc(186px + env(safe-area-inset-bottom)); }
#cavebtn, #smithbtn { bottom: calc(240px + env(safe-area-inset-bottom)); }
#stage.notools #bar, #stage.notools #brand span, #stage.notools #stats, #stage.notools .sheet footer { display: none; }
#stage.notools #brand { cursor: default; }
#stage.notools #heroes { bottom: calc(14px + env(safe-area-inset-bottom)); }
#stage.notools #hint { bottom: calc(62px + env(safe-area-inset-bottom)); }
#stage.notools #powers { bottom: calc(86px + env(safe-area-inset-bottom)); }
#stage.notools #talkbtn { bottom: calc(144px + env(safe-area-inset-bottom)); }
#stage.notools #cavebtn, #stage.notools #smithbtn { bottom: calc(198px + env(safe-area-inset-bottom)); }

/* ---- Shop of cosmetics (shop.js, cosmetics.js): the refuge's button, the sheet, the supporter frame */
#shopbtn { position: absolute; left: 50%; bottom: calc(240px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px 0 8px; transform: translateX(-50%); border: 0; border-radius: 23px; background: #fff; color: #17566b; font: inherit; font-size: 15px; font-weight: 900; box-shadow: 0 4px 0 rgba(27, 58, 75, 0.35), 0 0 0 2px #ffc93c; cursor: pointer; white-space: nowrap; animation: talkpop 0.25s ease-out; }
#shopbtn[hidden] { display: none; }
#shopbtn i { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #fff4cf; }
#shopbtn i svg { width: 24px; height: 24px; }
#shopbtn em { margin-left: 2px; padding: 2px 7px; border-radius: 9px; background: #ff5a7a; color: #fff; font-size: 11px; font-style: normal; }
#stage.notools #shopbtn { bottom: calc(198px + env(safe-area-inset-bottom)); }
#shop { position: absolute; inset: 0; z-index: 9; display: none; align-items: flex-end; background: rgba(13, 43, 54, 0.55); }
#shop.open { display: flex; }
#shop .sheet { max-height: 94%; }
.shop-simband { margin: 10px 0 4px; padding: 7px 10px; border-radius: 10px; background: repeating-linear-gradient(-45deg, #ffe08a 0 10px, #ffd04a 10px 20px); color: #5a3a00; font-size: 12px; font-weight: 900; text-align: center; letter-spacing: 0.3px; }
.shop-off { margin: 10px 0 4px; padding: 8px 10px; border-radius: 12px; background: #efe2cb; color: #6a5244; font-size: 13px; }
.shop-free { margin-top: 8px; }
.shop-me { display: flex; align-items: center; gap: 14px; margin-top: 10px; padding: 12px; border-radius: 16px; background: #fff; }
.shop-me div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.shop-me b { font-size: 15px; }
.shop-me small { font-size: 12px; color: #8a6a55; }
.rh-framebox { position: relative; flex: none; display: block; width: 64px; height: 64px; border: 3px solid #e2d3ba; border-radius: 18px; background: radial-gradient(circle at 50% 35%, #fff 0, #e9f7fb 70%); }
.rh-framebox > i { display: grid; place-items: start center; width: 100%; height: 100%; overflow: hidden; border-radius: 15px; }
.rh-framebox img { width: 125%; height: auto; margin-top: 4%; }
.rh-framebox.rh-frame-supporter { border-color: #f2c14e; box-shadow: 0 0 0 3px #3d3aa8, 0 0 0 5px #f2c14e, 0 0 12px rgba(255, 210, 80, 0.85); }
.rh-framebox.rh-frame-supporter::after { content: "\2605"; position: absolute; top: -17px; left: 50%; transform: translateX(-50%); color: #ffd54a; font-size: 20px; line-height: 1; -webkit-text-stroke: 1px #3d3aa8; }
#lvl.rh-frame-supporter { border-color: #f2c14e; box-shadow: 0 0 0 2px #3d3aa8, 0 0 0 4px #f2c14e, 0 0 10px rgba(255, 210, 80, 0.8); }
#lvl.rh-frame-supporter i { background: linear-gradient(90deg, #ffe27a, #f2a516); }
.shop-card { margin-top: 12px; padding: 10px; border-radius: 18px; background: #fff; box-shadow: inset 0 0 0 2px #efe2cb; }
.shop-card.st-owned, .shop-card.st-equipped { box-shadow: inset 0 0 0 2px #1fbf6a; }
.shop-card.st-locked, .shop-card.st-unavailable { background: #fdf9f1; }
.shop-pics { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 10px; }
.shop-pic { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; margin: 0; }
.shop-pic > img { width: 64px; height: 81px; object-fit: contain; border-radius: 12px; background: radial-gradient(circle at 50% 70%, #f4e8d2 0, #fbf3e4 70%); }
.shop-pic figcaption { width: 100%; font-size: 10px; color: #8a6a55; text-align: center; }
.shop-pic .rh-framebox { width: 64px; height: 64px; margin: 10px 10px 8px; }
.rh-trailbox { display: grid; place-items: center; width: 96px; height: 81px; border-radius: 12px; background: linear-gradient(#24305a, #3d3aa8); }
.rh-trailbox svg { width: 90px; height: 45px; }
.shop-info header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-top: 8px; }
.shop-info h3 { margin: 0; color: #3a2a22; font-size: 17px; }
.shop-state { flex: none; padding: 3px 9px; border-radius: 10px; background: #efe2cb; color: #6a5244; font-size: 11px; font-weight: 900; white-space: nowrap; }
.st-available .shop-state { background: #dff6f3; color: #12776d; }
.st-buying .shop-state, .st-verifying .shop-state, .st-pending .shop-state { background: #fff1c2; color: #7a5200; }
.st-owned .shop-state { background: #dff6e7; color: #137a40; }
.st-equipped .shop-state { background: #1fbf6a; color: #fff; }
.shop-in { margin: 6px 0 2px; font-size: 12px; color: #8a6a55; }
.shop-has { margin: 0; padding: 0; list-style: none; }
.shop-has li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; border-top: 1px solid #f1e6d2; }
.shop-has li:first-child { border-top: 0; }
.shop-has li div { display: flex; flex-direction: column; min-width: 0; }
.shop-has b { font-size: 13px; }
.shop-has small { font-size: 11px; font-weight: 700; line-height: 1.3; color: #8a6a55; }
.shop-wear { flex: none; min-width: 74px; min-height: 36px; padding: 0 10px; border: 0; border-radius: 12px; background: #1fb5a8; color: #fff; font-size: 13px; }
.shop-wear.on { background: #efe2cb; color: #3a2a22; }
.shop-cosm { display: inline-block; margin: 8px 0 0; padding: 3px 9px; border-radius: 9px; background: #eef4ff; color: #2f4f8f; font-size: 11px; font-weight: 900; }
.shop-note { margin: 8px 0 0; padding: 6px 9px; border-radius: 10px; background: #f4efe6; color: #6a5244; font-size: 12px; font-weight: 700; }
.shop-note.n-granted, .shop-note.n-owned { background: #dff6e7; color: #137a40; }
.shop-note.n-canceled, .shop-note.n-network, .shop-note.n-failed, .shop-note.n-declined, .shop-note.n-rejected, .shop-note.n-refunded { background: #ffe9e4; color: #9a3322; }
.shop-note.n-pending, .shop-note.n-verifyLater { background: #fff1c2; color: #7a5200; }
.shop-buy { display: block; width: 100%; min-height: 48px; margin-top: 10px; border: 0; border-radius: 14px; background: #1fb5a8; color: #fff; font-size: 16px; font-weight: 900; box-shadow: 0 3px 0 #13786f; }
.shop-buy em { margin-left: 4px; padding: 1px 6px; border-radius: 7px; background: #ffd04a; color: #5a3a00; font-size: 11px; font-style: normal; vertical-align: 2px; }
.shop-buy:disabled { background: #efe2cb; color: #8a7b68; box-shadow: none; }
.shop-buy.alt { background: #ffc93c; color: #5a3a00; box-shadow: 0 3px 0 #b8860b; }
.shop-lock { margin: 10px 0 0; padding: 8px 10px; border-radius: 12px; background: #efe2cb; color: #6a5244; font-size: 12px; font-weight: 800; }
.shop-lock span { white-space: nowrap; color: #3a2a22; }
.shop-foot { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.shop-foot button { min-height: 44px; border: 2px solid #1fb5a8; border-radius: 14px; background: #fff; color: #12776d; font-size: 14px; font-weight: 900; }
.shop-foot small { font-size: 11px; font-weight: 700; line-height: 1.35; color: #8a6a55; }
.shop-simtools { margin-top: 14px; padding: 10px; border: 2px dashed #e0b84a; border-radius: 14px; background: #fffaf0; color: #5a4a3a; font-size: 12px; }
.shop-simtools h3 { margin: 0 0 4px; color: #7a5200; }
.shop-simtools p { margin: 8px 0 4px; font-weight: 900; }
.shop-simtools p.small { font-weight: 700; color: #8a6a55; }
.shop-simtools .pick { display: flex; flex-wrap: wrap; gap: 5px; }
.shop-simtools button { min-height: 34px; padding: 0 9px; border: 0; border-radius: 10px; background: #efe2cb; color: #5a4a3a; font-size: 12px; }
.shop-simtools button.on { background: #e0a21a; color: #fff; }
.shop-simtools .txs { margin: 0; padding: 0; list-style: none; }
.shop-simtools .txs li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 0; border-top: 1px solid #f1e3c4; }
.shop-simtools .txs .acts { display: flex; gap: 4px; }
#settings .shopopen { min-width: 76px; padding: 0 14px; justify-content: center; }
/* The campaign (story.js): the one main goal at the top right, the short dialogues at the bottom, the diary's card */
#mainquest { position: absolute; right: 10px; top: calc(172px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 6px; max-width: 200px; padding: 5px 9px 5px 6px; border: 2px solid #ffd23a; border-radius: 14px; background: rgba(42, 26, 12, 0.8); color: #fff; font: inherit; text-align: left; cursor: pointer; }
#mainquest[hidden] { display: none; }
#mainquest > i { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #ffd23a; color: #5a3a00; font-style: normal; font-size: 15px; font-weight: 900; }
#mainquest div { display: flex; min-width: 0; flex-direction: column; line-height: 1.15; }
#mainquest b { overflow: hidden; color: #ffe08a; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
#mainquest span { font-size: 11px; line-height: 1.2; }
#mainquest svg.dir { flex: none; width: 22px; height: 22px; filter: drop-shadow(0 2px 0 rgba(27, 58, 75, 0.45)); }
#mainquest small { flex: none; font-size: 11px; font-variant-numeric: tabular-nums; }
#quest { top: calc(232px + env(safe-area-inset-top)); } /* a side mission sits under the main goal */
#dialog { position: absolute; left: 12px; right: 12px; bottom: calc(118px + env(safe-area-inset-bottom)); z-index: 30; max-width: 460px; margin: 0 auto; padding: 14px 14px 10px; border: 3px solid #3a2a22; border-radius: 18px; background: #fff8ea; color: #3a2a22; box-shadow: 0 6px 0 rgba(58, 42, 34, 0.35); cursor: pointer; animation: dlgIn 0.2s ease-out; }
#dialog[hidden] { display: none; }
#dialog .who { position: absolute; top: -14px; left: 14px; padding: 3px 12px; border: 2px solid #3a2a22; border-radius: 12px; color: #fff; font-size: 13px; font-weight: 900; }
#dialog .who[hidden] { display: none; }
#dialog p { margin: 6px 0 10px; font-size: 15px; line-height: 1.35; }
#dialog.narr p { font-style: italic; color: #6a5244; }
#dialog .acts { display: flex; justify-content: space-between; gap: 8px; }
#dialog .acts button { padding: 6px 14px; border: 2px solid #3a2a22; border-radius: 12px; background: #fff; color: #3a2a22; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
#dialog .acts button.main { background: #ffd23a; }
@keyframes dlgIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
#diary .storycard { margin: 0 0 12px; padding: 10px 12px; border: 2px solid #ffd23a; border-radius: 14px; background: #fff6dc; }
#diary .storycard small { color: #8a6a3a; font-weight: 800; }
#diary .storycard h3 { margin: 2px 0 6px; }
#diary .steps { margin: 0 0 8px; padding-left: 20px; font-size: 13px; }
#diary .steps li.done { color: #7a8a7a; }
#diary .steps li.now { font-weight: 800; }
#diary .seals { display: flex; align-items: center; gap: 5px; font-size: 12px; }
#diary .seals span { margin-left: 4px; color: #8a6a3a; }
#diary .seal { width: 18px; height: 18px; border: 2px solid #6a7a8c; border-radius: 50%; background: #3a4656; opacity: 0.45; }
#diary .seal.on { border-color: #fff; background: var(--c); box-shadow: 0 0 6px var(--c); opacity: 1; }
#diary .talks details { margin: 0 0 6px; padding: 6px 10px; border-radius: 10px; background: rgba(58, 42, 34, 0.06); font-size: 13px; }
#diary .talks summary { cursor: pointer; font-weight: 800; }
#diary .talks p { margin: 4px 0; }
#travel { margin-top: 10px; }
#travel h3 { margin: 0 0 6px; font-size: 14px; }
#travel button { margin: 0 6px 6px 0; padding: 6px 12px; border: 2px solid #3a2a22; border-radius: 12px; background: #bff3ff; color: #1b3a4b; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }

/* The opening of chapter 1 (story.js): the HUD grows with what Kai has: nothing at first, the sword, then the base */
#stage.prologue #pack, #stage.prologue #wallet, #stage.prologue #powers, #stage.prologue #boost, #stage.prologue #tripboost, #stage.prologue #chestchip, #stage.prologue #quest { display: none !important; }
#stage.nosword #carry { display: none !important; }
#stage.noshelf #chestbtn { display: none !important; }
#carry.free b { display: none; }
/* the action of the place (pick up, enter, light the fire, rest...) */
#actbtn { position: absolute; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 12; display: flex; align-items: center; height: 48px; padding: 0 20px; transform: translateX(-50%); border: 3px solid #3a2a22; border-radius: 24px; background: #ffd23a; color: #3a2a22; font: inherit; font-size: 15px; font-weight: 900; box-shadow: 0 4px 0 rgba(58, 42, 34, 0.45); cursor: pointer; white-space: nowrap; animation: talkpop 0.25s ease-out; }
#actbtn[hidden] { display: none; }
/* no row of buttons at the bottom any more: heroes are chosen in the weapons menu ("Gioca con …"), the test tools live in
   the DEV panel of a development page (?debug) */
#heroes { display: none; }
#bar { display: none; }
#stage.devopen:not(.notools) #bar { display: grid; position: absolute; left: 10px; right: 10px; top: auto; bottom: calc(52px + env(safe-area-inset-bottom)); z-index: 40; padding: 8px; border-radius: 14px; background: rgba(13, 43, 54, 0.9); }
#stage.devopen:not(.notools) #bar #heroes { display: flex; position: static; grid-column: 1 / -1; margin: 0; }
#devbtn { position: absolute; left: 10px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 41; padding: 5px 9px; border: 0; border-radius: 8px; background: rgba(13, 43, 54, 0.78); color: #7af0ff; font: inherit; font-size: 11px; font-weight: 900; cursor: pointer; }
#stage.notools #devbtn { display: none; }
/* the bottom, freed */
#hint, #stage.notools #hint { bottom: calc(18px + env(safe-area-inset-bottom)); }
#hint[hidden] { display: none; }
#powers, #stage.notools #powers { bottom: calc(18px + env(safe-area-inset-bottom)); }
#talkbtn, #stage.notools #talkbtn { bottom: calc(152px + env(safe-area-inset-bottom)); }
#cavebtn, #smithbtn, #stage.notools #cavebtn, #stage.notools #smithbtn { bottom: calc(152px + env(safe-area-inset-bottom)); }

/* The party (main.js, companions.js): the portraits of the heroes met so far, bottom right; the ring is their life; gold =
   the one being led, bright = in the field, dim = waiting; tap one to lead him */
/* the party portraits sit at the dock's level (z-index 4, dock.css): above the field and the HUD, under every sheet (5 and up), so an open
   sheet such as the diary covers them instead of the portraits covering its buttons (2026-11-13) */
#party { position: absolute; right: 10px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 4; display: flex; flex-direction: column-reverse; gap: 7px; }
#party[hidden] { display: none; }
#party button { position: relative; width: 52px; height: 52px; padding: 3px; border: 0; border-radius: 50%; background: conic-gradient(#3fe07a var(--hp), rgba(20, 30, 40, 0.55) 0); box-shadow: 0 3px 0 rgba(27, 58, 75, 0.35); cursor: pointer; opacity: 0.55; }
#party button.field { opacity: 1; }
#party button.lead { background: conic-gradient(#ffd23a var(--hp), rgba(20, 30, 40, 0.55) 0); transform: scale(1.12); }
#party button.down { filter: grayscale(1); }
#party button img { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff8ea; object-fit: cover; object-position: 50% 20%; }
#party button small { position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%); padding: 0 5px; border-radius: 6px; background: rgba(13, 43, 54, 0.85); color: #fff; font-size: 9px; font-weight: 800; white-space: nowrap; }
/* the weapons tab with a secondary slot chosen: the weapons of every hero, one group each (2026-11-13) */
.sheet .ghead { margin: 10px 0 6px; font-size: 12px; font-weight: 800; color: #8a6a55; }
/* the backpack hides the portraits altogether: they would show through at the edge of its sheet */
#inv.open ~ #party { display: none; }
/* the volume sliders of the settings (2026-11-13): a row with a slider and its percentage */
.volrow { align-items: center; }
.setrow .volctl { display: flex; flex-direction: row; align-items: center; gap: 8px; min-width: 0; flex: 1; justify-content: flex-end; }
.volctl input[type="range"] { flex: 1; min-width: 80px; max-width: 170px; accent-color: #1fbf6a; }
.volctl output { flex: none; width: 48px; font-size: 13px; font-weight: 900; color: #17566b; text-align: right; font-variant-numeric: tabular-nums; }
/* a sheet is open (main.js toggles `menu`): the buttons of the places (enter, talk, the shelf...) hide so the sheet stays clean */
#stage.menu #actbtn, #stage.menu #talkbtn, #stage.menu #cavebtn, #stage.menu #smithbtn, #stage.menu #shopbtn, #stage.menu #shelfbtn, #stage.menu #portalbtn, #stage.menu #powers { display: none !important; }
/* a forge the story does not allow yet: what it would make and the area that opens it (inventory.js, 2026-11-13) */
.wlock { margin: 6px 0 0; padding: 6px 10px; border-radius: 10px; background: #f3e6cf; color: #6a4a2e; font-size: 12px; font-weight: 800; }
