/* A interface inteira escala com o palco: 1rem = 4 pixels do jogo (o canvas tem 480x270).
   --s é definido por Game.resize() e vale quantos pixels de tela cabem em um pixel do jogo. */
:root {
  --s: 2;
  --ink: #231c38;
  --night: #0f1428;
  --panel: rgba(18, 16, 36, 0.93);
  --panel-line: rgba(190, 200, 255, 0.16);
  --paper: #f3e9d2;
  --paper-2: #e6d8b6;
  --paper-ink: #46342c;
  --warm: #ffd98a;
  --pink: #f4a6c0;
  --teal: #58c9b9;
  --snow: #f4f8ff;
  --red: #e05a5a;
  --violet: #9b7be0;
  /* celular e tablet: --z amplia as letras num palco pequeno, --hx abre espaço nos cantos de cima
     para os botões de menu (os dois vêm de Game.resize), --u é o lado de um botão de ação */
  --z: 1;
  --hx: 0px;
  --u: clamp(44px, 13.5vmin, 76px);
  --tm: clamp(38px, 11vmin, 58px);
  --hand: "Segoe Print", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", cursive;
  --uif: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

html {
  font-size: calc(var(--s) * 4px);
}

* {
  box-sizing: border-box;
}

html,
body {
  /* nada de zoom com dois dedos, de rolar a página nem de "puxar para atualizar" no meio do jogo */
  touch-action: none;
  overscroll-behavior: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh; /* no celular, 100vh conta a barra do navegador que some e volta */
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #04050b;
  color: var(--snow);
  font-family: var(--uif);
  user-select: none;
  -webkit-user-select: none;
}

#stage {
  position: relative;
  width: calc(var(--s) * 480px);
  height: calc(var(--s) * 270px);
  overflow: hidden;
  background: #000;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
}

#ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: 1.75rem;
  line-height: 1.35;
}

.hidden {
  display: none !important;
}

.pix {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.hand {
  font-family: var(--hand);
}

.muted {
  opacity: 0.6;
}

kbd {
  display: inline-block;
  min-width: 2.4rem;
  padding: 0.1rem 0.6rem;
  margin: 0 0.5rem 0 0;
  border-radius: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-bottom-width: 0.4rem;
  background: rgba(255, 255, 255, 0.1);
  font: 700 0.8em var(--uif);
  text-align: center;
  color: inherit;
}

/* ───────────── botões ───────────── */
.btn {
  pointer-events: auto;
  cursor: pointer;
  padding: 0.7rem 2rem;
  border: 0;
  border-radius: 1rem;
  background: var(--warm);
  color: var(--ink);
  font: 700 1.6rem var(--uif);
  box-shadow: 0 0.5rem 0 #b98a3a;
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:active {
  transform: translateY(0.4rem);
  box-shadow: 0 0.1rem 0 #b98a3a;
}

.btn:disabled {
  cursor: default;
  filter: grayscale(0.8) brightness(0.7);
}

.btn.big {
  padding: 1rem 3rem;
  font-size: 1.9rem;
}

.btn.small {
  padding: 0.4rem 1.2rem;
  font-size: 1.35rem;
  box-shadow: 0 0.35rem 0 #b98a3a;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.1);
  color: var(--snow);
  box-shadow: 0 0.5rem 0 rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.btn.paper {
  background: #fffaf0;
  color: var(--paper-ink);
  box-shadow: 0 0.4rem 0 #b9a680, inset 0 0 0 1px #b9a680;
  font-family: var(--hand);
  font-size: 1.45rem;
}

.btn.pulse {
  animation: pulse 0.9s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    filter: brightness(1.2);
    transform: scale(1.05);
  }
}

/* ───────────── HUD ───────────── */
#hud > div {
  position: absolute;
  text-shadow: 0 0.25rem 0 rgba(0, 0, 0, 0.55);
}

.hud-tl {
  top: 2.5rem;
  left: 3rem;
}

.hearts {
  display: flex;
  gap: 0.5rem;
}

.hearts .heart {
  width: 3rem;
  height: 3rem;
  filter: drop-shadow(0 0.25rem 0 rgba(0, 0, 0, 0.5));
}

.ink {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.ink-drop {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 0 50% 50% 50%;
  transform: rotate(45deg);
  background: var(--violet);
  box-shadow: 0 0 1rem rgba(155, 123, 224, 0.8);
}

.ink-bar {
  width: 22rem;
  height: 1.5rem;
  border-radius: 1rem;
  background: rgba(10, 8, 24, 0.7);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  overflow: hidden;
}

.ink-bar i {
  display: block;
  height: 100%;
  border-radius: 1rem;
  background: linear-gradient(90deg, #7b5fd0, #c79bf2 70%, #ffd0f0);
  transition: width 0.15s linear;
}

.ink.frozen .ink-bar i {
  background: linear-gradient(90deg, #5d7aa8, #bfe3ff);
}

.ink.frozen .ink-drop {
  background: #bfe3ff;
  box-shadow: 0 0 1rem rgba(191, 227, 255, 0.8);
}

.hud-tr {
  top: 2.5rem;
  right: 3rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1.2rem;
  max-width: 44rem;
}

.chapter-line {
  font: 700 1.25rem var(--hand);
  color: #cfe3fb;
  opacity: 0.85;
  margin-bottom: -0.6rem;
}

.quest-track {
  padding: 0.8rem 1.4rem;
  border-radius: 1rem;
  background: rgba(12, 10, 28, 0.55);
  border-left: 0.5rem solid var(--warm);
  text-align: right;
  font-size: 1.45rem;
}

.quest-track b {
  display: block;
  color: var(--warm);
  font-size: 1.3rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.companions {
  display: flex;
  gap: 1rem;
}

.companion {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.3rem 1.4rem 0.3rem 0.4rem;
  border-radius: 4rem;
  background: rgba(12, 10, 28, 0.6);
  box-shadow: inset 0 0 0 1px var(--panel-line);
  font-size: 1.4rem;
}

.companion canvas {
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.hud-bl {
  left: 3rem;
  bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  font-size: 1.4rem;
}

.ability {
  padding: 0.6rem 1.4rem 0.6rem 0.8rem;
  border-radius: 1rem;
  background: rgba(12, 10, 28, 0.55);
  box-shadow: inset 0 0 0 1px var(--panel-line);
  opacity: 0.8;
}

.ability.on {
  opacity: 1;
  color: #aaffe6;
  box-shadow: inset 0 0 0 1px #6fe8c6, 0 0 2rem rgba(111, 232, 198, 0.45);
}

.summons {
  color: var(--warm);
  font-family: var(--hand);
}

.hud-br {
  right: 3rem;
  bottom: 2.5rem;
  font-size: 1.25rem;
  opacity: 0.55;
}

.hud-br kbd {
  margin-left: 1.2rem;
}

/* ───────────── avisos ───────────── */
#prompt {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 0.4rem 1.4rem 0.5rem 0.8rem;
  border-radius: 1rem;
  background: rgba(12, 10, 28, 0.82);
  box-shadow: inset 0 0 0 1px rgba(255, 217, 138, 0.5);
  color: var(--warm);
  font-size: 1.45rem;
  white-space: nowrap;
}

#caption {
  position: absolute;
  left: 50%;
  bottom: 9rem;
  transform: translateX(-50%);
  max-width: 78rem;
  padding: 0.7rem 2rem;
  border-radius: 1rem;
  background: rgba(8, 6, 20, 0.7);
  font-style: italic;
  font-size: 1.6rem;
  text-align: center;
  animation: rise 0.25s ease-out;
}

#toasts {
  position: absolute;
  left: 3rem;
  top: 12rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: fit-content;
  padding: 0.6rem 1.6rem 0.6rem 1rem;
  border-radius: 1rem;
  background: rgba(12, 10, 28, 0.85);
  border-left: 0.5rem solid var(--snow);
  font-size: 1.45rem;
  animation: slide-in 0.25s ease-out;
  transition: opacity 0.4s, transform 0.4s;
}

.toast.out {
  opacity: 0;
  transform: translateX(-2rem);
}

.toast img {
  width: 4.5rem;
  height: 4.5rem;
}

.toast-item {
  border-color: var(--teal);
}

.toast-quest {
  border-color: var(--warm);
  color: var(--warm);
}

.toast-magic,
.toast-skill {
  border-color: var(--violet);
  color: #dccbff;
}

.toast-friend {
  border-color: var(--pink);
  color: #ffd0e0;
}

.toast-journal {
  border-color: #b9a680;
}

.toast-chapter {
  border-color: #cfe3fb;
  color: #cfe3fb;
  font-family: var(--hand);
}

.toast-save {
  border-color: #7fd6a0;
  opacity: 0.85;
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(-3rem);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translate(-50%, 1rem);
  }
}

#area-title {
  position: absolute;
  top: 24rem;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--hand);
  text-shadow: 0 0.4rem 0 rgba(0, 0, 0, 0.5), 0 0 3rem rgba(0, 0, 0, 0.8);
  animation: area 3.6s ease forwards;
}

