/* Emberquest: what the real-time page adds to emberdeep.css. */

/* No double-tap zoom: a quick second tap beside a button must not zoom the page. */
html,
body {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}
canvas {
  touch-action: none;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
#me {
  position: absolute;
  left: 12px;
  top: 10px;
  background: var(--panel);
  border: 2px solid var(--edge);
  border-radius: 8px;
  padding: 6px 10px 7px;
  display: block;
}
#me-name {
  margin: 0 0 3px;
  font-weight: 800;
  font-size: 14px;
}
#hearts canvas {
  image-rendering: pixelated;
  display: block;
}
#me-xp {
  margin: 4px 0 0;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
#me-xp b {
  color: var(--gold);
  white-space: nowrap;
}
#me-xp span {
  flex: 1;
  min-width: 70px;
  height: 5px;
  background: #2a1a10;
  border: 1px solid var(--edge);
  border-radius: 3px;
  overflow: hidden;
}
#me-xp i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #c88a2a, #ffd060);
}

/* The ability bar: three slots along the bottom. */
#abar {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}
.slot {
  position: relative;
  width: 52px;
  height: 52px;
  background: var(--panel);
  border: 2px solid var(--edge);
  border-radius: 8px;
  overflow: hidden;
}
.slot canvas {
  width: 40px;
  height: 40px;
  margin: 4px;
  image-rendering: pixelated;
  display: block;
}
.slot .key {
  position: absolute;
  left: 3px;
  top: 1px;
  font-size: 11px;
  font-weight: 800;
  text-shadow: 0 1px 0 #000;
}
.slot .cd,
#pads .ab .cd {
  position: absolute;
  inset: 0;
  background: conic-gradient(rgba(0, 0, 0, 0.7) calc(var(--cd, 0) * 1turn), transparent 0);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  text-shadow: 0 1px 0 #000;
}
.slot.locked,
#pads .ab.locked {
  opacity: 0.45;
}
.slot.locked .cd,
#pads .ab.locked .cd {
  background: rgba(0, 0, 0, 0.6);
  font-size: 11px;
}
.slot.held {
  border-color: var(--gold);
}
.slot .tip {
  display: none;
}
body.touch #abar {
  display: none;
}
#party {
  position: absolute;
  left: 12px;
  top: 92px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.qpal {
  background: rgba(20, 13, 10, 0.8);
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 12px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.qpal canvas {
  image-rendering: pixelated;
}
.qpal.down {
  opacity: 0.55;
}
#inv {
  position: absolute;
  right: 12px;
  top: 10px;
  background: var(--panel);
  border: 2px solid var(--edge);
  border-radius: 8px;
  padding: 6px 8px;
  text-align: center;
  pointer-events: auto;
}
#minimap {
  width: 128px;
  height: 100px;
  object-fit: contain;
  cursor: pointer;
  position: static;
  display: block;
  margin: 0 auto;
  image-rendering: pixelated;
}
#keys {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 800;
}
#keys .big {
  color: var(--gold);
}
#party-code {
  margin: 2px 0 0;
  font-family: "Cinzel", serif;
  letter-spacing: 0.2em;
  color: var(--gold);
  cursor: pointer;
  font-size: 13px;
}
#banner {
  position: absolute;
  left: 50%;
  top: 14%;
  transform: translateX(-50%);
  text-align: center;
  opacity: 0;
  transition: opacity 0.6s;
  /* Long inscriptions and chapter goals wrap instead of running off the screen. */
  width: max-content;
  max-width: min(92vw, 900px);
}
#banner.on {
  opacity: 1;
}
#banner-main {
  margin: 0;
  font-family: "Cinzel", serif;
  font-weight: 900;
  font-size: clamp(22px, 4vw, 38px);
  color: #ffe2a0;
  text-shadow: 0 3px 0 #2a1208, 0 0 18px rgba(255, 140, 40, 0.5);
}
#banner-sub {
  margin: 2px 0 0;
  color: #e8d8b8;
  text-shadow: 0 2px 0 #000;
}
#toast {
  position: absolute;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  background: var(--panel);
  border: 2px solid var(--edge-hi);
  border-radius: 8px;
  padding: 7px 14px;
  font-weight: 700;
}
#log {
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: min(360px, 60vw);
  font-size: 13px;
  text-shadow: 0 1px 0 #000;
}
#log p {
  margin: 2px 0;
}
#log .sys {
  color: var(--dim);
}
#chat {
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: min(360px, 70vw);
  pointer-events: auto;
}
#link-lost {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  background: #6a1a10;
  padding: 6px 12px;
  border-radius: 6px;
}

