#festival-memory-hud {
  position: absolute;
  top: calc(var(--top) + 70px);
  right: max(18px, var(--safe-right));
  z-index: 3;
  width: clamp(210px, 25vw, 260px);
  padding: 9px;
  border: 1px solid #bba8d4;
  border-radius: 12px;
  background: #302745f5;
  color: #fff0da;
  box-shadow: 0 3px 0 #251d3896, 0 8px 22px #29204048;
}
#festival-memory-hud[hidden] { display: none; }
.memory-desk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 7px;
}
.memory-desk-head strong {
  display: block;
  color: #fff1cb;
  font-size: 15px;
  line-height: 1.18;
}
.memory-desk-head [data-memory-count] {
  display: block;
  margin-top: 3px;
  color: #e2d5ee;
  font-size: 11px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}
.memory-desk-action, .memory-desk-pads button {
  min-height: 44px;
  border-radius: 7px;
  overflow: hidden;
  font-weight: 820;
}
.memory-desk-action {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid #d2aa72;
  background: #f6dba4;
  color: #422f43;
  font-size: 12px;
}
.memory-desk-action[aria-disabled="true"] {
  border-color: #90779f;
  background: #4b3e62;
  color: #e2d5ee;
  cursor: default;
}
.memory-desk-pads {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}
.memory-desk-pads button {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 5px;
  border: 1px solid #b69bc2;
  border-bottom: 3px solid #625073;
  background: #eee4ed;
  color: #3d304c;
  text-align: left;
}
.memory-desk-pads button[aria-disabled="true"] { cursor: default; }
.memory-desk-pads button[data-lit] {
  border-color: #fff4cf;
  background: var(--lamp);
  box-shadow: inset 0 0 0 2px #fff4cf, 0 0 9px #fff1bd6e;
}
.memory-desk-pads button[data-mistake] {
  border-color: #ffd2bc;
  background: #ffc4ad;
  box-shadow: inset 0 0 0 2px #905262;
}
.memory-pad-shape {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  flex: none;
  border: 1px solid #493759;
  border-radius: 5px;
  background: var(--lamp);
  color: #332641;
  font: 900 17px/1 system-ui, sans-serif;
}
.memory-pad-name { white-space: nowrap; font-size: 12px; }
.memory-desk-pads kbd { margin-left: auto; }
#festival-memory-hud kbd {
  min-width: 16px;
  padding: 1px 3px;
  border: 1px solid #715d80;
  border-radius: 4px;
  background: #fff5de;
  color: #3c2e4d;
  font: 760 10px/1.2 system-ui, sans-serif;
  text-align: center;
}
#festival-memory-hud[data-touch] kbd { display: none; }
.memory-desk-hint {
  min-height: 1.4em;
  margin: 6px 0 0;
  color: #f7e8cb;
  font-size: 11px;
  line-height: 1.4;
}
#festival-memory-hud[data-retry] .memory-desk-head strong { color: #ffd0b9; }
#app[data-memory-desk] #race :is(.festival-overlay, #festival-prompt, .touch-actions, .keyboard-guide) { display: none; }
#app[data-memory-desk] #race .race-place { justify-self: start; width: max-content; }
@media (orientation: landscape) and (max-height: 410px) {
  #festival-memory-hud {
    top: calc(var(--top) + 52px);
    right: var(--phone-right);
    width: clamp(188px, 29vw, 230px);
    padding: 6px;
  }
  .memory-desk-head { margin-bottom: 5px; }
  .memory-desk-head strong { font-size: 13px; }
  .memory-desk-head [data-memory-count] { font-size: 10px; }
  .memory-desk-hint { margin-top: 5px; }
}
@media (orientation: portrait) {
  #festival-memory-hud {
    top: auto;
    right: 50%;
    bottom: calc(var(--bottom) + 18px);
    width: min(250px, calc(100% - 32px));
    transform: translateX(50%);
  }
}