#area-title b {
  display: block;
  font-size: 4.4rem;
  font-weight: 700;
}

#area-title span {
  font-size: 1.9rem;
  color: var(--warm);
}

@keyframes area {
  0% {
    opacity: 0;
    letter-spacing: 0.3em;
  }
  18%,
  75% {
    opacity: 1;
    letter-spacing: 0.02em;
  }
  100% {
    opacity: 0;
  }
}

/* ───────────── diálogo ───────────── */
/* A caixa fica no alto: a ação do jogo acontece na metade de baixo da tela. */
#ui.talking #hud {
  opacity: 0;
}

#hud {
  transition: opacity 0.2s;
}

#dialogue {
  position: absolute;
  left: 9rem;
  right: 9rem;
  top: 3rem;
  display: flex;
  gap: 2rem;
  min-height: 16rem;
  padding: 1.6rem 2.4rem 1.6rem 1.8rem;
  border-radius: 1.6rem;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--panel-line), 0 1rem 4rem rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  cursor: pointer;
}

.dlg-portrait {
  flex: none;
  width: 13rem;
  height: 13rem;
  border-radius: 1rem;
  background: linear-gradient(180deg, #3a4a7a, #26305a);
  box-shadow: inset 0 0 0 0.4rem var(--paper), 0 0.4rem 0 rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.dlg-portrait canvas {
  width: 100%;
  height: 100%;
}

.dlg-body {
  position: relative;
  flex: 1;
  min-width: 0;
}

.dlg-name {
  color: var(--warm);
  font: 700 1.6rem var(--uif);
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.dlg-text {
  font-size: 1.85rem;
  min-height: 5rem;
}

#dialogue.narration {
  left: 14rem;
  right: 14rem;
  min-height: 11rem;
  background: rgba(8, 6, 20, 0.88);
}

#dialogue.narration .dlg-text {
  font-style: italic;
  text-align: center;
  color: #dfe6f7;
  padding-top: 1rem;
}

.dlg-choices {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.2rem;
}

.dlg-choice {
  cursor: pointer;
  text-align: left;
  padding: 0.6rem 1.4rem 0.6rem 0.8rem;
  border: 0;
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--snow);
  font: 1.65rem var(--uif);
  box-shadow: inset 0 0 0 1px transparent;
}

.dlg-choice.sel {
  background: rgba(255, 217, 138, 0.16);
  box-shadow: inset 0 0 0 1px var(--warm);
  color: var(--warm);
}

.dlg-next {
  position: absolute;
  right: 0;
  bottom: -0.6rem;
  font-size: 1.3rem;
  color: var(--warm);
  animation: bob 0.9s ease-in-out infinite;
}

@keyframes bob {
  50% {
    transform: translateX(0.6rem);
  }
}

/* ───────────── painéis ───────────── */
.modal-wrap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 6, 16, 0.62);
  pointer-events: auto;
  animation: fade-in 0.15s ease-out;
}

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

.modal {
  /* --mz: quanto UI.fit ampliou este painel num palco pequeno */
  max-width: calc(112rem / var(--mz, 1));
  max-height: calc(65rem / var(--mz, 1));
  animation: pop 0.18s ease-out;
}

@keyframes pop {
  from {
    transform: scale(0.96) translateY(1rem);
    opacity: 0;
  }
}

.modal h2 {
  margin: 0 0 1.2rem;
  font: 700 3rem var(--hand);
}

/* mochila: lona, costura e bolsos de papel */
.backpack {
  width: 104rem;
  height: 56rem;
  display: flex;
  flex-direction: column;
  padding: 1.6rem;
  border-radius: 2.4rem;
  background: #6a4a3a;
  box-shadow: inset 0 0 0 0.5rem #4f352a, inset 0 0 0 0.9rem #6a4a3a, inset 0 0 0 1rem rgba(255, 230, 190, 0.35), 0 2rem 6rem rgba(0, 0, 0, 0.6);
}

.tabs {
  display: flex;
  gap: 0.8rem;
  padding: 0.6rem 1rem 0;
}