/* Touch: a stick on the left, four buttons on the right. */
#touch {
  display: none;
}
body.touch #touch {
  display: block;
}
#stick {
  position: absolute;
  left: 22px;
  bottom: 26px;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  border: 2px solid rgba(255, 210, 150, 0.25);
  background: rgba(20, 12, 8, 0.35);
  pointer-events: none;
  touch-action: none;
  transition: opacity 0.2s;
  opacity: 0.7;
}
#stick.live {
  opacity: 1;
}
/* Where a thumb down starts the stick: the lower left, clear of the panels at the top. */
#stickzone {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 50%;
  height: 58%;
  pointer-events: auto;
  touch-action: none;
}
#fullscreen {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  width: 40px;
  height: 32px;
  padding: 0;
  font-size: 18px;
  pointer-events: auto;
  background: rgba(40, 24, 14, 0.6);
}
body.touch {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
@media (orientation: landscape) {
  body.touch #log,
  body.touch #toast {
    bottom: 12px;
  }
  body.touch #stickzone {
    width: 40%;
    height: 70%;
  }
}
#stick span {
  position: absolute;
  left: 39px;
  top: 39px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 200, 140, 0.35);
  border: 2px solid rgba(255, 210, 150, 0.5);
}
#pads {
  position: absolute;
  right: 16px;
  bottom: 22px;
  display: grid;
  grid-template-columns: 60px 60px 60px;
  gap: 8px;
  pointer-events: auto;
}
#pads button {
  position: relative;
  height: 60px;
  padding: 0;
  overflow: hidden;
  border-radius: 50%;
  font-weight: 800;
  font-size: 13px;
  touch-action: none;
  background: rgba(60, 36, 22, 0.75);
}
#pads .ab canvas {
  width: 34px;
  height: 34px;
  image-rendering: pixelated;
}
#pads button[data-k="swing"] {
  border-color: var(--gold);
  font-size: 14px;
}
#pads button.down {
  border-color: var(--gold);
  background: rgba(140, 80, 30, 0.85);
}
body.touch #log {
  bottom: 170px;
}
body.touch #toast {
  bottom: auto;
  top: 34%;
}
@media (max-width: 640px) {
  #me {
    transform: scale(0.85);
    transform-origin: top left;
  }
  #party {
    top: 80px;
  }
  #inv {
    transform: scale(0.85);
    transform-origin: top right;
  }
  #banner {
    top: 120px;
  }
}

/* Title: eight classes, each with its abilities. */
.cls small.abl {
  display: block;
  color: var(--gold);
  margin-top: 2px;
}
.cls small.abl i {
  color: var(--dim);
  font-style: normal;
}

/* The Depths of Ember: seals, items, the bomb button. */
#keys .seals {
  display: inline-flex;
  gap: 3px;
  vertical-align: middle;
}
#keys .seal {
  width: 9px;
  height: 9px;
  transform: rotate(45deg);
  background: #2a2024;
  border: 1px solid #5a4a40;
}
#keys .seal.on {
  background: #ff9a40;
  border-color: #ffe0a0;
  box-shadow: 0 0 6px #ff8a24;
}
#keys .item {
  margin-left: 6px;
  font-size: 15px;
  vertical-align: middle;
}
#keys .item.wait {
  opacity: 0.4;
}
#pads button.bomb {
  display: none;
  position: absolute;
  right: 0;
  top: -60px;
  width: 50px;
  height: 50px;
  font-size: 22px;
}
body.bombs #pads button.bomb {
  display: block;
}
#pads button.bomb .cd {
  position: absolute;
  inset: 0;
  background: conic-gradient(rgba(0, 0, 0, 0.7) calc(var(--cd, 0) * 1turn), transparent 0);
  border-radius: 50%;
  pointer-events: none;
}

