:root {
  --shell-max: 576px;
}

.top-bar-fixed {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  width: 100%;
  max-width: min(var(--shell-max), 100%);
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.top-bar-fixed--home {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.667) 0%, rgba(0, 0, 0, 0) 100%);
  padding-top: max(env(safe-area-inset-top, 0px), 0px);
}

.top-bar-fixed--game {
  background: transparent;
  padding-top: 0;
}

.top-bar-fixed--game-safe {
  background: transparent;
  padding-top: max(env(safe-area-inset-top, 0px), 0px);
}

.top-bar {
  width: 100%;
  overflow: visible;
  font-family: "EB Garamond", Garamond, Georgia, serif;
  --top-bar-parchment: #e9e2d4;
  color: var(--top-bar-parchment);
}

.top-bar--home {
  padding-top: max(env(safe-area-inset-top, 0px), 0.35rem);
  padding-bottom: 0.5rem;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

.top-bar--game {
  padding-top: max(env(safe-area-inset-top, 0px), 0.35rem);
  padding-bottom: 0.5rem;
  padding-left: 0;
  padding-right: 0.25rem;
  background-color: #0c0c10;
  background-image: url("/assets/ui-elements/campaign/top-bg.webp");
  background-size: 100% 100%;
  background-position: center top;
  background-repeat: no-repeat;
}

.top-bar--campaign {
  margin-left: 0.25rem;
  margin-right: 0.25rem;
  width: auto;
}

.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  width: 100%;
  max-width: min(var(--shell-max), 100%);
  overflow: visible;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.35);
  transition: opacity 150ms;
}

.bottom-bar__row {
  position: relative;
  z-index: 10;
  display: grid;
  min-height: 100px;
  width: 100%;
  flex-shrink: 0;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-content: center;
  align-items: end;
  gap: 1px;
  padding-left: 1.25%;
  padding-right: 1.25%;
  padding-bottom: 0.2rem;
  padding-top: 0.2rem;
}

.csp-scroll {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.csp-scroll--campaign {
  background-color: #060302;
  background-image: url("/assets/ui-elements/campaign/background-box.webp");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.csp-scroll--with-bottom-nav {
  padding-bottom: 1rem;
  margin-bottom: 0.5rem;
}

.csp-scroll-fade {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    transparent 1rem,
    #000 4rem,
    #000 calc(100% - 4rem),
    transparent calc(100% - 1.75rem),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    transparent 1rem,
    #000 4rem,
    #000 calc(100% - 4rem),
    transparent calc(100% - 1.75rem),
    transparent 100%
  );
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.csp-scroll-fade::-webkit-scrollbar {
  display: none;
}

.campaign-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0;
}

.home-shell {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.battle-shell {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.battle-shell--combat-flow {
  flex: 1 1 auto;
  gap: 0;
  padding-bottom: 1.5rem;
}

.battle-shell--combat-flow-end {
  position: relative;
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.battle-shell--post-combat {
  gap: 0.75rem;
}

.popup-layer {
  pointer-events: auto;
  background-image: url("/assets/ui-elements/campaign/background-box.webp");
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 9999px rgba(12, 10, 8, 0.42);
}

.battle-shell__control-cell {
  display: flex;
  min-height: 2.75rem;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 0;
  background-color: transparent;
  padding: 0.2rem 0.35rem;
  text-align: center;
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 0.62rem;
  font-weight: 500;
  line-height: 1.25;
  color: rgba(228, 212, 190, 0.88);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}