.tab {
  cursor: pointer;
  padding: 0.7rem 2.2rem;
  border: 0;
  border-radius: 1.2rem 1.2rem 0 0;
  background: #4f352a;
  color: #e6d2b8;
  font: 700 1.6rem var(--hand);
}

.tab.on {
  background: var(--paper);
  color: var(--paper-ink);
}

.tab.close {
  margin-left: auto;
  border-radius: 1.2rem;
  margin-bottom: 0.5rem;
  font-family: var(--uif);
  font-size: 1.3rem;
}

.tab-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 2rem;
  padding: 2rem;
  border-radius: 1.4rem;
  background: var(--paper);
  color: var(--paper-ink);
  font-size: 1.55rem;
  box-shadow: inset 0 0.4rem 1.2rem rgba(70, 52, 44, 0.25);
}

.tab-body h3,
.tab-body h4,
.tab-body h5 {
  margin: 0;
  font-family: var(--hand);
}

.tab-body p {
  margin: 0.8rem 0;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  min-width: 0;
}

.col.wide {
  flex: 1;
  overflow-y: auto;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(5, 8.4rem);
  gap: 0.8rem;
  /* quatro fileiras à vista; do quinto ato em diante a mochila tem mais que isso, e rola */
  max-height: 36rem;
  width: 47.4rem;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #b9a680 transparent;
}

.slot {
  position: relative;
  width: 8.4rem;
  height: 8.4rem;
  padding: 0;
  cursor: pointer;
  border: 0;
  border-radius: 1rem;
  background: #fffaf0;
  box-shadow: inset 0 0 0 1px #c9b78f, inset 0 -0.5rem 0 rgba(70, 52, 44, 0.08);
}

.slot img {
  width: 6rem;
  height: 6rem;
}

.slot.empty {
  cursor: default;
  background: rgba(70, 52, 44, 0.07);
  box-shadow: inset 0 0 0 1px rgba(70, 52, 44, 0.15);
}

.slot.on {
  box-shadow: inset 0 0 0 0.5rem var(--rarity, #c9b78f), 0 0.4rem 0 rgba(70, 52, 44, 0.3);
  transform: translateY(-0.3rem);
}

.slot .qty,
.slot .eq {
  position: absolute;
  font: 700 1.25rem var(--uif);
  font-style: normal;
  color: #fff;
  border-radius: 0.8rem;
  padding: 0 0.6rem;
}

.slot .qty {
  right: 0.4rem;
  bottom: 0.4rem;
  background: var(--paper-ink);
}

.slot .eq {
  left: 0.4rem;
  top: 0.4rem;
  background: #3d9c7a;
}

.equip-row {
  display: flex;
  gap: 0.8rem;
  padding-top: 1.2rem;
  border-top: 0.3rem dashed rgba(70, 52, 44, 0.3);
}

.equip {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.6rem;
  border-radius: 1rem;
  background: rgba(70, 52, 44, 0.07);
  opacity: 0.6;
}

.equip.on {
  opacity: 1;
  background: #fffaf0;
  box-shadow: inset 0 0 0 1px #c9b78f;
}

.equip img,
.equip .ph {
  display: block;
  width: 5rem;
  height: 5rem;
}

.equip small {
  font-size: 1.2rem;
}

.item-detail {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0 0 2rem;
  border-left: 0.3rem dashed rgba(70, 52, 44, 0.3);
}

.item-head {
  display: flex;
  align-items: center;
  gap: 1.6rem;
}

.item-head .big {
  width: 12rem;
  height: 12rem;
  border-radius: 1.2rem;
  background: #fffaf0;
  box-shadow: inset 0 0 0 1px #c9b78f;
}

.item-head h3 {
  font-size: 2.3rem;
}

.rarity {
  display: inline-block;
  margin-right: 0.8rem;
  padding: 0 0.9rem;
  border-radius: 0.6rem;
  color: var(--ink);
  font-weight: 700;
}

.effects {
  margin: 1rem 0;
  padding-left: 2.4rem;
  color: #2f6b55;
  font-weight: 700;
}

.actions {
  display: flex;
  gap: 1.2rem;
  margin-top: 1.6rem;
}

.skill-head {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  font-family: var(--hand);
}

.xp-bar {
  flex: 1;
  height: 1.4rem;
  border-radius: 1rem;
  background: rgba(70, 52, 44, 0.15);
  overflow: hidden;
}

.xp-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #7b5fd0, #c79bf2);
}

.points b {
  color: #7b5fd0;
  font-size: 1.2em;
}

.skill-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.skill {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1rem 1.2rem;
  border-radius: 1rem;
  background: #fffaf0;
  box-shadow: inset 0 0 0 1px #c9b78f;
}

.skill.locked {
  opacity: 0.55;
  background: rgba(70, 52, 44, 0.06);
}

.skill .glyph {
  flex: none;
  width: 5.4rem;
  height: 5.4rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #4a3b6b;
  color: #ffe9a8;
  font-size: 2.6rem;
}

.skill-info {
  flex: 1;
  min-width: 0;
}

.skill-info h4 {
  font-size: 1.7rem;
}

.skill-info p {
  margin: 0.2rem 0 0;
  font-size: 1.35rem;
}

.skill-info .next {
  color: #7b5fd0;
}

.pips {
  margin-left: 1rem;
}

.pips i {
  display: inline-block;
  width: 1.2rem;
  height: 1.2rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px #7b5fd0;
}

.pips i.on {
  background: #7b5fd0;
}

.quest {
  padding: 1rem 1.4rem;
  margin-bottom: 1rem;
  border-radius: 1rem;
  background: #fffaf0;
  box-shadow: inset 0 0 0 1px #c9b78f;
}

.quest.done {
  opacity: 0.6;
}

.quest h4 {
  font-size: 1.8rem;
}

.quest ul {
  margin: 0.6rem 0 0;
  padding-left: 2.6rem;
}

.quest li.ok {
  text-decoration: line-through;
  opacity: 0.55;
}

.quests h5 {
  margin: 1.4rem 0 0.8rem;
  font-size: 1.5rem;
  opacity: 0.7;
}

.tag {
  display: inline-block;
  margin-right: 1rem;
  padding: 0 0.9rem;
  border-radius: 0.6rem;
  background: var(--paper-ink);
  color: #fff;
  font: 700 1.15rem var(--uif);
  vertical-align: middle;
}

.tag-principal {
  background: #c98a2b;
}

.tag-gato {
  background: #d9668c;
}

.tag-criatura {
  background: #5a4a8a;
}

.tag-secreta {
  background: #2f6b55;
}

.chapters .acts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}