/* Four ability slots and the skill book. */
#pads button[data-k="a4"] {
  position: absolute;
  left: -68px;
  top: 0;
  width: 60px;
}
#pads .ab[hidden] {
  visibility: hidden;
  display: block;
}
.slot.empty {
  opacity: 0.55;
  border-style: dashed;
  cursor: pointer;
}
.slot .plus {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--gold);
}
.slot .rank {
  position: absolute;
  right: 3px;
  bottom: 0;
  font-size: 12px;
  color: var(--gold);
  text-shadow: 0 1px 0 #000;
  z-index: 1;
}
#skillbtn {
  position: absolute;
  left: 50%;
  bottom: 74px;
  transform: translateX(-50%);
  padding: 2px 12px;
  font-weight: 800;
  pointer-events: auto;
}
#skillbtn.ready {
  border-color: var(--gold);
  color: var(--gold);
  animation: skillpulse 1.2s ease-in-out infinite;
}
@keyframes skillpulse {
  50% {
    box-shadow: 0 0 14px rgba(255, 200, 80, 0.8);
  }
}
#book {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--panel);
  border: 2px solid var(--gold);
  border-radius: 10px;
  padding: 12px 14px;
  pointer-events: auto;
  z-index: 20;
  display: block;
}
#book[hidden] {
  display: none;
}
#book h3 {
  margin: 0 0 2px;
  color: var(--gold);
}
#book .pts {
  margin: 0;
}
#book .pts b {
  color: var(--gold);
  font-size: 18px;
}
#book .tip {
  margin: 2px 0 8px;
  color: var(--dim);
  font-size: 12px;
}
#book .bk {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid var(--edge);
}
#book .bk canvas {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
}
#book .bk:not(.known) canvas {
  opacity: 0.55;
}
#book .bk small {
  display: block;
  color: var(--dim);
}
#book .bk i {
  color: var(--dim);
  font-style: normal;
  font-size: 12px;
}
#book .pips {
  color: var(--gold);
  letter-spacing: 1px;
}
#book .bk button {
  min-width: 96px;
}
#book .close {
  margin-top: 8px;
  width: 100%;
}

/* Saved heroes on the title. */
#saves {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
#saves[hidden] {
  display: none;
}
#saves .kicker {
  width: 100%;
  margin: 0;
}
#saves .save {
  position: relative;
  padding: 5px 26px 5px 10px;
  text-align: left;
}
#saves .save.on {
  border-color: var(--gold);
}
#saves .save small {
  display: block;
  color: var(--dim);
}
#saves .del {
  position: absolute;
  right: 6px;
  top: 4px;
  color: var(--dim);
  font-size: 12px;
}
#saves .del:hover {
  color: #ff8070;
}

/* Gold, potions and the quests you carry. */
#purse {
  margin: 3px 0 0;
  font-size: 12px;
  font-weight: 700;
}
#quests {
  position: absolute;
  right: 12px;
  top: 196px;
  width: 210px;
  background: rgba(20, 13, 10, 0.72);
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
}
#quests[hidden] {
  display: none;
}
#quests p {
  margin: 2px 0;
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
#quests p span {
  color: var(--gold);
  white-space: nowrap;
}
#quests p.qdone {
  color: #a0ff90;
}
#packbtn {
  position: absolute;
  left: calc(50% + 40px);
  bottom: 74px;
  padding: 2px 10px;
  pointer-events: auto;
}
#skillbtn {
  transform: translateX(calc(-50% - 20px));
}
body.touch #quests {
  display: none;
}

