@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4-700-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

.game-shell {
  --top-h: clamp(57px,9.85vw,158px);
}

.game-shell .topbar {
  --topbar-inset: clamp(2px,.8vw,13px);
  --topbar-face-top: max(3px,calc(var(--top-h) * .058));
  --topbar-face-bottom: max(6px,calc(var(--top-h) * .151));
  --topbar-face-rim: max(2px,calc(var(--top-h) * .035));
  --topbar-serif: "Source Serif 4",Georgia,serif;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto;
  align-items: center;
  column-gap: clamp(2px,1.12vw,18px);
  padding: calc(env(safe-area-inset-top) + 2px) clamp(11px,4.28vw,69px)
    calc(var(--topbar-face-bottom) * .7);
  isolation: isolate;
}

.game-shell .topbar::before {
  content: "";
  position: absolute;
  inset: calc(env(safe-area-inset-top) + var(--topbar-face-top))
    calc(var(--topbar-inset) + var(--topbar-face-rim)) var(--topbar-face-bottom);
  z-index: -2;
  border-radius: 999px;
  background:
    radial-gradient(ellipse at 48% 29%,#ad765127,transparent 68%),
    linear-gradient(#26160bb2,#4c2a1a55 38%,#1c1009ba),
    #5b2c14 url("../img/topbar/walnut.webp") center/100% 100%;
  box-shadow: inset 0 1px 8px #1c0904,inset 0 -4px 11px #200b03,0 4px 9px #0e0704a8;
  pointer-events: none;
}

.topbar-frame {
  --rim-end-width: calc(var(--top-h) * .8);
  --rim-join: calc(var(--rim-end-width) * .14);
  position: absolute;
  z-index: -1;
  inset: calc(env(safe-area-inset-top) + 2px) var(--topbar-inset) 1px;
  display: grid;
  grid-template-columns: var(--rim-end-width) minmax(0,1fr)
    calc(var(--top-h) * 1.36) minmax(0,1fr) var(--rim-end-width);
  filter: drop-shadow(0 2px 2px #210905c9);
  pointer-events: none;
}

.topbar-frame::before {
  content: "";
  position: absolute;
  inset: 0 calc(var(--rim-end-width) - var(--rim-join));
  background: url("../img/topbar/rim-rail.webp") center/100% 100% no-repeat;
}
.topbar-rim-end {
  background: url("../img/topbar/rim-end.webp") center/100% 100% no-repeat;
  mask-image: linear-gradient(to right,#000 86%,transparent);
}
.topbar-rim-crest {
  grid-column: 3;
  background: url("../img/topbar/rim-crest.webp") center/100% 100% no-repeat;
  mask-image: linear-gradient(to right,transparent,#000 9%,#000 91%,transparent);
}
.topbar-rim-end:last-child {
  grid-column: 5;
  transform: scaleX(-1);
}

.game-shell .topbar .brand {
  display: flex;
  min-width: 0;
  margin: 0;
}
.topbar .brand-logo {
  display: block;
  width: min(100%,calc(var(--top-h) * 2.74));
  max-height: calc(var(--top-h) * .83);
  height: auto;
  object-fit: contain;
  object-position: left center;
}

#app .topbar :is(.balance-value,.balance-value *,.unread) {
  font-family: var(--topbar-serif) !important;
}

.game-shell .topbar .balance {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(3px,1.55vw,24px);
  height: calc(var(--top-h) * .66);
  margin: 0;
  padding: 0 clamp(9px,3.15vw,51px);
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  white-space: nowrap;
}

.topbar .balance::before,.topbar .balance::after {
  content: "";
  position: absolute;
  inset-block-start: 50%;
  inline-size: clamp(6px,1.15vw,18px);
  block-size: clamp(20px,4vw,62px);
  translate: 0 -50%;
  clip-path: polygon(50% 0,57% 31%,73% 41%,100% 50%,72% 58%,57% 69%,50% 100%,43% 69%,30% 59%,0 50%,29% 41%,43% 31%);
  background:
    linear-gradient(90deg,#7d3e15,#e59d40 37%,#fff6bb 51%,#d9892e 65%,#7e3d17);
  pointer-events: none;
}
.topbar .balance::before { inset-inline-start: 0; }
.topbar .balance::after { content:none; }

.topbar .top-coins {
  display: block;
  flex: none;
  width: clamp(27px,6.3vw,101px);
  height: calc(var(--top-h) * .51);
  object-fit: contain;
  filter: drop-shadow(0 3px 2px #2a0e03);
}

.topbar .balance-value {
  color: #ffebbd;
  font-size: clamp(15px,2.72vw,43px);
  font-weight: 700;
  font-variant-numeric: lining-nums tabular-nums;
  line-height: 1;
}
.topbar .balance-value b,.topbar .balance-currency {
  display: inline-block;
  filter: drop-shadow(0 1px #2a0d03) drop-shadow(0 2px 1px #321705c9);
}
.topbar .balance-currency {
  color: #e4a754;
}
@supports (background-clip: text) {
  .topbar .balance-value b {
    color: transparent;
    background: linear-gradient(#fff3cd 36%,#f6d591 94%) text;
  }
  .topbar .balance-currency {
    color: transparent;
    background: linear-gradient(#ffe1a2 22%,#c87927 95%) text;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
}
.game-shell .topbar .top-action {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(30px,8.25vw,132px);
  height: calc(var(--top-h) * .64);
  min-width: 0;
  min-height: 0;
  padding: 0 clamp(2px,1.1vw,17px);
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  transform: none;
}
.game-shell .topbar #helpBtn {
  width: clamp(33px,9.75vw,156px);
}
.game-shell .topbar .directory-action {
  width: clamp(27px,6vw,94px);
  color: #edbd64;
}
.topbar .directory-action .top-picto {
  width: 72%;
  stroke-width: 1.6;
}

.topbar .top-action + .top-action::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block: 13%;
  width: 1px;
  background: linear-gradient(transparent,#ca914a90 32%,#bf8648a1 63%,transparent);
  box-shadow: 1px 0 #230b0469;
  pointer-events: none;
}

.topbar .top-picto {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  filter: drop-shadow(0 3px 2px #1b0905ce);
}
.topbar .top-action:is(:hover,:focus-visible) .top-picto {
  filter: brightness(1.1) drop-shadow(0 0 5px #ffc2779e);
}
.game-shell .topbar :is(.top-action,.balance):focus-visible {
  outline: 2px solid #ffe5a3;
  outline-offset: 1px;
  border-radius: 5px;
}

.topbar .unread {
  --badge-size: clamp(15px,2.75vw,43px);
  position: absolute;
  z-index: 1;
  top: calc(var(--badge-size) * -.25);
  right: clamp(0px,.48vw,8px);
  display: grid;
  place-items: center;
  min-width: var(--badge-size);
  height: var(--badge-size);
  padding: 0 .21em;
  border: max(1px,calc(var(--badge-size) * .06)) solid #ffe08b;
  border-radius: 30px;
  background: linear-gradient(#ee573b,#bc2719 60%,#83180d);
  box-shadow: inset 0 1px #ffab72,0 1px 1px #4b1209,0 0 0 1px #87450f,0 2px 4px #210905ce;
  color: #fff2d1;
  font-size: clamp(10px,1.63vw,26px);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 1px #66140e;
}

@media (max-width:600px) {
  .game-shell .topbar .balance {
    gap: 3px;
    padding-inline: clamp(7px,2.35vw,14px);
  }
  .topbar .balance::before,.topbar .balance::after {
    inline-size: 6px;
  }
  .game-shell .topbar .top-action {
    padding-inline: 2px;
  }
}
@media (max-width:380px) {
  .game-shell .topbar .balance { padding-inline: 5px; }
  .game-shell .topbar :is(.top-action,#helpBtn) { width: 27px; }
}

/* The coin pictogram identifies the currency; reserve the right space for digits. */
.game-shell .topbar .balance { padding-inline-end:2px; }