.act h5 {
  font-size: 1.6rem;
  min-height: 4.2rem; /* dois títulos de ato quebram em duas linhas: as listas ficam alinhadas */
  margin-bottom: 0.6rem;
}

.act ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.act li {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.25rem 0.8rem;
  border-radius: 0.6rem;
  font: 1.45rem var(--hand);
  opacity: 0.45;
}

.act li i {
  flex: none;
  width: 2.8rem;
  height: 2.8rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(70, 52, 44, 0.14);
  font: 700 1.15rem var(--uif);
  font-style: normal;
}

.act li.ok {
  opacity: 1;
}

.act li.ok i {
  background: #3d9c7a;
  color: #fff;
}

.act li.now {
  opacity: 1;
  background: #ffe9b0;
}

.act li.now i {
  background: #c98a2b;
  color: #fff;
}

.journal-list {
  width: 34rem;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow-y: auto;
  padding-right: 0.8rem;
}

.journal-item {
  cursor: pointer;
  text-align: left;
  padding: 0.6rem 1.2rem;
  border: 0;
  border-radius: 0.8rem;
  background: #fffaf0;
  box-shadow: inset 0 0 0 1px #c9b78f;
  color: var(--paper-ink);
  font: 1.45rem var(--hand);
}

.journal-item small {
  display: block;
  font: 700 1.05rem var(--uif);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.6;
}

.journal-item.on {
  background: #ffe9b0;
}

.tab-diario .col {
  flex: 1;
}

.journal-page {
  flex: 1;
  overflow-y: auto;
  font-family: var(--hand);
}

.journal-page h3 {
  font-size: 2.1rem;
}

.heart-box {
  padding-top: 1rem;
  border-top: 0.3rem dashed rgba(70, 52, 44, 0.3);
}

.heart-box h5 {
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
}

.trait {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1.25rem;
}

.trait span {
  width: 13rem;
}

.trait-bar {
  flex: 1;
  height: 0.9rem;
  border-radius: 1rem;
  background: rgba(70, 52, 44, 0.14);
  overflow: hidden;
}

.trait-bar i {
  display: block;
  height: 100%;
  background: #d9668c;
}

.trait-coragem i {
  background: #d98a2b;
}

.trait-curiosidade i {
  background: #3d9cb5;
}

.trait-agressividade i {
  background: #8a3a4a;
}

.trait-amizade i {
  background: #3d9c7a;
}

.friends {
  font: 1.3rem var(--hand);
}

/* o caderno: duas páginas e uma espiral */
.book {
  position: relative;
  width: 104rem;
  height: 58rem;
  display: flex;
  padding: 1.2rem;
  border-radius: 1.6rem;
  background: #7a4a8a;
  box-shadow: inset 0 0 0 0.4rem #5c3569, 0 2rem 6rem rgba(0, 0, 0, 0.6);
  color: var(--paper-ink);
}

.page {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 2rem 2.4rem;
  background: var(--paper);
  background-image: radial-gradient(rgba(70, 52, 44, 0.05) 1px, transparent 1px);
  background-size: 1.6rem 1.6rem;
}

.page-left {
  border-radius: 1rem 0 0 1rem;
  box-shadow: inset -2rem 0 3rem -2rem rgba(70, 52, 44, 0.35);
}

.page-right {
  border-radius: 0 1rem 1rem 0;
  box-shadow: inset 2rem 0 3rem -2rem rgba(70, 52, 44, 0.35);
  align-items: center;
}

.spine {
  width: 2.2rem;
  background: repeating-linear-gradient(180deg, #d8d2c0 0 1rem, #5c3569 1rem 2.6rem);
}

.book h2 {
  font-size: 2.8rem;
  margin: 0;
}

.book .note {
  margin: 0 0 1.2rem;
  font-size: 1.4rem;
  opacity: 0.7;
}

.drawings {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  overflow-y: auto;
}

.drawing {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  padding: 0.6rem 1rem;
  border-radius: 1rem;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(70, 52, 44, 0.2);
}

.drawing.on {
  background: #fffaf0;
  box-shadow: inset 0 0 0 0.4rem #d9b96a;
}

.drawing.locked {
  cursor: default;
  opacity: 0.5;
}

.drawing .glyph {
  flex: none;
  width: 7rem;
  height: 7rem;
}

.drawing-info b {
  font: 700 1.8rem var(--hand);
}

.drawing-info small {
  margin-left: 1rem;
  font-size: 1.15rem;
  opacity: 0.7;
}

.drawing-info p {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.25;
}

.drawing.locked p {
  display: none;
}

.sketch {
  width: 47.5rem;
  height: 37.5rem;
  border-radius: 0.8rem;
  background: #fffdf6;
  box-shadow: inset 0 0 0 1px rgba(70, 52, 44, 0.25), 0 0.4rem 1rem rgba(70, 52, 44, 0.2);
  cursor: crosshair;
  touch-action: none;
}

.book .msg {
  min-height: 4.4rem;
  margin: 1rem 0 0.4rem;
  font-size: 1.6rem;
  text-align: center;
}

.msg.good {
  color: #b5762b;
  font-size: 2.2rem;
  font-weight: 700;
}

.msg.bad {
  color: #a8433f;
}

.book-foot {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-top: auto;
}

.ink-left {
  flex: 1;
  font: 700 1.4rem var(--hand);
  color: #7b5fd0;
}

/* mapa: pergaminho */
.map {
  padding: 2rem 2.4rem;
  border-radius: 1rem;
  background: var(--paper-2);
  background-image: radial-gradient(rgba(70, 52, 44, 0.07) 1px, transparent 1px);
  background-size: 1.4rem 1.4rem;
  color: var(--paper-ink);
  box-shadow: 0 2rem 6rem rgba(0, 0, 0, 0.6), inset 0 0 6rem rgba(120, 90, 50, 0.35);
  transform: rotate(-0.6deg);
}

.map canvas {
  display: block;
  width: 84rem;
  height: 49rem;
}

.map h2 {
  margin-bottom: 0;
}

/* uma folha por ato */
.map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.map-head h2 {
  flex: none;
}

.map-act-title {
  flex: 1;
  font-size: 1.5rem;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-acts {
  display: flex;
  flex: none;
  gap: 0.6rem;
}

.map-acts .btn {
  min-width: 3.4rem;
  padding: 0.3rem 0.8rem;
  font-size: 1.4rem;
  opacity: 0.6;
}

.map-acts .btn.on {
  opacity: 1;
  background: #ffe9b0;
}

.map-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.8rem;
  font-size: 1.3rem;
  opacity: 0.85;
}

/* pausa, controles, puzzle, fim */
.pause,
.controls,
.puzzle,
.ending,
.look {
  padding: 2.6rem 3.4rem;
  border-radius: 2rem;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--panel-line), 0 2rem 6rem rgba(0, 0, 0, 0.6);
}