/* The window over the game: the pack, the village folk, the waystones. */
#panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(620px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--panel);
  border: 2px solid var(--gold);
  border-radius: 10px;
  padding: 12px 14px;
  pointer-events: auto;
  z-index: 20;
  display: block;
}
#panel[hidden] {
  display: none;
}
#panel h3 {
  margin: 0 0 2px;
  color: var(--gold);
}
#panel h4,
#book h4 {
  margin: 10px 0 4px;
  color: var(--gold);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
#panel .tip {
  margin: 2px 0 6px;
  color: var(--dim);
  font-size: 12px;
}
#panel .purse {
  margin: 0 0 4px;
  font-weight: 700;
}
#panel .worn {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
@media (max-width: 560px) {
  #panel .worn {
    grid-template-columns: 1fr;
  }
}
#panel .prow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-top: 1px solid var(--edge);
}
#panel .pbtns {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#panel .pbtns button {
  min-width: 92px;
}
#panel .it {
  flex: 1;
  min-width: 0;
}
#panel .worn .it {
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 4px 6px;
}
#panel .it b {
  display: block;
}
#panel .it small {
  display: block;
  color: var(--dim);
  font-size: 12px;
}
#panel .it.r4 b {
  text-shadow: 0 0 8px rgba(255, 138, 36, 0.6);
}
#panel .better {
  color: #80ff80;
}
#panel .worse {
  color: #ff8070;
}
#panel .tag {
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
}
#panel .close {
  margin-top: 8px;
  width: 100%;
}

/* Talent paths in the skill book. */
#book .paths {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 560px) {
  #book .paths {
    grid-template-columns: 1fr;
  }
}
#book .path {
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 6px 8px;
}
#book .path.mine {
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(255, 200, 80, 0.3);
}
#book .path.off {
  opacity: 0.45;
}
#book .path small {
  display: block;
  color: var(--dim);
}
#book .path ul {
  margin: 4px 0;
  padding-left: 16px;
  font-size: 12px;
}
#book .path li {
  color: var(--dim);
}
#book .path li.got {
  color: #ffe2a0;
}
#book .path button {
  width: 100%;
}

/* The potion button on a phone. */
#pads button.potion {
  position: absolute;
  right: 58px;
  top: -60px;
  width: 50px;
  height: 50px;
  font-size: 16px;
}
#world {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(8, 5, 4, 0.82);
  pointer-events: auto;
  z-index: 30;
}
#world[hidden] {
  display: none;
}
#world .wtitle {
  font-family: Cinzel, serif;
  font-weight: 800;
  color: var(--gold);
  margin: 0 0 8px;
  font-size: 22px;
}
#world .wtitle span {
  font: 500 13px "Alegreya Sans", sans-serif;
  color: #b8a890;
}
#worldmap {
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 80px);
  border: 2px solid var(--edge);
  border-radius: 8px;
  background: #120c0a;
}
#quests p.sgoal,
#quests p.egoal {
  display: block;
  color: #ffd870;
  font-weight: 700;
}
#quests p.sgoal {
  border-bottom: 1px solid var(--edge);
  padding-bottom: 4px;
}
#quests p.sgoal span,
#quests p.egoal span {
  display: block;
  color: #e8dcc0;
  font-weight: 500;
  font-size: 12px;
  white-space: normal;
}
#quests p.egoal {
  color: #ff9a70;
}
#panel .story {
  border-left: 3px solid var(--gold);
  padding: 4px 10px;
  margin: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
#panel .story.done {
  border-color: #6a8a5a;
  opacity: 0.85;
}
#panel .story small {
  font-size: 13px;
  line-height: 1.35;
}
#panel .story .goal {
  color: #ffd870;
  font-weight: 700;
}
#panel .story .end {
  color: #b8d8a0;
  font-style: italic;
}
#storybtn {
  position: absolute;
  left: calc(50% + 96px);
  bottom: 74px;
  padding: 2px 10px;
  pointer-events: auto;
}

/* The saddle and the rod on a phone. */
#pads button.ride,
#pads button.fish {
  display: none;
  position: absolute;
  top: -60px;
  width: 50px;
  height: 50px;
  font-size: 20px;
}
#pads button.ride {
  right: 116px;
}
#pads button.fish {
  right: 174px;
}
body.horse #pads button.ride,
body.rod #pads button.fish {
  display: block;
}