.pause {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.3rem;
  width: 58rem;
  text-align: center;
}

.pause h2,
.pause [data-a='resume'],
.pause [data-a='title'],
.pause .settings {
  grid-column: 1 / -1;
}

.pause .settings {
  margin: 0.4rem 0;
  padding: 1.2rem 0;
  border-top: 1px solid var(--panel-line);
  border-bottom: 1px solid var(--panel-line);
}

/* língua e voz: fileiras de opções, iguais na tela de título e na pausa */
.settings {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.option-row > span {
  width: 9rem;
  text-align: right;
  font: 700 1.6rem var(--hand);
  opacity: 0.85;
}

.options {
  display: flex;
  gap: 0.7rem;
  width: 34rem;
}

.options .chip {
  pointer-events: auto;
  flex: 1;
  padding: 0.6rem 0.8rem;
  white-space: nowrap;
}

.title-card .settings {
  margin-top: 2.2rem;
}

/* o que a voz do navegador está fazendo de verdade, logo abaixo da fileira Voz */
.voice-status {
  max-width: 50rem;
  min-height: 3.3rem;
  margin: 0 auto;
  font-size: 1.2rem;
  line-height: 1.35;
  opacity: 0.7;
}

.controls {
  width: 76rem;
}

.controls dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem 2rem;
  margin: 0 0 1.4rem;
  font-size: 1.55rem;
}

.controls dt {
  text-align: right;
}

.controls dd {
  margin: 0;
}

.controls p {
  color: var(--warm);
  font-size: 1.5rem;
}

.puzzle {
  width: 70rem;
  text-align: center;
  background: linear-gradient(180deg, #3d4853, #2a323b);
}

.lights {
  display: flex;
  justify-content: center;
  gap: 1.6rem;
  margin: 1.4rem 0;
}

.lights i {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: #1b2026;
  box-shadow: inset 0 0 0 0.3rem #56626e;
}

.lights i.on {
  background: #7fe0b0;
  box-shadow: inset 0 0 0 0.3rem #56626e, 0 0 2rem #7fe0b0;
}

/* lâmpadas numeradas, para o puzzle das alavancas */
.lights.numbered i {
  width: 4rem;
  height: 4rem;
  display: grid;
  place-items: center;
  font: 700 1.5rem var(--uif);
  font-style: normal;
  color: #56626e;
}

.lights.numbered i.on {
  color: #12301f;
}

.breakers {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.breaker {
  position: relative;
  width: 11rem;
  height: 20rem;
  cursor: pointer;
  border: 0;
  border-radius: 1rem;
  background: #1b2026;
  box-shadow: inset 0 0 0 0.4rem #56626e;
  color: var(--snow);
}

.breaker span {
  position: absolute;
  top: 1rem;
  left: 0;
  right: 0;
  font-size: 3.6rem;
  line-height: 1;
  color: var(--warm);
}

.breaker i {
  position: absolute;
  left: 3.5rem;
  top: 6.4rem;
  width: 4rem;
  height: 5.5rem;
  border-radius: 0.8rem;
  background: linear-gradient(180deg, #e6ebf0, #9aa3b5);
  box-shadow: 0 0.6rem 0 #5b6378;
  transition: top 0.12s ease-in;
}

.breaker.down i {
  top: 11rem;
  background: linear-gradient(180deg, #7fe0b0, #3d9c7a);
  box-shadow: 0 0.3rem 0 #2a6b54;
}

.breaker small {
  position: absolute;
  bottom: 0.9rem;
  left: 0;
  right: 0;
  font-size: 1.2rem;
  opacity: 0.7;
}

.breaker:disabled {
  cursor: default;
}

.puzzle-msg {
  min-height: 4.6rem;
  margin: 1.2rem 0 0.6rem;
  font-size: 1.5rem;
}

.puzzle-msg.bad {
  color: #ffb0a8;
}

.puzzle-msg.good {
  color: #a8f0c8;
}

.puzzle-intro {
  margin: 0 0 0.6rem;
  font-size: 1.5rem;
  opacity: 0.85;
}

.puzzle-intro span,
.riddle span {
  display: block;
}

/* adivinhas e cadeados: um cartão de papel sobre o painel */
.puzzle-riddle,
.puzzle-code {
  width: 64rem;
}

.riddle {
  margin: 0 auto 1.6rem;
  padding: 1.6rem 2.4rem;
  border-radius: 0.8rem;
  background: var(--paper);
  color: var(--paper-ink);
  font-size: 1.75rem;
  line-height: 1.5;
  box-shadow: 0 0.6rem 0 rgba(0, 0, 0, 0.3);
  transform: rotate(-0.5deg);
}

.riddle-form {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
}

.riddle-form input {
  width: 30rem;
  padding: 0.7rem 1.4rem;
  border: 0;
  border-radius: 1rem;
  background: #1b2026;
  box-shadow: inset 0 0 0 0.3rem #56626e;
  color: var(--snow);
  font: 1.8rem var(--hand);
  text-align: center;
  outline: none;
}

.riddle-form input:focus {
  box-shadow: inset 0 0 0 0.3rem var(--warm);
}

.riddle-form input::placeholder {
  color: #56626e;
}

/* cadeado de combinação */
.dials {
  display: flex;
  justify-content: center;
  gap: 1.4rem;
}

.dial {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.dial b {
  width: 6rem;
  height: 7rem;
  display: grid;
  place-items: center;
  border-radius: 0.8rem;
  background: linear-gradient(180deg, #9aa3b5, #e6ebf0 45%, #9aa3b5);
  box-shadow: inset 0 0 0 0.3rem #56626e;
  color: var(--ink);
  font: 700 4rem var(--uif);
}

.dial button {
  width: 6rem;
  height: 3rem;
  cursor: pointer;
  border: 0;
  border-radius: 0.6rem;
  background: #1b2026;
  box-shadow: inset 0 0 0 0.2rem #56626e;
  color: var(--warm);
  font-size: 1.4rem;
}

.dial button:hover:not(:disabled) {
  background: #2a323b;
}

.dial button:disabled {
  cursor: default;
  opacity: 0.4;
}

/* quebra-cabeça: peças que trocam de lugar */
.puzzle-jigsaw {
  width: 60rem;
}

.jigsaw {
  display: grid;
  gap: 0.3rem;
  width: 44rem;
  height: 33rem;
  margin: 0 auto;
  padding: 0.6rem;
  border-radius: 0.6rem;
  background: #1b2026;
}

.jigsaw .tile {
  cursor: pointer;
  border: 0;
  padding: 0;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  box-shadow: inset 0 0 0 1px rgba(70, 52, 44, 0.5);
}

.jigsaw .tile.ok {
  box-shadow: inset 0 0 0 1px rgba(127, 224, 176, 0.55);
}

.jigsaw .tile.on {
  box-shadow: inset 0 0 0 0.4rem var(--warm);
  filter: brightness(1.15);
}

.jigsaw .tile:disabled {
  cursor: default;
  box-shadow: none;
}

.puzzle-jigsaw .puzzle-msg {
  min-height: 2.4rem;
  margin: 0.8rem 0 0.6rem;
}

/* melodia: teclas de caixinha de música */
.keys {
  display: flex;
  justify-content: center;
  gap: 1.4rem;
  margin: 0.6rem 0;
}

.key {
  width: 9rem;
  height: 15rem;
  cursor: pointer;
  border: 0;
  border-radius: 0.8rem 0.8rem 1.6rem 1.6rem;
  background: linear-gradient(180deg, #2a323b, #1b2026);
  box-shadow: inset 0 0 0 0.4rem var(--key), 0 0.6rem 0 rgba(0, 0, 0, 0.4);
  color: var(--key);
  font-size: 4rem;
  transition: background 0.08s, transform 0.08s;
}

.key.lit,
.key:active:not(:disabled) {
  background: var(--key);
  color: var(--ink);
  transform: translateY(0.4rem);
  box-shadow: inset 0 0 0 0.4rem var(--key), 0 0 3rem var(--key);
}

.key:disabled {
  cursor: default;
  opacity: 0.6;
}

/* máquina de pegar: a garra vai e volta; o prêmio é um gato laranja */
.puzzle-claw {
  width: 76rem;
}

.claw-box {
  position: relative;
  height: 26rem;
  margin: 0.8rem auto 0;
  border-radius: 1rem;
  background: linear-gradient(180deg, #1b2a4a, #16203a);
  box-shadow: inset 0 0 0 0.4rem #56626e, inset 0 0 4rem rgba(120, 200, 255, 0.18);
  overflow: hidden;
}

.claw-rail {
  position: absolute;
  left: 0;
  right: 0;
  top: 1.4rem;
  height: 0.6rem;
  background: #9aa3b5;
}

.claw-chute {
  position: absolute;
  bottom: 0;
  height: 4.6rem;
  display: grid;
  place-items: center;
  transform: translateX(-50%);
  background: #0d1220;
  box-shadow: inset 0 0 0 0.3rem #ffd866;
}

.claw-chute span {
  color: #ffd866;
  font: 700 1.1rem var(--uif);
  letter-spacing: 0.12em;
}

.claw-toy {
  position: absolute;
  bottom: 0.6rem;
  width: 5rem;
  height: 4.4rem;
  margin-left: -2.5rem;
  border-radius: 2rem 2rem 1rem 1rem;
  opacity: 0.8;
}

.claw-prize {
  position: absolute;
  z-index: 1;
  bottom: calc(0.6rem + var(--lift, 0) * 14rem);
  width: 7rem;
  height: 5rem;
  margin-left: -3.5rem;
  border-radius: 2.4rem 2.4rem 1.4rem 1.4rem;
  background:
    radial-gradient(circle at 35% 42%, #231c38 0.35rem, transparent 0.42rem),
    radial-gradient(circle at 65% 42%, #231c38 0.35rem, transparent 0.42rem),
    linear-gradient(180deg, #f29e4c 70%, #d9823a 70%);
}

.claw-prize::before,
.claw-prize::after {
  content: '';
  position: absolute;
  top: -1.1rem;
  border: 0.9rem solid transparent;
  border-top: 0;
  border-bottom-color: #f29e4c;
}

.claw-prize::before {
  left: 0.7rem;
}

.claw-prize::after {
  right: 0.7rem;
}

.claw-prize.won {
  opacity: 0;
}

.claw-arm {
  position: absolute;
  z-index: 2;
  top: 2rem;
  width: 0;
}

.claw-arm b {
  position: absolute;
  left: -0.2rem;
  top: 0;
  width: 0.4rem;
  height: calc(3rem + var(--drop, 0) * 14rem);
  background: #cfd6e6;
}

.claw-arm u {
  position: absolute;
  left: -2.8rem;
  top: calc(3rem + var(--drop, 0) * 14rem);
  width: 5.6rem;
  height: 3rem;
  border: 0.5rem solid #cfd6e6;
  border-bottom: 0;
  border-radius: 2.8rem 2.8rem 0 0;
}

.claw-arm.closed u {
  left: -2rem;
  width: 4rem;
}

.puzzle-claw .puzzle-msg {
  min-height: 2.6rem;
  margin: 0.8rem 0 0.6rem;
}

.puzzle-foot,
.ending-foot,
.look-foot {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.6rem;
}

.ending {
  width: 78rem;
  text-align: center;
}

.ending .over {
  margin: 0;
  color: var(--warm);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 1.3rem;
}

.ending h2 {
  font-size: 4rem;
  margin: 0.4rem 0 0.6rem;
}

.ending > .hand {
  font-size: 1.9rem;
  color: #ffd0e0;
}

.ending ul {
  list-style: none;
  margin: 1.6rem auto;
  padding: 0;
  width: 54rem;
}

.ending li {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--panel-line);
}

.ending li b {
  color: var(--warm);
}

.ending .questions {
  font-style: italic;
  opacity: 0.75;
  margin-bottom: 2rem;
}

/* editor de aparência */
.look {
  width: 108rem;
  padding: 2rem 3rem;
}

.look h2 {
  margin-bottom: 0.8rem;
}

.look-body {
  display: flex;
  gap: 3rem;
}

.look-preview {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  padding: 1.6rem;
  border-radius: 1.6rem;
  background: linear-gradient(180deg, #26356b, #51669f);
  box-shadow: inset 0 0 0 1px var(--panel-line);
}

.look-preview canvas {
  width: 27.5rem;
  height: 28.75rem;
}

.look-options {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.look-row {
  display: flex;
  align-items: center;
  gap: 1.6rem;
}

.look-row label {
  width: 11rem;
  font: 700 1.6rem var(--hand);
  text-align: right;
}

.picks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.swatch {
  width: 3.8rem;
  height: 3.8rem;
  cursor: pointer;
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 0.3rem rgba(255, 255, 255, 0.25), 0 0.3rem 0 rgba(0, 0, 0, 0.4);
}

.swatch.none {
  background: repeating-linear-gradient(45deg, #444 0 0.6rem, #666 0.6rem 1.2rem);
}

.swatch.on {
  box-shadow: inset 0 0 0 0.3rem #fff, 0 0 0 0.4rem var(--warm);
  transform: scale(1.1);
}

.chip {
  cursor: pointer;
  padding: 0.5rem 1.6rem;
  border: 0;
  border-radius: 4rem;
  background: rgba(255, 255, 255, 0.1);
  color: var(--snow);
  font: 1.5rem var(--uif);
}

.chip.on {
  background: var(--warm);
  color: var(--ink);
  font-weight: 700;
}

.look-foot {
  margin-top: 1.4rem;
  justify-content: flex-end;
}

.look-foot .warn {
  margin-right: auto;
  color: #ffb0a8;
  font-size: 1.4rem;
}

/* ───────────── título ───────────── */
#title {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(8, 10, 28, 0.25), rgba(8, 10, 28, 0.78));
  pointer-events: auto;
}

.title-card {
  text-align: center;
  margin-top: -3rem;
}

.title-over {
  margin: 0;
  color: var(--warm);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 1.4rem;
}

.title-card h1 {
  margin: 1rem 0 3rem;
  font: 700 9rem/0.95 var(--hand);
  color: var(--snow);
  text-shadow: 0 0.6rem 0 #26305a, 0 0 6rem rgba(120, 160, 255, 0.55);
}

.title-card h1 span {
  display: block;
  color: var(--warm);
  font-size: 0.72em;
}

.title-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
}

.title-menu .btn {
  min-width: 34rem;
}

.title-foot {
  margin-top: 2.4rem;
  font-size: 1.2rem;
  opacity: 0.5;
  letter-spacing: 0.2em;
}

/* ───────────── transições ───────────── */
#fade {
  position: absolute;
  inset: 0;
  background: #04050b;
  opacity: 1;
  pointer-events: none;
}

#flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

#flash.on {
  animation: flash 0.55s ease-out;
}

@keyframes flash {
  0% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
  }
}

#file-warning,
#load-warning {
  max-width: 560px;
  padding: 32px;
  font: 16px/1.6 var(--uif);
  text-align: center;
}

#file-warning h1,
#load-warning h1 {
  font-family: var(--hand);
  color: var(--warm);
}

#file-warning code {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
}

/* ───────────── puzzle das cisternas (pour) ───────────── */
.tanks {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 3.2rem;
  margin: 1.6rem 0 1rem;
}

.tank {
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border: 0;
  border-radius: 1.2rem;
  background: transparent;
  color: var(--snow);
  font: 1.4rem var(--uif);
}

.tank:disabled {
  cursor: default;
}

.tank.from {
  background: rgba(255, 216, 102, 0.14);
  box-shadow: inset 0 0 0 2px var(--warm);
}

.tank .glass {
  position: relative;
  display: block;
  width: 7rem;
  overflow: hidden;
  border-radius: 0 0 1rem 1rem;
  background: rgba(10, 8, 24, 0.75);
  box-shadow: inset 0 0 0 2px #5d7a6e, inset 0 -0.6rem 0 rgba(0, 0, 0, 0.25);
}

.tank .water {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, #a8e0f0 0, #3f8fb0 0.5rem, #2f6f8f 100%);
  transition: height 0.35s ease;
}

.tank .mark {
  position: absolute;
  left: 0;
  right: 0;
  height: 0.35rem;
  margin-bottom: -0.17rem;
  background: #ff6a5a;
  box-shadow: 0 0 0.8rem rgba(255, 106, 90, 0.9);
}

.tank b {
  font: 700 1.9rem var(--hand);
}

.tank small {
  opacity: 0.8;
}

/* ───────────── o calor (salas frias de verdade) ───────────── */
.warmth {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.8rem;
}

.warmth-flame {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: #ff9a5a;
  box-shadow: 0 0 1rem rgba(255, 154, 90, 0.8);
}

.warmth-bar {
  width: 22rem;
  height: 1.2rem;
  border-radius: 1rem;
  background: rgba(10, 8, 24, 0.7);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  overflow: hidden;
}

.warmth-bar i {
  display: block;
  height: 100%;
  border-radius: 1rem;
  background: linear-gradient(90deg, #bfe3ff, #ffd98a 45%, #ff8a4a);
  transition: width 0.15s linear;
}

.warmth.low .warmth-bar i {
  background: #bfe3ff;
}

.warmth.low .warmth-flame {
  background: #bfe3ff;
  box-shadow: 0 0 1rem rgba(191, 227, 255, 0.9);
}

/* o que ainda falta para uma receita, debaixo do botão */
.recipe-missing {
  flex-basis: 100%;
  margin: 0.6rem 0 0;
  font-size: 1.3rem;
  opacity: 0.8;
}

/* muitos companheiros: só os retratos */
.companions.compact .companion span {
  display: none;
}

.companions.compact .companion {
  padding-right: 0.6rem;
}

/* ───────────── o cronômetro das corridas ───────────── */
.race-timer {
  position: absolute;
  top: 2.4rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 1.8rem;
  border-radius: 4rem;
  background: rgba(12, 10, 28, 0.72);
  box-shadow: inset 0 0 0 1px var(--panel-line);
  font: 700 2rem var(--hand);
  color: var(--snow);
  white-space: nowrap;
}

.race-timer.late {
  color: #ffb0a8;
}

/* ───────────── celular e tablet ───────────── */

/* Num palco pequeno, o que se lê durante o jogo cresce (Game.resize define --z). */
#hud,
#dialogue,
#caption,
#toasts,
#area-title,
#prompt {
  zoom: var(--z);
}

body.small #dialogue {
  left: 3rem;
  right: 3rem;
  top: 2rem;
}

body.small .hud-tr {
  max-width: 34rem;
}

/* os cantos de cima dão lugar aos botões de menu */
body.touch .hud-tl {
  left: calc(3rem + var(--hx));
}

body.touch .hud-tr {
  right: calc(3rem + var(--hx));
}

body.touch #toasts {
  left: calc(3rem + var(--hx));
}

/* com os dedos não há teclas para lembrar */
body.touch kbd,
body.touch .dlg-key,
body.touch .hud-br,
body.touch .ability {
  display: none;
}

body.touch #game {
  cursor: default;
}

/* o que ficava nos cantos de baixo sobe para o meio: os cantos são dos polegares */
body.touch .hud-bl {
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

body.touch #caption {
  max-width: 56rem;
}

body.touch #prompt {
  pointer-events: auto;
  padding: 0.7rem 1.6rem 0.8rem 1rem;
}

.only-touch {
  display: none !important;
}

body.touch .only-touch {
  display: flex !important;
}

/* alvos um pouco maiores para um dedo */
body.touch .chip {
  padding: 0.8rem 1.9rem;
}

body.touch .dlg-choice {
  padding: 1rem 1.6rem 1rem 1.2rem;
}

/* sem mouse nem setas não há escolha "destacada": nenhuma parece já marcada */
body.touch .dlg-choice.sel {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px transparent;
  color: var(--snow);
}

.tc-icon {
  display: inline-block;
  width: 1.5em;
  height: 1.5em;
  margin-right: 0.35em;
  vertical-align: -0.35em;
}

.tc-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.controls .tc-icon {
  margin: 0;
  color: var(--warm);
}

/* ── os botões ── */
#touch {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: none;
  pointer-events: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  /* o entalhe e a barra de gestos do aparelho */
  --sl: env(safe-area-inset-left, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --st: env(safe-area-inset-top, 0px);
}

body.touch #touch.play {
  display: block;
}