/* The Hall of Heroes: the trophy wall and the Ember Trials' board. */
#panel .trophies {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 6px;
  margin: 6px 0 10px;
}
#panel .trophy {
  padding: 6px 4px;
  text-align: center;
  border: 1px solid rgba(255, 210, 150, 0.15);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  opacity: 0.5;
}
#panel .trophy.got {
  opacity: 1;
  border-color: rgba(255, 200, 100, 0.55);
  background: rgba(120, 70, 20, 0.3);
}
#panel .trophy b {
  display: block;
  font-size: 20px;
}
#panel .trophy small {
  display: block;
  font-size: 11px;
  line-height: 1.2;
}
#panel ol.board,
#board ol {
  margin: 4px 0 8px;
  padding-left: 22px;
}
#panel ol.board li,
#board li {
  margin: 3px 0;
}
#panel ol.board small,
#board small {
  color: var(--dim);
}
#board {
  margin-top: 10px;
}
#board h4 {
  margin: 0 0 2px;
  color: var(--gold);
  font-family: Cinzel, serif;
}

/* On a phone the skill book, the pack and the Chronicle sit in a row under your hearts,
   clear of the buttons on the right and the stick on the left; the party list moves down. */
body.touch #skillbtn,
body.touch #packbtn,
body.touch #storybtn {
  top: 102px;
  bottom: auto;
  right: auto;
  transform: none;
  width: 44px;
  height: 40px;
  padding: 0;
  font-size: 18px;
  /* Over the stick's zone, which reaches up to here in a phone held sideways. */
  z-index: 5;
}
body.touch #skillbtn {
  left: 12px;
}
body.touch #packbtn {
  left: 62px;
}
body.touch #storybtn {
  left: 112px;
}
body.touch #party {
  top: 150px;
}
/* Nothing on a phone's game screen pans or zooms; the windows over it still scroll. */
body.touch #hud,
body.touch #hud * {
  touch-action: none;
}
body.touch #hud #panel,
body.touch #hud #panel *,
body.touch #hud #book,
body.touch #hud #book *,
body.touch #hud #chat {
  touch-action: pan-y;
}

/* The settings (⚙ or Esc). */
#setbtn {
  position: absolute;
  left: calc(50% + 152px);
  bottom: 74px;
  padding: 2px 10px;
  pointer-events: auto;
}
body.touch #setbtn {
  top: 102px;
  bottom: auto;
  left: 162px;
  width: 44px;
  height: 40px;
  padding: 0;
  font-size: 18px;
  z-index: 5;
}
#settings {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  background: var(--panel);
  border: 2px solid var(--gold);
  border-radius: 10px;
  padding: 12px 14px;
  pointer-events: auto;
  z-index: 25;
  display: block;
}
#settings[hidden] {
  display: none;
}
#settings h3 {
  margin: 0 0 6px;
  color: var(--gold);
}
#settings h4 {
  margin: 10px 0 4px;
  color: var(--gold);
  font-size: 13px;
  text-transform: uppercase;
}
#settings .srow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 210, 150, 0.12);
}
#settings .srow small {
  display: block;
  color: var(--dim);
  font-size: 11px;
}
#settings .schoice {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
#settings .schoice button {
  min-width: 58px;
  padding: 5px 8px;
}
#settings .schoice button.on {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(140, 80, 30, 0.6);
}
#settings select {
  padding: 5px 6px;
  background: #2a1a10;
  color: inherit;
  border: 1px solid var(--edge);
  border-radius: 6px;
  font: inherit;
}
#settings .keys {
  color: var(--dim);
  font-size: 12px;
  line-height: 1.5;
}
#settings .sbtns {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
#settings .sbtns button {
  flex: 1;
}
#settings .sbtns .danger {
  border-color: #a8402a;
  color: #ffb0a0;
}
body.touch #hud #settings,
body.touch #hud #settings * {
  touch-action: pan-y;
}