.tc-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: var(--u);
  height: var(--u);
  padding: 0;
  border: 1.5px solid rgba(244, 248, 255, 0.42);
  border-radius: 50%;
  background: rgba(18, 16, 36, 0.44);
  color: var(--snow);
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.tc-btn svg {
  width: 54%;
  height: 54%;
  pointer-events: none;
}

.tc-btn.on {
  background: rgba(255, 217, 138, 0.78);
  border-color: var(--warm);
  color: var(--ink);
  transform: scale(0.93);
}

.tc-btn.hidden {
  display: none;
}

/* ações: um losango no canto direito, com o pulo embaixo */
.tc-acts {
  position: absolute;
  right: calc(var(--sr) + var(--u) * 0.2);
  bottom: calc(var(--sb) + var(--u) * 0.25);
  width: calc(var(--u) * 3.55);
  height: calc(var(--u) * 3.3);
}

.tc-jump {
  right: calc(var(--u) * 1.15);
  bottom: 0;
  width: calc(var(--u) * 1.25);
  height: calc(var(--u) * 1.25);
}

.tc-interact {
  right: 0;
  bottom: calc(var(--u) * 1.1);
}

.tc-attack {
  right: calc(var(--u) * 2.55);
  bottom: calc(var(--u) * 1.1);
}

.tc-dodge {
  right: calc(var(--u) * 1.275);
  bottom: calc(var(--u) * 2.2);
}

.tc-special,
.tc-photo,
.tc-sneak {
  width: calc(var(--u) * 0.84);
  height: calc(var(--u) * 0.84);
}

.tc-special {
  right: calc(var(--u) * 0.08);
  bottom: calc(var(--u) * 2.32);
}

.tc-photo {
  right: calc(var(--u) * 2.63);
  bottom: calc(var(--u) * 2.32);
}

.tc-interact.ready {
  border-color: var(--warm);
  color: var(--warm);
  box-shadow: 0 0 0 3px rgba(255, 217, 138, 0.3);
}

.tc-special.lit {
  border-color: var(--teal);
  color: var(--teal);
}

.tc-sneak {
  left: calc(var(--sl) + var(--u) * 0.35);
  bottom: calc(var(--sb) + var(--u) * 3.65);
}

/* direcional */
.tc-pad {
  position: absolute;
  left: calc(var(--sl) + var(--u) * 0.25);
  bottom: calc(var(--sb) + var(--u) * 0.3);
  width: calc(var(--u) * 3.1);
  height: calc(var(--u) * 3.1);
  border: 1.5px solid rgba(244, 248, 255, 0.3);
  border-radius: 50%;
  background: rgba(18, 16, 36, 0.36);
  pointer-events: auto;
  touch-action: none;
}

.tc-pad i {
  position: absolute;
  width: 26%;
  height: 26%;
  color: rgba(244, 248, 255, 0.75);
  pointer-events: none;
}

.tc-pad i svg {
  display: block;
  width: 100%;
  height: 100%;
}

.tc-pad .r {
  right: 6%;
  top: 37%;
}

.tc-pad .l {
  left: 6%;
  top: 37%;
  transform: rotate(180deg);
}

.tc-pad .u {
  left: 37%;
  top: 6%;
  transform: rotate(-90deg);
}

.tc-pad .d {
  left: 37%;
  bottom: 6%;
  transform: rotate(90deg);
}

.tc-pad b {
  position: absolute;
  inset: 37%;
  border-radius: 50%;
  background: rgba(244, 248, 255, 0.16);
  pointer-events: none;
}

.tc-pad.left .l,
.tc-pad.right .r,
.tc-pad.up .u,
.tc-pad.down .d {
  color: var(--warm);
}

/* menus: dois em cada canto de cima */
.tc-menu .tc-btn {
  width: var(--tm);
  height: var(--tm);
  border-radius: 28%;
}

.tc-pause {
  left: calc(var(--sl) + 8px);
  top: calc(var(--st) + 8px);
}

.tc-map {
  left: calc(var(--sl) + 8px);
  top: calc(var(--st) + var(--tm) + 16px);
}

.tc-inventory {
  right: calc(var(--sr) + 8px);
  top: calc(var(--st) + 8px);
}

.tc-book {
  right: calc(var(--sr) + 8px);
  top: calc(var(--st) + var(--tm) + 16px);
  border-color: rgba(255, 217, 138, 0.7);
  color: var(--warm);
}

/* De pé, um celular não mostra o jogo. */
#rotate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-content: center;
  justify-items: center;
  gap: 22px;
  padding: 24px;
  background: var(--night);
  color: var(--snow);
  font: 600 18px/1.4 var(--uif);
  text-align: center;
}

#rotate svg {
  width: 86px;
  height: 86px;
  color: var(--warm);
  animation: tilt 2.4s ease-in-out infinite;
}

@keyframes tilt {
  0%,
  25% {
    transform: rotate(0deg);
  }
  60%,
  100% {
    transform: rotate(-90deg);
  }
}

@media (orientation: portrait) and (max-width: 639px) {
  #rotate {
    display: grid;
  }
}

/* enquanto os módulos do jogo chegam pela rede */
#loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(244, 248, 255, 0.55);
  font-size: 34px;
  pointer-events: none;
  animation: loading 1.6s ease-in-out infinite;
}

@keyframes loading {
  50% {
    opacity: 0.25;
  }
}
